/* =====================================================================
   styles.css — Tema "performance" (modo oscuro, minimalista, tipo Whoop)
   ---------------------------------------------------------------------
   1. Tokens · 2. Base · 3. Cabecera · 4. Tarjetas y métricas
   5. Anillos y barras · 6. Listas / filas · 7. Botones y controles
   8. Entreno · 9. Nutrición · 10. Progreso · 11. Modal y toasts
   12. Navegación · 13. Movimiento reducido
   ===================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --bg-2: #121214;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .12);

  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;

  --green: #30D158;   /* salud / completado */
  --amber: #FF9F0A;   /* esfuerzo */
  --cyan: #0A84FF;    /* métricas generales */
  --red: #FF453A;     /* solo avisos */
  --track: rgba(255, 255, 255, .08);

  /* superficies que cambian con el tema */
  --bar-bg: rgba(11, 11, 12, .86);
  --tab-bg: rgba(18, 18, 20, .82);
  --press: rgba(255, 255, 255, .04);
  --on-strong: #000;          /* texto sobre botón "fuerte" (fondo = --text) */
  --cyan-text: #4DA3FF;       /* texto cian sobre fondo tintado */
  --chart-grid: rgba(255, 255, 255, .06);
  --toast-bg: rgba(44, 44, 46, .92);
  --zone: rgba(255, 255, 255, .12);
  --card-shadow: none;

  /* alias usados desde app.js */
  --kcal: var(--cyan); --protein: var(--green); --water: var(--cyan); --salt: var(--red);
  --muted: var(--text-2); --accent: var(--cyan);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter",
          "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --r-lg: 20px; --r-md: 16px; --r-sm: 12px;
  --gap: 12px;
  --nav-h: 64px;
  --nav-lift: 0px; /* espacio extra bajo la barra inferior (0 = normal) */
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Tema claro: cambian fondos y textos; los acentos (verde, cian, ámbar) son idénticos */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F8F9FA;
  --bg-2: #F1F3F5;
  --surface: #FFFFFF;
  --surface-2: #F1F3F5;
  --surface-3: #CED4DA;
  --border: rgba(0, 0, 0, .07);
  --border-strong: rgba(0, 0, 0, .12);
  --text: #0b0b0c;
  --text-2: #52575e;
  --text-3: #868e96;
  --track: rgba(0, 0, 0, .07);
  --bar-bg: rgba(248, 249, 250, .86);
  --tab-bg: rgba(255, 255, 255, .86);
  --press: rgba(0, 0, 0, .04);
  --on-strong: #fff;
  --cyan-text: #0A84FF;
  --chart-grid: rgba(0, 0, 0, .07);
  --toast-bg: rgba(255, 255, 255, .96);
  --zone: rgba(0, 0, 0, .1);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .03);
}

/* ---------- 2. BASE ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  font: 400 15px/1.4 var(--font);
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1, "ss01" 1;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--nav-lift) + 24px);
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: 30px; letter-spacing: -.03em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
p { margin: 0; }
small, .muted { color: var(--text-2); }
.dim { color: var(--text-3); }
input, select, textarea, button { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Etiqueta de sección (estilo "eyebrow") */
.label, .section-title {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 4px 10px; }
.section-title span:last-child { letter-spacing: 0; text-transform: none; font-weight: 500; }

/* ---------- 3. CABECERA ---------- */
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  /* franja a todo el ancho; el contenido se alinea con la columna central de 600 px */
  padding: calc(env(safe-area-inset-top) + 18px) max(20px, calc((100% - 600px) / 2 + 20px)) 14px;
  background: var(--bar-bg);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
#topbar .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 13px 0 10px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.streak-pill b { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.streak-pill .emoji { font-size: 16px; line-height: 1; filter: grayscale(1); opacity: .5; }
.streak-pill.on { background: rgba(255, 159, 10, .12); border-color: rgba(255, 159, 10, .45); box-shadow: 0 0 18px rgba(255, 159, 10, .15); }
.streak-pill.on b { color: var(--amber); }
.streak-pill.on .emoji { filter: none; opacity: 1; }
.theme-btn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
}
.theme-btn svg.i { width: 18px; height: 18px; }
.theme-btn:active { transform: scale(.94); }

