/* Sistema Manu Gil · sistema visual de la fase 2.
   Base: identidad de manu-gil.com (carbón, hueso, verde bosque, salvia, arena; titulares condensados).
   Luz: un acento menta luminoso con halos medidos que solo marcan acción principal, selección,
   progreso y confirmación. Intensidad del halo: atributo data-halo en <html> ("suave" | "intenso" | "sin"). */

:root {
  /* Superficies: carbón con un punto de verde, cada nivel algo más claro */
  --bg: #0e110f;
  --bg-raise: #131714;
  --surface: #181d19;
  --surface-2: #1e241f;
  --surface-3: #283029;
  --line: rgba(242, 240, 232, 0.11);
  --line-2: rgba(170, 196, 168, 0.26);
  --line-strong: rgba(170, 196, 168, 0.45);

  /* Texto */
  --text: #f4f2ea;
  --muted: #b6bdb4;
  --faint: #8c948b;

  /* Marca */
  --bone: #f2f0e8;
  --forest: #183a31;
  --forest-2: #245246;
  --sage: #a3b59e;
  --sand: #cdc6a2;
  --mark: #78b58b;

  /* Luz */
  --glow: #93f0b6;
  --glow-ink: #0b1a11;
  --glow-rgb: 147, 240, 182;
  --hydro: #7fd3e6;
  --hydro-rgb: 127, 211, 230;

  /* Estados (sin rojo ni naranja; siempre con icono y texto) */
  --good: #93f0b6;
  --attention: #e3d9a6;
  --alert: #c8b8ff;
  --alert-rgb: 200, 184, 255;

  /* Halos: la intensidad se regula con un solo número */
  --halo-a: 0.32;
  --halo-blur: 22px;
  --halo-spread: -6px;
  --glow-blur: 5px;
  --halo-ring: 0 0 0 1px rgba(var(--glow-rgb), calc(var(--halo-a) + 0.18));
  --halo: 0 6px var(--halo-blur) var(--halo-spread) rgba(var(--glow-rgb), var(--halo-a)), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  --halo-strong: 0 10px 34px -6px rgba(var(--glow-rgb), calc(var(--halo-a) + 0.12)), 0 0 0 1px rgba(var(--glow-rgb), 0.55);
  --depth: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 28px -18px rgba(0, 0, 0, 0.7);

  /* Tipografía */
  --font-title: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --font-label: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.1875rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.125rem;

  /* Espacio, radios, movimiento */
  --gutter: 18px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --tabbar-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}
:root[data-halo="intenso"] { --halo-a: 0.7; --halo-blur: 46px; --halo-spread: 2px; --glow-blur: 14px; }
:root[data-halo="sin"] { --halo-a: 0; }

/* ---------- Base ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--surface-3) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
::selection { background: rgba(var(--glow-rgb), 0.35); color: var(--text); }
input, textarea { caret-color: var(--glow); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; border-radius: 6px; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Marco ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background:
    radial-gradient(120% 38% at 85% -6%, rgba(36, 82, 70, 0.55), transparent 70%),
    radial-gradient(70% 22% at 10% -4%, rgba(var(--glow-rgb), 0.07), transparent 70%),
    var(--bg);
}
.app::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 420px; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(163, 181, 158, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(163, 181, 158, 0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent);
}
.screen {
  position: relative; z-index: 1;
  padding-top: 10px;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: var(--s4);
  animation: screen-in 0.26s var(--ease-out);
}
.screen.no-tabs { padding-bottom: calc(var(--safe-b) + 28px); }
.screen.flow { min-height: 100dvh; }
@keyframes screen-in { from { opacity: 0.4; transform: translateY(6px); } }
@media (min-width: 520px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.brandline { display: flex; align-items: center; gap: 11px; margin-bottom: -4px; font: 700 16px/1 Arial, "Helvetica Neue", sans-serif; letter-spacing: -0.045em; color: var(--text); }
.brandline::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--mark); box-shadow: 0 0 0 5px rgba(120, 181, 139, 0.14), 0 0 14px rgba(var(--glow-rgb), calc(var(--halo-a) * 0.8)); flex: none; }
.logo { display: none; }

.topbar { display: flex; align-items: center; gap: var(--s3); min-height: 52px; }
.topbar-title { display: flex; align-items: center; gap: var(--s3); flex: 1; min-width: 0; }
.topbar h1 { font: 400 32px/1 var(--font-title); letter-spacing: 0.01em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flowbar { display: flex; align-items: center; gap: var(--s3); min-height: 56px; }
.flowbar-title { flex: 1; min-width: 0; }
.flowbar h1 { font: 400 26px/1.05 var(--font-title); letter-spacing: 0.01em; text-transform: uppercase; }
.subhead { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.subhead strong { color: var(--text); font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--surface-2); border: 1px solid var(--line-2); font: 600 14px/1 var(--font-label); letter-spacing: 0.04em; color: var(--text); }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn:disabled { opacity: 0.4; }
.back-link { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 44px; background: none; border: 0; padding: 0; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Tipografía ---------- */

