/* ============================================================
   SIMAQ — cursos + multiherramienta. Mobile first.
   ============================================================ */

/* El usuario típico tiene 50–60 años y usa el teléfono al sol, en el
   huerto. De ahí el cuerpo de 18px, los textos secundarios que no bajan
   de 15px, y los contrastes por sobre el mínimo AA de WCAG. */
:root {
  --green-900: #14532D;
  --green-800: #166534;
  --green-700: #15803D;
  --green-600: #16A34A;
  --green-100: #DCFCE7;
  --green-50:  #F0FDF4;

  --amber-700: #B45309;
  --amber-600: #D97706;
  --amber-100: #FEF3C7;
  --red-600:   #DC2626;
  --red-50:    #FEF2F2;

  --ink:       #0B1220;   /* 17,4:1 sobre blanco */
  --ink-2:     #283548;   /* 11,4:1 */
  --ink-3:     #51607A;   /*  6,4:1 — antes 4,8:1 */
  --line:      #D8DFE9;
  --line-2:    #A9B6C8;
  --surface:   #FFFFFF;
  --surface-2: #F4F7FA;
  --bg:        #E9EEF4;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --r:    14px;
  --r-lg: 20px;
  --sh-1: 0 1px 2px rgba(15,23,42,.08), 0 2px 5px rgba(15,23,42,.08);
  --sh-2: 0 4px 12px rgba(15,23,42,.10), 0 12px 28px rgba(15,23,42,.12);
  --sh-3: 0 8px 24px rgba(15,23,42,.18), 0 24px 48px rgba(15,23,42,.20);

  --topbar-h: 60px;
  --sudo-h:    76px;
  --dock-h:   72px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
  --safe-t:   env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #F8FAFC;
    --ink-2:     #DCE3EC;   /* 13,6:1 sobre la superficie oscura */
    --ink-3:     #ABBACD;   /*  8,5:1 — antes 6,2:1 */
    --line:      #2E3B52;   /* borde visible contra la tarjeta */
    --line-2:    #4A5B75;
    --surface:   #161F2E;
    --surface-2: #1E293B;
    --bg:        #0A101C;
    --green-600: #22C55E;   /* el verde debe brillar sobre fondo oscuro */
    --green-700: #16A34A;
    --green-100: #14532D;
    --green-50:  #0C2A1A;
    --amber-100: #4A2A06;
    --amber-600: #FBBF24;
    --red-50:    #4A1010;
    --sh-1: 0 1px 3px rgba(0,0,0,.5);
    --sh-2: 0 4px 14px rgba(0,0,0,.55);
    --sh-3: 0 8px 26px rgba(0,0,0,.7);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Sin esto, cualquier `display` explícito le gana al atributo hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

/* ---------------- Topbar ---------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 8px 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__icon {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%;
  cursor: pointer; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.topbar__icon:active { background: var(--line); }
.topbar__icon svg { width: 26px; height: 26px; stroke-width: 2.2; }
.topbar__title {
  font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-inline: 8px;
}
.topbar__spacer { flex: 1; }

/* Una identidad prestada nunca puede confundirse con la cuenta propia.
   El aviso vive fuera del router y ocupa sitio real sobre todas las rutas. */
.sudoBanner {
  position: fixed; z-index: 39;
  inset: calc(var(--topbar-h) + var(--safe-t)) 0 auto;
  height: var(--sudo-h);
  color: #fff; background: #7C2D12;
  border-bottom: 1px solid rgba(255, 255, 255, .35);
  box-shadow: var(--sh-1);
}
.sudoBanner__inner {
  height: 100%; max-width: 720px; margin-inline: auto; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
}
.sudoBanner__texto {
  min-width: 0; flex: 1; font-size: .9375rem; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sudoBanner__texto strong { font-weight: 800; }
.sudoBanner__k {
  display: block; margin-bottom: 2px; font-size: .75rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.sudoBanner__volver {
  flex: none; min-height: 48px; max-width: 154px; padding: 7px 12px;
  border: 2px solid #fff; border-radius: 11px;
  color: #7C2D12; background: #fff; cursor: pointer;
  font-size: .875rem; font-weight: 800; line-height: 1.2;
}
.sudoBanner__volver:disabled { opacity: .7; cursor: wait; }

/* ---------------- Vista ---------------- */
.view {
  padding: calc(var(--topbar-h) + var(--safe-t) + 12px) 16px
           calc(var(--dock-h) + var(--safe-b) + 28px);
  max-width: 720px; margin-inline: auto;
  outline: none;
}
.view:focus-visible { outline: none; }
body.is-sudo .view {
  padding-top: calc(var(--topbar-h) + var(--safe-t) + var(--sudo-h) + 12px);
}

/* Cada render se dibuja en su propio nodo —ver app.js—, y ese nodo no
   debe alterar la maquetación: con `display: contents` sus hijos se
   comportan como si colgaran del marco. */
.pantalla { display: contents; }

:where(button, a, input, [tabindex]):focus-visible {
  outline: 3px solid var(--green-600);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- Dock ---------------- */
.dock {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--dock-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.dock__gap { width: 112px; flex: none; }
.dock__link {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-2); font-size: .8125rem; font-weight: 650;
  letter-spacing: .01em;
  transition: color .18s;
}
.dock__link svg { width: 26px; height: 26px; stroke-width: 2.1; }
.dock__link[aria-current="page"] { color: var(--green-600); }

/* ---------------- FAB ---------------- */
.fab {
  position: fixed; z-index: 60;
  left: 50%; bottom: calc(var(--safe-b) + 14px);
  transform: translateX(-50%);
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.35); border-radius: 50%;
  background: linear-gradient(160deg, var(--green-600), var(--green-800));
  color: #fff; cursor: pointer;
  box-shadow: var(--sh-3), 0 0 0 4px rgba(22,163,74,.18);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s;
}
/* Los dos iconos se superponen y se alternan con opacidad. */
.fab__icon {
  grid-area: 1 / 1;
  width: 34px; height: 34px;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  transition: opacity .18s, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.fab__icon--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.fab__ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 3px solid #fff; opacity: 0;
  transition: opacity .2s, transform .2s;
}
.fab[aria-expanded="true"] { transform: translateX(-50%) scale(.94); }
.fab[aria-expanded="true"] .fab__icon--tool { opacity: 0; transform: rotate(90deg) scale(.6); }
.fab[aria-expanded="true"] .fab__icon--close { opacity: 1; transform: none; }
.fab[aria-expanded="true"] .fab__ring { opacity: .8; transform: scale(1.08); }

/* ---------------- Abanico ---------------- */
.fan { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
/* El velo tiene que ser opaco de verdad: con poco contraste, los discos
   se confundían con el contenido de fondo. */
.fan__scrim {
  position: absolute; inset: 0;
  background: radial-gradient(130% 80% at 50% 100%, rgba(2,6,23,.90), rgba(2,6,23,.80) 55%, rgba(2,6,23,.70));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .24s ease;
}
.fan.is-open { pointer-events: auto; }
.fan.is-open .fan__scrim { opacity: 1; }

.fan__items { position: absolute; inset: 0; }

.fan-item {
  position: absolute; left: 0; top: 0;
  width: 92px;
  /* Reset del botón: sin esto el fondo blanco del UA tapa la etiqueta. */
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translate(-50%, -50%) scale(.3);
  opacity: 0; pointer-events: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .3s cubic-bezier(.34,1.4,.64,1), opacity .22s ease;
  will-change: transform, opacity;
}
.fan.is-open .fan-item { pointer-events: auto; }

/* El disco va siempre claro: el fondo del abanico es oscuro en ambos
   temas, así que un disco oscuro se perdía contra el velo. */
.fan-item__disc {
  width: 72px; height: 72px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--green-900);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
  border: 3px solid rgba(255,255,255,.9);
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), background .16s, color .16s;
}
.fan-item__disc svg { width: 34px; height: 34px; stroke-width: 2.1; }

.fan-item__label {
  font-size: .875rem; font-weight: 700; line-height: 1.2;
  text-align: center; color: #fff;
  letter-spacing: -.01em;
  padding: 4px 10px; border-radius: 99px;
  background: rgba(2,6,23,.82);
  border: 1px solid rgba(255,255,255,.16);
  white-space: nowrap;
  transition: background .16s, transform .16s;
}

.fan-item.is-active .fan-item__disc {
  transform: scale(1.18);
  background: var(--green-600); color: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 6px rgba(22,163,74,.35), 0 8px 22px rgba(0,0,0,.55);
}
.fan-item.is-active .fan-item__label {
  background: var(--green-700); transform: scale(1.06);
  border-color: rgba(255,255,255,.5);
}

.fan__hint {
  position: absolute; left: 50%; bottom: calc(var(--safe-b) + 100px);
  transform: translateX(-50%);
  font-size: .8125rem; font-weight: 650; letter-spacing: .02em;
  color: #fff; padding: 6px 14px; border-radius: 99px;
  background: rgba(2,6,23,.8); border: 1px solid rgba(255,255,255,.18);
  opacity: 0; transition: opacity .24s;
  pointer-events: none; white-space: nowrap;
}
.fan.is-open.has-overflow .fan__hint { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .fan-item, .fab, .fab__icon, .fan__scrim { transition-duration: .01ms; }
}

/* ---------------- Bloques comunes ---------------- */
.hero {
  background: linear-gradient(150deg, var(--green-700), var(--green-900));
  color: #fff; border-radius: var(--r-lg);
  padding: 22px 20px; margin-bottom: 20px;
  box-shadow: var(--sh-2);
}
/* Las herramientas usan un tono distinto para que se lean como otra
   zona de la app, no como una lámina más del curso. */
.hero--tool { background: linear-gradient(150deg, #1E293B, #020617); }
.hero__eyebrow {
  font-size: .8125rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; opacity: .85; margin-bottom: 7px;
}
.hero h2 { font-size: 1.625rem; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.hero p { margin-top: 9px; opacity: .92; font-size: 1rem; line-height: 1.5; }

.section-title {
  font-size: .875rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
  margin: 26px 0 12px;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  padding: 18px; margin-bottom: 16px;
}

.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex; align-items: center; gap: 14px; min-height: 72px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-1);
  padding: 14px 16px; cursor: pointer;
  transition: transform .12s, border-color .16s;
  -webkit-tap-highlight-color: transparent;
  width: 100%; text-align: left;
}
.row:active { transform: scale(.985); border-color: var(--line-2); }
.row__ico {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center; border-radius: 13px;
  background: var(--green-50); color: var(--green-700);
  font-weight: 700; font-size: 1.125rem;
  border: 1px solid var(--green-100);
}
.row__body { flex: 1; min-width: 0; }
.row__title { font-weight: 700; font-size: 1.0625rem; letter-spacing: -.01em; }
.row__sub { font-size: .9375rem; color: var(--ink-2); margin-top: 3px; line-height: 1.4; }
.row__meta { font-size: .875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.row__chev { color: var(--line-2); flex: none; }
.row__chev svg { width: 18px; height: 18px; }

.card__title {
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em;
  margin-bottom: 14px; color: var(--ink);
}
.card__intro { font-size: .9375rem; color: var(--ink-2); margin: -6px 0 14px; line-height: 1.5; }

/* ---------------- Stepper: el control principal ----------------
   Botones de 56px y número grande: pensado para dedos, guantes
   y usuarios que no están acostumbrados a formularios. */
.step { padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step:first-child { padding-top: 0; }

.step__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.step__art {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--green-50); color: var(--green-700);
}
.step__art svg { width: 34px; height: 34px; }
.step__labels { min-width: 0; }
.step__label { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.step__help { font-size: .9375rem; color: var(--ink-2); line-height: 1.35; margin-top: 1px; }

/* Pregunta directa antes de un grupo de opciones. */
.ask {
  font-size: 1.0625rem; font-weight: 700; color: var(--ink);
  margin: 18px 0 10px;
}

.step__ctrl { display: flex; align-items: stretch; gap: 10px; }
.step__btn {
  width: 66px; height: 66px; flex: none;
  border: 2px solid var(--green-700); background: var(--green-50);
  border-radius: 16px; cursor: pointer;
  font-size: 2rem; font-weight: 600; line-height: 1; color: var(--green-700);
  display: grid; place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, background .14s;
}
.step__btn:active:not(:disabled) { transform: scale(.94); background: var(--green-100); }
.step__btn:disabled { opacity: .35; cursor: default; border-color: var(--line-2); color: var(--ink-3); background: var(--surface-2); }

.step__value {
  flex: 1; min-width: 0; border: 2px solid var(--line-2);
  background: var(--surface-2); border-radius: 16px;
  /* `place-items: center` centra la lectura completa en los dos ejes.
     Antes la caja alineaba por base de letra, y eso deja el bloque
     arriba: la base la fija el número, que es el más alto, y el sobrante
     queda todo abajo. */
  display: grid; place-items: center;
  cursor: pointer; padding: 0 8px; min-height: 66px;
  -webkit-tap-highlight-color: transparent;
}
/* Aquí sí manda la base de la letra: es lo que hace que la unidad se
   apoye en el número en vez de flotar a media altura. */
.step__lectura { display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.step__num {
  font-size: 2.125rem; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.step__unit { font-size: 1.0625rem; font-weight: 650; color: var(--ink-2); }
.step__input {
  flex: 1; min-width: 0; min-height: 66px;
  border: 3px solid var(--green-600); background: var(--surface);
  border-radius: 16px; text-align: center;
  font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums;
  outline: none;
  /* Sin esto el texto se apoya arriba: el alto lo da `min-height`, no el
     contenido, y el relleno que pone el navegador no es simétrico. */
  padding: 0 8px; line-height: 1;
}

/* ---------------- Picker visual ---------------- */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick--wide { grid-template-columns: 1fr; }
.pick__opt {
  position: relative; text-align: left; padding: 16px; min-height: 72px;
  border: 2px solid var(--line); background: var(--surface-2);
  border-radius: 14px; cursor: pointer;
  transition: border-color .16s, background .16s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.pick__opt:active { transform: scale(.98); }
.pick__opt[aria-pressed="true"] {
  border-color: var(--green-600); background: var(--green-50);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-600) 22%, transparent);
}
.pick__opt[aria-pressed="true"]::after {
  content: '✓'; position: absolute; top: 10px; right: 12px;
  color: var(--green-700); font-weight: 800; font-size: 1.25rem;
}
.pick__opt[aria-pressed="true"] .pick__label { color: var(--green-700); }
.pick__art { color: var(--green-700); margin-bottom: 8px; }
.pick__art svg { width: 38px; height: 38px; }
.pick__label { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.pick__sub { font-size: .9375rem; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }

/* ---------------- Botones ---------------- */
.btn {
  display: block; width: 100%; padding: 17px; min-height: 58px;
  border-radius: 14px; border: 2px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-size: 1.0625rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--sh-1);
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.btn:active { transform: scale(.985); }
.btn--big {
  padding: 19px; font-size: 1.1875rem; min-height: 64px;
  background: var(--green-700); color: #fff; border-color: var(--green-700);
  box-shadow: var(--sh-2);
}
.btn--stop { background: var(--red-600); border-color: var(--red-600); }
.btn--ghost { background: var(--surface-2); box-shadow: none; color: var(--ink-2); }

/* ---------------- Resultados ---------------- */
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.result {
  background: linear-gradient(150deg, var(--green-600), var(--green-900));
  color: #fff; border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-2); min-width: 0;
}
.result--alt { background: linear-gradient(150deg, #475569, #0F172A); }
.result__label {
  font-size: .8125rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; opacity: .92;
}
.result__value {
  font-size: 2.25rem; font-weight: 700; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; margin-top: 3px; line-height: 1.05;
}
.result__unit { font-size: 1rem; font-weight: 650; opacity: .92; margin-left: 4px; letter-spacing: -.01em; }
.result__help { font-size: .875rem; opacity: .88; margin-top: 7px; line-height: 1.35; }

.minirow {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.minirow__item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh-1);
}
.minirow__k { display: block; font-size: .875rem; color: var(--ink-2); font-weight: 600; }
.minirow__v {
  display: block; font-size: 1.375rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px;
}

.note {
  font-size: .9375rem; color: var(--ink-2); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--green-600);
  border-radius: 10px; padding: 12px 14px; margin-top: 10px;
}
.note strong { font-weight: 700; color: var(--ink); }
.note code {
  font-family: var(--mono); font-size: .8125em;
  background: var(--surface); padding: 2px 5px; border-radius: 4px;
  border: 1px solid var(--line); white-space: nowrap;
}
.note.warn {
  border-left-color: var(--amber-700); background: var(--amber-100);
  color: var(--ink); font-weight: 550;
}

/* ---------------- Cronómetro ---------------- */
.crono { margin-top: 16px; }
.crono__time {
  text-align: center; font-size: 3.75rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
  color: var(--ink); margin-bottom: 14px; line-height: 1;
}
.crono__res {
  text-align: center; font-size: 1.0625rem; color: var(--ink-2);
  margin-top: 14px; min-height: 1.4em;
}
/* El tiempo que debería demorar el tramo: se lee antes de cronometrar. */
.crono__control {
  margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r);
  background: var(--green-50); border: 1px solid var(--green-600);
  color: var(--ink); font-size: 1rem; line-height: 1.4;
}
.crono__res strong { font-size: 1.25rem; color: var(--green-700); }

/* ---------------- Selector de boquillas ---------------- */
/* Una herramienta ya medida dentro de la calibración. */
.row--hecha .row__ico { background: var(--green-50); color: var(--green-700); }
.row--hecha .row__sub { color: var(--green-700); font-weight: 650; }

.noz { display: flex; flex-direction: column; gap: 10px; }
/* En el aforo la fila se elige entera, así que es un botón. */
.noz__item--elegible { width: 100%; text-align: left; cursor: pointer; font: inherit; }
/* El control de caudal ocupa la fila entera: en un teléfono no caben el
   control, el diagnóstico y el botón en una sola línea. */
.aforo__fila {
  /* `minmax(0, …)` deja que las columnas se encojan: sin eso el control
     de caudal impone su ancho máximo y la tarjeta se sale de la pantalla. */
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px;
  align-items: center; padding: 12px 0; border-top: 1px solid var(--line);
}
.aforo__fila > .step { grid-column: 1 / -1; min-width: 0; }
.aforo__fila:first-of-type { border-top: 0; }
.aforo__marca { display: flex; align-items: baseline; gap: 8px; }
.aforo__estado { font-size: .8125rem; font-weight: 700; }
.aforo__desvio { font-size: 1.0625rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.aforo__marca--buena { color: var(--green-700); }
.aforo__marca--gastada, .aforo__marca--tapada { color: var(--red-600); }
.aforo__quitar { min-height: 48px; padding: 0 16px; justify-self: end; }
.noz__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface-2);
  transition: border-color .16s, background .16s;
}
.noz__item.is-set {
  border-color: var(--green-600); background: var(--green-50);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green-600) 18%, transparent);
}
.noz__dot {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-2);
  box-shadow: inset 0 -3px 7px rgba(0,0,0,.22);
  display: grid; place-items: center;
}
.noz__dot--plain { background: var(--surface); box-shadow: none; }
.noz__dotTxt { font-size: .875rem; font-weight: 700; color: var(--ink); }
.noz__body { flex: 1; min-width: 0; }
.noz__name { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; }
.noz__q { font-size: .875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.noz__stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.noz__btn {
  width: 52px; height: 52px; border: 1px solid var(--line-2);
  background: var(--surface); border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 500;
  color: var(--ink); line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, background .14s;
}
.noz__btn:active:not(:disabled) { transform: scale(.92); background: var(--line); }
.noz__btn--add:active:not(:disabled) { background: var(--green-800); }
.noz__btn:disabled { opacity: .28; cursor: default; }
.noz__btn--add { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.noz__count {
  min-width: 42px; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums; font-size: 1.5rem;
}




.empty { text-align: center; padding: 48px 24px; color: var(--ink-2); font-size: 1.0625rem; }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .5; }

/* ---------------- Portada ----------------
   Fondo claro en los dos temas: el logo es azul oscuro y sobre fondo
   oscuro se perdería. La marca manda por sobre el tema del sistema. */
.splash {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(90% 70% at 50% 42%, #FFFFFF, #EDF1F7 70%, #DFE7F2);
  color: #1B3A8C;
  transition: opacity 1s ease, visibility 1s;
}
.splash.is-gone { opacity: 0; visibility: hidden; }
.splash__logo {
  width: min(62vw, 280px); height: auto;
  animation: splashIn 1.2s cubic-bezier(.34,1.4,.64,1) both;
}
.splash__logo img { width: 100%; height: auto; }
.splash__tag {
  font-size: 1rem; font-weight: 600; color: #4A5B75;
  animation: splashIn 1.2s .36s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .splash__logo, .splash__tag { animation: none; }
}

/* ---------------- Estado de la red ----------------
   Una banda fija abajo, sobre el dock: en el huerto hay que saber si lo
   medido ya viajó o sigue esperando señal. */
.estadoRed {
  position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + var(--safe-b));
  z-index: 60; padding: 8px 14px;
  background: var(--green-700); color: #fff;
  font-size: .9375rem; font-weight: 650; text-align: center; line-height: 1.3;
}
.estadoRed--sin { background: var(--ink-2); }

/* ---------------- Instructivo ---------------- */
.instructivo__pasos {
  margin: 0 0 16px; padding: 18px 18px 18px 44px;
  list-style: decimal; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-1);
}
.instructivo__paso {
  margin-bottom: 12px; padding-left: 4px;
  font-size: 1.0625rem; line-height: 1.45; color: var(--ink);
}
.instructivo__paso:last-child { margin-bottom: 0; }
.instructivo__paso::marker { color: var(--green-700); font-weight: 700; }
/* La nota es la advertencia del tema: se separa de los pasos. */
.instructivo__nota {
  margin: 0 0 16px; padding: 14px 16px;
  border-left: 4px solid var(--green-600); border-radius: 0 var(--r) var(--r) 0;
  background: var(--green-50); color: var(--ink);
  font-size: 1rem; line-height: 1.45;
}

/* ---------------- Cuenta, planes y formularios ---------------- */

/* El dock ahora tiene tres destinos, así que el hueco del FAB se
   reparte distinto. */
.dock__link--cuenta[data-estado="vencido"] { color: var(--amber-600); }
.dock__link--cuenta[data-estado="activo"] { color: var(--green-600); }

.campo { margin-bottom: 20px; }
.campo__label {
  display: block; font-size: 1.0625rem; font-weight: 700;
  color: var(--ink); margin-bottom: 4px;
}
.campo__ayuda {
  font-size: .9375rem; color: var(--ink-2); margin-bottom: 10px; line-height: 1.4;
}
.campo__input {
  width: 100%; min-height: 62px; padding: 12px 16px;
  border: 2px solid var(--line-2); border-radius: 14px;
  background: var(--surface-2); color: var(--ink);
  font-size: 1.25rem;
  transition: border-color .16s, box-shadow .16s;
}
.campo__input:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green-600) 18%, transparent);
}
/* El código se lee de un vistazo y se escribe mirando el teclado. */
.campo__input--codigo {
  font-size: 2rem; font-weight: 700; text-align: center;
  letter-spacing: .35em; font-variant-numeric: tabular-nums;
  padding-left: 24px;   /* compensa el espaciado del último dígito */
}

