/* ═══════════════════════════════════════════════════════════════
   BuildGets PWA · styles.css v21
   Sprint 1 visual (2026-05-15):
   - Tipografía: Courier Prime (mono) + IBM Plex Sans (sans)
   - Paleta unificada azul BuildGets #2563eb (sin rojo)
   - Verde #16a34a solo para "completado" (fases del paso 3)
   - Header: logo SVG rayo + texto BuildGets + " · FAST"
   - Capítulos: tarjetas con barra de peso %
   - Rueda porcentual 0→100% por fase con cierre verde
   Mantiene selectores críticos de app.js:
     .active, .show, .open, .done, .mode-pane, .mode-tab, .gen-step
   ═══════════════════════════════════════════════════════════════ */

/* ─── Tokens YL (papel amarillo) ────────────────────────────── */
:root {
  --yl-paper:        #fef9c3;
  --yl-paper-shade:  #fef08a;
  --yl-paper-edge:   #facc15;
  --yl-ink:          #0f172a;
  --yl-ink2:         #334155;
  --yl-ink-title:    #2563eb;  /* v21: azul BuildGets (antes navy oscuro) */
  --yl-ink-amber:    #854d0e;
  --yl-ink-amber2:   #a16207;
  --yl-ink-amber-d:  #ca8a04;
  --yl-ink-red:      #2563eb;  /* v21: alias azul (todos los rojos quedan neutralizados) */
  --yl-ink-blue:     #2563eb;  /* v21: el azul único de la marca */
  --yl-ink-blue-soft:#3b82f6;  /* v21: variante clara para acentos */
  --yl-ink-green:    #16a34a;  /* SOLO para "completado" en paso 3 */
  --yl-ink-green-l:  #86efac;  /* Verde claro (texto tachado de fase completada) */
  --yl-mute:         #94a3b8;
  --yl-grid:         rgba(161,98,7,0.10);
  --yl-grid-major:   rgba(161,98,7,0.22);
  --yl-slate:        #475569;
  --yl-slate-deep:   #334155;
  --yl-border:       #ca8a04;
  --yl-border-soft:  rgba(202,138,4,0.30);
  --yl-bg:           #faf9f5;

  --yl-sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --yl-serif: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --yl-mono:  'Courier Prime', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ─── Reset & base ──────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  width: 100%;
  font-family: var(--yl-sans);
  background: var(--yl-bg);
  color: var(--yl-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}
body { overflow-x: hidden; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
a { color: var(--yl-ink-title); text-decoration: none; }

/* ─── App shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── Header (nav azul) ─────────────────────────────────────── */
.bg-nav {
  background: #2563eb;
  /* v21·iter4: padding vertical equilibrado visualmente.
     El padding-top suma safe-area-inset-top (Android lo necesita por la barra superior),
     pero el área VISIBLE bajo la barra debe quedar simétrica: top=14px, bottom=14px. */
  padding-left: 16px;
  padding-right: 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 2px 12px rgba(37,99,235,0.22);
}
/* v21: bloque marca completo (rayo + texto BuildGets + sufijo FAST) */
.bg-nav-brand {
  display: flex;
  align-items: center;
  gap: 5px;             /* v22: gap reducido de 8 a 5 para que FAST quede más pegada */
  flex: 1;
  min-width: 0;
  line-height: 1;
}
/* v21·iter4: rayo como emoji unicode (el del header de buildgets.com) */
.bg-nav-bolt {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  display: inline-block;
}
.bg-nav-wordmark {
  color: #fff;
  font-family: var(--yl-sans);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}
.bg-nav-tag {
  color: rgba(255,255,255,0.65);
  font-family: var(--yl-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}
/* v21·iter2: FAST como flecha SVG con muesca en V */
.bg-nav-fast {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}
.bg-nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  color: #fff;
  font-family: var(--yl-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.bg-nav-pill .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #86efac;
  display: inline-block;
}
.bg-nav-pill.anon .dot { background: #fbbf24; }

/* ─── Yellow paper (main milimetrado) ───────────────────────── */
.yellow-paper {
  flex: 1;
  background: var(--yl-paper);
  background-image:
    linear-gradient(var(--yl-grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--yl-grid-major) 1px, transparent 1px),
    linear-gradient(var(--yl-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--yl-grid) 1px, transparent 1px);
  background-size: 30px 30px, 30px 30px, 6px 6px, 6px 6px;
  border-top: 2px solid var(--yl-border);
  position: relative;
  overflow-x: hidden;
}

/* ─── Pantallas (toggle .active mantenido) ─────────────────── */
.screen {
  display: none;
  padding: 20px 16px 32px;
  min-height: 100%;
  animation: scrFadeIn 0.25s ease-out;
}
.screen.active { display: block; }
@keyframes scrFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Welcome ───────────────────────────────────────────────── */
.welcome-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--yl-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--yl-ink-blue);
  margin-top: 4px;
}
.dot-blue { width: 7px; height: 7px; background: var(--yl-ink-blue); border-radius: 50%; }
.dot-green { width: 7px; height: 7px; background: var(--yl-ink-green); border-radius: 50%; }

.welcome-title-cursive {
  font-family: var(--yl-mono);
  font-style: normal;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--yl-ink-title);
  margin-top: 6px;
}
.welcome-title-cursive span {
  color: var(--yl-ink-blue-soft);
  font-weight: 400;
}
.welcome-lead {
  font-family: var(--yl-sans);
  font-style: normal;
  font-size: 13.5px;
  color: var(--yl-slate);
  line-height: 1.55;
  margin-top: 10px;
  margin-bottom: 18px;
}
.welcome-lead strong {
  color: var(--yl-ink-title);
  font-weight: 600;
  font-style: normal;
  font-family: var(--yl-sans);
  font-size: 1em;
}
/* v21·iter3: etiquetas de formato (PDF, EXCEL, BGT, BC3) en mono */
.welcome-lead .fmt-tag {
  font-family: var(--yl-mono);
  font-weight: 700;
  color: var(--yl-ink-blue);
  font-size: 0.93em;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ─── Mode toggle (3 tabs) ───────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  margin-bottom: 14px;
}
.mode-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px;
  border-radius: 8px;
  font-family: var(--yl-mono);
  font-weight: 500;
  font-size: 11.5px;
  color: var(--yl-slate);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.mode-tab svg { flex-shrink: 0; }
.mode-tab.active {
  background: var(--yl-ink-blue);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(37,99,235,0.30);
}
/* v21·iter3: la pestaña import es ligeramente más ancha para que "BC3" no apriete */
.mode-tab--import { flex: 1.18; }
/* v21·iter3: sub "BC3" más sutil dentro de "Importar BC3" */
.mode-tab-sub {
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.55;
  margin-left: 1px;
}
.mode-tab.active .mode-tab-sub { opacity: 0.78; }

.mode-pane { display: none; }
.mode-pane.active { display: block; animation: scrFadeIn 0.2s ease-out; }

/* ─── Mic button ────────────────────────────────────────────── */
.mic-button {
  display: block;
  margin: 24px auto 14px;
  width: 88px; height: 88px;
  border-radius: 50%;
  /* v21·iter2: gradient naranja-amarillo (eco del rayo del logo) */
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 55%, #ea580c 100%);
  color: #fff;
  box-shadow:
    0 8px 24px rgba(234,88,12,0.45),
    inset 0 2px 0 rgba(255,255,255,0.30);
  transition: transform 0.15s;
}
.mic-button:active { transform: scale(0.95); }
.mic-button.recording {
  background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%);
  animation: micPulse 1.4s infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 10px 30px rgba(234,88,12,0.45), 0 0 0 0 rgba(234,88,12,0.45); }
  50%     { box-shadow: 0 10px 30px rgba(234,88,12,0.45), 0 0 0 20px rgba(234,88,12,0); }
}
.mic-hint {
  text-align: center;
  font-family: var(--yl-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yl-slate);
  font-weight: 700;
}
/* v21·iter2: el strong del hint a naranja (acompaña al botón) */
.mic-hint strong { color: #ea580c; }
.mic-example {
  margin-top: 24px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.5);
  border: 1px dashed var(--yl-border-soft);
  border-radius: 8px;
  font-size: 12px;
  color: var(--yl-slate);
  text-align: center;
  line-height: 1.5;
}

