/* ============================================================
   Prueba técnica Boletu — hoja de estilos única
   Sin frameworks. Variables CSS + layout con grid/flex.
   ============================================================ */

:root {
    --bg: #f6f6f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --fg: #18181b;
    --fg-muted: #71717a;
    --fg-dim: #a1a1aa;
    --accent: #0a0a0a;
    --accent-fg: #ffffff;
    --ok: #16a34a;
    --ok-bg: #f0fdf4;
    --warn: #ca8a04;
    --warn-bg: #fefce8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #0284c7;
    --info-bg: #f0f9ff;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px -4px rgba(0, 0, 0, .06);
    --shadow-lg: 0 8px 32px -8px rgba(0, 0, 0, .14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 16.5px; }
h4 { font-size: 14px; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a  { color: var(--fg); text-underline-offset: 3px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1260px; margin: 0 auto; padding: 0 20px; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-in { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--accent); color: var(--accent-fg);
    display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.brand-sub { font-size: 11px; font-weight: 600; color: var(--fg-muted); letter-spacing: .04em; text-transform: uppercase; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }

/* ── Cards / secciones ──────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.card + .card { margin-top: 18px; }

.section { scroll-margin-top: 90px; margin-bottom: 22px; }
.section-head {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius) var(--radius) 0 0;
}
.section-num {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
    background: var(--accent); color: var(--accent-fg);
    display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.section-title { flex: 1; min-width: 0; }
.section-title h2 { margin: 0; }
.section-title .meta { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.section-body { padding: 24px; }

/* ── Formularios ────────────────────────────────────────── */
label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; letter-spacing: .01em; }
label .opt { font-weight: 500; color: var(--fg-dim); text-transform: none; letter-spacing: 0; }

input[type=text], input[type=email], input[type=tel], input[type=password], select, textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    background: #fff; font: inherit; font-size: 14px; color: var(--fg);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .07);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
select { cursor: pointer; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hint { font-size: 12px; color: var(--fg-muted); margin-top: 5px; }

/* ── Botones ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent);
    background: var(--accent); color: var(--accent-fg);
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
    text-decoration: none; transition: opacity .15s, transform .05s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-ghost { background: #fff; color: var(--fg); border-color: var(--border-strong); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; }

/* ── Avisos ─────────────────────────────────────────────── */
.note { padding: 14px 16px; border-radius: 8px; border: 1px solid; font-size: 13.5px; margin-bottom: 16px; }
.note:last-child { margin-bottom: 0; }
.note-info { background: var(--info-bg); border-color: #bae6fd; color: #075985; }
.note-warn { background: var(--warn-bg); border-color: #fde68a; color: #854d0e; }
.note-ok { background: var(--ok-bg); border-color: #bbf7d0; color: #166534; }
.note-danger { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.note strong { display: block; margin-bottom: 3px; }

/* ── Chips / badges ─────────────────────────────────────── */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
    background: #f4f4f5; color: var(--fg-muted); border: 1px solid var(--border);
}
.chip-ok { background: var(--ok-bg); color: #166534; border-color: #bbf7d0; }
.chip-warn { background: var(--warn-bg); color: #854d0e; border-color: #fde68a; }
.chip-danger { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.chip-info { background: var(--info-bg); color: #075985; border-color: #bae6fd; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Índice lateral (prueba) ────────────────────────────── */
.layout { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: start; }
.toc { position: sticky; top: 80px; }
.toc-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.toc a {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: 7px;
    font-size: 13px; font-weight: 600; color: var(--fg-muted); text-decoration: none;
    transition: background .12s, color .12s;
}
.toc a:hover { background: var(--surface-2); color: var(--fg); }
.toc a.on { background: var(--accent); color: var(--accent-fg); }
.toc a .ico { font-size: 14px; width: 18px; text-align: center; }
.toc a .tick { margin-left: auto; font-size: 11px; opacity: .75; }

/* ── Hallazgos ──────────────────────────────────────────── */
.finding {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2); padding: 18px; margin-bottom: 14px;
}
.finding-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.finding-n {
    width: 26px; height: 26px; border-radius: 7px; background: var(--fg); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto;
}
.finding-head .sev-preview { margin-left: auto; }

.sev-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.sev-opt { flex: 1 1 120px; }
.sev-opt input { position: absolute; opacity: 0; pointer-events: none; }
.sev-opt span {
    display: block; padding: 9px 11px; border: 2px solid var(--border);
    border-radius: 8px; background: #fff; cursor: pointer;
    font-size: 12.5px; font-weight: 700; text-align: center;
    transition: all .13s;
}
.sev-opt input:checked + span { border-color: currentColor; box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .035); }
.sev-opt:hover span { border-color: var(--border-strong); }

/* ── Casos de prueba ────────────────────────────────────── */
.case { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: #fff; }
.case-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.case-id { font-family: ui-monospace, monospace; font-size: 11.5px; font-weight: 700; color: var(--fg-muted); }
.case-title { font-weight: 700; font-size: 14px; flex: 1; }
.case-body { padding: 16px; }
.case-step { font-size: 13.5px; margin-bottom: 10px; }
.case-step b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); margin-bottom: 3px; }
.case-result { display: flex; gap: 8px; margin: 14px 0 12px; flex-wrap: wrap; }
.case-result label { margin: 0; flex: 1 1 130px; }
.case-result input { position: absolute; opacity: 0; pointer-events: none; }
.case-result span {
    display: block; text-align: center; padding: 9px; border-radius: 8px;
    border: 2px solid var(--border); background: #fff; cursor: pointer;
    font-size: 13px; font-weight: 700; transition: all .13s;
}
.case-result input:checked + span { border-color: currentColor; box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .035); }

/* ── Priorización (lista ordenable) ─────────────────────── */
.prio-list { list-style: none; margin: 0 0 16px; padding: 0; counter-reset: prio; }
.prio-item {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--border); border-radius: 9px;
    padding: 12px 14px; margin-bottom: 8px; cursor: grab;
    transition: box-shadow .15s, border-color .15s;
}
.prio-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.prio-item.dragging { opacity: .4; }
.prio-item.over { border-color: var(--accent); border-style: dashed; }
.prio-rank {
    counter-increment: prio; flex: 0 0 auto;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.prio-rank::before { content: counter(prio); }
.prio-text { flex: 1; font-size: 13.5px; }
.prio-tag { font-family: ui-monospace, monospace; font-size: 11px; color: var(--fg-dim); font-weight: 700; }
.prio-grip { color: var(--fg-dim); font-size: 15px; cursor: grab; user-select: none; }
.prio-move { display: flex; flex-direction: column; gap: 2px; }
.prio-move button {
    border: 1px solid var(--border); background: #fff; border-radius: 5px;
    width: 22px; height: 17px; font-size: 9px; line-height: 1; cursor: pointer; color: var(--fg-muted);
}
.prio-move button:hover { background: var(--surface-2); color: var(--fg); }

/* ── Barra de guardado ──────────────────────────────────── */
.savebar {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
    background: var(--fg); color: #fff; border-radius: 999px;
    padding: 9px 18px; font-size: 12.5px; font-weight: 600;
    box-shadow: var(--shadow-lg); z-index: 60;
    display: flex; align-items: center; gap: 10px;
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.savebar.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.savebar .spin { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tablas (panel) ─────────────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); background: var(--surface-2); font-weight: 700; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; }

/* ── KPIs ───────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.kpi { background: #fff; padding: 16px 18px; }
.kpi .k { font-size: 11.5px; font-weight: 700; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

/* ── Rúbrica ────────────────────────────────────────────── */
.rub { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 14px; overflow: hidden; }
.rub-head { padding: 12px 15px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rub-head h4 { margin: 0; display: flex; align-items: center; gap: 8px; }
.rub-head .peso { margin-left: auto; font-size: 11.5px; color: var(--fg-muted); font-weight: 700; }
.rub-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--fg-muted); }
.rub-body { padding: 12px 15px; }
.rub-scale { display: flex; gap: 6px; margin-bottom: 10px; }
.rub-scale label { flex: 1; margin: 0; }
.rub-scale input { position: absolute; opacity: 0; pointer-events: none; }
.rub-scale span { display: block; text-align: center; padding: 7px 4px; border: 2px solid var(--border); border-radius: 7px; cursor: pointer; font-weight: 800; font-size: 14px; background: #fff; transition: all .12s; }
.rub-scale input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.rub-levels { font-size: 12px; color: var(--fg-muted); line-height: 1.5; }
.rub-levels div { padding: 2px 0; }
.rub-levels b { color: var(--fg); }

/* ── Respuestas del candidato (panel) ───────────────────── */
.answer { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }
.answer.empty { color: var(--fg-dim); font-style: italic; white-space: normal; }
.qa { margin-bottom: 18px; }
.qa > .q { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); margin-bottom: 6px; }

details.acc { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 10px; background: #fff; overflow: hidden; }
details.acc > summary { padding: 12px 15px; cursor: pointer; font-weight: 700; font-size: 13.5px; background: var(--surface-2); list-style: none; display: flex; align-items: center; gap: 9px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: '▸'; color: var(--fg-muted); transition: transform .15s; }
details.acc[open] > summary::before { transform: rotate(90deg); }
details.acc > div { padding: 15px; border-top: 1px solid var(--border); }

/* ── Varios ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 22px 0; border: 0; }
.muted { color: var(--fg-muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
ul.clean { margin: 0 0 1em; padding-left: 20px; }
ul.clean li { margin-bottom: 6px; }
ol.steps { margin: 0 0 1em; padding-left: 20px; }
ol.steps li { margin-bottom: 8px; }

.site-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 9px; background: #fff; margin-bottom: 12px; align-items: flex-start; }
.site-card .n { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.site-card a { font-weight: 700; text-decoration: none; }
.site-card a:hover { text-decoration: underline; }

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .toc { position: static; margin-bottom: 18px; }
    .toc-inner { display: flex; overflow-x: auto; gap: 4px; }
    .toc a { white-space: nowrap; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    h1 { font-size: 24px; }
    .section-body, .card-pad { padding: 18px; }
}

@media print {
    .topbar, .toc, .savebar, .btn, form.noprint { display: none !important; }
    body { background: #fff; }
    .card, .section { box-shadow: none; break-inside: avoid; }
}