.avisoCaja {
  padding: 14px 16px; border-radius: var(--r); margin-bottom: 16px;
  font-size: 1rem; font-weight: 600; line-height: 1.45;
  border-left: 4px solid;
}
.avisoCaja--error {
  background: var(--red-50); border-left-color: var(--red-600); color: var(--ink);
}
.avisoCaja--ok {
  background: var(--green-50); border-left-color: var(--green-600); color: var(--ink);
}

.estadoPlan {
  padding: 18px; border-radius: var(--r-lg); margin-bottom: 16px;
  border: 2px solid;
}
.estadoPlan--ok { background: var(--green-50); border-color: var(--green-600); }
.estadoPlan--vencido { background: var(--amber-100); border-color: var(--amber-600); }
.estadoPlan__titulo { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; }
.estadoPlan__detalle { font-size: 1rem; color: var(--ink-2); margin-top: 4px; }

/* Tarjetas de plan: el precio es lo que se compara, así que manda. */
.planCard {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 20px; margin-bottom: 14px;
  border: 2px solid var(--line-2); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-1); cursor: pointer;
  transition: transform .1s, border-color .16s;
  -webkit-tap-highlight-color: transparent;
}
.planCard:active { transform: scale(.99); }
.planCard:disabled { opacity: .5; cursor: default; }
.planCard--destacado {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-600) 18%, transparent), var(--sh-2);
}
.planCard__cinta {
  position: absolute; top: 14px; right: 16px;
  background: var(--green-700); color: #fff;
  font-size: .8125rem; font-weight: 700;
  padding: 5px 12px; border-radius: 99px;
}
.planCard__meses {
  font-size: 1.125rem; font-weight: 700; color: var(--ink-2);
  letter-spacing: -.01em;
}
.planCard__precio {
  font-size: 2.25rem; font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.1;
}
.planCard__mes { font-size: .9375rem; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

/* Lista de lo que incluye el plan, en la pantalla de candado. */
.incluye { list-style: none; }
.incluye li {
  position: relative; padding-left: 30px; margin-bottom: 12px;
  font-size: 1rem; color: var(--ink-2); line-height: 1.45;
}
.incluye li::before {
  content: ''; position: absolute; left: 0; top: .35em;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--green-600);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/13px no-repeat,
           linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/13px no-repeat,
        linear-gradient(#000 0 0);
  mask-composite: exclude;
}

/* ============================================================
   Avisos que se difuminan (avisos.js)

   Van bajo la barra de arriba y no encima del dock: abajo está el FAB,
   que es lo que más se toca, y un aviso ahí se comería el gesto.
   La capa no recibe toques —`pointer-events: none`— para no bloquear
   la pantalla; cada aviso sí, porque se puede tocar para cerrarlo.
   ============================================================ */
.avisos {
  position: fixed; z-index: 80; pointer-events: none;
  top: calc(var(--topbar-h) + var(--safe-t) + 10px);
  left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 24px), 460px);
  display: flex; flex-direction: column; gap: 10px;
}