.eyebrow { font: 700 var(--fs-xs)/1.2 var(--font-label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--sage); }
.eyebrow.tone-blue { color: var(--hydro); }
.eyebrow.tone-red { color: var(--alert); }
.eyebrow.tone-amber { color: var(--attention); }
.eyebrow.tone-muted { color: var(--muted); }
.display { font: 400 var(--fs-2xl)/1 var(--font-title); letter-spacing: 0.01em; text-transform: uppercase; text-wrap: balance; }
.title { font: 600 var(--fs-xl)/1.15 var(--font-label); letter-spacing: 0.01em; }
.section-title { font: 700 var(--fs-lg)/1.2 var(--font-label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); }
.lead { color: var(--muted); font-size: var(--fs-md); }
.meta { color: var(--muted); font-size: var(--fs-sm); }
.note { color: var(--faint); font-size: var(--fs-xs); text-align: center; }
.muted { color: var(--muted); }
.tone-blue { color: var(--hydro); }
.tone-red { color: var(--alert); }
.tone-amber { color: var(--attention); }
.tone-muted { color: var(--muted); }
.why { font-size: var(--fs-sm); color: var(--muted); }
.big-number { font: 400 64px/1 var(--font-title); letter-spacing: 0.005em; }
.big-number small { font: 500 18px/1 var(--font-body); color: var(--muted); letter-spacing: 0; }
.quote { border-left: 1px solid var(--line-strong); padding: 4px 0 4px 18px; font-size: 21px; line-height: 1.4; }

/* ---------- Disposición ---------- */

.stack { display: flex; flex-direction: column; gap: var(--s3); }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grow { flex: 1; min-width: 0; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section + .section { padding-top: var(--s4); border-top: 1px solid var(--line); }

/* ---------- Tarjetas ---------- */

.card {
  position: relative;
  background: linear-gradient(150deg, rgba(36, 82, 70, 0.28), rgba(24, 29, 25, 0.96) 55%);
  border: 1px solid rgba(163, 181, 158, 0.18);
  border-radius: var(--r-lg);
  padding: var(--s4);
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--depth);
}
.card h2 { font: 600 22px/1.15 var(--font-label); letter-spacing: 0.01em; }
.card p { color: var(--muted); }
.card-flat { background: var(--surface-2); box-shadow: none; }
.card-link { text-align: left; width: 100%; cursor: pointer; color: inherit; font: inherit; }
.card-link:active { transform: scale(0.995); }
.card-hero { align-items: center; text-align: center; }
.card-green { border-color: rgba(var(--glow-rgb), 0.35); }
.card-amber, .card-amber-edge { border-color: rgba(227, 217, 166, 0.4); }
.card-red { border-color: rgba(var(--alert-rgb), 0.45); }
.card-blue { background: linear-gradient(150deg, rgba(var(--hydro-rgb), 0.12), rgba(24, 29, 25, 0.96) 60%); border-color: rgba(var(--hydro-rgb), 0.25); }
.card-message { background: linear-gradient(150deg, rgba(36, 82, 70, 0.55), rgba(24, 29, 25, 0.96) 65%); border-color: var(--line-strong); }
.card-ai { background: linear-gradient(150deg, rgba(var(--hydro-rgb), 0.1), rgba(24, 29, 25, 0.96) 60%); }
.card-report { background: linear-gradient(150deg, rgba(36, 82, 70, 0.4), rgba(24, 29, 25, 0.96) 60%); }

