:root {
  --bg: #f4f6f9; --card: #fff; --text: #1b2430; --muted: #6b7684; --line: #dde3ea;
  --brand: #0b4f8a; --brand-2: #0e6bb8; --ok: #1f7a4d; --warn: #9a6400; --err: #b42318;
  --mono: ui-monospace, Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; background: var(--brand); color: #fff; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; } .brand span { font-weight: 400; opacity: .8; }
nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; opacity: .85; }
nav a.active, nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
.banner { background: #fff4d6; color: #6b4a00; padding: 8px 20px; font-size: 14px; border-bottom: 1px solid #f0dca0; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 6px; } h2 { font-size: 16px; margin: 0 0 10px; }
.hint { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
fieldset { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 16px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; color: var(--brand); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 6px; align-self: end; padding-bottom: 8px; }
input, select { font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
input.invalid, select.invalid { border-color: var(--err); background: #fff6f5; }
.error-msg { color: var(--err); font-size: 12px; }
.checks { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.checks label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .btn { font: inherit; cursor: pointer; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; padding: 9px 18px; border-radius: 6px; cursor: pointer; font: inherit; }
.primary:hover { background: var(--brand-2); }
.danger { color: var(--err); }
.preview { position: sticky; top: 16px; background: #0f1b2a; color: #d7e6f5; border-radius: 10px; padding: 16px; }
.preview h2 { color: #fff; }
pre { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; }
.preview .muted { color: #9fb3c8; }
.warnings { list-style: none; padding: 0; margin: 0; }
.warnings li { background: #fff4d6; color: #6b4a00; border-radius: 6px; padding: 8px 10px; margin-top: 8px; font-size: 13px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
#search { max-width: 300px; }
table.plans { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.plans th, .plans td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.plans th { font-size: 12px; text-transform: uppercase; color: var(--muted); background: #fafbfc; }
.plans tbody tr { cursor: pointer; } .plans tbody tr:hover { background: #f5f9fd; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: var(--muted); }
.badge.enviado { background: #e3f4ea; color: var(--ok); }
.badge.simulado { background: #eaf1fb; color: var(--brand); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 14px; }
.card pre { background: #f4f6f8; padding: 12px; border-radius: 6px; }
.history { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.history li.error { color: var(--err); }
dialog { border: none; border-radius: 12px; padding: 20px; max-width: 460px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,20,30,.45); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ok); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--err); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .preview { position: static; } }
@media (max-width: 600px) { .plans th:nth-child(4), .plans td:nth-child(4) { display: none; } }

[hidden] { display: none !important; }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.who { color: #fff; opacity: .7; font-size: 14px; padding: 0 8px; }
button.link { background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 6px 8px; text-decoration: underline; }
nav button.link { color: #fff; opacity: .85; }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: center; padding-top: 32px; }
.auth-intro h1 { font-size: 30px; line-height: 1.15; text-wrap: balance; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card .primary { width: 100%; }
.auth-card button.link { color: var(--brand); justify-self: center; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: none; padding: 10px; font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.auth-msg { margin: 12px 0 0; padding: 8px 10px; border-radius: 6px; background: #fdeeec; color: var(--err); font-size: 14px; }
.auth-msg.ok { background: #e3f4ea; color: var(--ok); }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; padding-top: 8px; gap: 16px; } .auth-intro h1 { font-size: 24px; } }
/* Hoja del formulario OACI: siempre "papel", en ambos temas */
.sheet-wrap { overflow: hidden; background: #eef1f4; border-radius: 6px; padding: 12px; }
.sheet-scale { transform-origin: top left; width: 760px; }
.sheet { width: 760px; background: #ffffff; color: #111111; border: 1.5px solid #111111; font: 10px/1.2 Arial, Helvetica, sans-serif; color-scheme: light; }
.sheet .sh-title { text-align: center; font-size: 13px; padding: 6px 0; border-bottom: 1.5px solid #111111; }
.sheet .row { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 14px; padding: 6px 10px; border-bottom: 1px solid #111111; }
.sheet .row.gray { background: #e3e3e3; }
.sheet .row.center { justify-content: center; text-align: center; }
.sheet .cell { display: flex; align-items: flex-end; gap: 4px; flex-wrap: wrap; }
.sheet .cell.grow { flex: 1; min-width: 0; }
.sheet .cell.half { flex: 1; flex-direction: column; align-items: flex-start; min-height: 64px; }
.sheet .row.foot { padding: 0; gap: 0; align-items: stretch; }
.sheet .row.foot .cell { padding: 6px 10px; } .sheet .row.foot .cell + .cell { border-left: 1px solid #111111; }
.sheet .lb { display: block; width: 100%; font-size: 8px; line-height: 1.15; color: #222222; }
.sheet .lb b { font-weight: 700; } .sheet .lb.mini { width: auto; margin-left: 6px; }
.sheet .bx { display: inline-flex; background: #ffffff; border: 1px solid #111111; }
.sheet .bx i { font-style: normal; width: 17px; height: 20px; display: grid; place-items: center; border-left: 1px solid #9a9a9a; font: 700 13px/1 "IBM Plex Mono", Consolas, monospace; color: #0a3a8a; }
.sheet .bx i:first-child { border-left: none; }
.sheet .field { flex: 1; min-width: 120px; min-height: 22px; background: #ffffff; border: 1px solid #111111; padding: 3px 6px; font: 700 13px/1.25 "IBM Plex Mono", Consolas, monospace; color: #0a3a8a; overflow-wrap: anywhere; }
.sheet .ln { width: 100%; min-height: 20px; background: #ffffff; border: 1px solid #111111; border-top: none; padding: 2px 6px; font: 700 13px/1.2 "IBM Plex Mono", Consolas, monospace; color: #0a3a8a; }
.sheet .ln:first-of-type { border-top: 1px solid #111111; }
.sheet .cell.grow > .ln { flex-basis: 100%; }
.sheet .big { font-size: 14px; font-weight: 700; }
.sheet .ae { font-size: 11px; white-space: nowrap; }
.sheet .op { display: inline-flex; flex-direction: column; align-items: center; margin-right: 6px; position: relative; }
.sheet .op small { font-size: 7px; }
.sheet .op i { font-style: normal; font-weight: 700; font-size: 13px; width: 22px; height: 22px; display: grid; place-items: center; background: #ffffff; border: 1.5px solid #111111; }
.sheet .op.off i { color: #555555; background: linear-gradient(to top right, transparent calc(50% - 1.5px), #c0261a calc(50% - 1px), #c0261a calc(50% + 1px), transparent calc(50% + 1.5px)), linear-gradient(to bottom right, transparent calc(50% - 1.5px), #c0261a calc(50% - 1px), #c0261a calc(50% + 1px), transparent calc(50% + 1.5px)), #ffffff; }
.sheet .hand { font: 700 13px/1.35 "IBM Plex Mono", Consolas, monospace; color: #0a3a8a; padding-top: 6px; }
.sheet .hand.small { font-size: 11.5px; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .top, .banner, .list-head, #detail-warnings, .card:not(.sheet-card), .sheet-card h2, .sheet-card .hint, #view-list, #view-form, #view-auth, .toast { display: none !important; }
  main { padding: 0; max-width: none; } .card { border: none; padding: 0; margin: 0; }
  .sheet-wrap { padding: 0; height: auto !important; background: none; }
  .sheet-scale { transform: none !important; }
  .sheet { zoom: 0.93; }
}

.auth-intro h2 { font-size: 16px; margin: 20px 0 8px; }
.seo-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }

/* Guías (páginas públicas de contenido) */
.top .brand a { color: #fff; text-decoration: none; }
.guide { max-width: 780px; margin: 0 auto; padding: 24px 16px 60px; }
.guide h1 { font-size: 28px; line-height: 1.2; margin: 6px 0 10px; text-wrap: balance; }
.guide h2 { font-size: 19px; margin: 30px 0 8px; color: var(--brand); }
.guide h3 { font-size: 16px; margin: 20px 0 6px; }
.guide p, .guide li { font-size: 16px; line-height: 1.6; }
.guide ul, .guide ol { padding-left: 22px; }
.guide code { font-family: var(--mono); background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.guide table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15px; background: var(--card); }
.guide th, .guide td { text-align: left; padding: 8px 10px; border: 1px solid var(--line); vertical-align: top; }
.guide th { background: #fafbfc; }
.guide .crumbs { font-size: 14px; color: var(--muted); }
.guide .crumbs a, .guide a { color: var(--brand-2); }
.guide .note { background: #fff4d6; color: #6b4a00; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.guide .cta { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 30px; }
.guide .cta .primary { display: inline-block; text-decoration: none; margin-top: 6px; }
.guide .table-wrap { overflow-x: auto; }
.guide-links { margin-top: 14px; font-size: 14px; }
.guide-links a { color: var(--brand-2); }
.guide .cta .primary, .guide .cta .primary:hover { color: #fff; }
.pw { position: relative; display: block; }
.pw input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 28px; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