.avisoFlash {
  pointer-events: auto; cursor: pointer;
  padding: 16px 18px; border-radius: var(--r);
  font-size: 1.0625rem; font-weight: 700; line-height: 1.4;
  color: #fff; box-shadow: var(--sh-2);
  border-left: 5px solid rgba(255, 255, 255, .55);
  /* Empieza arriba y transparente; las clases de estado lo mueven. */
  opacity: 0; transform: translateY(-14px);
  transition: opacity .28s ease, transform .28s ease;
}
.avisoFlash--entra { opacity: 1; transform: translateY(0); }
.avisoFlash--sale  { opacity: 0; transform: translateY(-10px); }

.avisoFlash--ok    { background: var(--green-700); }
.avisoFlash--info  { background: #1B3A8C; }   /* el azul de la marca */
.avisoFlash--error { background: var(--red-600); }

/* Quien pidió menos movimiento recibe sólo el fundido. */
@media (prefers-reduced-motion: reduce) {
  .avisoFlash { transform: none; transition: opacity .28s ease; }
  .avisoFlash--entra, .avisoFlash--sale { transform: none; }
}

/* Una línea del historial de pagos. El número de orden va en pequeño y
   apagado: casi nunca hace falta, pero cuando hace falta es lo único que
   sirve para reclamar, así que tiene que estar. */
.pagoFila {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.pagoFila:last-child { border-bottom: 0; padding-bottom: 0; }
.pagoFila__cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pagoFila__meses { font-size: 1.0625rem; font-weight: 700; color: var(--ink); }
.pagoFila__monto { font-size: 1.0625rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pagoFila__detalle { font-size: .9375rem; color: var(--ink-2); margin-top: 2px; }
.pagoFila__orden {
  font-size: .875rem; color: var(--ink-3); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Aviso bajo un campo: qué le falta a lo que se escribió.

   El texto es de 15px como el resto de lo secundario, no más chico: un
   mensaje de error que no se lee es peor que no ponerlo. */
.campo__pista {
  font-size: .9375rem; font-weight: 600; line-height: 1.35;
  margin-top: 8px; min-height: 1.35em;
  color: var(--red-600);
}
.campo__pista--mal { color: var(--red-600); }

/* El borde acompaña al mensaje. El verde no lleva texto: la ausencia de
   aviso ya dice que está bien, y felicitar por escribir un teléfono
   sobra. */
.campo__input--mal {
  border-color: var(--red-600);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red-600) 14%, transparent);
}
.campo__input--bien { border-color: var(--green-600); }

/* Contrapeso del dock. El hueco central mide 112 px fijos y los accesos
   se reparten el resto: para que ese hueco caiga en el centro exacto
   —donde está el FAB— hace falta el mismo peso a cada lado. Con tres
   accesos, el cuarto hueco lo pone este elemento vacío. */
.dock__filler { flex: 1; }

/* Aire bajo una lista de filas: sin esto, la tarjeta que viene después
   —«Agregar un fundo»— queda pegada a la última fila y las dos se leen
   como si fueran lo mismo. */
.list + .card,
.list + details.card { margin-top: 16px; }

/* Barra de calibración en curso, sobre las herramientas. Verde como el
   FAB porque pertenece a lo mismo: lo que se calcula aquí va a parar a
   esa máquina. */
.calibrando {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--r);
  background: var(--green-50);
  border: 2px solid var(--green-600);
}
/* En consulta la barra no promete nada: es un aviso, no un destino. */
.calibrando--consulta { background: var(--surface-2); border-color: var(--line); }
.calibrando--consulta .calibrando__k,
.calibrando--consulta .calibrando__m,
.calibrando--consulta .calibrando__c { color: var(--ink-2); }
.calibrando--consulta .calibrando__m { color: var(--ink); }
.calibrando__txt { min-width: 0; flex: 1; }
.calibrando__k {
  display: block; font-size: .8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--green-700);
}
.calibrando__m {
  display: block; font-size: 1.0625rem; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calibrando__c { display: block; font-size: .9375rem; color: var(--ink-2); }
.calibrando__btn {
  flex: none; min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--green-700); color: #fff;
  font-size: 1rem; font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

/* Una fila del historial con su botón de borrar al costado. La cruz va
   fuera del área tocable de la fila: tocar la fila abre el informe, y
   equivocarse de destino con el dedo grande no puede costar un borrado. */
.filaConAccion { display: flex; align-items: stretch; gap: 8px; }
.filaConAccion .row { flex: 1; }
.filaConAccion__x {
  flex: none; width: 56px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink-3);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.filaConAccion__x:active { background: var(--red-50); color: var(--red-600); border-color: var(--red-600); }

/* Revisión previa: muchas preguntas, pero ninguna obligatoria. Las
   categorías parten cerradas para que la pantalla siga siendo recorrible
   en terreno y cada control conserva un área cómoda para el dedo. */
.revision { padding: 0; overflow: hidden; }
.revision__summary {
  min-height: 66px; padding: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 1.0625rem; font-weight: 700; cursor: pointer;
  list-style: none; -webkit-tap-highlight-color: transparent;
}
.revision__summary::-webkit-details-marker,
.revision__seccionTitulo::-webkit-details-marker { display: none; }
.revision__summary::after,
.revision__seccionTitulo::after {
  content: '›'; flex: none; color: var(--ink-3); font-size: 1.5rem; line-height: 1;
  transform: rotate(90deg); transition: transform .16s;
}
.revision[open] > .revision__summary::after,
.revision__seccion[open] > .revision__seccionTitulo::after { transform: rotate(-90deg); }
.revision__opcional {
  margin-left: auto; padding: 4px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: .8125rem; font-weight: 650;
}
.revision__contenido { padding: 0 18px 18px; }
.revision__progreso { margin: -4px 0 14px; font-size: .875rem; color: var(--ink-3); }
.revision__seccion {
  margin-bottom: 10px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.revision__seccionTitulo {
  min-height: 58px; padding: 13px 14px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; line-height: 1.3; cursor: pointer; list-style: none;
}
.revision__seccionTitulo::after { margin-left: auto; }
.revision__seccionCuerpo { padding: 0 14px 14px; }
.revision__item { padding: 16px 0; border-top: 1px solid var(--line); }
.revision__item:first-child { border-top: 0; }
.revision__itemTitulo,
.revision__labelSecundaria {
  display: block; margin-bottom: 9px;
  font-size: .9375rem; font-weight: 700; line-height: 1.35; color: var(--ink);
}
.revision__estados { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.revision__estado {
  min-height: 50px; padding: 9px 8px;
  border: 2px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink-2);
  font-size: .9375rem; font-weight: 700; cursor: pointer;
}
.revision__estado[aria-pressed="true"] {
  border-color: var(--green-600); background: var(--green-50); color: var(--green-700);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green-600) 18%, transparent);
}
.revision__estado--regular[aria-pressed="true"] {
  border-color: var(--amber-600); background: var(--amber-100); color: var(--amber-700);
}
.revision__estado--malo[aria-pressed="true"] {
  border-color: var(--red-600); background: var(--red-50); color: var(--red-600);
}
.revision__estado--no_aplica[aria-pressed="true"] {
  border-color: var(--line-2); background: var(--surface-2); color: var(--ink-2);
}
.revision__valor { margin-bottom: 12px; }
.revision__inputFila { display: flex; align-items: center; gap: 8px; }
.revision__input,
.revision__textarea {
  width: 100%; min-width: 0; border: 2px solid var(--line-2);
  border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; outline: none;
}
.revision__input { min-height: 54px; padding: 10px 12px; }
.revision__textarea { display: block; padding: 11px 12px; resize: vertical; line-height: 1.4; }
.revision__input:focus,
.revision__textarea:focus { border-color: var(--green-600); }
.revision__unidad { flex: none; color: var(--ink-2); font-size: .9375rem; font-weight: 650; }
.revision__compartido { margin-top: 6px; color: var(--green-700); font-size: .8125rem; line-height: 1.35; }
.revision__observacion { margin-top: 12px; }
.revision__observacion .revision__labelSecundaria { font-size: .875rem; color: var(--ink-2); }
.revision__general { margin-top: 18px; }
.card .btn + .btn { margin-top: 12px; }
.sudoAdmin__select { appearance: auto; }
.sudoCuenta__bloqueo { margin-bottom: 16px; }
.informes-maquina .inf + .inf { margin-top: 24px; }

