/* ControlWallet v3 — mobile-first, tema claro/oscuro, sin dependencias */

:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef1f3;
  --text: #15191e;
  --text-2: #4b545e;
  --muted: #6f7882;
  --border: #e1e5e9;
  --brand: #00897b;
  --brand-2: #00a896;
  --brand-ink: #ffffff;
  --brand-soft: #d9f2ee;
  --pos: #0f8a4f;
  --neg: #c2362f;
  --warn-bg: #fff4dc;
  --warn-text: #7a4b00;
  --info-bg: #e6f0ff;
  --info-text: #1d4f9c;
  --in: #16a37a;
  --out: #e0675c;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 4px 16px rgba(16, 24, 32, .05);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1318;
    --surface: #151d24;
    --surface-2: #1c262f;
    --text: #e9eef2;
    --text-2: #b7c1ca;
    --muted: #8a96a1;
    --border: #25313b;
    --brand: #19b3a2;
    --brand-2: #2fd0bd;
    --brand-ink: #04211d;
    --brand-soft: #0f3330;
    --pos: #42d392;
    --neg: #ff7b72;
    --warn-bg: #3a2c0c;
    --warn-text: #ffd27a;
    --info-bg: #13263f;
    --info-text: #9cc2ff;
    --in: #34c79a;
    --out: #f0857b;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1318;
  --surface: #151d24;
  --surface-2: #1c262f;
  --text: #e9eef2;
  --text-2: #b7c1ca;
  --muted: #8a96a1;
  --border: #25313b;
  --brand: #19b3a2;
  --brand-2: #2fd0bd;
  --brand-ink: #04211d;
  --brand-soft: #0f3330;
  --pos: #42d392;
  --neg: #ff7b72;
  --warn-bg: #3a2c0c;
  --warn-text: #ffd27a;
  --info-bg: #13263f;
  --info-text: #9cc2ff;
  --in: #34c79a;
  --out: #f0857b;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.big { font-size: 2.5rem; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- Íconos (Lucide, sprite local) ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.18em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 40px; height: 40px; stroke-width: 1.6; }
