/* ==========================================================================
   Plata en orden · estilos
   Paleta tomada de la planilla (teal #092B2C, verde #2FB176, naranja #FA6C3A).
   Colores de gráficos validados (contraste y daltonismo) para fondo claro y oscuro.
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --bg: #F3F7F6;
  --surface: #FFFFFF;
  --surface-2: #EEF4F2;
  --surface-3: #E2EBE8;
  --border: #E1E9E6;
  --border-strong: #CAD6D2;
  --text: #092B2C;
  --text-2: #4A5F5E;
  --text-3: #627776;

  --brand: #092B2C;
  --brand-2: #16403F;
  --accent: #2FB176;
  --accent-strong: #1C9460;
  --accent-ink: #04241A;
  --accent-soft: #DEF2E8;

  --primary: #092B2C;
  --primary-hover: #16403F;
  --primary-ink: #FFFFFF;
  --focus: #2FB176;
  --focus-ring: rgba(47, 177, 118, .25);

  --good: #0B7A48;
  --good-bg: #DEF2E8;
  --warn: #855700;
  --warn-bg: #FEF2D2;
  --bad: #B3301F;
  --bad-bg: #FADFDC;
  --info: #1D5874;
  --info-bg: #E4EEF4;

  --shadow-sm: 0 1px 2px rgba(9, 43, 44, .05);
  --shadow: 0 1px 2px rgba(9, 43, 44, .04), 0 8px 24px -10px rgba(9, 43, 44, .14);
  --shadow-lg: 0 28px 70px -18px rgba(9, 43, 44, .38);

  /* Colores de cada concepto en los gráficos (siempre el mismo color para lo mismo). */
  --c-ahorro: #1baf7a;
  --c-fijos: #6250d6;
  --c-cuotas: #e87ba4;
  --c-fugas: #eda100;
  --c-libre: #2a78d6;
  --c-diario: #eb6834;
  --c-neutral: #B4C2BF;

  --grid: #E9EFED;
  --axis: #C6D2CE;
  --chart-text: #627776;
  --hover-band: rgba(9, 43, 44, .05);

  --tip-bg: #092B2C;
  --tip-text: #FFFFFF;
  --tip-muted: rgba(255, 255, 255, .72);

  --side-bg: #092B2C;
  --side-border: transparent;
  --side-text: #FFFFFF;
  --side-text-2: rgba(255, 255, 255, .74);
  --side-text-3: rgba(255, 255, 255, .45);
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(255, 255, 255, .12);

  --hero-a: #0D3A3A;
  --hero-b: #092B2C;
  --hero-glow: rgba(47, 177, 118, .35);

  --toast-bg: #092B2C;
  --toast-text: #FFFFFF;
  --toast-action: #6FE3AE;

  --backdrop: rgba(4, 20, 21, .46);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #061516;
  --surface: #0D2223;
  --surface-2: #132C2D;
  --surface-3: #1A3738;
  --border: #193334;
  --border-strong: #284849;
  --text: #E8F1EF;
  --text-2: #A8BCB9;
  --text-3: #849B98;

  --accent: #34C283;
  --accent-strong: #4ED497;
  --accent-ink: #03170E;
  --accent-soft: rgba(52, 194, 131, .14);

  --primary: #34C283;
  --primary-hover: #4ED497;
  --primary-ink: #03170E;
  --focus: #34C283;
  --focus-ring: rgba(52, 194, 131, .28);

  --good: #4ADE9B;
  --good-bg: rgba(52, 194, 131, .14);
  --warn: #F4C152;
  --warn-bg: rgba(244, 193, 82, .13);
  --bad: #FF8B7E;
  --bad-bg: rgba(255, 120, 105, .14);
  --info: #9CD3E8;
  --info-bg: rgba(142, 201, 224, .10);

  --shadow-sm: none;
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .85);

  --c-ahorro: #199e70;
  --c-fijos: #9085e9;
  --c-cuotas: #d55181;
  --c-fugas: #c98500;
  --c-libre: #3987e5;
  --c-diario: #d95926;
  --c-neutral: #3E5858;

  --grid: #17302F;
  --axis: #2A4646;
  --chart-text: #849B98;
  --hover-band: rgba(255, 255, 255, .05);

  --tip-bg: #E8F1EF;
  --tip-text: #092B2C;
  --tip-muted: #4A5F5E;

  --side-bg: #081B1C;
  --side-border: #132A2B;
  --side-text: #E8F1EF;
  --side-text-2: rgba(232, 241, 239, .70);
  --side-text-3: rgba(232, 241, 239, .40);
  --side-hover: rgba(255, 255, 255, .05);
  --side-active: rgba(255, 255, 255, .09);

  --hero-a: #10393A;
  --hero-b: #0A2829;
  --hero-glow: rgba(52, 194, 131, .22);

  --toast-bg: #E8F1EF;
  --toast-text: #092B2C;
  --toast-action: #0B7A48;

  --backdrop: rgba(0, 0, 0, .6);

  color-scheme: dark;
}

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

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */

