/* ==========================================================================
   Completar en línea · hojas de trabajo del encuentro (versión interactiva)
   Blanco, tinta azul noche, acento azul y remate dorado (como la versión clara).
   ========================================================================== */
@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Geist"; src: url("../fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #0b1b3a; --ink-2: #3a4864; --muted: #6a7792; --line: #dbe2ee; --line-2: #c3cde0;
  --soft: #f4f7fc; --soft-2: #eaf0ff; --accent: #1f4fd1; --accent-2: #2a62f0; --gold: #b8862e; --gold-soft: #fbf4e4;
  --ok: #0f7a4d; --ok-soft: #e8f6ef; --warn: #a15c07; --warn-soft: #fff4e2; --risk: #c0352b; --risk-soft: #fdecea;
  --r: 14px; --shadow: 0 16px 40px -26px rgb(11 27 58 / 0.35);
  --display: "Bricolage", "Geist", system-ui, sans-serif; --body: "Geist", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--body); color: var(--ink); background: #fff; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Barra superior ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, env(safe-area-inset-left)); background: rgb(255 255 255 / 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top img { height: 30px; width: auto; }
.top .where { font-size: 13px; color: var(--muted); line-height: 1.2; }
.top .where b { display: block; color: var(--ink); font-size: 14px; }
.top .back { margin-left: auto; font-size: 14px; font-weight: 600; text-decoration: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); white-space: nowrap; }

.wrap { max-width: 980px; margin: 0 auto; padding: 22px 16px 120px; }