/* ─── Welcome textarea / import ─────────────────────────────── */
.welcome-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--yl-ink);
  resize: vertical;
  min-height: 130px;
  outline: none;
  transition: border-color 0.15s;
}
.welcome-textarea:focus { border-color: var(--yl-ink-blue); }
.welcome-text-counter {
  font-family: var(--yl-mono);
  font-size: 10px;
  color: var(--yl-ink-amber);
  text-align: right;
  margin-top: 5px;
  letter-spacing: 0.08em;
}
.welcome-text-submit, .review-confirm-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--yl-ink-title), #2563eb);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(30,64,175,0.30);
  transition: transform 0.1s;
}
.welcome-text-submit:active, .review-confirm-btn:active { transform: scale(0.98); }

.import-dropzone {
  background: #fff;
  border: 2px dashed var(--yl-border-soft);
  border-radius: 12px;
  padding: 26px 14px;
  text-align: center;
  transition: all 0.2s;
}
.import-dropzone:active { background: #fffbeb; border-color: var(--yl-border); }
.import-icon {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  border-radius: 14px;
  margin: 0 auto 10px;
  background: rgba(202,138,4,0.10);
  color: var(--yl-ink-amber-d);
}
.import-title {
  font-weight: 700; font-size: 15px;
  color: var(--yl-ink-title);
  margin-bottom: 4px;
}
.import-desc {
  font-size: 12px;
  color: var(--yl-ink-amber);
}
.import-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--yl-ink-amber);
  text-align: center;
  line-height: 1.5;
}