.app { min-height: 100vh; min-height: 100dvh; }

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 16px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-brand img { border-radius: 9px; }
.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.view {
  padding: 8px 16px calc(104px + env(safe-area-inset-bottom));
  max-width: 1240px;
  margin: 0 auto;
  outline: none;
}

.desktop-only { display: none !important; }

/* Barra inferior (celular) */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: calc(66px + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--border);
}
.tabbar > a,
.tabbar > button:not(.fab) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 58px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 14px;
}
.tabbar > a .ic,
.tabbar > button:not(.fab) .ic { width: 23px; height: 23px; }
.tabbar > .active { color: var(--text); }
.tabbar > .active .ic { color: var(--accent-strong); }
.fab {
  justify-self: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -6px rgba(47, 177, 118, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
  transform: translateY(-14px);
  transition: transform .15s ease;
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: translateY(-14px) scale(.94); }

.sidebar { display: none; }

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
  }
  .tabbar, .topbar-brand { display: none; }
  .desktop-only { display: inline-flex !important; }
  .topbar {
    height: 72px;
    padding: 0 32px;
  }
  .topbar-title { font-size: 22px; }
  .view { padding: 8px 32px 48px; }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 20px 14px 16px;
    background: var(--side-bg);
    color: var(--side-text);
    border-right: 1px solid var(--side-border);
    overflow-y: auto;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 18px;
    text-decoration: none;
  }
  .brand img { border-radius: 11px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
  .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
  .brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
  .brand-text small { font-size: 12px; color: var(--side-text-3); font-weight: 500; }

  .side-nav, .side-foot { display: flex; flex-direction: column; gap: 2px; }
  .side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .side-sep {
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--side-text-3);
  }
  .side-nav a, .side-foot a, .side-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--side-text-2);
    font-size: 14.5px;
    font-weight: 550;
    text-decoration: none;
    text-align: left;
    transition: background .15s, color .15s;
  }
  .side-nav a:hover, .side-foot a:hover, .side-btn:hover { background: var(--side-hover); color: var(--side-text); }
  .side-nav a.active, .side-foot a.active {
    background: var(--side-active);
    color: var(--side-text);
  }
  .side-nav a.active .ic, .side-foot a.active .ic { color: #4ED497; }
}

/* Íconos de tema: muestran el modo al que vas a pasar */
[data-theme="light"] .theme-ic-light, [data-theme="dark"] .theme-ic-dark { display: none; }

/* ---------- Tipografía de vista ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 18px;
}
.page-head p { color: var(--text-2); font-size: 14.5px; max-width: 60ch; }
.page-head .btn { flex: none; }

.eyebrow {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-title {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 26px 0 10px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.card-sub b { color: var(--text); font-weight: 650; white-space: nowrap; }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 2px 0;
}
.card-link .ic { width: 16px; height: 16px; }
.card-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 14px; }

@media (min-width: 760px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 > .span-2 { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .grid-inicio { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .grid-asis { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .sticky-col { position: sticky; top: 88px; }
}

/* ---------- Hero (plata libre) ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 22px 20px 20px;
  color: #FFFFFF;
  background:
    radial-gradient(520px 260px at 100% -10%, var(--hero-glow), transparent 70%),
    linear-gradient(150deg, var(--hero-a), var(--hero-b));
  box-shadow: var(--shadow);
  /* Dentro del hero (siempre oscuro) usamos los tonos validados para fondo oscuro */
  --c-ahorro: #199e70;
  --c-fijos: #9085e9;
  --c-cuotas: #d55181;
  --c-fugas: #c98500;
  --c-libre: #3987e5;
  --c-diario: #d95926;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero .eyebrow { color: rgba(255, 255, 255, .66); }
