/* ═══════════════════════════════════════════════════════
   VAULT — Private Treasury Design System
   Graphite + champagne gold · color only carries meaning
   ═══════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  --bg: #08090c;
  --bg-2: #0d0f14;
  --surface: #12151b;
  --surface-2: #181c24;
  --surface-3: #20252f;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.1);

  --text: #f2f1ee;
  --text-2: #a3a6ad;
  --text-3: #6b6f78;

  --gold: #d4b483;
  --gold-2: #b8955e;
  --gold-soft: rgba(212, 180, 131, 0.12);

  --pos: #3ecf8e;
  --pos-soft: rgba(62, 207, 142, 0.12);
  --neg: #f0565c;
  --neg-soft: rgba(240, 86, 92, 0.13);
  --warn: #f4b740;
  --warn-soft: rgba(244, 183, 64, 0.13);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --sidebar: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  accent-color: var(--gold);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.gold { color: var(--gold); }

svg.lucide { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }

/* ── Shell ───────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
html, body { overflow-x: clip; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #1a1408;
  background: linear-gradient(145deg, #ecd3a6, var(--gold-2));
  box-shadow: 0 6px 20px -6px rgba(212, 180, 131, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.brand-mark.lg { width: 52px; height: 52px; font-size: 24px; border-radius: 15px; margin: 0 auto 18px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }

.side-nav, .side-foot { display: flex; flex-direction: column; gap: 2px; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--gold); }
.nav-item.active svg { color: var(--gold); }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 36px;
  background: rgba(8, 9, 12, 0.82);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.topbar-title h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.topbar-date { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 18px; }

.scenarios { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }

.switch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px; cursor: pointer; user-select: none; }
.switch:hover { background: var(--surface-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 26px; height: 15px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background 0.2s; }
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text-3);
  transition: translate 0.2s var(--ease), background 0.2s;
}
.switch input:checked + .switch-track { background: var(--gold-soft); }
.switch input:checked + .switch-track::after { translate: 11px 0; background: var(--gold); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }

.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.sync.saving .sync-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: pulse 1s infinite; --animation-reduced: none; }
.sync.error .sync-dot { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
@keyframes pulse { 50% { opacity: 0.35; } }

.workspace { padding: 28px 36px 120px; max-width: 1480px; }

.view { display: none; }
.view.active { display: block; animation: rise 0.35s var(--ease); --animation-reduced: none; }
@keyframes rise { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }

/* ── Layout primitives ──────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g-hero { grid-template-columns: 1.35fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: stretch; }
.chart-card { display: flex; flex-direction: column; }
.chart-card .chart { height: 400px; flex: none; }
.chart-card .legend { margin-top: auto; padding-top: 16px; }
.g-sim { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: var(--text-3); }

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

/* ── Hero balance ───────────────────────────────────── */
.hero {
  overflow: hidden;
  padding: 28px 30px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(212, 180, 131, 0.14), transparent 55%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border-color: rgba(212, 180, 131, 0.16);
}
.hero-value { font-size: clamp(40px, 5vw, 58px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin: 10px 0 6px; }
.hero-value .cents { font-size: 0.45em; color: var(--text-3); font-weight: 500; letter-spacing: -0.01em; }
.hero-meta { color: var(--text-3); font-size: 13px; }

.accounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.acct {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}
.acct:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.05); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; }
.acct-name { color: var(--text-2); font-size: 12.5px; }
.acct-val { font-weight: 600; font-size: 13.5px; }