.tx-icon .i, .goal-ic .i { width: 20px; height: 20px; color: var(--text-2); }
.chip .i { margin-right: 4px; color: var(--text-2); }
.chip input:checked + span .i { color: var(--brand); }
.menu .i { margin-right: 10px; color: var(--text-2); }
.notice > .i { width: 20px; height: 20px; }
.big .i { width: 44px; height: 44px; stroke-width: 1.5; color: var(--brand); }
.nav-item .i { stroke-width: 1.8; }
.nav-add .i { width: 28px; height: 28px; stroke-width: 2.4; }
.icon-btn .i { width: 20px; height: 20px; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-moon { display: none; }
  :root:not([data-theme="light"]) .theme-sun { display: inline-block; }
}
.pw-toggle .i { width: 20px; height: 20px; color: var(--muted); }
.wallet-ic .i { width: 20px; height: 20px; color: #fff; }
.back .i { vertical-align: -0.22em; }
.notice > .i:first-child { color: currentColor; }
.menu a > span { display: inline-flex; align-items: center; }
.menu a > .i { color: var(--muted); }

/* Selector de íconos */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-opt span { display: grid; place-items: center; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.icon-opt span .i { width: 20px; height: 20px; }
.icon-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.icon-opt input:focus-visible + span { outline: 3px solid var(--brand-2); }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), #1d6ff2);
  box-shadow: inset 0 0 0 5px color-mix(in srgb, #fff 22%, transparent);
}
.brand-lg { font-size: 1.25rem; justify-content: center; margin-bottom: 1.25rem; }
.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 4px 16px 16px; }
.page-title { margin: .5rem 0 1rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head .page-title { margin-bottom: .75rem; }
.back { display: inline-block; margin: .25rem 0 .5rem; font-size: .95rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; float: right; color: var(--muted); }
details.card[open] > summary { margin-bottom: 12px; }
details.card[open] > summary::after { content: "▴"; }
.empty { color: var(--muted); text-align: center; padding: 12px 0; margin: 0; }

/* ---------- Navegación inferior ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: .7rem; padding: 6px 0;
}
.nav-item:hover { text-decoration: none; color: var(--text); }
.nav-item.is-active { color: var(--brand); font-weight: 600; }
.nav-add { display: flex; justify-content: center; }
.nav-add span {
  display: grid; place-items: center;
  width: 54px; height: 54px; margin-top: -22px;
  border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  font-size: 2rem; line-height: 1; font-weight: 400;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent);
}
.nav-add:hover { text-decoration: none; }
@media (min-width: 760px) {
  .bottom-nav { left: 50%; transform: translateX(-50%); max-width: 720px; border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

/* ---------- Mensajes ---------- */
.flash { padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 12px; font-size: .95rem; }
.flash-success { background: var(--brand-soft); color: var(--text); border-left: 4px solid var(--brand); }
.flash-error { background: color-mix(in srgb, var(--neg) 14%, var(--surface)); color: var(--text); border-left: 4px solid var(--neg); }
.flash-info { background: var(--info-bg); color: var(--info-text); }
.notice {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 12px 14px; margin-bottom: 12px; border-radius: var(--radius-sm);
  background: var(--info-bg); color: var(--info-text); font-size: .92rem;
}
.notice:hover { text-decoration: none; filter: brightness(.98); }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.legal-foot { margin: 24px 0 8px; text-align: center; font-size: .78rem; color: var(--muted); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .06s ease, filter .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, transparent); }
.btn-link { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.2rem; cursor: pointer;
}
.icon-btn:hover { text-decoration: none; }
.icon-btn.is-disabled { opacity: .35; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: .9rem; color: var(--text-2); }
.field > span:first-child { font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="search"], input[type="number"], select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* evita zoom en iOS */
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-icon { max-width: 110px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--text-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 40px; height: 38px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
fieldset.group { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
fieldset.group legend { padding: 0; margin-bottom: 8px; }
[hidden] { display: none !important; }

.amount-field {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.amount-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.amount-cur { font-size: 1.6rem; color: var(--muted); font-weight: 600; }
.amount-field input {
  border: 0; box-shadow: none !important; padding: 6px 0; min-height: 0;
  font-size: 2.2rem; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; background: transparent;
}
.amount-sm .amount-cur { font-size: 1.1rem; }
.amount-sm input { font-size: 1.35rem; }
.inline-form { grid-template-columns: 1fr auto; align-items: center; }

/* Segmented control */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 10px 6px; border-radius: 10px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 3px solid var(--brand-2); }

/* Chips (radio) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip > span, button.chip {
  display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 40px; padding: 7px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .92rem; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.chip input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.chip input:focus-visible + span { outline: 3px solid var(--brand-2); }
.chip > span, button.chip { flex-direction: row; align-items: center; gap: 2px; }
.chip-account > span, .chips-col .chip > span { flex-direction: column; align-items: flex-start; }
.chips-col .chip > span:not(:has(small)) { flex-direction: row; align-items: center; gap: 6px; }
.chip-account b { display: inline-flex; align-items: center; gap: 4px; }
.chip-account small { color: var(--muted); font-family: var(--mono); font-size: .78rem; margin-top: 2px; }
.chip-account b { font-weight: 600; }
.chip-quick { background: var(--surface-2) !important; }
.frequent { display: grid; gap: 6px; }

.actions-sticky {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 10px 0 0; background: linear-gradient(transparent, var(--bg) 30%);
}

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: start center; min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 440px; padding: 40px 16px; }
.auth-card h1 { font-size: 1.4rem; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 16px; font-size: .92rem; }
.consent span { font-size: .88rem; }

/* ---------- Dashboard ---------- */
.greeting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 4px 0 12px; }
.greeting p { margin: 0; }
.month-switch { display: flex; align-items: center; gap: 8px; }
.month-switch strong { min-width: 120px; text-align: center; }
.hero { background: linear-gradient(140deg, var(--brand), #1d6ff2); color: #fff; border: 0; }
.hero a { color: #fff; text-decoration: underline; }
.hero-label { margin: 0; opacity: .85; font-size: .9rem; }
.hero-amount { margin: 2px 0 6px; font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; font-family: var(--mono); overflow-wrap: anywhere; }
.hero-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; opacity: .9; margin: 0 0 8px; }
.hero-compact .hero-amount { font-size: 1.8rem; }
.wallet-strip { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px -4px; padding: 0 16px 6px; scrollbar-width: none; }
.wallet-strip::-webkit-scrollbar { display: none; }
.wallet-chip {
  flex: none; display: grid; gap: 1px; min-width: 120px; padding: 10px 12px;
  border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff !important; text-decoration: none !important;
}
.wallet-ic { font-size: 1.1rem; }
.wallet-name { font-size: .8rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.wallet-bal { font-family: var(--mono); font-weight: 700; font-size: .95rem; }
.wallet-bal.neg { color: #ffd2cd; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: clamp(1rem, 4.6vw, 1.25rem); font-weight: 800; font-family: var(--mono); letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi-value.pos, .pos { color: var(--pos); }
.kpi-value.neg, .neg { color: var(--neg); }
.delta { font-size: .76rem; color: var(--muted); }
.delta.good { color: var(--pos); }
.delta.bad { color: var(--neg); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars a { display: grid; gap: 5px; color: inherit; text-decoration: none; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.bar-label span:last-child { color: var(--muted); font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: block; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.bar-fill.muted-fill { background: var(--muted); opacity: .5; }

.legend { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 6px; }
.dot.in { background: var(--in); }
.dot.out { background: var(--out); }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; height: 170px; padding-top: 8px; }
.trend-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; color: var(--muted); text-decoration: none !important; border-radius: 8px; }
.trend-col.is-current .trend-label { color: var(--text); font-weight: 700; }
.trend-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.tb { display: block; width: 40%; max-width: 18px; min-height: 2px; border-radius: 4px 4px 0 0; }
.tb.in { background: var(--in); }
.tb.out { background: var(--out); }
.trend-label { text-align: center; font-size: .75rem; }

/* ---------- Listas de movimientos ---------- */
.tx-list { display: grid; }
.card.tx-list { padding: 6px 12px; }
.day-head { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 4px 2px; }
.tx-row, .account-row, .cat-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 10px 4px; color: inherit; text-decoration: none !important;
  border-bottom: 1px solid var(--border);
}
.tx-list > .tx-row:last-child, .account-list > .account-row:last-child { border-bottom: 0; }
.tx-row:hover, .account-row:hover { background: var(--surface-2); border-radius: 10px; }
.tx-row.is-unclassified .tx-icon { background: var(--warn-bg); }
.tx-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 1.15rem; flex: none;
}
.tx-main { display: grid; min-width: 0; }
.tx-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-family: var(--mono); font-weight: 700; font-size: .95rem; text-align: right; white-space: nowrap; display: grid; }
.tx-amount small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.tx-amount.is-in { color: var(--pos); }
.tx-amount.is-out { color: var(--text); }
.tx-amount.is-transfer { color: var(--muted); }
.big-amount { font-size: 1.8rem; font-weight: 800; font-family: var(--mono); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 16px; }
.filters-form { margin-top: 4px; }

/* ---------- Revisar ---------- */
.review-list { display: grid; gap: 0; }
.review-item { display: grid; gap: 10px; padding: 14px; }
.review-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.review-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.pill-in { background: color-mix(in srgb, var(--pos) 18%, transparent); color: var(--pos); }
.pill-out { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }

/* ---------- Categorías / menú ---------- */
.cat-row-details { border-bottom: 1px solid var(--border); }
.cat-row-details > summary { list-style: none; cursor: pointer; border-bottom: 0; }
.cat-row-details > summary::-webkit-details-marker { display: none; }
.cat-row-details[open] { padding-bottom: 12px; }
.cat-row-details.is-archived { opacity: .6; }
.menu { padding: 4px 0; }
.menu a { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; color: var(--text); border-bottom: 1px solid var(--border); text-decoration: none; }
.menu a:last-child { border-bottom: 0; }
.menu a:hover { background: var(--surface-2); }
.menu a.danger { color: var(--neg); }
.badge { background: var(--neg); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: .78rem; font-weight: 700; }

/* ---------- Presupuesto ---------- */
.flash-warn { background: var(--warn-bg); color: var(--warn-text); border-left: 4px solid #e0a106; }
.bar-lg { height: 12px; position: relative; overflow: visible; }
.bar-lg .bar-fill { border-radius: 99px; }
.bar-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .55; border-radius: 2px; }
.bar-fill.state-ok { background: var(--brand); }
.bar-fill.state-warn { background: #e0a106; }
.bar-fill.state-over { background: var(--neg); }
.state-text-ok { color: var(--muted); }
.state-text-warn { color: #b77f00; }
.state-text-over { color: var(--neg); }
:root[data-theme="dark"] .state-text-warn { color: #f3c053; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .state-text-warn { color: #f3c053; } }
.budget-mini { display: grid; gap: 8px; color: inherit; text-decoration: none !important; }
.budget-mini .card-head { margin-bottom: 0; }
.budget-hot { margin: 0; font-size: .86rem; font-weight: 600; }
.budget-lines .line-left { font-size: .78rem; }
.kpis-inline { margin: 14px 0 0; }
.kpis-inline .kpi { box-shadow: none; background: var(--surface-2); border: 0; }
.mt-half { margin-top: .5rem; }
.budget-edit-row { display: grid; grid-template-columns: 1fr 130px; gap: 10px; align-items: center; font-size: .92rem; padding: 4px 0; border-bottom: 1px solid var(--border); }
.budget-edit-row input { min-height: 40px; text-align: right; font-family: var(--mono); }
.plain-list { list-style: none; margin: 0 0 8px; padding: 0; }
.plain-list a { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); color: inherit; font-size: .92rem; }
.plain-list a span:last-child { font-family: var(--mono); }

/* ---------- Recurrentes ---------- */
.segmented-4 span { font-size: .85rem; padding: 10px 2px; }
.pending-card { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.pending-row { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pending-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pending-info { display: grid; gap: 2px; }
.pending-confirm { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pending-confirm input { min-height: 38px; font-family: var(--mono); text-align: right; }
.pending-skip { text-align: right; margin-top: -4px; }
.center-row { justify-content: center; }

/* ---------- Metas ---------- */
.goal-card, .goal-suggest, .goal-mini { display: grid; gap: 8px; color: inherit; text-decoration: none !important; }
.goal-mini { padding: 8px 0; border-bottom: 1px solid var(--border); }
.goal-mini:last-child { border-bottom: 0; }
.goal-suggest { grid-template-columns: auto 1fr; align-items: center; gap: 12px; border-style: dashed; border-color: var(--brand); }
.goal-suggest span { display: grid; gap: 2px; }
.goal-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.goal-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.3rem; }
.goal-title { display: grid; min-width: 0; }
.goal-badge { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.goal-badge.good { background: color-mix(in srgb, var(--pos) 16%, transparent); color: var(--pos); }
.goal-badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.goal-badge.bad { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
.bar-fill.goal-reached, .bar-fill.goal-on_track { background: var(--pos); }
.bar-fill.goal-behind { background: #e0a106; }
.bar-fill.goal-off_track { background: var(--neg); }
.bar-fill.goal-no_date { background: var(--brand); }
.hero-bar { background: rgba(255, 255, 255, .25); }
.hero-bar .bar-fill { background: #fff; }
.kpi-value.small-value { font-size: 1rem; }
.chip-icon > span { font-size: 1.25rem; min-width: 46px; align-items: center; }
.goal-chart { width: 100%; height: auto; display: block; margin: 4px 0 8px; }
.gc-area { fill: color-mix(in srgb, var(--brand) 16%, transparent); }
.gc-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.gc-target { stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .55; }
.gc-label { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend .dash { display: inline-block; width: 14px; border-top: 2px dashed var(--muted); margin: 0 4px 0 8px; vertical-align: middle; }
.delta.warn { color: #b77f00; }

/* ---------- Onboarding ---------- */
.chips-col { display: grid; grid-template-columns: 1fr; gap: 8px; }
.chips-col .chip, .chips-col .chip > span { width: 100%; }
.chips-col .chip > span { white-space: normal; padding: 11px 14px; }
.chip > span small { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.onboarding .q { font-weight: 700; font-size: 1.02rem; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; color: var(--text); }
.q-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: .85rem; flex: none; }

.prose h2 { margin-top: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.debug { white-space: pre-wrap; font-size: .75rem; text-align: left; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 8px; }

@media (min-width: 620px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .hero-amount { font-size: 2.5rem; }
}
@media (max-width: 360px) {
  .row-2 { grid-template-columns: 1fr; }
  .amount-field input { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