/* El encabezado de especie separa calibraciones que no se comparan entre
   sí: el nogal y el cerezo tienen otra altura y otra distancia. */
.informes-maquina__especie {
  margin: 32px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  font-size: 1.0625rem; font-weight: 700; color: var(--ink);
}
.informes-maquina__especie:first-child { margin-top: 0; }

/* Las alternativas del calibrador siguen a la vista mientras se ajusta la
   siguiente. Cada fila muestra el objetivo y lo que realmente entregó. */
.configsGuardadas {
  margin-top: 14px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.configsGuardadas__titulo { font-size: .9375rem; font-weight: 700; color: var(--ink); }
.configsGuardadas__lista { margin-top: 8px; }
.configGuardada {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.configGuardada:first-child { border-top: 0; }
.configGuardada__cuerpo { flex: 1; min-width: 0; }
.configGuardada__nombre { font-weight: 700; color: var(--ink); }
.configGuardada__datos { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 0; }
.configGuardada__datos > div { display: flex; gap: 5px; }
.configGuardada__datos dt { color: var(--ink-3); }
.configGuardada__datos dd { margin: 0; color: var(--ink-2); font-weight: 650; }
.configGuardada__eliminar {
  flex: none; width: 48px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--red-600);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}

@media (min-width: 560px) {
  .revision__estados { grid-template-columns: repeat(4, 1fr); }
}

@media print {
  .sudoBanner { display: none !important; }
  .informes-maquina .inf + .inf { break-before: page; }
  /* Cada especie empieza en página propia, y su encabezado nunca queda
     solo al pie: un título huérfano hace creer que falta el contenido. */
  .informes-maquina__especie { break-before: page; break-after: avoid; }
  .informes-maquina__especie:first-child { break-before: auto; }
  .informes-maquina__especie + .inf { break-before: auto; }
}