/* ─── Recording screen ─────────────────────────────────────── */
.rec-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--yl-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--yl-ink-red);
  margin-bottom: 4px;
}
.rec-dot {
  width: 8px; height: 8px;
  background: var(--yl-ink-red);
  border-radius: 50%;
  animation: recPulse 1.2s infinite;
}
@keyframes recPulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.rec-timer {
  margin-left: auto;
  font-family: var(--yl-mono);
  font-size: 11px;
  color: var(--yl-ink-red);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rec-title-cursive {
  font-family: var(--yl-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--yl-ink-title);
  margin: 8px 0 18px;
}
.rec-title-cursive span { color: var(--yl-ink-red); font-weight: 500; }

.rec-waveform {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  height: 70px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 0 12px;
  margin-bottom: 14px;
}
.rec-waveform span {
  display: inline-block;
  width: 3px;
  height: 8px;
  background: var(--yl-ink-red);
  border-radius: 2px;
  transition: height 0.1s;
}

.rec-transcript-wrap { margin-bottom: 14px; }
.rec-transcript-label {
  font-family: var(--yl-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--yl-ink-amber);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.rec-transcript {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 14px;
  min-height: 110px;
  font-family: var(--yl-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  color: var(--yl-ink);
}
.rec-transcript-placeholder {
  color: var(--yl-mute);
  font-style: italic;
}

.rec-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}
.rec-cancel-btn {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  color: var(--yl-ink);
  font-weight: 600;
  font-size: 13px;
}
.rec-stop-btn {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--yl-ink-red), #b91c1c);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(220,38,38,0.28);
}

.diag-panel {
  margin-top: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.5);
  border: 1px dashed var(--yl-border-soft);
  border-radius: 8px;
  font-family: var(--yl-mono);
  font-size: 10px;
}
.diag-panel summary { cursor: pointer; color: var(--yl-ink-amber); font-weight: 700; letter-spacing: 0.06em; }
.diag-rows { margin-top: 6px; }
.diag-row { padding: 2px 0; color: var(--yl-ink2); }
.diag-log-label { margin-top: 8px; font-size: 9px; color: var(--yl-ink-amber); }
.diag-log {
  margin-top: 4px;
  background: rgba(0,0,0,0.04);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--yl-ink2);
  max-height: 100px; overflow-y: auto;
  line-height: 1.5;
}

/* ─── Review screen ─────────────────────────────────────────── */
.step-pill {
  display: inline-block;
  font-family: var(--yl-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--yl-ink-amber-d);
  background: rgba(254,243,199,0.8);
  border: 1px solid var(--yl-border-soft);
  padding: 3px 9px;
  border-radius: 999px;
}
.step-pill-green {
  color: var(--yl-ink-green);
  background: rgba(187,247,208,0.5);
  border-color: rgba(22,163,74,0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.review-eyebrow { margin-bottom: 8px; }
.review-title-cursive {
  font-family: var(--yl-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--yl-ink-title);
}
.review-title-cursive span { color: var(--yl-ink-red); font-weight: 500; }
.review-lead {
  font-family: var(--yl-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--yl-ink-amber);
  margin: 8px 0 16px;
}

.review-textarea-wrap { position: relative; }
.review-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 14px;
  font-family: var(--yl-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  color: var(--yl-ink);
  resize: vertical;
  min-height: 180px;
  outline: none;
}
.review-textarea:focus { border-color: var(--yl-ink-blue); }
.review-counter {
  font-family: var(--yl-mono);
  font-size: 10px;
  color: var(--yl-ink-amber);
  text-align: right;
  margin-top: 5px;
  letter-spacing: 0.08em;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 14px;
}
.review-back-btn {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  color: var(--yl-ink);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}

/* ─── Generating screen ─────────────────────────────────────── */
.gen-eyebrow { margin-bottom: 8px; }
.gen-title-cursive {
  font-family: var(--yl-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--yl-ink-title);
  margin-bottom: 24px;
}
.gen-title-cursive span { color: var(--yl-ink-red); font-weight: 500; }
.gen-spinner-big {
  display: flex; justify-content: center;
  margin: 16px 0 18px;
}
.gen-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(30,64,175,0.18);
  border-top-color: var(--yl-ink-title);
  border-radius: 50%;
  animation: genSpin 0.9s linear infinite;
}
@keyframes genSpin { to { transform: rotate(360deg); } }
.gen-desc {
  text-align: center;
  font-family: var(--yl-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yl-ink-amber);
  font-weight: 700;
  margin-bottom: 16px;
}

.gen-steps {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
}
.gen-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--yl-ink-amber);
  padding: 6px 0;
  border-bottom: 1px dotted var(--yl-border-soft);
  transition: color 0.2s;
}
.gen-step:last-child { border-bottom: none; }
.gen-step-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--yl-mute);
  flex-shrink: 0;
  transition: background 0.2s;
}
.gen-step.active { color: var(--yl-ink-title); font-weight: 700; }
.gen-step.active .gen-step-dot {
  background: var(--yl-ink-red);
  animation: stepBlink 1s infinite;
}
@keyframes stepBlink { 50% { opacity: 0.3; } }
.gen-step.done { color: var(--yl-ink-green); font-weight: 600; }
.gen-step.done .gen-step-dot { background: var(--yl-ink-green); }

