/* Estilos de la app. Base: prototipo aprobado (una columna tipo celular de 460px, barra de navegación fija abajo). */
:root {
  --bg: #F5EEEB;
  --surface: #FFFFFF;
  --surface-2: #EFE2DD;
  --fg: #2B1E24;
  --muted: #76626B;
  --line: #E2D1CB;
  --primary: #513946;
  --on-primary: #FFFFFF;
  --accent: #B35F4F;
  --accent-soft: #D18577;
  --rosa: #E4BBB0;
  --good: #3F7D4E;
  --good-bg: #E1EEE3;
  --warn: #9A6A12;
  --warn-bg: #F5E9CF;
  --bad: #A8443A;
  --bad-bg: #F6DEDA;
  --display: "Bebas Neue", "Oswald", "Arial Narrow", sans-serif;
  --body: "Montserrat", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A120F; --surface: #251915; --surface-2: #33231E; --fg: #F3E7E2; --muted: #B29D95;
    --line: #3F2D27; --primary: #E4BBB0; --on-primary: #2B1E24; --accent: #E39A8B; --accent-soft: #D18577;
    --rosa: #E4BBB0; --good: #8CC79A; --good-bg: #20352A; --warn: #E2B866; --warn-bg: #3A2F17;
    --bad: #EE9187; --bad-bg: #42221E; color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo-claro { display: none; }
  :root:not([data-theme="light"]) .logo-oscuro { display: block; }
}
:root[data-theme="dark"] {
  --bg: #1A120F; --surface: #251915; --surface-2: #33231E; --fg: #F3E7E2; --muted: #B29D95;
  --line: #3F2D27; --primary: #E4BBB0; --on-primary: #2B1E24; --accent: #E39A8B; --accent-soft: #D18577;
  --rosa: #E4BBB0; --good: #8CC79A; --good-bg: #20352A; --warn: #E2B866; --warn-bg: #3A2F17;
  --bad: #EE9187; --bad-bg: #42221E; color-scheme: dark;
}
:root[data-theme="dark"] .logo-claro { display: none; }
:root[data-theme="dark"] .logo-oscuro { display: block; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--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(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo-oscuro { display: none; }

.app { max-width: 460px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top img { width: 44px; height: 44px; }
.top .marca { font-family: var(--display); font-size: 22px; letter-spacing: .06em; line-height: 1; color: var(--primary); }
.top .marca small { display: block; font-size: 13px; color: var(--accent); letter-spacing: .18em; }
.top .volver { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.vista { padding-block: 16px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 18px; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .03em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: 34px; color: var(--primary); }
h2 { font-size: 24px; color: var(--primary); }
h3 { font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.demo { justify-self: start; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--accent-soft); color: var(--accent); }

.seccion { display: grid; gap: 10px; }
.seccion-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; min-width: 0; }
.lista { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fila { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.fila:first-child { border-top: 0; }
.fila:hover { background: var(--surface-2); }
.fila .t { font-weight: 600; line-height: 1.3; }
.fila .s { font-size: 12.5px; color: var(--muted); }
.pos { font-family: var(--display); font-size: 26px; color: var(--accent-soft); width: 26px; text-align: center; }

.nota-badge { display: grid; place-items: center; min-width: 52px; padding: 4px 6px; border-radius: 10px; background: var(--surface-2); }
.nota-badge b { font-family: var(--display); font-size: 26px; font-weight: 400; line-height: 1; color: var(--primary); }
.nota-badge span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.c-excelente, .c-buena { background: var(--good-bg); color: var(--good); }
.c-bueno { background: var(--good-bg); color: var(--good); }
.c-aceptable, .c-regular { background: var(--warn-bg); color: var(--warn); }
.c-mediocre, .c-cara { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.resena-card { display: grid; gap: 8px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.resena-card:hover { border-color: var(--accent-soft); }
.resena-card .cab { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.resena-card q { font-size: 14px; color: var(--fg); quotes: "“" "”"; }

.destacado { background: var(--primary); color: var(--on-primary); border-radius: 14px; padding: 16px; display: grid; gap: 6px; }
.destacado .eyebrow { color: inherit; opacity: .75; }
.destacado h2 { color: var(--on-primary); }
.destacado .muted { color: inherit; opacity: .8; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 28px; font-weight: 400; color: var(--primary); line-height: 1; }
.stat span { font-size: 12px; color: var(--muted); }

.radar { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.r-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.r-axis { stroke: var(--line); stroke-width: 1; }
.r-lbl { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.r-val { fill: var(--accent-soft); fill-opacity: .35; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.r-cmp { fill: none; stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 4 3; }
.leyenda-r { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); }
.leyenda-r i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 4px; }
.leyenda-r i.cmp { border-top: 2px dashed var(--primary); }

.barras { display: grid; gap: 6px; }
.barra { display: grid; grid-template-columns: minmax(0, 1fr) 90px 22px; gap: 8px; align-items: center; font-size: 13px; }
.barra .pista { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.barra .pista i { display: block; height: 100%; background: var(--accent-soft); }

.datos { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; margin: 0; }
.datos dt { color: var(--muted); }
.datos dd { margin: 0; min-width: 0; }

.bloqueado { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); }
.privado { border: 1px solid var(--accent-soft); background: var(--surface-2); }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.nav-in { max-width: 460px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav button { background: none; border: 0; padding: 10px 4px 12px; display: grid; justify-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.nav button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav button[aria-current="page"] { color: var(--accent); }
.nav .mas span.circ { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; margin-top: -18px; box-shadow: 0 2px 8px rgb(0 0 0 / .18); }

.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; background: var(--primary); color: var(--on-primary); }
.btn.sec { background: var(--surface); color: var(--fg); border: 1px solid var(--line); }
.btn.peq { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formulario de la ficha */
.pasos { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pasos button { border: 0; background: var(--surface-2); height: 6px; border-radius: 3px; padding: 0; }
.pasos button.hecho { background: var(--accent-soft); }
.pasos button.actual { background: var(--primary); }
.campo { display: grid; gap: 4px; min-width: 0; }
.campo > label, .campo > .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.campo input[type=text], .campo input[type=number], .campo input[type=date], .campo input[type=time], .campo select, .campo textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 9px 11px; }
.campo textarea { min-height: 76px; resize: vertical; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tres { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.opciones { display: flex; flex-wrap: wrap; gap: 6px; }
.opciones button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.opciones button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.escala { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.escala input[type=range] { width: 100%; accent-color: var(--accent); }
.calc { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.calc b { color: var(--primary); }
.deslizadores { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.desl { display: grid; grid-template-columns: minmax(0,1fr) 16px; gap: 0 6px; align-items: center; font-size: 12.5px; }
.desl input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.desl output { text-align: right; font-weight: 700; color: var(--accent); }

.item { display: grid; gap: 6px; padding-block: 10px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item-h { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.item-n { font-weight: 600; font-size: 14px; }
.item-s { font-size: 12px; color: var(--muted); }
.item-c { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.q { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.q button { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--accent-soft); background: none; padding: 0; }
.q button.on { background: var(--accent-soft); }
.q .linea { width: 6px; height: 1.5px; background: var(--accent-soft); }
.nota { display: flex; gap: 3px; }
.nota button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; padding: 0; }
.nota button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.total { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 4; background: var(--primary); color: var(--on-primary); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.total b { font-family: var(--display); font-size: 30px; font-weight: 400; line-height: 1; }
.total .chip { background: var(--surface); }
.envivo { display: grid; gap: 10px; text-align: center; }
.reloj { font-family: var(--display); font-size: 56px; line-height: 1; color: var(--primary); }
.tercios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tercios span { padding: 6px; border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }
.tercios span.on { background: var(--accent-soft); color: #2B1E24; }
.pie-form { display: flex; justify-content: space-between; gap: 8px; }

.pie { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.4; padding-top: 8px; }
.pie b { font-family: var(--display); font-weight: 400; font-size: 15px; letter-spacing: .06em; display: block; }
.vacio { text-align: center; padding: 18px; color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Agregados de la app real ---------- */
body { margin: 0; }
.nav a { text-decoration: none; display: grid; justify-items: center; gap: 2px; padding: 10px 4px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a.mas span.circ { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; margin-top: -18px; box-shadow: 0 2px 8px rgb(0 0 0 / .18); }
.top a.inicio { display: flex; align-items: center; gap: 10px; text-decoration: none; }
a.btn { display: inline-block; text-align: center; text-decoration: none; }
a.fila, a.resena-card { color: inherit; text-decoration: none; }
a.link { display: inline; }
.btn.peligro { background: var(--bad); color: #fff; }
.campo input[type=email], .campo input[type=password] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 9px 11px; }
.aviso { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; background: var(--bad-bg); color: var(--bad); }
.aviso.ok { background: var(--good-bg); color: var(--good); }
.aviso:empty { display: none; }
.cargando { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 14px; }
.form { display: grid; gap: 12px; }
.clave-temporal { font-family: ui-monospace, monospace; font-size: 18px; letter-spacing: .08em; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; user-select: all; }
.reenc-ctrl { display: flex; align-items: center; gap: 8px; }
.reenc-ctrl button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.reenc-ctrl output { min-width: 28px; text-align: center; font-weight: 700; }
.q-ver { font-size: 11.5px; color: var(--muted); }
.barra-q { grid-template-columns: minmax(0, 1fr) 90px 22px; }