.hero-value {
  margin-top: 6px;
  font-size: clamp(36px, 11vw, 54px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.hero-msg { margin-top: 8px; color: rgba(255, 255, 255, .82); font-size: 14.5px; max-width: 46ch; }
.hero-msg b { color: #fff; }
.hero .segbar-thin { margin-top: 18px; --gap-color: var(--hero-b); }
.hero .legend { color: rgba(255, 255, 255, .78); }
.hero .legend b { color: #fff; }
.hero-cta { margin-top: 14px; }

.hero-diario {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.hd-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 13.5px; color: rgba(255, 255, 255, .78); }
.hd-row b { color: #fff; font-weight: 650; white-space: nowrap; }
.hd-foot b { color: #fff; font-weight: 650; white-space: nowrap; }
.hd-foot { margin-top: 8px; font-size: 13px; color: rgba(255, 255, 255, .7); }
.hero .meter { margin-top: 10px; background: rgba(57, 135, 229, .28); }
.hero .meter > span { background: #3987e5; }
.hero .meter.over { background: rgba(255, 139, 126, .28); }
.hero .meter.over > span { background: #FF8B7E; }

.pill-dark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  white-space: nowrap;
}
.pill-dark .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.pill-dark.good { background: rgba(74, 222, 155, .16); color: #7CF0BA; }
.pill-dark.bad { background: rgba(255, 139, 126, .18); color: #FFB4AA; }

/* ---------- KPIs ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis-3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-3 > :first-child { grid-column: auto; }
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s;
}
a.kpi:hover, button.kpi:hover { border-color: var(--border-strong); }
a.kpi:active, button.kpi:active { transform: scale(.985); }
.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-2);
}
.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
.kpi-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-sub { font-size: 12.5px; line-height: 1.35; color: var(--text-3); }
.kpi-hl { background: var(--surface-2); border-color: transparent; }
.kpi-hl .kpi-value { font-size: 24px; }

/* ---------- Leyendas y barras segmentadas ---------- */

.legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--text-2);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--text); font-weight: 650; }

.segbar-thin {
  display: flex;
  gap: 2px;
  height: 8px;
}
.segbar-thin > span { border-radius: 4px; min-width: 2px; }

.segbar-tall {
  display: flex;
  gap: 2px;
  height: 28px;
}
.segbar-tall > .seg-block {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 2px;
  border-radius: 4px;
  padding: 0 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  outline-offset: 2px;
  cursor: default;
}
.segbar-tall > .seg-block.ink-dark { color: #0b0b0b; }
.segbar-tall > .seg-block .seg-lbl.hide { visibility: hidden; }
.segbar-tall > .seg-block:hover { filter: brightness(1.08); }

.meter {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.meter-good > span { background: var(--accent); }
.meter-cuotas { background: color-mix(in srgb, var(--c-cuotas) 22%, var(--surface)); }
.meter-cuotas > span { background: var(--c-cuotas); }

/* ---------- Listas ---------- */

.list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row-hit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border: 0;
  background: none;
  text-align: left;
  border-radius: 12px;
}
.row-hit:hover .row-title { color: var(--accent-strong); }
.row-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
  background: var(--surface-2);
}
.row-main { flex: 1; min-width: 0; }
.row-main > span { display: block; }
.row-flat { border-bottom: 0; }
.deseo-item { border-bottom: 1px solid var(--border); }
.deseo-item:last-child { border-bottom: 0; }
.deseo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 0 14px; }
.deseo-actions .btn { padding: 0 10px; }
@media (min-width: 560px) {
  .deseo-actions { display: flex; padding-left: 54px; }
  .deseo-actions .btn { padding: 0 13px; }
}
.row-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.row-sub {
  margin-top: 1px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-end { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.row-sub.wrap { white-space: normal; }
.row-sub b { color: var(--text); font-weight: 650; }
.row-pill { margin-top: 6px; }
.row-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-amount-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .meter { margin-top: 8px; height: 6px; }
.row.is-done .row-title { color: var(--text-2); }
.row.is-done .row-icon { opacity: .6; }

.day-group + .day-group { margin-top: 6px; }
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 2px 4px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.day-head span:last-child { font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* Botón de "pagado" */
.check-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: transparent;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.check-btn .ic { width: 20px; height: 20px; stroke-width: 2.6; }
.check-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.check-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check-btn:active { transform: scale(.92); }

/* ---------- Pills de estado (siempre con ícono + texto) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}
.pill .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { filter: brightness(.97); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 14px; border-radius: 11px; }
.btn-sm .ic { width: 17px; height: 17px; }
.btn-lg { height: 52px; font-size: 16px; border-radius: 15px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }

/* ---------- Formularios ---------- */

.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.field-label small { font-weight: 500; color: var(--text-3); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-error { font-size: 12.5px; font-weight: 600; color: var(--bad); }
.field.has-error .input { border-color: var(--bad); }
.field.has-error .chips .chip { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--text-3); opacity: .8; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-ring); }
select.input {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23627776' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
input[type="date"].input { min-width: 0; }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 48px; }
.input-icon-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-3);
  display: grid;
  place-items: center;
}
.input-icon-btn:hover { color: var(--text); }
.input-icon-btn[aria-pressed="true"] { color: var(--accent-strong); }

.input-prefix { position: relative; }
.input-prefix > span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-weight: 600;
  pointer-events: none;
}
.input-prefix .input { padding-left: 32px; }
.input-suffix { position: relative; }
.input-suffix > span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-weight: 600;
  pointer-events: none;
}
.input-suffix .input { padding-right: 40px; }

.amount-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 2px;
}
.amount-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.amount-input span { font-size: 30px; font-weight: 700; color: var(--text-3); }
.amount-input input {
  width: 100%;
  max-width: 320px;
  border: 0;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 44px;
  font-weight: 750;
  letter-spacing: -0.035em;
  color: var(--text);
  padding: 4px 0;
  -webkit-appearance: none;
}
.amount-input input::placeholder { color: var(--text-3); opacity: .5; }
.amount-line {
  width: 100%;
  max-width: 280px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  transition: background .15s;
}
.amount-box:focus-within .amount-line { background: var(--accent); }
.amount-hint { font-size: 13px; color: var(--text-3); min-height: 19px; }

.live {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-2);
}
.live b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

/* Selector segmentado */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface-2);
}
.seg > button, .seg > a {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg > button:hover, .seg > a:hover { color: var(--text); }
.seg > [aria-pressed="true"], .seg > .active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(9, 43, 44, .10), 0 1px 1px rgba(9, 43, 44, .04);
}
[data-theme="dark"] .seg > [aria-pressed="true"], [data-theme="dark"] .seg > .active { background: var(--surface-3); }