/* ─── Result screen ─────────────────────────────────────────── */
.result-topbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.result-back {
  width: 34px; height: 34px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--yl-ink);
}
/* v22b (2026-05-16): bloque título CON tarjeta blanca (devuelto tras iter4) */
.result-title-block {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(202,138,4,0.10);
}
.result-title-compact {
  font-family: var(--yl-sans);
  font-style: normal;
  font-weight: 700;
  font-size: 17px;       /* compacto (17px, antes 22px) */
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--yl-ink-title);
  margin: 0;
}
/* v22b: descripción que va dentro de la misma tarjeta */
.result-title-block .result-summary {
  margin-top: 6px;
  margin-bottom: 0;
}

/* Mantenido por compatibilidad (HTML viejo) */
.result-title-card {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
.result-title-cursive {
  font-family: var(--yl-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--yl-ink-title);
}
.result-summary {
  margin-top: 4px;
  font-size: 12px;
  color: var(--yl-ink-amber);
  line-height: 1.5;
}

.result-total-card {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(202,138,4,0.10);
}
.result-total-label {
  font-family: var(--yl-mono);
  font-size: 9px;
  color: var(--yl-ink-amber);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
}
.result-total-value {
  margin-top: 4px;
  font-family: var(--yl-sans);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.03em;
  color: var(--yl-ink-title);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* v21·iter4: meta testimonial en una línea (sustituye result-kpis-row antiguo) */
.result-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--yl-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--yl-ink-amber);  /* marrón ámbar (mismo que TOTAL · PEM, ÍNDICE DE CAPÍTULOS) */
  letter-spacing: 0.12em;
  padding: 4px 0 10px;
  margin-bottom: 0;
}
.result-meta-row strong {
  color: var(--yl-ink);        /* números en negro (los datos destacan) */
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.result-meta-sep {
  color: var(--yl-border);     /* "·" en marrón claro (#ca8a04, mismo que borde papel) */
}

/* Clases antiguas mantenidas como fallback por compatibilidad,
   en caso de que algún JS o HTML viejo siga referenciándolas. */
.result-kpis-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.result-kpi-mini {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.result-kpi-mini-value {
  font-family: var(--yl-sans);
  font-weight: 500;
  font-size: 22px;
  color: var(--yl-ink-title);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-kpi-mini-label {
  font-family: var(--yl-mono);
  font-size: 9px;
  color: var(--yl-ink-amber);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 700;
}

.result-chapters-wrap {
  background: transparent;  /* v21: las tarjetas tienen su fondo blanco propio */
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-chapters-title {
  font-family: var(--yl-mono);
  font-size: 9px;
  color: var(--yl-slate);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ═══ Capítulos v21 · Tarjetas con barra de peso (variante D) ═══
   Cada capítulo es una tarjeta blanca individual. Muestra su % del total
   con una barra horizontal debajo de la fila principal.
   La barra se calcula desde JS asignando width: N% al .chap-bar-fill.
   ═══════════════════════════════════════════════════════════════════ */
.chap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.chap[open] {
  border-color: #bfdbfe;
  box-shadow: 0 1px 3px rgba(37,99,235,0.06);
}
.chap-summary {
  display: flex; flex-direction: column;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 8px;
}
.chap-summary::-webkit-details-marker { display: none; }
.chap-summary-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.chap-summary-left {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.chap-summary-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.chap-code {
  font-family: var(--yl-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: var(--yl-ink-blue);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.chap-name {
  font-family: var(--yl-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--yl-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chap-total {
  font-family: var(--yl-mono);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--yl-ink);
  font-variant-numeric: tabular-nums;
}
.chap-chevron { color: var(--yl-mute); transition: transform 0.2s; }
.chap[open] .chap-chevron { transform: rotate(180deg); }

/* Barra horizontal de peso % del total */
.chap-summary-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.chap-bar {
  flex: 1;
  height: 3px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}
.chap-bar-fill {
  height: 100%;
  background: var(--yl-ink-blue);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.chap-bar-pct {
  font-family: var(--yl-mono);
  font-size: 9.5px;
  color: var(--yl-mute);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}
/* El capítulo con mayor peso (≥ 30%) resalta % en azul */
.chap--major .chap-bar-pct {
  color: var(--yl-ink-blue);
  font-weight: 700;
}

/* Partidas v21·iter2 · Formato 3: tarjetas blancas individuales sobre fondo azul claro */
.chap-items {
  background: #eff6ff;          /* azul claro del fondo del capítulo abierto */
  padding: 10px 10px;
  border-top: 1px solid #bfdbfe;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chap-item {
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: none;             /* anula divisores antiguos */
}
.chap-item:last-child { border-bottom: none; }
.chap-item-desc {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--yl-ink);
  line-height: 1.4;
  font-family: var(--yl-sans);
  font-size: 11.5px;
  font-weight: 500;
}
.chap-item-code {
  font-family: var(--yl-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--yl-ink-blue);   /* v21·iter2: código azul (antes gris) para resaltar */
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.chap-item-figures {
  display: flex; align-items: center;
  gap: 8px;
  font-family: var(--yl-mono);
  font-size: 10.5px;
  color: var(--yl-slate);
  font-variant-numeric: tabular-nums;
}
.chap-item-qty {
  /* v21·iter2: caja qty más sutil, sin fondo/borde de color (queda dentro de tarjeta blanca) */
  background: transparent;
  border: none;
  color: var(--yl-slate);
  padding: 0;
  border-radius: 0;
  font-weight: 700;
}
.chap-item-total {
  margin-left: auto;
  font-family: var(--yl-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--yl-ink);       /* total negro, no azul, para no competir con totales del capítulo */
  font-variant-numeric: tabular-nums;
}

/* ─── Download button + menu ───────────────────────────────── */
.download-wrap { position: relative; margin-bottom: 10px; }
.download-main-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--yl-ink-title), #2563eb);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(30,64,175,0.30);
}
.download-main-btn.open { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.download-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20;
  overflow: hidden;
}
.download-menu.open { display: block; }
.dl-option {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  transition: background 0.1s;
}
.dl-option:hover, .dl-option:active { background: rgba(254,249,195,0.7); }
.dl-icon { font-size: 20px; flex-shrink: 0; }
.dl-text { display: flex; flex-direction: column; line-height: 1.2; }
.dl-name { font-weight: 700; color: var(--yl-ink-title); }
.dl-desc { font-size: 11px; color: var(--yl-ink-amber); margin-top: 1px; }

/* ─── Plan toggle button ───────────────────────────────────── */
.plan-toggle-btn {
  width: 100%;
  display: flex; align-items: center;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: background 0.15s;
}
.plan-toggle-btn:hover, .plan-toggle-btn:active { background: #fffbeb; }
.plan-toggle-icon { font-size: 16px; margin-right: 10px; color: var(--yl-ink-title); }
.plan-toggle-label { flex: 1; text-align: left; font-weight: 600; font-size: 13px; color: var(--yl-ink-title); }
.plan-toggle-arrow { color: var(--yl-ink-amber); font-family: var(--yl-mono); font-size: 12px; }

/* ─── Result new button ─────────────────────────────────────── */
.result-new-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--yl-border-soft);
  border-radius: 10px;
  color: var(--yl-ink-amber);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 14px;
}

.result-footer-mark {
  text-align: center;
  font-family: var(--yl-serif);
  font-style: italic;
  font-size: 11px;
  color: var(--yl-ink-amber);
  padding: 8px 0 4px;
}

/* ─── Plano modal ───────────────────────────────────────────── */
.plan-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: planFadeIn 0.2s ease-out;
}
.plan-modal-overlay.active { display: flex; }
@keyframes planFadeIn { from { opacity: 0; } to { opacity: 1; } }

.plan-modal-sheet {
  width: 100%;
  max-height: 92%;
  background: var(--yl-paper);
  background-image:
    linear-gradient(var(--yl-grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--yl-grid-major) 1px, transparent 1px),
    linear-gradient(var(--yl-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--yl-grid) 1px, transparent 1px);
  background-size: 30px 30px, 30px 30px, 6px 6px, 6px 6px;
  border-top: 2px solid var(--yl-border);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  animation: planSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes planSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.plan-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.plan-modal-eyebrow {
  font-family: var(--yl-mono);
  font-size: 9px;
  color: var(--yl-ink-amber-d);
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
}
.plan-modal-title {
  font-family: var(--yl-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 20px;
  color: var(--yl-ink-title);
  line-height: 1;
  margin-top: 2px;
}
.plan-modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--yl-border-soft);
  font-size: 16px;
  color: var(--yl-ink);
  display: flex; align-items: center; justify-content: center;
}
.plan-modal-hint {
  font-size: 12px;
  color: var(--yl-ink-amber);
  margin-bottom: 10px;
}
.plan-modal-canvas {
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 10px;
  padding: 6px;
  display: flex; align-items: center; justify-content: center;
  min-height: 280px;
}
.plan-modal-canvas svg { display: block; max-width: 100%; height: auto; }
.plan-modal-meta {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(254,243,199,0.6);
  border: 1px dashed var(--yl-border-soft);
  border-radius: 8px;
  font-family: var(--yl-mono);
  font-size: 10px;
  color: var(--yl-ink-amber-d);
  line-height: 1.7;
}
.plan-modal-meta b { color: var(--yl-ink-title); }

/* ─── Toast ─────────────────────────────────────────────────── */
.bg-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 16px;
  background: #1e293b;
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
  max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.bg-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.bg-toast.success { background: var(--yl-ink-green); }
.bg-toast.error { background: var(--yl-ink-red); }

/* ─── Footer ───────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--yl-ink-amber);
  padding: 14px 8px;
  background: rgba(254,249,195,0.6);
  border-top: 1px solid var(--yl-border-soft);
}
.app-footer a { color: var(--yl-ink-title); font-weight: 600; }

/* ─── Install banner ───────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 12px; left: 12px; right: 12px;
  background: #fff;
  border: 1px solid var(--yl-border-soft);
  border-radius: 12px;
  padding: 12px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  z-index: 90;
  transform: translateY(140%);
  transition: transform 0.3s;
}
.install-banner.show { display: flex; transform: translateY(0); }
.install-text { flex: 1; min-width: 0; }
.install-title { font-weight: 700; font-size: 14px; color: var(--yl-ink-title); }
.install-desc { font-size: 11.5px; color: var(--yl-ink-amber); margin-top: 1px; line-height: 1.3; }
.install-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--yl-ink-title), #2563eb);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12.5px;
}
.install-close {
  width: 28px; height: 28px;
  color: var(--yl-mute);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ─── iOS guide modal ───────────────────────────────────────── */
.ios-guide-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 110;
  padding: 16px;
}
.ios-guide-overlay.active { display: flex; }
.ios-guide-sheet {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  position: relative;
  text-align: center;
}
.ios-guide-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  font-size: 16px;
  color: var(--yl-mute);
}
.ios-guide-icon { margin: 0 auto 10px; }
.ios-guide-icon img { width: 56px; height: 56px; border-radius: 12px; }
.ios-guide-title { font-size: 18px; font-weight: 700; color: var(--yl-ink-title); margin-bottom: 4px; }
.ios-guide-subtitle { font-size: 13px; color: var(--yl-ink-amber); margin-bottom: 16px; }
.ios-guide-steps {
  list-style: none;
  text-align: left;
  font-size: 13px;
  color: var(--yl-ink);
}
.ios-guide-steps li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--yl-border-soft);
}
.ios-guide-steps li:last-child { border-bottom: none; }
.ios-guide-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--yl-ink-title);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ios-guide-ok {
  margin-top: 16px;
  padding: 12px 20px;
  background: var(--yl-ink-title);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
}

/* ─── Auth modal ───────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.auth-overlay.active { display: flex; }
.auth-sheet {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 380px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.auth-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  font-size: 16px;
  color: var(--yl-mute);
}
.auth-title { font-family: var(--yl-serif); font-style: italic; font-size: 24px; color: var(--yl-ink-title); margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: var(--yl-ink-amber); margin-bottom: 18px; line-height: 1.4; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(254,249,195,0.7);
  border-radius: 8px;
  margin-bottom: 16px;
}
.auth-tab {
  padding: 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--yl-ink-amber);
}
.auth-tab.active {
  background: #fff;
  color: var(--yl-ink-title);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-field { margin-bottom: 12px; }
.auth-field-collapsed { display: none; }
.auth-field-collapsed.show { display: block; }
.auth-field label { display: block; font-size: 12px; font-weight: 600; color: var(--yl-ink-amber); margin-bottom: 4px; }
.auth-hint { font-weight: 400; color: var(--yl-mute); font-size: 11px; }
.auth-field input {
  width: 100%;
  padding: 11px 12px;
  background: rgba(254,249,195,0.4);
  border: 1px solid var(--yl-border-soft);
  border-radius: 8px;
  font-size: 14px;
  color: var(--yl-ink);
  outline: none;
}
.auth-field input:focus { border-color: var(--yl-ink-blue); background: #fff; }
.auth-remember { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--yl-ink-amber); margin-bottom: 12px; }
.auth-error { color: var(--yl-ink-red); font-size: 12px; margin-bottom: 8px; min-height: 16px; }
.auth-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--yl-ink-title), #2563eb);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.auth-toggle-invite {
  display: block;
  margin: 0 auto 10px;
  font-size: 12px;
  color: var(--yl-ink-amber);
  text-decoration: underline;
}
.auth-toggle-invite span { font-weight: 600; }
.auth-legal { margin-top: 10px; font-size: 11px; color: var(--yl-mute); text-align: center; line-height: 1.4; }
.auth-legal a { color: var(--yl-ink-amber); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   v21 (2026-05-15) · SPRINT 1 VISUAL · OVERRIDES Y AÑADIDOS NUEVOS
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Neutralizar italic heredado de Fraunces ─────────────────── */
/* Muchos selectores tenían font-style: italic apuntando a --yl-serif.
   Como ahora --yl-serif = IBM Plex Sans (no es itálica), forzamos normal
   en TODOS los lugares "decorativos" que antes iban en cursiva. */
[class*="cursive"],
[class*="-italic"],
.welcome-lead,
.mic-hint,
.result-footer-mark,
.generating-line,
.plan-modal-hint,
.gen-title-cursive,
.result-title-cursive {
  font-style: normal !important;
}

/* ─── Acentos en azul (antes rojos) ───────────────────────────── */
.welcome-title-cursive span,
.result-title-cursive span,
.title-accent,
.gen-title-cursive span {
  color: var(--yl-ink-blue-soft);
}

/* ═══════════════════════════════════════════════════════════════
   RUEDA PORCENTUAL · PASO 3 GENERANDO
   La rueda es un SVG con dos círculos concéntricos: track (fondo)
   y fill (relleno animado). JS controla:
   - #genWheelFill stroke-dashoffset (283 → 0 == 100%)
   - #genWheelPct  textContent  (0 → 100)
   - #genWheelPhase textContent  ("FASE 1/4" → "FASE 4/4")
   - .gen-wheel-wrap.is-complete  → muestra check verde + oculta resto
   ═══════════════════════════════════════════════════════════════ */
.gen-wheel-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 8px auto 14px;
}
.gen-wheel {
  display: block;
  transform: rotate(-90deg);  /* arrancar desde las 12 */
}
.gen-wheel-track {
  stroke: rgba(37,99,235,0.12);
}
.gen-wheel-fill {
  stroke: var(--yl-ink-blue);
  transition: stroke-dashoffset 0.4s ease, stroke 0.35s ease;
}
/* Estado completado: aro entero verde */
.gen-wheel-wrap.is-complete .gen-wheel-track {
  stroke: rgba(22,163,74,0.18);
}
.gen-wheel-wrap.is-complete .gen-wheel-fill {
  stroke: var(--yl-ink-green);
  stroke-dashoffset: 0 !important;
}
.gen-wheel-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.gen-wheel-num {
  font-family: var(--yl-mono);
  font-weight: 700;
  font-size: 30px;
  color: var(--yl-ink-blue);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  transition: color 0.35s;
}
.gen-wheel-num span {
  font-size: 18px;
  color: var(--yl-mute);
  margin-left: 1px;
}
.gen-wheel-tag {
  font-family: var(--yl-mono);
  font-size: 8.5px;
  color: var(--yl-mute);
  letter-spacing: 0.18em;
  font-weight: 700;
  margin-top: 3px;
  transition: color 0.35s;
}
/* El check verde de cierre: oculto por defecto */
.gen-wheel-check {
  position: absolute;
  inset: 0;
  margin: auto;
  display: none;
}
.gen-wheel-wrap.is-complete .gen-wheel-inner { opacity: 0; }
.gen-wheel-wrap.is-complete .gen-wheel-check { display: block; }