/* ── Alert (the one thing to look at) ───────────────── */
.alert {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 24px 26px;
  border-radius: var(--r-lg);
  border: 1px solid;
  overflow: hidden;
  position: relative;
}
.alert::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(90% 120% at 0% 0%, var(--tone-soft), transparent 60%);
  pointer-events: none;
}
.alert.neg { --tone: var(--neg); --tone-soft: var(--neg-soft); border-color: rgba(240, 86, 92, 0.3); background: #1a1114; }
.alert.warn { --tone: var(--warn); --tone-soft: var(--warn-soft); border-color: rgba(244, 183, 64, 0.28); background: #19160f; }
.alert.neg, .alert.warn, .alert.pos, .verdict.neg, .verdict.warn, .verdict.pos { color: var(--text); }
.alert.pos { --tone: var(--pos); --tone-soft: var(--pos-soft); border-color: rgba(62, 207, 142, 0.25); background: #0f1814; }

.alert-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tone);
}
.alert-tag .beacon { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 0 var(--tone); animation: beacon 2s infinite; --animation-reduced: none; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 var(--tone-soft); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.alert-value { font-size: 40px; font-weight: 600; letter-spacing: -0.035em; color: var(--tone); margin: 14px 0 4px; position: relative; }
.alert-when { font-size: 15px; font-weight: 500; position: relative; }
.alert-why { color: var(--text-2); font-size: 13px; margin-top: 4px; position: relative; }
.alert-foot { flex-wrap: wrap; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; position: relative; }
.countdown { display: flex; align-items: baseline; gap: 6px; }
.countdown b { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.countdown span { color: var(--text-2); font-size: 12.5px; }

/* ── KPI tiles ──────────────────────────────────────── */
.kpi { padding: 20px 22px; }
.kpi-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi-label svg { width: 15px; height: 15px; color: var(--text-3); }
.kpi-value { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; margin-top: 10px; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip.pos { background: var(--pos-soft); color: var(--pos); }
.chip.neg { background: var(--neg-soft); color: var(--neg); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }

/* ── Segmented control ──────────────────────────────── */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-3); transition: color 0.15s, background 0.15s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); }
.seg label { display: flex; cursor: pointer; }
.seg-opt { flex: 1; text-align: center; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-3); transition: background 0.15s, color 0.15s; }
.seg input:checked + .seg-opt { background: var(--surface-3); color: var(--text); }
.seg input:focus-visible + .seg-opt { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ── Chart ──────────────────────────────────────────── */
.chart { position: relative; height: 300px; }
.chart.sm { height: 240px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-3); }
.legend i { display: inline-block; width: 10px; height: 2px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ── Month strip (risk map) ─────────────────────────── */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(34px, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.strip-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 0 6px;
  border-radius: 8px;
  transition: background 0.15s;
}
.strip-cell:hover { background: var(--surface-2); }
.strip-bar { width: 100%; max-width: 26px; height: 34px; border-radius: 6px; background: var(--pos); opacity: var(--o, 0.6); }
.strip-bar.neg { background: var(--neg); opacity: 1; }
.strip-bar.warn { background: var(--warn); opacity: 1; }
.strip-m { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.strip-y { font-size: 10px; color: var(--gold); font-weight: 600; height: 12px; }

/* ── Upcoming list ──────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.li {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--line);
}
.li:first-child { border-top: 0; }
.li-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 6px 0; border-radius: 9px; background: var(--surface-2); }
.li-date b { font-size: 15px; font-weight: 600; }
.li-date span { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.li-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12px; color: var(--text-3); }
.li-amt { font-weight: 600; text-align: right; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  position: sticky; top: 0;
}
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background 0.12s; }
.t tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.t .r { text-align: right; }
.t .strong { font-weight: 500; }
.t .dim td { opacity: 0.45; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; opacity: 0.55; transition: opacity 0.15s; }
.t tr:hover .row-actions { opacity: 1; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--text-3); }
.dot.pos { background: var(--pos); }
.dot.warn { background: var(--warn); }
.dot.neg { background: var(--neg); }
.dot.gold { background: var(--gold); }

/* ── Calendar matrix ────────────────────────────────── */
.matrix-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: var(--r); }
table.matrix { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
.matrix th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); color: var(--text-2);
  font-weight: 600; padding: 8px 6px; white-space: nowrap; font-size: 11px;
}
.matrix th.yr { color: var(--gold); }
.matrix .d {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface); color: var(--text-3); font-weight: 600; text-align: center; padding: 0 8px;
}
.matrix thead .d { z-index: 3; }
.matrix td.c {
  min-width: 64px; padding: 7px 8px; text-align: right;
  border-radius: 6px;
  background: rgba(62, 207, 142, var(--a, 0.05));
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: outline-color 0.1s;
  outline: 1px solid transparent;
}
.matrix td.c:hover { outline-color: var(--gold); color: var(--text); }
.matrix td.c.mv { color: var(--text); font-weight: 600; }
.matrix td.c.mv::before { content: ''; position: absolute; left: 5px; top: 50%; translate: 0 -50%; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.matrix td.c.warn { background: var(--warn-soft); color: var(--warn); }
.matrix td.c.neg { background: var(--neg-soft); color: #ff8a8f; }
.matrix td.c.off { background: transparent; color: var(--surface-3); cursor: default; }
.matrix tr.sum td { font-weight: 600; padding-top: 10px; }

/* ── Real vs previsto ───────────────────────────────── */
.month-nav { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.month-nav strong { min-width: 130px; text-align: center; font-weight: 600; font-size: 14px; }

.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 600; font-size: 13px; }

.drop {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border-radius: var(--r);
  border: 1px dashed rgba(212, 180, 131, 0.35);
  background: linear-gradient(90deg, var(--gold-soft), transparent 70%);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--gold); background: linear-gradient(90deg, rgba(212, 180, 131, 0.2), transparent 80%); }
.drop-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.drop-title { font-weight: 600; }
.drop-sub { font-size: 12.5px; color: var(--text-3); }

/* ── Km steppers ────────────────────────────────────── */
.routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.route { padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s; }
.route.on { border-color: rgba(212, 180, 131, 0.3); }
.route-code { font-weight: 600; font-size: 14px; }
.route-km { font-size: 12px; color: var(--text-3); }
.stepper { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 4px; border-radius: 10px; background: var(--bg-2); }
.stepper button { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper b { font-size: 18px; font-weight: 600; }
.route-eur { margin-top: 10px; font-size: 12.5px; color: var(--pos); font-weight: 600; text-align: right; }

/* ── Simulator ──────────────────────────────────────── */
.range-field { margin-bottom: 22px; }
.range-field .row { justify-content: space-between; margin-bottom: 10px; }
.range-field output { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
input[type='range'] { width: 100%; height: 4px; }
.verdict { text-align: center; padding: 30px 24px; }
.verdict-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--tone-soft); color: var(--tone); }
.verdict-icon svg { width: 26px; height: 26px; }
.verdict-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--tone); }
.verdict-sub { color: var(--text-2); margin-top: 6px; font-size: 13px; }
.verdict.pos { --tone: var(--pos); --tone-soft: var(--pos-soft); }
.verdict.warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.verdict.neg { --tone: var(--neg); --tone-soft: var(--neg-soft); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--gold); color: #1a1408; }
.btn.primary:hover { background: #e2c597; }
.btn.secondary { background: var(--surface-2); border-color: var(--line-2); }
.btn.secondary:hover { border-color: var(--gold-2); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { background: var(--neg-soft); color: var(--neg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.icon-btn { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text-3); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.ok:hover { color: var(--pos); }
.icon-btn.del:hover { color: var(--neg); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── Forms ──────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type='text'], input[type='email'], input[type='number'], input[type='date'], input[type='month'], select {
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--gold-soft); }
input.big { height: 52px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

.error-msg { display: none; color: var(--neg); font-size: 12px; margin-top: 6px; }
input:user-invalid, input.user-invalid-fallback { border-color: var(--neg); }
input:user-invalid + .error-msg, input.user-invalid-fallback + .error-msg { display: block; }

/* ── Dialog ─────────────────────────────────────────── */
.dialog {
  margin: auto;
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8);
  opacity: 0;
  translate: 0 10px;
  transition: opacity 0.2s var(--ease), translate 0.2s var(--ease), display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
.dialog[open] { opacity: 1; translate: 0 0; }
@starting-style { .dialog[open] { opacity: 0; translate: 0 10px; } }
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.dlg-head h2 { font-size: 16px; font-weight: 600; }
.dlg-body { padding: 18px 22px 22px; }
.dlg-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.dlg-stat div { padding: 12px; border-radius: 12px; background: var(--bg-2); }
.dlg-stat span { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.dlg-stat b { font-size: 15px; font-weight: 600; }

/* ── Auth ───────────────────────────────────────────── */
.auth {
  position: fixed; inset: 0; z-index: 100;
  display: none; place-items: center; padding: 20px;
  background: radial-gradient(80% 60% at 50% 0%, rgba(212, 180, 131, 0.1), transparent 60%), var(--bg);
}
.auth.active { display: grid; }
body:has(#authOverlay.active) .shell,
body:has(#authOverlay.active) .tabbar { visibility: hidden; pointer-events: none; }
.auth-card { width: min(380px, 100%); text-align: center; padding: 36px 30px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line-2); }
.auth-card h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.auth-lead { color: var(--text-3); margin: 4px 0 26px; }
.auth-card .field { text-align: left; }
.auth-card .btn + .btn { margin-top: 8px; }
.otp { text-align: center; font-size: 24px !important; height: 54px !important; letter-spacing: 10px; font-weight: 600; }
.auth-status { min-height: 20px; margin-top: 14px; font-size: 12.5px; }

/* ── Toast ──────────────────────────────────────────── */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
  font-size: 13px; font-weight: 500;
  animation: rise 0.25s var(--ease); --animation-reduced: none;
}
.toast svg { color: var(--pos); width: 16px; height: 16px; }

.skeleton-hero { height: 220px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s infinite; --animation-reduced: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }

/* ── Planning: Préstamos, Patrimonio & Escenarios ────── */
.g-2 { grid-template-columns: 440px minmax(0, 1fr); align-items: start; }
.kpi-link { text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.kpi-link:hover { border-color: rgba(212, 180, 131, 0.35); background: var(--surface-2); }
.strip-slot { display: flex; flex-direction: column; align-items: center; }
.block-btn { width: 100%; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.block-btn:hover { border-color: var(--gold-2); background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.link-btn:hover { color: var(--gold) !important; }

.banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--r-lg);
  background: linear-gradient(90deg, rgba(212, 180, 131, 0.14), rgba(212, 180, 131, 0.03));
  border: 1px solid rgba(212, 180, 131, 0.28);
}
.banner-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); flex-shrink: 0; }

.loans, .invs { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.loan-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); flex-shrink: 0; }
.loan-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan-main {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 16px 0 12px; padding: 12px 14px;
  border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line);
}
.loan-main span { display: block; font-size: 11px; margin-bottom: 3px; }
.loan-main b { font-size: 15px; font-weight: 600; }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }

.sim-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sim-box output { font-weight: 600; color: var(--gold); font-size: 14px; }
.sim-box input[type='range'] { margin: 8px 0 12px; }

.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-opt {
  position: relative; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.cmp-opt.best { border-color: rgba(212, 180, 131, 0.4); background: linear-gradient(180deg, rgba(212, 180, 131, 0.08), var(--bg-2)); }
.cmp-opt .chip { position: absolute; top: 10px; right: 10px; font-size: 10px; padding: 2px 7px; }
.cmp-title { font-size: 11.5px; color: var(--text-2); font-weight: 500; padding-right: 76px; }
.cmp-big { font-size: 19px; font-weight: 600; margin: 6px 0 2px; letter-spacing: -0.02em; }
.cmp-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }

.hint-box {
  margin: 10px 0 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-2);
}