.tabs-head {
  position: sticky;
  top: calc(58px + env(safe-area-inset-top));
  z-index: 20;
  margin: 0 -16px 14px;
  padding: 4px 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
@media (min-width: 1024px) {
  .tabs-head { top: 72px; margin: 0 -32px 16px; padding: 4px 32px 12px; }
  .tabs-head .seg { max-width: 560px; }
}

/* Chips (categorías, frecuencias) */
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 70px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.chip .emo { font-size: 23px; line-height: 1; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chips-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sm, .chips-pick > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.chip-sm:hover, .chips-pick > button:hover { color: var(--text); }
.chip-sm[aria-pressed="true"], .chips-pick > button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface);
  overflow: hidden;
}
.stepper button {
  width: 48px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 22px;
  font-weight: 500;
  display: grid;
  place-items: center;
}
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-ring); }

/* Checkbox */
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  margin: 0;
}

/* Slider */
.range { width: 100%; accent-color: var(--accent); }

/* ---------- Hojas (bottom sheet en celular, diálogo en PC) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity .22s ease;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2, .85, .25, 1);
  outline: none;
}
.sheet.open { transform: translateY(0); }
.sheet-grip {
  flex: none;
  width: 42px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: var(--border-strong);
}
.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 6px 20px;
}
.sheet-title { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.sheet-tabs { flex: none; padding: 4px 20px 6px; }
.sheet-tabs .seg { overflow-x: auto; scrollbar-width: none; }
.sheet-tabs .seg::-webkit-scrollbar { display: none; }
.sheet-tabs .seg > button { flex: 1 0 auto; padding: 0 12px; }
.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 20px 22px;
  -webkit-overflow-scrolling: touch;
}
.sheet-foot {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0 0 0 0;
}
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-danger { flex: none; width: 52px; padding: 0; }
.sheet-foot .btn-danger span { display: none; }

@media (min-width: 720px) {
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(580px, calc(100vw - 48px));
    max-height: min(88vh, 860px);
    border-radius: 24px;
    transform: translate(-50%, -47%) scale(.98);
    opacity: 0;
    transition: transform .22s cubic-bezier(.2, .85, .25, 1), opacity .18s ease;
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding: 18px 16px 6px 24px; }
  .sheet-tabs { padding: 4px 24px 6px; }
  .sheet-body { padding: 12px 24px 24px; }
  .sheet-foot { padding: 14px 24px 18px; border-radius: 0 0 24px 24px; }
  .sheet-foot .btn-danger { width: auto; padding: 0 16px; }
  .sheet-foot .btn-danger span { display: inline; }
}

/* Menú "Más" */
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  text-align: left;
  text-decoration: none;
  color: var(--text);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .mi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
  flex: none;
}
.menu-item strong { display: block; font-size: 15px; font-weight: 650; }
.menu-item small { display: block; font-size: 13px; color: var(--text-2); }