/* ---------- 4. TARJETAS Y MÉTRICAS ---------- */
#view { padding: 4px 16px 16px; max-width: 600px; margin: 0 auto; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  padding: 20px; margin-bottom: var(--gap);
}
.card.flat { background: var(--bg-2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.metric { display: flex; flex-direction: column; gap: 4px; }
.metric .value {
  font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -.04em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric .value.xl { font-size: 56px; }
.metric .value.md { font-size: 32px; }
.metric .value small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text-2); margin-left: 4px; }
.metric .sub { font-size: 13px; color: var(--text-2); }

.big-num { font-size: 44px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }

/* Highlights: valor destacado y etiquetas de estado */
.hl-green { color: var(--green) !important; }
.hl-cyan { color: var(--cyan) !important; }
.hl-amber { color: var(--amber) !important; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  color: var(--text-2); background: var(--surface-2);
}
.pill.green { color: var(--green); background: rgba(48, 209, 88, .14); }
.pill.cyan { color: var(--cyan); background: rgba(10, 132, 255, .14); }
.pill.amber { color: var(--amber); background: rgba(255, 159, 10, .14); }
.emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; }

/* Tarjetas principales de Hoy: anillo a la izquierda, detalle a la derecha */
.hero-card[data-act] { cursor: pointer; }
.hero-card .card-head .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-card.ok-green { border-color: rgba(48, 209, 88, .35); box-shadow: var(--card-shadow), 0 10px 40px -16px rgba(48, 209, 88, .35); }
.hero-card.ok-amber { border-color: rgba(255, 159, 10, .35); box-shadow: var(--card-shadow), 0 10px 40px -16px rgba(255, 159, 10, .35); }
.hero-body { display: flex; align-items: center; gap: 20px; }
.ring-wrap.hero { flex: 0 0 auto; width: 128px; max-width: none; }
.ring-wrap.hero .ring-val { font-size: 13px; line-height: 1.1; }
.ring-wrap.hero .ring-val > small { margin-top: 4px; }
.hero-num { display: block; font-size: 34px; font-weight: 600; letter-spacing: -.04em; line-height: 1; color: var(--text); }
.ring-val .hero-num small { display: inline; font-size: 15px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.hero-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hero-side .btn { align-self: flex-start; margin-top: 8px; }
.hero-row + .hero-row { margin-top: 10px; }
.hero-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; color: var(--text-2); }
.hero-row-head > span { white-space: nowrap; }
.hero-row-head b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-row-head small { font-weight: 500; color: var(--text-3); }
.hero-row .bar { margin-top: 8px; }
.hero-rest { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.hero-rest b { color: var(--text); font-weight: 600; }
.hero-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.hero-side > .sub { font-size: 13px; color: var(--text-2); }
.hero-side .score-bar { margin-top: 10px; }
@media (max-width: 360px) { .ring-wrap.hero { width: 108px; } .hero-body { gap: 14px; } }

.score-bar { position: relative; height: 8px; margin-top: 18px; border-radius: 999px; background: var(--track); }
.score-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; transition: width .6s var(--ease); }
.score-bar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--amber); }
.goal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.goal-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px;
  font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid transparent;
}
.goal-chip b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.goal-chip.done { background: rgba(48, 209, 88, .1); border-color: rgba(48, 209, 88, .25); }
.goal-chip.done b { color: var(--green); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.wd { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.wd .dot { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: #000; }
.wd .dot svg.i { width: 13px; height: 13px; stroke-width: 2.8; }
.wd.done .dot { background: var(--green); }
.wd.today { color: var(--text); }
.wd.today .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--cyan); }

/* Avisos discretos con acento lateral */
.notice { border-left: 2px solid var(--cyan); }
.notice.amber { border-left-color: var(--amber); }
.notice.red { border-left-color: var(--red); }
.notice.green { border-left-color: var(--green); }
.notice b { display: block; font-weight: 600; margin-bottom: 4px; }
.notice p { color: var(--text-2); font-size: 14px; }
.notice .btn { margin-top: 14px; }

/* ---------- 5. ANILLOS Y BARRAS ---------- */
.ring-wrap { position: relative; width: 100%; max-width: 104px; aspect-ratio: 1; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring-wrap circle { fill: none; stroke-linecap: round; }
.ring-wrap .trk { stroke: var(--track); }
.ring-wrap .arc { transition: stroke-dasharray .8s var(--ease); }
.ring-val {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center;
  font-size: 24px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.ring-val small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-top: 2px; }

.bar { position: relative; height: 4px; margin-top: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar.thick { height: 6px; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cyan); border-radius: 999px; transition: width .6s var(--ease); }
.bar .zone { position: absolute; top: 0; bottom: 0; background: var(--zone); }
.bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--text-2); }
.bar-label b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.bar-label b small { font-weight: 400; color: var(--text-3); }