/* ─── Lista de fases del paso 3 ─────────────────────────────── */
/* JS pone .done en fases completadas y .active en la actual */
.gen-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-family: var(--yl-mono);
  font-size: 11px;
  color: var(--yl-mute);
  transition: color 0.3s;
}
.gen-step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--yl-mute);
  flex-shrink: 0;
  position: relative;
  transition: all 0.3s;
}
/* Fase activa: spinner azul */
.gen-step.active {
  color: var(--yl-ink-blue);
  font-weight: 700;
  animation: stepPulse 1.4s ease-in-out infinite;
}
.gen-step.active .gen-step-dot {
  width: 12px;
  height: 12px;
  border-width: 2.5px;
  border-color: var(--yl-ink-blue);
  border-top-color: transparent;
  animation: stepSpin 0.8s linear infinite;
}
/* Fase completada: solo verde (v21·iter4: sin tachado) */
.gen-step.done {
  color: var(--yl-ink-green);
  font-weight: 700;
}
.gen-step.done .gen-step-dot {
  background: var(--yl-ink-green);
  border-color: var(--yl-ink-green);
  width: 13px;
  height: 13px;
  border-width: 0;
}
.gen-step.done .gen-step-dot::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 4px;
  width: 6px;
  height: 3px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg);
}
@keyframes stepSpin {
  to { transform: rotate(360deg); }
}
@keyframes stepPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}