/* ---------- Toasts ---------- */

#toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 80;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
@media (min-width: 1024px) { #toast-root { bottom: 28px; left: calc(50% + 132px); } }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 10px 10px 10px 16px;
  border-radius: 15px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .45);
  font-size: 14px;
  font-weight: 550;
  animation: toast-in .28s cubic-bezier(.2, .85, .25, 1);
}
.toast.out { animation: toast-out .2s ease forwards; }
.toast .ic { width: 18px; height: 18px; color: var(--toast-action); }
.toast button {
  border: 0;
  background: none;
  color: var(--toast-action);
  font-weight: 750;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 8px;
}
.toast.error .ic { color: #FF8B7E; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Notas, vacíos, carga ---------- */

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 13.5px;
  line-height: 1.5;
}
.note .ic { width: 18px; height: 18px; margin-top: 1px; }
.note-warn { background: var(--warn-bg); color: var(--warn); }

.callout {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 14.5px;
  color: var(--text-2);
}
.callout b { color: var(--text); }
.callout-ic { display: flex; align-items: flex-start; gap: 10px; }
.callout-ic .ic { margin-top: 2px; color: var(--accent-strong); }

.empty {
  text-align: center;
  padding: 26px 12px 18px;
  color: var(--text-2);
  font-size: 14px;
}
.empty-emoji { font-size: 38px; line-height: 1; }
.empty h3 { margin: 10px 0 4px; color: var(--text); font-size: 16px; font-weight: 650; }
.empty p { max-width: 38ch; margin: 0 auto; }
.empty .btn { margin-top: 14px; }