/* ---------- Portada: lista de hojas ---------- */
.hero h1 { font-family: var(--display); font-weight: 800; font-stretch: 86%; letter-spacing: -0.03em; font-size: clamp(34px, 7vw, 58px); line-height: 0.98; margin: 6px 0 12px; }
h1 em, h2 em { font-style: normal; background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--gold) 120%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--ink-2); max-width: 60ch; font-size: 17px; }
.kick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; padding: 5px 12px 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; }
.kick::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.privacy { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 8px; padding: 12px 14px; border-radius: var(--r); background: var(--soft); font-size: 14px; color: var(--ink-2); }
.privacy b { color: var(--ink); }
.day { margin-top: 28px; }
.day h2 { font-family: var(--display); font-weight: 800; font-stretch: 88%; letter-spacing: -0.02em; font-size: 24px; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform 180ms, border-color 180ms; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.card img { width: 74px; height: 96px; object-fit: cover; object-position: top; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); background: #fff; }
.card img.land { height: 54px; }
.card small { display: block; font-size: 12px; font-weight: 700; color: var(--accent); }
.card b { display: block; font-size: 17px; line-height: 1.2; margin: 2px 0 4px; }
.card span { font-size: 13px; color: var(--muted); }
.card .st { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.card .st.on { background: var(--ok-soft); color: var(--ok); }

/* ---------- Cabecera de una hoja ---------- */
.fhead { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; margin-bottom: 18px; }
.fhead h1 { font-family: var(--display); font-weight: 800; font-stretch: 86%; letter-spacing: -0.03em; font-size: clamp(30px, 6vw, 48px); line-height: 1; margin: 10px 0 8px; }
.fhead p { color: var(--ink-2); max-width: 62ch; }
.fhead .doc { display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-decoration: none; }
.fhead .doc img { width: 92px; border-radius: 5px; box-shadow: 0 8px 20px -8px rgb(11 27 58 / 0.35), 0 0 0 1px var(--line); transform: rotate(-2deg); }
.fhead .doc img.land { width: 130px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; font-size: 14px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; font-size: 12px; font-weight: 800; color: #fff; background: var(--accent); }

/* ---------- Progreso ---------- */
.prog { position: sticky; top: 51px; z-index: 5; display: flex; align-items: center; gap: 12px; margin: 0 -16px 16px; padding: 10px 16px; background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.prog .bar { flex: 1; height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.prog .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 300ms; }
.prog b { color: var(--ink); white-space: nowrap; }

/* ---------- Bloques y campos ---------- */
.sec { margin: 0 0 16px; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.sec > h2 { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); font-weight: 800; font-stretch: 90%; letter-spacing: -0.02em; font-size: 21px; margin-bottom: 4px; }
.sec > h2 .n { font-size: 16px; color: var(--gold); font-stretch: 78%; }
.sec > .hint { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
label.f { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
label.f > small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #fbfcfe; font-size: 16px; font-weight: 400; color: var(--ink);
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgb(31 79 209 / 0.12); }
::placeholder { color: #a3aec4; }
.inline { display: inline-block; width: auto; min-width: 9ch; max-width: 100%; padding: 4px 8px !important; margin: 2px 2px; border-radius: 8px !important; vertical-align: baseline; font-size: 15px !important; }
.inline.w-s { min-width: 6ch; width: 9ch; } .inline.w-m { width: 18ch; } .inline.w-l { width: min(34ch, 100%); }

/* Chips (radio/checkbox con estilo de botón) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: all 150ms; }
.chip input:checked + span { color: #fff; background: var(--accent); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.ok input:checked + span { background: var(--ok); border-color: var(--ok); }
.chip.up input:checked + span { background: var(--gold); border-color: var(--gold); }
.chip.risk input:checked + span { background: var(--risk); border-color: var(--risk); }

/* Avisos */
.note { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.risk { background: var(--risk-soft); color: var(--risk); }
.note.info { background: var(--soft-2); color: var(--accent); }
.note button { margin-left: auto; flex: none; }
.from { margin-top: 6px; font-size: 13px; color: var(--muted); }
.from button { margin-left: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn:hover { border-color: var(--accent); }
.count { font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; }
.count.over { color: var(--risk); }

/* ---------- Autodiagnóstico ---------- */
.q { padding: 12px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.q > p { font-weight: 700; margin-bottom: 8px; }
.q .chips .chip span b { font-size: 12px; opacity: 0.75; }
.route { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px; border-radius: var(--r); background: linear-gradient(140deg, var(--soft-2), #fff 70%); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.route .big { font-family: var(--display); font-weight: 800; font-stretch: 80%; font-size: 64px; line-height: 0.9; color: var(--accent); }
.route b { font-size: 18px; }
.tally { display: flex; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.tally span { padding: 2px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }

/* ---------- Lienzo: decisiones ---------- */
.dec { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.dec + .dec { margin-top: 10px; }
.dec.fire { border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: linear-gradient(180deg, var(--gold-soft), #fff 40%); }
.dec header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.dec header .n { font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: 20px; color: var(--gold); }
.dec header b { font-size: 17px; }
.dec header .tag { margin-left: auto; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #fff; }
.dec .hint { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.dec .row { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.dec .up-fields { display: none; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dec.is-up .up-fields { display: grid; }
.dec.is-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.dec.is-up { border-color: color-mix(in srgb, var(--gold) 70%, transparent); }
.fire-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.fire-box div { padding: 10px; border-radius: 10px; font-size: 13px; background: var(--soft); color: var(--ink-2); }
.fire-box div b { display: block; font-size: 15px; color: var(--ink); }
.fire-box div.ok { background: var(--ok-soft); } .fire-box div.ok b { color: var(--ok); }

/* ---------- Bases ---------- */
.clause { padding: 12px 0; border-top: 1px solid var(--line); line-height: 2.1; font-size: 15px; color: var(--ink-2); }
.clause:first-of-type { border-top: 0; }
.clause > b { color: var(--ink); margin-right: 4px; }
.clause .pend { float: right; margin-left: 10px; line-height: 1.4; }
.clause.is-pend { background: linear-gradient(90deg, var(--gold-soft), transparent 70%); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }

/* ---------- Hoja de ruta ---------- */
.hito { display: grid; grid-template-columns: 76px 1fr; gap: 6px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.hito:first-of-type { border-top: 0; }
.hito .d { font-family: var(--display); font-weight: 800; font-stretch: 80%; font-size: 20px; color: var(--accent); line-height: 1.1; }
.hito .d small { display: block; font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--muted); }
.hito .what { font-weight: 700; }
.hito .flds { grid-column: 2; display: grid; grid-template-columns: 1fr 170px; gap: 8px; }
.hito .note { grid-column: 2; margin-top: 0; }

/* ---------- Co-creación y acuerdos ---------- */
.paso { display: grid; grid-template-columns: 170px 1fr; gap: 10px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.paso:first-of-type { border-top: 0; }
.paso .pn b { display: block; font-size: 16px; }
.paso .pn small { color: var(--muted); font-size: 12px; }
.paso.dim { opacity: 0.55; }
.paso.dim:focus-within { opacity: 1; }
.acuerdo { padding: 16px; border-radius: 12px; border: 1px solid var(--line); }
.acuerdo + .acuerdo { margin-top: 12px; }
.acuerdo h3 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-stretch: 88%; font-size: 19px; margin-bottom: 10px; }
.acuerdo h3 .parts { margin-left: auto; font-family: var(--body); font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.acuerdo h3 .parts.ok { background: var(--ok-soft); color: var(--ok); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--ok); flex: none; margin-top: 1px; }

/* ---------- Problema ---------- */
.tray { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tray > div { padding: 10px; border-radius: 10px; background: var(--soft); }
.tray > div b { display: block; font-size: 14px; margin-bottom: 6px; }
.tray select { padding: 7px 8px; font-size: 14px; }
.tray textarea { min-height: 56px; margin-top: 6px; font-size: 14px; }
.ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; counter-reset: i; }
.ideas label { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; counter-increment: i; }
.ideas label::before { content: counter(i); font-family: var(--display); font-weight: 800; color: var(--gold); text-align: right; }
.mx { width: 100%; border-collapse: collapse; font-size: 14px; }
.mx th, .mx td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.mx th:first-child, .mx td:first-child { text-align: left; }
.mx th { font-size: 12px; color: var(--muted); font-weight: 700; }
.mx select { padding: 6px; width: 54px; }
.mx td.tot { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--accent); }
.mx tr.best td { background: var(--ok-soft); }
.mx-wrap { overflow-x: auto; }
.ladder { display: grid; gap: 6px; }

/* ---------- Barra inferior de acciones ---------- */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgb(255 255 255 / 0.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.actions .saved { font-size: 13px; color: var(--muted); margin-right: auto; }
.actions .saved::before { content: "● "; color: var(--ok); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 200ms; }
.toast.on { opacity: 1; }

@media (max-width: 680px) {
  .fhead { grid-template-columns: 1fr; }
  .fhead .doc { display: none; }
  .tray { grid-template-columns: 1fr 1fr; }
  .paso { grid-template-columns: 1fr; }
  .hito .flds { grid-template-columns: 1fr; }
  .dec .up-fields { grid-template-columns: 1fr; }
  .fire-box { grid-template-columns: 1fr; }
  .actions .saved { display: none; }
  .route .big { font-size: 48px; }
}

/* ---------- PDF (impresión): un documento limpio con lo completado ---------- */
#print { display: none; }
@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  body { background: #fff; font-size: 10pt; }
  #app, .actions, .toast { display: none !important; }
  #print { display: block; color: var(--ink); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; padding-bottom: 4mm; border-bottom: 1.4pt solid var(--ink); margin-bottom: 5mm; }
  .p-head img { height: 12mm; }
  .p-head .k { font-size: 8pt; font-weight: 700; color: var(--accent); }
  .p-head h1 { font-family: var(--display); font-weight: 800; font-stretch: 86%; letter-spacing: -0.02em; font-size: 22pt; line-height: 1; margin-top: 1.5mm; }
  .p-head h1 em { -webkit-text-fill-color: var(--accent); }
  .p-meta { display: flex; flex-wrap: wrap; gap: 2mm 8mm; font-size: 9pt; color: var(--ink-2); margin-bottom: 4mm; }
  .p-meta b { color: var(--ink); }
  .p-sec { break-inside: avoid; margin-bottom: 4mm; }
  .p-sec h2 { font-family: var(--display); font-weight: 800; font-stretch: 90%; font-size: 12pt; padding: 1.5mm 0; border-bottom: 0.6pt solid var(--line-2); margin-bottom: 1.5mm; }
  .p-sec table { width: 100%; border-collapse: collapse; }
  .p-sec td { vertical-align: top; padding: 1.3mm 2mm 1.3mm 0; font-size: 9.2pt; line-height: 1.35; border-bottom: 0.4pt solid var(--line); }
  .p-sec td:first-child { width: 36%; font-weight: 700; color: var(--ink-2); }
  .p-sec td.empty { color: #a3aec4; font-style: italic; }
  .p-sec p { font-size: 9.2pt; line-height: 1.5; color: var(--ink-2); margin: 1mm 0; }
  .p-foot { margin-top: 6mm; padding-top: 2mm; border-top: 0.6pt solid var(--line-2); font-size: 7.5pt; color: var(--muted); display: flex; justify-content: space-between; }
}
.hito > div[data-out] { grid-column: 2; }
.hito > div[data-out]:empty { display: none; }
@media print { .p-head h1 em { background: none; color: var(--accent); -webkit-text-fill-color: var(--accent); } }

/* Identidad del Laboratorio y estado de guardado en la plataforma */
.sec.ident { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(140deg, var(--soft-2), #fff 65%); }
.actions .saved.ok { color: var(--ok); }
.actions .saved.warn { color: var(--warn); font-weight: 600; }
.actions .saved.warn::before { color: var(--warn); }
.actions .saved:not(.ok):not(.warn)::before { color: var(--muted); }
@media (max-width: 680px) {
  .actions { flex-wrap: wrap; }
  .actions .saved { display: block; width: 100%; font-size: 12px; margin: 0 0 2px; }
  .actions .copy { display: none; }
  .actions .btn { flex: 1; padding-left: 10px; padding-right: 10px; }
}