/* Tarjeta de la acción principal del día: la única con halo en reposo */
.card-cta {
  background: radial-gradient(90% 80% at 100% 0%, rgba(var(--glow-rgb), 0.12), transparent 60%), linear-gradient(150deg, #17271f, #121612);
  border-color: rgba(var(--glow-rgb), 0.38);
  box-shadow: var(--depth), 0 18px calc(var(--halo-blur) * 2) calc(var(--halo-spread) * 4) rgba(var(--glow-rgb), calc(var(--halo-a) + 0.1));
}
.card-cta.is-hydro {
  background: radial-gradient(90% 80% at 100% 0%, rgba(var(--hydro-rgb), 0.14), transparent 60%), linear-gradient(150deg, #13232a, #121612);
  border-color: rgba(var(--hydro-rgb), 0.4);
  box-shadow: var(--depth), 0 18px calc(var(--halo-blur) * 2) calc(var(--halo-spread) * 4) rgba(var(--hydro-rgb), calc(var(--halo-a) + 0.1));
}

/* Chips de estado: icono o punto + texto, nunca solo color */
.chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font: 700 12px/1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.chip-green { color: var(--good); border-color: rgba(var(--glow-rgb), 0.4); background: rgba(var(--glow-rgb), 0.08); }
.chip-amber { color: var(--attention); border-color: rgba(227, 217, 166, 0.45); background: rgba(227, 217, 166, 0.08); }
.chip-red { color: var(--alert); border-color: rgba(var(--alert-rgb), 0.5); background: rgba(var(--alert-rgb), 0.1); }
.chip-blue { color: var(--hydro); border-color: rgba(var(--hydro-rgb), 0.45); background: rgba(var(--hydro-rgb), 0.08); }
.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.summary-chips span { font-size: var(--fs-sm); padding: 6px 10px; border-radius: 10px; background: rgba(36, 82, 70, 0.45); color: var(--text); }

/* ---------- Botones ---------- */

.btn {
  min-height: 52px; padding: 12px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font: 700 var(--fs-md)/1.1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  transition: transform 0.12s var(--ease-out), box-shadow 0.2s var(--ease-out), background-color 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
/* Acción principal: menta luminosa con halo */
.btn-primary { background: linear-gradient(180deg, #a9f6c6, var(--glow)); color: var(--glow-ink); border-color: rgba(255, 255, 255, 0.25); box-shadow: var(--halo); }
.btn-primary[aria-busy="true"] { cursor: progress; opacity: 0.85; }
.btn-secondary { background: var(--surface-3); border-color: var(--line-2); color: var(--text); }
.btn-outline { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost { background: none; color: var(--muted); min-height: 44px; font: 500 var(--fs-md)/1.2 var(--font-body); letter-spacing: 0; text-transform: none; text-decoration: underline; text-underline-offset: 3px; width: auto; }
.btn-small { min-height: 44px; padding: 8px 14px; font-size: 14px; letter-spacing: 0.06em; border-radius: 12px; width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { box-shadow: var(--halo-strong); }
  .btn-secondary:hover:not(:disabled), .icon-btn:hover:not(:disabled) { background: #313a32; }
}
.link-btn { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--text); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); align-self: flex-start; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bottom-actions {
  position: sticky; bottom: 0; margin: auto calc(-1 * var(--gutter)) 0;
  padding: var(--s4) var(--gutter) calc(12px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  display: flex; flex-direction: column; gap: 6px; align-items: stretch; z-index: 2;
}
.bottom-actions .btn-ghost { align-self: center; }
.share-chip { align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(24, 58, 49, 0.4); color: var(--sage); font: 700 14px/1 var(--font-label); letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- Barra de pestañas ---------- */

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(14, 17, 15, 0.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab { position: relative; background: none; border: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font: 700 12px/1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 30px; height: 2px; border-radius: 2px; background: var(--glow); box-shadow: 0 2px 10px rgba(var(--glow-rgb), calc(var(--halo-a) + 0.2)); }
.tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--alert); color: #17112b; font: 700 11px/18px var(--font-body); }
.bell { position: relative; }

/* ---------- Indicadores ---------- */

.dials { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.dial { background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: var(--r-md); min-width: 0; color: inherit; }
.dial:active { background: var(--surface); }
.dial-graphic { position: relative; width: 100%; max-width: 104px; aspect-ratio: 1; display: grid; place-items: center; }
.dial-graphic svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.dial-track, .dial-value { fill: none; stroke-width: 7; stroke-linecap: round; }
.dial-track { stroke: rgba(242, 240, 232, 0.08); }
.dial-value { transition: stroke-dasharray 0.9s var(--ease-out); filter: drop-shadow(0 1px var(--glow-blur) rgba(var(--glow-rgb), var(--halo-a))); }
.dial-number { font: 400 30px/1 var(--font-title); }
.dial-number small { font: 500 14px/1 var(--font-body); color: var(--muted); margin-left: 2px; }
.dial-label { font: 700 12px/1 var(--font-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage); }
.dial-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: -4px; }

.gauge { position: relative; display: grid; place-items: center; margin: 0 auto; }
.gauge svg { position: absolute; inset: 0; overflow: visible; }
.gauge-track, .gauge-value, .donut-track, .donut-value { fill: none; stroke-linecap: round; }
.gauge-track, .gauge-value { stroke-width: 14; transform: rotate(135deg); transform-origin: 100px 100px; }
.gauge-track, .donut-track { stroke: rgba(242, 240, 232, 0.08); }
.gauge-value, .donut-value { transition: stroke-dasharray 0.7s var(--ease-out); filter: drop-shadow(0 2px calc(var(--glow-blur) + 3px) rgba(var(--glow-rgb), var(--halo-a))); }
.donut-track, .donut-value { stroke-width: 16; transform: rotate(-90deg); transform-origin: 100px 100px; }
.gauge-center { position: relative; text-align: center; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; font: 700 14px/1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.rings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ring { background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: var(--r-md); color: inherit; }
.ring:active { background: var(--surface); }
.ring-graphic { position: relative; width: 60px; height: 60px; display: grid; place-items: center; }
.ring-graphic svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring-track { stroke: rgba(242, 240, 232, 0.1); }
.ring-value { transition: stroke-dasharray 0.7s var(--ease-out); }
.ring-text { font: 600 15px/1 var(--font-label); }
.ring-label { font-size: var(--fs-sm); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 92px; color: inherit; transition: border-color 0.15s, box-shadow 0.2s; }
.stat:disabled { opacity: 1; cursor: default; }
.stat.is-pressed { border-color: rgba(var(--glow-rgb), 0.6); box-shadow: var(--halo); }
.stat-value { font: 400 30px/1 var(--font-title); }
.stat-label { font-size: var(--fs-sm); color: var(--muted); line-height: 1.2; }
.stat.tone-red .stat-value { color: var(--alert); }
.stat.tone-amber .stat-value { color: var(--attention); }

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(163, 181, 158, 0.16); border-radius: var(--r-md); overflow: hidden; border: 1px solid rgba(163, 181, 158, 0.2); }
.metric { background: rgba(24, 29, 25, 0.95); padding: var(--s3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric b { font: 400 26px/1.05 var(--font-title); }
.metric b small { font: 500 14px/1 var(--font-body); color: var(--muted); }
.metric span { font: 700 11px/1.2 var(--font-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--glow); box-shadow: 0 0 10px rgba(var(--glow-rgb), var(--halo-a)); transition: width 0.3s var(--ease-out); }

.salt-track { position: relative; height: 6px; border-radius: 3px; background: rgba(242, 240, 232, 0.08); }
.salt-track span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--hydro); box-shadow: 0 0 10px rgba(var(--hydro-rgb), var(--halo-a)); }
.salt-ticks { display: flex; justify-content: space-between; font: 600 12px/1 var(--font-label); letter-spacing: 0.06em; color: var(--faint); }

.check-badge { width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--glow); color: var(--glow); display: grid; place-items: center; margin: 0 auto; box-shadow: 0 0 0 6px rgba(var(--glow-rgb), 0.08), 0 8px 26px -6px rgba(var(--glow-rgb), calc(var(--halo-a) + 0.15)); animation: pop 0.45s var(--ease-out); }
@keyframes pop { 0% { transform: scale(0.7); opacity: 0; } 70% { transform: scale(1.05); } }
.delta { font: 400 30px/1 var(--font-title); color: var(--good); }

/* Semana: siete días con estado */
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-dot { display: flex; flex-direction: column; align-items: center; gap: 6px; font: 600 13px/1 var(--font-label); letter-spacing: 0.08em; color: var(--muted); min-height: 44px; }
.week-dot i { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-style: normal; color: var(--glow-ink); }
.week-dot.is-done i { background: var(--glow); border-color: var(--glow); box-shadow: 0 2px 8px rgba(var(--glow-rgb), var(--halo-a)); }
.week-dot.is-missed i { border-style: dashed; border-color: rgba(var(--alert-rgb), 0.6); }
.week-dot.is-today i { border-color: var(--text); border-width: 2px; }
.week-dot.is-future { opacity: 0.45; }
.week-dots.compact { gap: 4px; }
.week-dots.compact .week-dot { font-size: 11px; gap: 4px; min-height: 0; }
.week-dots.compact .week-dot i { width: 24px; height: 24px; }

/* ---------- Entradas ---------- */

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.field-hint { font-size: var(--fs-xs); color: var(--muted); }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); color: var(--alert); }
.input, .textarea, .select {
  width: 100%; min-height: 52px; padding: 13px 16px; border-radius: var(--r-md);
  background: var(--bg-raise); border: 1px solid var(--line-2); font-size: 16px; color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: rgba(var(--glow-rgb), 0.7); box-shadow: 0 0 0 3px rgba(var(--glow-rgb), 0.16); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: rgba(var(--alert-rgb), 0.7); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input-big { font: 400 30px/1 var(--font-title); text-align: center; letter-spacing: 0.04em; }
.input-code { font: 400 34px/1 var(--font-title); letter-spacing: 0.32em; text-align: center; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); }
.scale-opt { aspect-ratio: 1 / 1.05; border-radius: var(--r-md); font: 400 30px/1 var(--font-title); background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); transition: transform 0.12s var(--ease-out), box-shadow 0.2s, background-color 0.15s, color 0.15s; }
.scale-opt:active { transform: scale(0.95); }
.scale-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-sm); margin-top: 8px; }

.choice { display: flex; flex-direction: column; gap: 10px; }
.choice-opt { text-align: left; padding: 14px 16px; border-radius: var(--r-md); min-height: 60px; background: var(--surface); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.choice-opt span { color: var(--muted); font-size: var(--fs-sm); }
.choice-2 { display: grid; grid-template-columns: 1fr 1fr; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-btn { min-height: 44px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); font-size: var(--fs-sm); color: var(--text); }

.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
.option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.option-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.option-grid.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opt { min-height: 64px; padding: 10px 6px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; min-width: 0; color: var(--text); }
.opt strong { font: 600 15px/1.1 var(--font-label); letter-spacing: 0.04em; text-transform: uppercase; }
.opt span { font-size: 12px; color: var(--muted); }
.opt svg { color: var(--muted); }

/* Seleccionado: borde y halo menta (una sola gramática para todos los controles) */
.opt.is-on, .chip-btn.is-on, .scale-opt.is-on, .choice-opt.is-on, .segmented button.is-on {
  background: linear-gradient(180deg, rgba(var(--glow-rgb), 0.2), rgba(var(--glow-rgb), 0.08));
  color: var(--text); border-color: rgba(var(--glow-rgb), 0.75);
  box-shadow: var(--halo-ring), 0 6px 18px -8px rgba(var(--glow-rgb), var(--halo-a));
}
.opt.is-on span, .opt.is-on svg, .choice-opt.is-on span { color: var(--text); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.segmented button { min-height: 44px; border-radius: 10px; border: 1px solid transparent; background: none; font: 700 15px/1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.stepper { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 10px; }
.stepper-btn { height: 64px; border-radius: var(--r-lg); background: var(--surface-3); border: 1px solid var(--line-2); font-size: 28px; color: var(--text); }
.stepper-btn:disabled { opacity: 0.35; }
.stepper-value { text-align: center; font: 400 46px/1 var(--font-title); }

.toggle-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; min-height: 56px; }
.toggle-row > span:first-child { flex: 1; display: flex; flex-direction: column; }
.toggle-row > span:first-child span { color: var(--muted); font-size: var(--fs-sm); }
.toggle-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle { width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; flex: none; transition: background-color 0.2s, box-shadow 0.2s; }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform 0.2s var(--ease-out), background-color 0.2s; }
.toggle-row input:checked + .toggle { background: var(--glow); border-color: var(--glow); box-shadow: var(--halo); }
.toggle-row input:checked + .toggle::after { transform: translateX(20px); background: var(--glow-ink); }
.toggle-row input:focus-visible + .toggle { outline: 2px solid var(--glow); outline-offset: 2px; }

/* Casilla de consentimiento: grande, sin premarcar */
.consent { display: grid; grid-template-columns: 28px 1fr; gap: var(--s3); align-items: start; padding: var(--s4); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.consent input { appearance: none; width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--bg-raise); margin: 0; display: grid; place-items: center; cursor: pointer; }
.consent input:checked { background: var(--glow); border-color: var(--glow); box-shadow: var(--halo); }
.consent input:checked::after { content: ""; width: 12px; height: 7px; border-left: 2.5px solid var(--glow-ink); border-bottom: 2.5px solid var(--glow-ink); transform: rotate(-45deg) translate(1px, -1px); }
.consent:has(input:checked) { border-color: rgba(var(--glow-rgb), 0.55); }

/* ---------- Listas y bloques ---------- */

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 14px 4px; min-height: 52px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; color: var(--text); }
.list-row:last-child { border-bottom: 0; }
.list-row small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.list-row .value { font-weight: 600; }
button.list-row:active { background: var(--surface); }
.task-dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: var(--glow-ink); }
.task-dot.is-done { background: var(--glow); border-color: var(--glow); }
.facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.facts li::marker { color: var(--glow); }
.steps { display: flex; flex-direction: column; }
.step-row { display: grid; grid-template-columns: 48px 1fr auto; gap: var(--s2); align-items: start; padding: 18px 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; color: var(--text); }
.step-num { font: 400 26px/1.1 var(--font-title); color: var(--sage); }
.step-row h3 { font: 600 19px/1.2 var(--font-label); }
.step-row p { color: var(--muted); font-size: var(--fs-sm); }
.step-row.is-done .step-num { color: var(--faint); }
.ask { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.report-pre { margin: 0; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); }
.device-mark { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); border: 1px solid var(--line-2); font: 700 18px/1 var(--font-label); }
.brand-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--mark); color: var(--glow-ink); font: 700 14px/1 var(--font-label); }
.status-pip { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--attention); }
.status-pip.is-bad { background: var(--alert); }