.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl { display: flex; align-items: center; gap: 12px; }
.tl-dot {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-2);
}
.tl-dot svg { width: 15px; height: 15px; }
.tl-dot.pos { background: var(--pos-soft); color: var(--pos); }
.tl-dot.neg { background: var(--neg-soft); color: var(--neg); }
.tl-dot.warn { background: var(--warn-soft); color: var(--warn); }
.tl-dot.gold { background: var(--gold-soft); color: var(--gold); }

.goal-foot { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }

/* ── Scenario builder & comparator ──────────────────── */
.preset-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.li-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.li-text { min-width: 0; flex: 1; }
.li-acts { display: flex; align-items: center; gap: 2px; }
.sc-list .li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.strip-item {
  padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.strip-item.active { border-color: var(--gold); background: var(--surface-2); }

.sc-table { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 8px; font-size: 12.5px; }
.sc-row { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line); align-items: center; }
.sc-row:last-child { border-bottom: 0; }
.sc-row.head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); font-weight: 600; }
.sc-row.active { background: rgba(62, 207, 142, 0.06); border-radius: 8px; }
.sc-row .r { text-align: right; }

.dialog.wide { width: min(680px, calc(100% - 28px)); }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.more-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-weight: 500; color: var(--text);
}
.more-item:hover { border-color: var(--gold-2); }