/* ---------- 6. LISTAS / FILAS ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); overflow: hidden; margin-bottom: var(--gap); }
.item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 12px 16px; text-align: left; color: var(--text);
  background: transparent; border: 0; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .15s ease;
}
.item:last-child { border-bottom: 0; }
.item:active { background: var(--press); }
.item .title { font-size: 15px; font-weight: 500; }
.item .sub { font-size: 13px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { flex: none; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.item .ico {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
}
.item .ico svg.i { width: 18px; height: 18px; }
.item.static { cursor: default; }
.item.static:active { background: transparent; }

/* Indicador circular de completado */
.tick {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--surface-3); color: transparent; transition: all .2s var(--ease);
}
.tick svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
.done .tick, .tick.on { background: var(--green); border-color: var(--green); color: #000; }
/* Quitar una comida registrada (Hoy) */
.undo {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
}
.undo svg.i { width: 14px; height: 14px; stroke-width: 2.4; }
.undo:active { transform: scale(.9); color: var(--red); }
.hint { margin: 8px 4px 0; font-size: 12px; color: var(--text-3); }
button:disabled { opacity: .35; cursor: default; pointer-events: none; }
.done .title { color: var(--text-2); }
.add {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); color: var(--text); border: 0;
}
.add svg.i { width: 16px; height: 16px; stroke-width: 2.2; }

.log-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.log-item:last-child { border-bottom: 0; padding-bottom: 0; }
.log-item small { font-size: 12px; color: var(--text-3); }
.x {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  color: var(--text-3); background: transparent; border: 1px solid var(--border); border-radius: 10px;
}
.x svg.i { width: 15px; height: 15px; }
.x:active { color: var(--red); border-color: rgba(255, 69, 58, .4); }

.badge {
  display: inline-block; padding: 1px 7px; margin-right: 4px; font-size: 11px; font-weight: 500;
  color: var(--text-2); background: var(--surface-2); border-radius: 6px;
}
.badge.salt { color: var(--amber); background: rgba(255, 159, 10, .12); }

/* ---------- 7. BOTONES Y CONTROLES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; text-align: center;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform .12s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn:focus-visible, .item:focus-visible, .chip:focus-visible, .food:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn.primary { background: var(--text); color: var(--on-strong); border-color: transparent; }
.btn.green { background: var(--green); color: #000; border-color: transparent; }
.btn.cyan { background: rgba(10, 132, 255, .14); color: var(--cyan-text); border-color: rgba(10, 132, 255, .25); }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(255, 69, 58, .3); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn svg.i { width: 18px; height: 18px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 14px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  transition: all .15s ease;
}
.chip.on { color: var(--on-strong); background: var(--text); border-color: transparent; }

.stepper-inline { display: flex; align-items: center; gap: 10px; }
.round-btn {
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%;
}
.round-btn svg.i { width: 18px; height: 18px; stroke-width: 2.2; }
.round-btn:active { transform: scale(.94); }
.row .round-btn { width: 36px; height: 36px; }

/* ---------- 8. ENTRENO ---------- */
.ex-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ex-name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.target { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.last { font-size: 13px; color: var(--text-3); margin: 6px 0 0; }
.suggest {
  display: flex; gap: 8px; align-items: center; margin: 12px 0 2px; padding: 9px 12px;
  font-size: 13px; color: var(--green); background: rgba(48, 209, 88, .08); border: 1px solid rgba(48, 209, 88, .18); border-radius: 10px;
}
.suggest svg.i { width: 16px; height: 16px; }
.set-row { display: grid; grid-template-columns: 26px 1fr 1fr 44px; gap: 8px; align-items: center; margin-top: 8px; }
.set-row .n { font-size: 13px; font-weight: 600; color: var(--text-3); text-align: center; }
.unit-hint { margin-top: 16px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); text-align: center; }
.num {
  width: 100%; min-height: 44px; padding: 6px 8px; text-align: center;
  font-size: 17px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.num:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(10, 132, 255, .2); }