/* Guardado, cambios pendientes y avisos */
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.save-state.is-saved { color: var(--good); }
.save-state.is-pending { color: var(--attention); }
.alert-box { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1px solid rgba(var(--alert-rgb), 0.5); background: rgba(var(--alert-rgb), 0.08); color: var(--text); }
.alert-box svg { color: var(--alert); margin-top: 2px; }
.alert-box.is-info { border-color: var(--line-2); background: var(--surface); }
.alert-box.is-info svg { color: var(--sage); }

/* Semana (pauta), selector de día, banner */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-btn { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 0; color: var(--text); }
.day-btn b { font: 400 18px/1 var(--font-title); }
.day-btn span { font-size: var(--fs-xs); color: var(--muted); }
.day-btn i { font-style: normal; font-size: 14px; color: var(--glow); min-height: 18px; display: grid; place-items: center; }
.day-btn.is-selected { border-color: rgba(var(--glow-rgb), 0.75); box-shadow: var(--halo-ring); background: var(--surface-3); }
.day-btn.is-future { opacity: 0.7; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: var(--fs-sm); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.daynav { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; }
.daynav button { width: 44px; height: 44px; background: none; border: 0; display: grid; place-items: center; color: var(--text); }
.daynav button:disabled { color: var(--faint); opacity: 0.5; }
.daynav span { min-width: 58px; text-align: center; font: 700 14px/1 var(--font-label); letter-spacing: 0.06em; }
.banner { display: flex; gap: 10px; align-items: center; padding: var(--s3) 14px; border-radius: var(--r-md); background: rgba(227, 217, 166, 0.08); border: 1px solid rgba(227, 217, 166, 0.35); font-size: var(--fs-sm); }
.banner .grow { flex: 1; }

/* Gráficos */
.bars { width: 100%; height: auto; display: block; }
.bars-grid { stroke: rgba(255, 255, 255, 0.07); }
.bars-axis { fill: var(--muted); font-size: 11px; }
.bars-band { fill: rgba(var(--hydro-rgb), 0.13); }
.bars-target { stroke: var(--text); stroke-dasharray: 5 4; opacity: 0.8; }
.bars-empty { fill: rgba(255, 255, 255, 0.12); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: var(--fs-xs); }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.week-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); align-items: end; height: 150px; }
.week-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week-bar b { font: 400 18px/1 var(--font-title); }
.week-bar span { width: 100%; max-width: 56px; border-radius: 10px 10px 4px 4px; background: var(--glow); transition: height 0.6s var(--ease-out); }
.week-bar.is-current span { opacity: 0.55; }
.week-bar small { color: var(--muted); font-size: var(--fs-xs); }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); text-align: center; }
.scores div { display: flex; flex-direction: column; gap: 8px; font: 400 20px/1 var(--font-title); }
.scores div::after { content: ""; height: 3px; border-radius: 2px; background: var(--glow); }
.scores .is-empty::after { background: var(--line-2); }
.calc { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; }
.calc-row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.calc-row span:nth-child(2) { color: var(--muted); }
.calc-row b { min-width: 44px; text-align: right; }
.calc-total { border-bottom: 0; font-size: 17px; }
details summary { cursor: pointer; font-weight: 600; padding: 10px 0; list-style: none; min-height: 44px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: " +"; color: var(--muted); }
details[open] summary::after { content: " −"; }

