:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #667085;
  --border: #dfe3ea;
  --primary: #2b5fd9;
  --primary-dark: #1f4cb5;
  --danger: #c93a3a;
  --ok: #1c7c4a;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
pre { overflow: auto; background: #10131a; color: #e6e9f0; padding: 1rem; border-radius: var(--radius); }
.muted { color: var(--muted); }
.req { color: var(--danger); }

.topbar { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.topbar nav a { text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 1.25rem; }
.subnav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card.narrow, .narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card.narrow { margin-top: 2rem; }
.card.narrow:has(.mono), .card:has(> form .mono) { max-width: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.event img, .cover { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; }
.event h2 { margin-top: .75rem; }
.event h2 a { text-decoration: none; color: inherit; }

label { display: block; margin-bottom: .9rem; font-weight: 600; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
input[type=radio], input[type=checkbox] { display: inline-block; width: auto; margin: 0 .4rem 0 0; }
label.opt { display: inline-block; font-weight: 400; margin-right: 1.25rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 1rem; padding: .75rem 1rem; }
fieldset[hidden] { display: none; }
legend { font-weight: 600; padding: 0 .4rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.inline-form input, .inline-form select { width: auto; margin: 0; }

.btn, button.btn { display: inline-block; padding: .55rem 1rem; font: inherit; font-weight: 600; text-decoration: none; color: #fff; background: var(--primary); border: 0; border-radius: 8px; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { color: var(--primary); background: #e9effc; }
.btn.danger { background: var(--danger); }
.btn.small { padding: .3rem .7rem; font-size: .9rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { background: #e8f6ee; border-color: #b7e0c8; color: var(--ok); }
.alert.error { background: #fdecec; border-color: #f3c4c4; color: var(--danger); }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e5e7eb; color: #374151; vertical-align: middle; }
.badge.activo, .badge.pagado { background: #d8f3e3; color: var(--ok); }
.badge.pendiente { background: #fff3cd; color: #8a6d00; }
.badge.pausado, .badge.retenido { background: #ffe5cc; color: #a5490a; }
.badge.rechazado { background: #fdecec; color: var(--danger); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; color: var(--muted); }
.stat span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
img.evidence { max-width: 100%; max-height: 420px; border: 1px solid var(--border); border-radius: 8px; }

.eval-head .stats { color: var(--muted); }
.objeto img { display: block; max-width: 100%; max-height: 420px; margin: 0 auto 1rem; border-radius: 8px; border: 1px solid var(--border); }
.objeto dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; }
.objeto dt { color: var(--muted); }
.objeto dd { margin: 0; }

@media (max-width: 640px) {
  .container { padding: .9rem; }
  h1 { font-size: 1.35rem; }
  .topbar { padding: .6rem .9rem; }
  dl.kv, .objeto dl { grid-template-columns: 1fr; }
  .btn { width: 100%; text-align: center; }
  .btn.small, .actions .btn { width: auto; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #12151c; --surface: #1a1f2a; --text: #e6e9f0; --muted: #98a2b3; --border: #2b3242; --primary: #6b96ff; --primary-dark: #8aacff; }
  input, select, textarea { background: #12151c; }
  .btn { color: #0b1020; }
  .btn.secondary { background: #232b3d; color: var(--primary); }
  .btn.danger { color: #fff; }
}