.num::placeholder { color: var(--text-3); font-weight: 500; }
.set-ok {
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  color: var(--text-3); background: transparent; border: 1.5px solid var(--surface-3); border-radius: 50%;
  transition: all .2s var(--ease);
}
.set-ok svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.set-ok.on { background: var(--green); border-color: var(--green); color: #000; }
.workout-progress { display: flex; justify-content: space-between; align-items: baseline; }

/* ---------- 9. NUTRICIÓN ---------- */
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.macro .label { font-size: 11px; }
.macro .v { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.macro .v small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.food .mc { font-size: 12px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.food .edit {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
  color: var(--text-3); background: transparent; border: 0; border-radius: 50%;
}
.food .edit svg.i { width: 16px; height: 16px; }

/* ---------- 10. PROGRESO ---------- */
canvas.chart { width: 100%; height: 200px; display: block; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 4px; border-bottom: 1px solid var(--border); text-align: right; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
td { color: var(--text); }
.up { color: var(--green); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-3); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 2px; border-radius: 2px; }
.delta { font-size: 14px; font-weight: 600; }
.ach-row .title { font-size: 14px; }
.ach-row.locked .title { color: var(--text-2); }
.ach-row.locked .tick { opacity: .6; }

/* ---------- 11. FORMULARIOS, MODAL, TOASTS ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.field label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field input[type=text], .field input[type=number], .field input[type=date], .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 10px 14px; font-size: 16px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--cyan); }
.field textarea { min-height: 76px; resize: vertical; }
.stepper { display: grid; grid-template-columns: 46px 1fr 46px; gap: 6px; }
.stepper .btn { min-height: 46px; padding: 0; font-size: 20px; font-weight: 400; }
.stepper input { text-align: center; }
.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rating button {
  min-height: 42px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text-2);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
}
.rating button.on { background: var(--text); color: var(--on-strong); border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--cyan); min-height: 32px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text-2); }
.check input { width: 22px; height: 22px; accent-color: var(--green); }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-box {
  width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slideup .28s var(--ease);
}
.modal-box::before { content: ''; display: block; width: 36px; height: 5px; margin: 0 auto 16px; border-radius: 3px; background: var(--surface-3); }
.modal-box h2 { margin-bottom: 6px; }
.modal-box > p, .modal-box form > p { margin-bottom: 14px; }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0 8px; }
.modal-actions .btn { flex: 1; }
pre.summary { white-space: pre-wrap; font: 400 12px/1.5 ui-monospace, "SF Mono", Consolas, monospace; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; max-height: 45vh; overflow: auto; }

#toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 14px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 90vw; padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--toast-bg); border: 1px solid var(--border-strong); border-radius: 999px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: toast 2.6s var(--ease) forwards;
}
.toast::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.toast.info::before { background: var(--cyan); }
@keyframes toast { 0% { transform: translateY(-10px); opacity: 0; } 8%, 85% { transform: none; opacity: 1; } 100% { transform: translateY(-6px); opacity: 0; } }

/* ---------- 12. NAVEGACIÓN INFERIOR ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  /* --nav-lift: espacio extra bajo los botones (deja libre la marca de Netlify en la esquina) */
  height: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--nav-lift));
  padding: 6px 12px calc(env(safe-area-inset-bottom) + var(--nav-lift));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--tab-bg);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
}
#tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; background: transparent; color: var(--text-3);
  font-size: 10px; font-weight: 500; letter-spacing: .02em; cursor: pointer; transition: color .15s ease;
}
#tabs button svg.i { width: 22px; height: 22px; stroke-width: 1.7; }
#tabs button.on { color: var(--text); }

/* ---------- 13. MOVIMIENTO REDUCIDO ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