/* Carrusel */
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { scroll-snap-align: center; min-height: 420px; }
.dots { display: flex; gap: 8px; justify-content: center; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); transition: background-color 0.2s, width 0.2s; }
.dots span.is-on { background: var(--glow); width: 18px; border-radius: 4px; }

/* ---------- Hoja inferior, aviso, estados ---------- */

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.62); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.2s; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 20px var(--gutter) calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: var(--s4); animation: sheet-in 0.32s var(--ease-out); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.sheet-head h2 { font: 600 22px/1.2 var(--font-label); }
.sheet p { color: var(--muted); }
.share-preview { aspect-ratio: 9 / 16; max-height: 52dvh; margin: 0 auto; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-2); background: #050607; }
.share-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

.toast { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); width: calc(100% - 2 * var(--gutter)); max-width: 440px; display: flex; align-items: center; gap: var(--s3); padding: 12px 12px 12px 18px; min-height: 54px; background: var(--bone); color: var(--glow-ink); border-radius: var(--r-md); font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: toast-in 0.3s var(--ease-out); }
.toast span { flex: 1; }
.toast-undo { background: var(--glow-ink); color: var(--bone); border: 0; border-radius: 10px; padding: 0 14px; min-height: 40px; font-weight: 600; font-size: 14px; }
.app.is-flow .toast { bottom: calc(var(--safe-b) + 128px); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 12px; }
.state h2 { font: 600 22px/1.2 var(--font-label); }
.state p { color: var(--muted); max-width: 320px; margin-bottom: 8px; }
.state .btn { max-width: 280px; }
.state-icon { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--glow-rgb), 0.1); color: var(--glow); box-shadow: 0 0 0 6px rgba(var(--glow-rgb), 0.05); }
.state-icon-warn { background: rgba(var(--alert-rgb), 0.12); color: var(--alert); box-shadow: none; }
.skeleton-wrap { display: flex; flex-direction: column; gap: var(--s3); }
.skeleton { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton-hero { height: 240px; }
.skeleton-row { height: 76px; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.demo-tag { text-align: center; color: var(--faint); font-size: 12px; letter-spacing: 0.04em; }

/* ---------- Acceso ---------- */

.auth { min-height: 100dvh; display: flex; flex-direction: column; gap: var(--s5); padding-top: max(28px, env(safe-area-inset-top, 0px)); padding-bottom: calc(24px + var(--safe-b)); }
.auth-mark { display: flex; align-items: center; gap: 12px; font: 700 20px/1 Arial, "Helvetica Neue", sans-serif; letter-spacing: -0.045em; }
.auth-mark::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--mark); box-shadow: 0 0 0 7px rgba(120, 181, 139, 0.14), 0 0 22px rgba(var(--glow-rgb), calc(var(--halo-a) + 0.1)); }
.auth h1 { font: 400 44px/0.98 var(--font-title); text-transform: uppercase; letter-spacing: 0.005em; text-wrap: balance; }
.auth h1 em { font-style: normal; color: var(--glow); text-shadow: 0 2px 24px rgba(var(--glow-rgb), calc(var(--halo-a) * 0.9)); }
.auth .lead { font-size: var(--fs-lg); }
.auth-steps { display: flex; gap: 6px; }
.auth-steps span { flex: 1; height: 3px; border-radius: 2px; background: var(--surface-3); }
.auth-steps span.is-on { background: var(--glow); box-shadow: 0 0 8px rgba(var(--glow-rgb), var(--halo-a)); }

/* Selector de intensidad del halo (solo en la propuesta) */
.halo-switch { position: fixed; z-index: 60; top: max(8px, env(safe-area-inset-top, 0px)); right: 8px; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(14, 17, 15, 0.9); border: 1px solid var(--line-2); font: 700 11px/1 var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; }
.halo-switch button { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 0; background: none; color: var(--muted); }
.halo-switch button[aria-pressed="true"] { background: var(--glow); color: var(--glow-ink); }

/* ---------- Movimiento reducido y colores forzados ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .btn-primary, .opt.is-on, .chip-btn.is-on, .scale-opt.is-on, .choice-opt.is-on, .segmented button.is-on { border: 2px solid CanvasText; }
}

/* ---------- Ten la app a mano ---------- */
.guide-steps { margin: 0; padding: 0; list-style: none; }
.step-glyph { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text); }
.video-cta { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); }
.video-cta strong { display: block; font: 600 18px/1.2 var(--font-label); }
.video-cta small { color: var(--muted); font-size: var(--fs-sm); }
.video-play { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--glow); color: var(--glow-ink); box-shadow: var(--halo); }
.video-box { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.video-box video { width: 100%; max-height: 70vh; border-radius: var(--r-md); background: #000; border: 1px solid var(--line-2); }