/* ── Mobile Pocket Mode (Versión móvil reducida) ─────── */
.m-stack { display: flex; flex-direction: column; gap: 14px; }
.m-hero { padding: 20px; }
.accounts.m-accounts { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.m-acct { justify-content: space-between; width: 100%; padding: 10px 12px; min-width: 0; }
.m-acct .acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-qbtn {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 13px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-2);
  cursor: pointer; min-width: 0;
}
.m-qbtn svg { width: 20px; height: 20px; color: var(--gold); flex-shrink: 0; }
.m-qbtn b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-qbtn span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-qbtn.primary {
  background: linear-gradient(135deg, rgba(212, 180, 131, 0.2), rgba(212, 180, 131, 0.05));
  border-color: rgba(212, 180, 131, 0.4);
}
.m-alert { padding: 16px 18px; }
.m-alert-val { font-size: 26px; font-weight: 600; color: var(--tone); letter-spacing: -0.03em; margin: 2px 0; }
body.pocket-mode .m-only-full { display: none; }
body.pocket-mode .topbar-right .scenarios { display: none; }
body.pocket-mode .topbar-right { width: auto; }

/* ── Mobile tab bar ─────────────────────────────────── */
.tabbar {
  display: none;
  position: fixed; inset: auto 0 0 0; z-index: 40;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(13, 15, 20, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  justify-content: space-around;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--text-3); padding: 4px 10px; }
.tab.active { color: var(--gold); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1200px) {
  .g-main, .g-sim, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .tabbar { display: flex; }
  .topbar { padding: 14px 16px; flex-wrap: nowrap; }
  .workspace { padding: 16px 14px 104px; }
  .g-hero, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .switch-label { font-size: 11.5px; }
  .loans, .invs { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .g-4, .cmp { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .form-2 { grid-template-columns: 1fr; }
  .topbar-date, .sync { display: none; }
  .hero { padding: 20px; }
  .alert-value { font-size: 32px; }
  .sc-row { grid-template-columns: 1.2fr repeat(2, 1fr); }
  .sc-row > :nth-child(4), .sc-row > :nth-child(5) { display: none; }
}

/* Reduced motion: per-element opt-out via --animation-reduced (motion guide) */
@property --animation-reduced { syntax: '*'; inherits: false; initial-value: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation: var(--animation-reduced) !important; }
  .dialog, .switch-track::after { transition: none; }
}