.boot {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--text-2);
  font-size: 14px;
}
.boot-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.view-enter { animation: view-in .26s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Navegador de mes ---------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.month-nav strong { font-size: 17px; font-weight: 700; text-transform: capitalize; letter-spacing: -0.01em; }
.month-nav .icon-btn { background: var(--surface); border: 1px solid var(--border); }
.month-nav .icon-btn:disabled { opacity: .35; pointer-events: none; }

/* ---------- Gráficos ---------- */

.chart-card .card-head { margin-bottom: 10px; }
.chart { position: relative; width: 100%; min-height: 40px; touch-action: pan-y; }
.chart svg { width: 100%; overflow: visible; }
.chart text {
  font-family: var(--font);
  font-size: 11.5px;
  fill: var(--chart-text);
  font-variant-numeric: tabular-nums;
}
.chart .tick-strong { fill: var(--text); font-weight: 650; }
.chart .val-label { fill: var(--text); font-weight: 650; font-size: 12px; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ref-line { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart .crosshair { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .band { fill: var(--hover-band); opacity: 0; transition: opacity .12s; }
.chart .band.on { opacity: 1; }
.chart .hit:focus-visible + .band, .chart .band.focus { opacity: 1; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 16px;
}
.filter-row .seg { min-width: 260px; }
.filter-row label { font-size: 13px; font-weight: 650; color: var(--text-2); }

/* Barras horizontales (HTML) */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 2px 0;
  border-radius: 10px;
  outline-offset: 3px;
  cursor: default;
}
.hb-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.hb-label span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-label .emo { font-size: 16px; }
.hb-track { display: flex; align-items: center; gap: 8px; height: 18px; }
.hb-bar {
  height: 16px;
  border-radius: 0 4px 4px 0;
  width: calc((100% - 104px) * var(--w));
  min-width: 3px;
  transition: filter .12s;
}
.hb-val { font-size: 12.5px; font-weight: 650; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-val small { font-weight: 500; color: var(--text-3); margin-left: 4px; }
.hb-row:hover .hb-bar, .hb-row:focus-visible .hb-bar { filter: brightness(1.1) saturate(1.05); }
@media (min-width: 760px) {
  .hb-row { grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 14px; }
}

/* Tooltip */
.chart-tip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  min-width: 140px;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--tip-bg);
  color: var(--tip-text);
  font-size: 12.5px;
  line-height: 1.35;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .35);
}
.tip-title { color: var(--tip-muted); font-size: 11.5px; font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip-val { font-weight: 750; font-variant-numeric: tabular-nums; }
.tip-name { color: var(--tip-muted); }

/* Tabla (vista accesible de cada gráfico) */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th, .table td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th { font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Asistente ---------- */

.q-list { display: flex; flex-direction: column; gap: 12px; }
.q {
  padding: 14px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.q-text { display: flex; gap: 10px; font-weight: 600; font-size: 14.5px; margin-bottom: 10px; }
.q-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
}
.q.answered .q-num { background: var(--accent-soft); color: var(--good); }
.q-hint { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.q-hint b { color: var(--text-2); }
.q.key { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

.verdict {
  border-radius: var(--r-xl);
  padding: 22px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.verdict-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text-2);
}
.verdict-icon .ic { width: 26px; height: 26px; }
.verdict-title { margin-top: 14px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.verdict-text { margin-top: 6px; color: var(--text-2); font-size: 14.5px; }
.verdict.good { background: var(--good-bg); border-color: transparent; }
.verdict.good .verdict-icon { color: var(--good); }
.verdict.good .verdict-title { color: var(--good); }
.verdict.warn { background: var(--warn-bg); border-color: transparent; }
.verdict.warn .verdict-icon { color: var(--warn); }
.verdict.warn .verdict-title { color: var(--warn); }
.verdict.bad { background: var(--bad-bg); border-color: transparent; }
.verdict.bad .verdict-icon { color: var(--bad); }
.verdict.bad .verdict-title { color: var(--bad); }
.verdict .btn-row { margin-top: 18px; }
.score { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.score-dots { display: flex; gap: 4px; }
.score-dots i { width: 18px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text-3) 30%, transparent); }
.score-dots i.on { background: var(--text); }
.verdict.good .score-dots i.on { background: var(--good); }
.verdict.warn .score-dots i.on { background: var(--warn); }
.verdict.bad .score-dots i.on { background: var(--bad); }

.num-list { display: flex; flex-direction: column; }
.num-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-2);
}
.num-item:last-child { border-bottom: 0; }
.num-item b { color: var(--text); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Ajustes ---------- */

.value-hour {
  padding: 18px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
}
[data-theme="dark"] .value-hour { background: var(--surface-3); }
.value-hour .eyebrow { color: rgba(255, 255, 255, .62); }
.value-hour strong { display: block; margin-top: 4px; font-size: 34px; font-weight: 750; letter-spacing: -0.03em; }
.value-hour p { margin-top: 8px; color: rgba(255, 255, 255, .78); font-size: 13.5px; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  border-radius: 13px;
  text-decoration: none;
}
.steps a:hover { background: var(--surface-2); }
.step-n {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--good);
  font-weight: 750;
  font-size: 14px;
}
.steps strong { display: block; font-size: 14.5px; }
.steps small { display: block; font-size: 13px; color: var(--text-2); }

/* ---------- Login ---------- */

.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 520px at 85% -15%, rgba(47, 177, 118, .32), transparent 62%),
    radial-gradient(700px 480px at -15% 115%, rgba(250, 108, 58, .16), transparent 60%),
    #092B2C;
  color: #fff;
}
.login { width: 100%; max-width: 400px; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
  margin: 0 auto 14px;
  border-radius: 16px;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
}
.login-brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.login-brand p { margin-top: 4px; color: rgba(255, 255, 255, .66); font-size: 15px; }
.login-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 22px 22px;
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 13.5px;
  font-weight: 600;
}
.login-error svg { flex: none; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: rgba(255, 255, 255, .45); letter-spacing: .04em; }

.sin-transicion *, .sin-transicion *::before, .sin-transicion *::after { transition: none !important; }

/* ---------- Movimiento reducido ---------- */

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

@media (forced-colors: active) {
  .segbar-thin > span, .segbar-tall > .seg-block, .hb-bar, .sw { forced-color-adjust: none; }
}
