:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #18212b; --muted: #5f6b7a; --line: #e2e7ee;
  --brand: #1f3a5f; --brand-ink: #ffffff; --accent: #1f6feb; --accent-soft: #e7f0ff;
  --ok: #2e7d32; --ok-soft: #e8f5e9; --warn: #b45309; --warn-soft: #fff4e5; --bad: #c62828; --bad-soft: #fdecec;
  --star: #e3a008; --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1621; --card: #172131; --ink: #e8edf3; --muted: #9aa7b8; --line: #263346;
    --brand: #15283f; --accent: #5b9dff; --accent-soft: #1b2d4a;
    --ok: #66bb6a; --ok-soft: #173322; --warn: #f0a248; --warn-soft: #3a2a14; --bad: #ef6b6b; --bad-soft: #3b1c1c;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 6px 0; }
pre { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; } .stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

/* barra superior */
.top { position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--brand-ink);
  padding: calc(10px + var(--safe-t)) 14px 10px; display: flex; align-items: center; gap: 10px; }
.top h1 { margin: 0; font-size: 18px; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top button { background: transparent; border: 0; color: inherit; font-size: 15px; padding: 6px 8px; border-radius: 10px; }
.top button:active { background: rgba(255, 255, 255, .15); }
.back { font-size: 22px !important; line-height: 1; }

main { padding: 12px 12px calc(var(--nav-h) + 24px + var(--safe-b)); max-width: 820px; margin: 0 auto; }

/* navegación inferior */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; background: var(--card);
  border-top: 1px solid var(--line); height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 11.5px; }
nav.tabs a .ico { font-size: 21px; line-height: 1; }
nav.tabs a.on { color: var(--accent); font-weight: 600; }

/* tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; border: 1px solid var(--line); }
.card + .card { margin-top: 10px; }
.list > .item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 10px;
  box-shadow: var(--shadow); display: block; color: inherit; text-decoration: none; }
.list > .item + .item { margin-top: 8px; }
.item .title { font-weight: 650; font-size: 15.5px; }
.item .sub { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.score { min-width: 44px; height: 44px; border-radius: 12px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-weight: 700; font-size: 17px; background: var(--accent-soft); color: var(--accent); }
.score small { font-size: 9.5px; font-weight: 600; opacity: .8; margin-top: -2px; }
.score.hi { background: var(--ok-soft); color: var(--ok); } .score.lo { background: var(--line); color: var(--muted); }
.star { color: var(--star); }

/* etiquetas */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px;
  background: var(--line); color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.info { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px;
  font-size: 13.5px; white-space: nowrap; }
.chips button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* formularios y botones */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; min-height: 340px; }
input[type=checkbox] { width: auto; margin-right: 8px; transform: scale(1.15); }
.check { display: flex; align-items: center; color: var(--ink); font-size: 14.5px; margin: 10px 0; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: 11px 14px; background: var(--line); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: #fff; } .btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad-soft); color: var(--bad); } .btn-ghost { background: transparent; color: var(--accent); padding: 8px; }
.btn-block { width: 100%; } .btn-sm { padding: 7px 11px; font-size: 13.5px; border-radius: 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .full { grid-column: 1 / -1; }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); z-index: 25; width: 56px; height: 56px;
  border-radius: 18px; background: var(--accent); color: #fff; font-size: 28px; box-shadow: 0 6px 18px rgba(31, 111, 235, .35); }

/* bloques */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
details + details, .card + details, details + .card { margin-top: 10px; }
summary { font-weight: 650; cursor: pointer; padding: 2px 0; }
.note { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.note.ok { background: var(--ok-soft); color: var(--ok); } .note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); } .note.info { background: var(--accent-soft); color: var(--accent); }
.answer { display: flex; gap: 8px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.answer:last-child { border-bottom: 0; }
.answer .lbl { font-size: 12.5px; color: var(--muted); }
.answer .val { font-weight: 600; word-break: break-word; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 14px; color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--line); font-size: 16px; }
.menu a:last-child { border-bottom: 0; } .menu .ico { width: 26px; text-align: center; font-size: 20px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.center-page .card { width: 100%; max-width: 420px; }
.logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 12px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; } .steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }

/* tarea en curso y avisos */
#task { position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 10px + var(--safe-b)); z-index: 40;
  background: var(--brand); color: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  display: flex; gap: 10px; align-items: center; max-width: 800px; margin: 0 auto; }
#task .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%;
  animation: spin .9s linear infinite; flex: none; }
#task .txt { flex: 1; min-width: 0; font-size: 13.5px; } #task .txt b { display: block; font-size: 14px; }
#task .txt span { display: block; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#task button { background: rgba(255, 255, 255, .15); color: #fff; padding: 6px 10px; font-size: 13px; }
#task[hidden], #toast[hidden] { display: none !important; }
pre.wide { white-space: pre; font-size: 11.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-t)); z-index: 50; max-width: 92vw;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; display: flex; align-items: flex-end; }
.sheet { background: var(--card); width: 100%; max-width: 820px; margin: 0 auto; border-radius: 18px 18px 0 0; padding: 16px 16px
  calc(16px + var(--safe-b)); max-height: 88vh; overflow: auto; }
.sheet h2 { margin-bottom: 10px; }
@media (min-width: 900px) { main { padding-top: 20px; } .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
/* guía */
.ui { font-weight: 600; background: var(--line); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
code { font: 12.5px ui-monospace, Menlo, Consolas, monospace; background: var(--line); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
ol.gsteps { counter-reset: g; list-style: none; padding: 0; margin: 8px 0; }
ol.gsteps > li { counter-increment: g; position: relative; padding: 4px 0 8px 36px; line-height: 1.55; }
ol.gsteps > li::before { content: counter(g); position: absolute; left: 0; top: 3px; width: 25px; height: 25px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
ol.gsteps .btn, ol.gsteps button { padding: 4px 10px; font-size: 13px; border-radius: 8px; vertical-align: middle; }
.gbody { padding-top: 6px; } .gbody h3 { margin-top: 14px; }
details > .stack, .card > .stack { margin-top: 0; }
dl.faq dt { font-weight: 650; margin-top: 10px; } dl.faq dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.note.row { align-items: center; }
