/* Layout: ficha técnica de campo — banda de cabecera, una columna de 880px; cada examen se identifica con el código de colores de fibra (1 azul, 2 naranja, 3 verde). */
:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --ink: #13222c;
  --muted: #566a76;
  --line: #d3dde2;
  --band: #13222c;
  --band-ink: #e9f0f3;
  --accent: #d9620b;
  --fa: #1d64c8;
  --fb: #d9620b;
  --fc: #2a8a3e;
  --ok: #237a37;
  --ok-bg: #e3f3e6;
  --bad: #b42323;
  --bad-bg: #fbe6e6;
  --warn: #9a6200;
  --warn-bg: #fdf1dc;
  --focus: #1d64c8;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e161c; --surface: #15212a; --surface-2: #1a2832; --ink: #e4ecf0; --muted: #94a8b4; --line: #27394a;
    --band: #0a1116; --band-ink: #e4ecf0; --accent: #f08a3c;
    --fa: #5b9bf0; --fb: #f08a3c; --fc: #57c06d;
    --ok: #6fd383; --ok-bg: #173323; --bad: #f07a7a; --bad-bg: #3a1c1f; --warn: #f0b85a; --warn-bg: #3a2c14; --focus: #5b9bf0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e161c; --surface: #15212a; --surface-2: #1a2832; --ink: #e4ecf0; --muted: #94a8b4; --line: #27394a;
  --band: #0a1116; --band-ink: #e4ecf0; --accent: #f08a3c;
  --fa: #5b9bf0; --fb: #f08a3c; --fc: #57c06d;
  --ok: #6fd383; --ok-bg: #173323; --bad: #f07a7a; --bad-bg: #3a1c1f; --warn: #f0b85a; --warn-bg: #3a2c14; --focus: #5b9bf0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--band); }
.wrap { max-width: 920px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header.band { background: var(--band); color: var(--band-ink); }
header.band .wrap { padding-block: 18px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: end; justify-content: space-between; }
.doc-code { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; opacity: .75; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 38px); line-height: 1; margin: 4px 0 0; letter-spacing: .01em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1; margin: 0; text-wrap: balance; }
h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0; }
.fibers { display: flex; gap: 6px; align-items: center; }
.fibers i { width: 26px; height: 6px; border-radius: 3px; display: block; }
.fibers i:nth-child(1) { background: var(--fa); } .fibers i:nth-child(2) { background: var(--fb); } .fibers i:nth-child(3) { background: var(--fc); }
main { padding-block: 24px 64px; display: grid; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fact { border-top: 3px solid var(--line); padding-top: 8px; }
.fact b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
label.field { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
input[type=text], input[type=search], select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); width: 100%; min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, .opt:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; font-weight: 500; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
button.primary:hover { opacity: .9; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger.armed { background: var(--bad); color: var(--surface); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--focus); text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.chip::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: var(--fiber, var(--muted)); }
.t-A { --fiber: var(--fa); } .t-B { --fiber: var(--fb); } .t-C { --fiber: var(--fc); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.notice { border-left: 4px solid var(--warn); background: var(--warn-bg); padding: 12px 14px; border-radius: 6px; }
.notice.bad { border-color: var(--bad); background: var(--bad-bg); }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); }
ul.rules { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
/* Examen */
.exam-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.exam-bar .wrap { padding-block: 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.timer { font-family: var(--font-mono); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.timer.low { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; background: var(--fiber, var(--accent)); transition: width .2s; }
.qhead { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.qnum { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--muted); }
.qref { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.qtext { font-size: 19px; font-weight: 500; line-height: 1.4; margin: 6px 0 4px; text-wrap: pretty; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.opt:hover { border-color: var(--muted); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .letter { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--muted); display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.opt.sel { border-color: var(--fiber, var(--ink)); box-shadow: inset 0 0 0 1px var(--fiber, var(--ink)); background: var(--surface); }
.opt.sel .letter { background: var(--fiber, var(--ink)); border-color: var(--fiber, var(--ink)); color: #fff; }
.navgrid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.navgrid button { padding: 6px 0; font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.navgrid button.done { background: var(--surface-2); border-color: var(--fiber, var(--ink)); }
.navgrid button.cur { background: var(--ink); color: var(--surface); border-color: var(--ink); }
@media (max-width: 480px) { .navgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } .qtext { font-size: 17px; } .card { padding: 16px; } }
/* Resultados */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td.name { white-space: normal; min-width: 160px; }
.nota { font-family: var(--font-display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 56px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--fiber, var(--ink)); }
.bar .fill.low { background: var(--bad); }
.bar .q { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.review { display: grid; gap: 12px; }
.review .item { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 6px; }
.review .ans { font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.review .ans.ok { color: var(--ok); } .review .ans.bad { color: var(--bad); }
.overlay { position: fixed; inset: 0; background: rgba(8, 14, 18, .55); z-index: 20; display: grid; place-items: start center; overflow-y: auto; padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.overlay .card { width: 100%; max-width: 760px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Solo en Cloudflare: base que en claude.ai pone la plataforma */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
footer.pie { padding-block: 0 32px; color: var(--muted); font-size: 12px; }

/* Inicio de sesión */
.login-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 24px; align-items: start; }
@media (max-width: 760px) { .login-wrap { grid-template-columns: minmax(0, 1fr); } }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button { border: 0; background: none; padding: 10px 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
input[type=password] { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); width: 100%; min-width: 0; }
input.pin { font-family: var(--font-mono); font-size: 22px; letter-spacing: .4em; text-align: center; }
.userbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--band-ink); font-size: 13px; }
.userbar button { padding: 5px 12px; background: transparent; color: var(--band-ink); border-color: rgba(233, 240, 243, .35); }
.creds { border: 1px dashed var(--ok); background: var(--ok-bg); border-radius: 8px; padding: 14px; display: grid; gap: 10px; }
.creds td.pin { font-family: var(--font-mono); font-size: 16px; font-weight: 500; letter-spacing: .12em; }
textarea { font: inherit; font-family: var(--font-mono); font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); width: 100%; min-width: 0; min-height: 140px; resize: vertical; }