/* ════════════════════════════════════════════════════════════════════
   v2.7.1 (2026-05-18) · EDICIÓN INLINE de partidas + MIS PRESUPUESTOS
   ════════════════════════════════════════════════════════════════════ */

/* Hacer que las partidas en modo lectura sean clicables */
.chap-item--clickable {
    cursor: pointer;
    transition: background 0.12s;
}
.chap-item--clickable:active .chap-item-view {
    background: #fef9c3;
}

/* La partida en edición se distingue visualmente */
.chap-item--editing {
    background: #fef9c3 !important;
    border: 1px solid #fbbf24 !important;
    box-shadow: 0 2px 8px rgba(202, 138, 4, 0.12);
    padding: 10px !important;
    cursor: default;
}

/* Zona de edición inline */
.chap-item-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.cie-head {
    font-size: 0.78rem;
    color: #0f172a;
    line-height: 1.4;
    font-weight: 500;
}
.cie-head .chap-item-code {
    font-family: 'Courier Prime', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: 0.04em;
    margin-right: 2px;
}

.cie-fields {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
.cie-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.cie-field--unit { flex: 0.55; }
.cie-label {
    font-family: 'Courier Prime', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    color: #854d0e;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.cie-input {
    background: #fff;
    border: 1px solid rgba(202, 138, 4, 0.4);
    border-radius: 6px;
    padding: 7px 9px;
    font-family: 'Courier Prime', monospace;
    font-size: 16px;       /* 16px MÍNIMO para evitar zoom automático de iOS al focus */
    color: #0f172a;
    font-weight: 700;
    text-align: right;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cie-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.cie-unit {
    background: #fef3c7;
    border: 1px solid rgba(202, 138, 4, 0.3);
    border-radius: 6px;
    padding: 7px 9px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    color: #854d0e;
    font-weight: 700;
    text-align: center;
    box-sizing: border-box;
}

/* Total parcial en vivo */
.cie-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 7px 12px;
}
.cie-total-eq {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
}
.cie-total-val {
    font-family: 'Courier Prime', monospace;
    font-size: 1rem;
    color: #2563eb;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Botones de acción */
.cie-actions {
    display: flex;
    gap: 5px;
    margin-top: 2px;
}
.cie-btn {
    flex: 1;
    border: none;
    border-radius: 6px;
    padding: 9px 8px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-appearance: none;
    transition: transform 0.1s, opacity 0.15s;
}
.cie-btn:active { transform: scale(0.97); }
.cie-btn-del {
    background: #fee2e2;
    color: #b91c1c;
}
.cie-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.cie-btn-save {
    background: #2563eb;
    color: #fff;
    flex: 1.3;
}
.cie-btn svg { flex-shrink: 0; }

/* ─── PAPELERA DE CAPÍTULO (D1 v2.7.1) ──────────────────────────
   Visible solo cuando el capítulo está abierto.
   Se coloca antes del chevron, a la derecha del total.
   El click sobre el botón NO cierra el <details> (gracias a
   e.preventDefault() en el listener delegado de app.js).
   ─────────────────────────────────────────────────────────────── */
.chap-del-btn {
    display: none;                 /* oculto por defecto (capítulo cerrado) */
    align-items: center;
    justify-content: center;
    background: rgba(220, 38, 38, 0.08);
    border: none;
    border-radius: 5px;
    padding: 4px 5px;
    color: #dc2626;
    cursor: pointer;
    -webkit-appearance: none;
    transition: background 0.12s, transform 0.1s;
    flex-shrink: 0;
}
.chap-del-btn:active {
    transform: scale(0.92);
    background: rgba(220, 38, 38, 0.18);
}
.chap-del-btn svg { display: block; }

/* Visible solo cuando el <details> tiene atributo open */
.chap[open] .chap-del-btn {
    display: inline-flex;
}

/* ─── MIS PRESUPUESTOS (desplegable bajo placeholder Ej.:) ─────── */
.recientes {
    background: #fff;
    border: 1px solid rgba(202, 138, 4, 0.3);
    border-radius: 10px;
    margin: 14px 0 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(202, 138, 4, 0.08);
}
.recientes-summary {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: #854d0e;
    letter-spacing: 0.08em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.recientes-summary::-webkit-details-marker { display: none; }
.recientes-summary svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}
.recientes-summary svg.rec-chev {
    color: #ca8a04;
    margin-left: auto;
}
.recientes-icon {
    color: #2563eb;
}
.recientes[open] .recientes-summary svg.rec-chev {
    transform: rotate(180deg);
}
.recientes-count {
    background: #fbbf24;
    color: #854d0e;
    font-size: 0.62rem;
    padding: 1px 7px;
    border-radius: 99px;
    font-weight: 700;
    letter-spacing: 0;
    margin-left: 2px;
}

.recientes-body {
    background: #fefce8;
    border-top: 1px solid rgba(202, 138, 4, 0.15);
}
.reciente-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(202, 138, 4, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    transition: background 0.12s;
}
.reciente-item:last-child { border-bottom: none; }
.reciente-item:active { background: #fef3c7; }
.reciente-file-icon {
    color: #2563eb;
    margin-top: 1px;
    flex-shrink: 0;
}
.reciente-info {
    flex: 1;
    min-width: 0;
}
.reciente-title {
    color: #0f172a;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.reciente-meta {
    color: #94a3b8;
    font-family: 'Courier Prime', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    margin-top: 2px;
    font-weight: 700;
}
.reciente-total {
    font-family: 'Courier Prime', monospace;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.78rem;
    white-space: nowrap;
    align-self: center;
    flex-shrink: 0;
}
.reciente-delete {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    align-self: center;
    flex-shrink: 0;
    -webkit-appearance: none;
}
.reciente-delete:active { background: #fee2e2; color: #b91c1c; }

.recientes-empty {
    padding: 16px 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.78rem;
    font-style: italic;
}
.recientes-loading {
    padding: 14px;
    text-align: center;
    color: #ca8a04;
    font-family: 'Courier Prime', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

/* ─── BOTÓN "COMPARTIR" (debajo de "Descargar presupuesto") ───── */
.share-btn {
    margin-top: 8px;
    width: 100%;
    background: #fff;
    color: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 12px;
    padding: 12px 14px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-appearance: none;
    transition: background 0.15s, transform 0.1s;
}
.share-btn:active {
    transform: scale(0.98);
    background: #eff6ff;
}
.share-btn svg { flex-shrink: 0; }

