/* ============================================================
   Finanzasconadan — Presupuesto Familiar PWA
   Estilo: OLED premium, banca privada europea, no fintech.
   Paleta y tipografía del spec §3.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0a0b0c;
  --surface: #111315;
  --surface-2: #16181b;
  --border: rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.13);
  --text-light: #f0ede6;
  --text-2: #6e6c67;
  --text-3: #2e2d2b;
  --gold: #b8982a;
  --gold-bright: #d1ae34;
  --gold-dim: rgba(184,152,42,0.09);
  --gold-border: rgba(184,152,42,0.22);
  --gold-glow: rgba(184,152,42,0.05);
  --positive: #4ade80;
  --warning: #facc15;
  --critical: #ef4444;
  --font-display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-ui: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.32,.72,0,1);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100vh; background: var(--bg); color: var(--text-light); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
body { font-size: 15px; line-height: 1.5; overflow-x: hidden; }
input, button, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

/* Grain texture */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px; opacity: 0.020;
}

@keyframes up { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: translateY(0) } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1) } 50% { opacity: .35; transform: scale(.7) } }
@keyframes saved-flash { 0%,100% { opacity: 0 } 15%,75% { opacity: 1 } }
@keyframes spin { to { transform: rotate(360deg) } }

#root { min-height: 100vh; display: flex; flex-direction: column; }

/* ============ COMMON ATOMS ============ */
.eyebrow {
  font-size: 10px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold); animation: pulse 2.5s ease-in-out infinite;
}
.rule-h { width: 36px; height: 1px; background: var(--gold-border); margin: 22px auto; }
.rule-v { width: 1px; height: 40px; background: var(--gold-border); margin: 20px auto; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--gold); color: #0a0b0c; padding: 14px 28px; border-radius: 100px;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  transition: background .2s, transform .15s, box-shadow .25s;
}
.btn-primary:hover { background: var(--gold-bright); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-border);
  padding: 11px 22px; border-radius: 100px; font-size: 12px; font-weight: 500;
  letter-spacing: .04em; transition: background .2s;
}
.btn-secondary:hover { background: rgba(184,152,42,0.2); }

.btn-ghost {
  background: transparent; color: var(--text-2);
  padding: 10px 18px; font-size: 12px; transition: color .2s;
}
.btn-ghost:hover { color: var(--text-light); }

.btn-danger {
  background: transparent; color: var(--critical);
  padding: 10px 18px; font-size: 12px; border: 1px solid rgba(239,68,68,0.25); border-radius: 100px;
  transition: background .2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.08); }

.text-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 14px 18px; color: var(--text-light);
  font-size: 16px; outline: none; transition: border-color .2s;
}
.text-input:focus { border-color: var(--gold-border); }
.text-input::placeholder { color: var(--text-3); }

.state-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 10px;
  vertical-align: middle; flex-shrink: 0;
}
.state-dot.positive { background: var(--positive); box-shadow: 0 0 8px rgba(74,222,128,0.35); }
.state-dot.warning { background: var(--warning); box-shadow: 0 0 8px rgba(250,204,21,0.35); }
.state-dot.critical { background: var(--critical); box-shadow: 0 0 8px rgba(239,68,68,0.35); }

.sub-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px;
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
  background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-border);
}

/* ============ SPLASH ============ */
.splash {
  flex: 1; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px; gap: 24px;
  background: radial-gradient(ellipse at center, rgba(184,152,42,0.06) 0%, transparent 60%);
  animation: fade .4s ease-out both;
}
.splash img { width: 88px; height: 88px; object-fit: contain; animation: up .8s var(--ease) both; }
.splash-name { font-family: var(--font-display); font-size: 22px; font-weight: 300; color: var(--text-light); animation: up .8s .15s var(--ease) both; }
.splash-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--gold); animation: spin 1s linear infinite; opacity: 0.6; }

/* ============ ONBOARDING ============ */
.onboarding {
  flex: 1; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 56px 32px;
  text-align: center; position: relative;
  background: radial-gradient(ellipse at center, rgba(184,152,42,0.05) 0%, transparent 60%);
}
.onboarding-step {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  width: 100%; max-width: 460px; animation: up .6s var(--ease) both;
}
.onboarding-progress {
  position: absolute; top: 32px; left: 0; right: 0;
  display: flex; gap: 6px; justify-content: center; padding: 0 24px;
}
.onboarding-progress span {
  flex: 0 0 36px; height: 2px; background: var(--border-2); border-radius: 1px;
  transition: background .35s var(--ease);
}
.onboarding-progress span.done { background: var(--gold); }
.onboard-logo { width: 240px; height: 240px; object-fit: contain; margin-bottom: 40px; }
.onboarding h1 {
  font-family: var(--font-display); font-weight: 300; font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.12; letter-spacing: -.02em; color: var(--text-light);
}
.onboarding h1 em { font-style: italic; color: var(--gold); font-weight: 300; }
.onboarding p.lead { font-size: 15px; font-weight: 300; color: var(--text-2); line-height: 1.75; margin-top: 24px; max-width: 420px; }
.onboarding .form-row { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 320px; margin-top: 28px; }
.year-btn {
  padding: 18px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border-2); color: var(--text-2);
  font-family: var(--font-display); font-size: 22px; font-weight: 300;
  transition: border-color .2s, color .2s, background .2s;
}
.year-btn:hover { color: var(--text-light); }
.year-btn.active { border-color: var(--gold-border); background: var(--gold-dim); color: var(--gold); }

/* ============ APP SHELL ============ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: rgba(10,11,12,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.app-logo { width: 75px; height: 75px; object-fit: contain; cursor: pointer; }
.header-right { display: flex; align-items: center; gap: 14px; }
.user-name { font-size: 12px; color: var(--text-2); }
.saved-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--positive); pointer-events: none;
}
.saved-pill.flash { animation: saved-flash 1.5s ease-out forwards; }
.saved-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--positive); }

.app-content { flex: 1; padding: 28px 22px 110px; max-width: 1200px; margin: 0 auto; width: 100%; position: relative; z-index: 1; }
@media (min-width: 1024px) {
  .app-content { padding: 36px 32px 60px 220px; }
}

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: rgba(10,11,12,0.92); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 4px 8px;
  color: var(--text-2); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 500; transition: color .25s;
}
.bottom-nav-item:hover { color: var(--text-light); }
.bottom-nav-item.active { color: var(--gold); }
.bottom-nav-item .ico { width: 22px; height: 22px; }

/* Side nav (desktop) */
.side-nav { display: none; }
@media (min-width: 1024px) {
  .bottom-nav { display: none; }
  .side-nav {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 140px; left: 32px; bottom: 32px; width: 170px;
    z-index: 40;
  }
  .side-nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: 12px; color: var(--text-2); font-size: 12px;
    letter-spacing: .04em; transition: background .2s, color .2s; text-align: left;
  }
  .side-nav-item:hover { background: var(--surface); color: var(--text-light); }
  .side-nav-item.active { background: var(--gold-dim); color: var(--gold); }
  .side-nav-item .ico { width: 18px; height: 18px; }
}

/* ============ SCREEN HEAD ============ */
.screen-head { margin-bottom: 28px; }
.screen-sub { font-size: 13px; color: var(--text-2); margin-top: 12px; line-height: 1.65; max-width: 620px; font-weight: 300; }
.vista-sub { font-size: 12px; color: var(--text-3); margin: 14px 0 8px; letter-spacing: 0.04em; }
.screen-greet { font-family: var(--font-display); font-weight: 300; font-size: 30px; color: var(--text-light); letter-spacing: -0.01em; margin: 8px 0 0; }
@media (min-width: 1024px) { .screen-greet { font-size: 38px; } }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 4px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border-2);
  margin-top: 18px; gap: 2px;
}
.segmented button {
  padding: 8px 18px; border-radius: 100px;
  font-size: 11px; font-weight: 500; letter-spacing: .04em;
  color: var(--text-2); transition: background .2s, color .2s; white-space: nowrap;
}
.segmented button.active { background: var(--gold-dim); color: var(--gold); }

/* Month row */
.month-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; margin-top: 18px; }
.month-row::-webkit-scrollbar { display: none; }
.month-chip {
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); padding: 7px 14px; border-radius: 100px;
  font-size: 11px; transition: all .2s;
}
.month-chip.active { background: var(--gold-dim); border-color: var(--gold-border); color: var(--gold); }
.month-chip:hover:not(.active) { color: var(--text-light); }

/* Partial-capture banner */
.partial-banner {
  background: rgba(250,204,21,0.06); border: 1px solid rgba(250,204,21,0.18);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-2);
}
.partial-banner b { color: var(--text-light); font-weight: 500; }
.partial-banner a { color: var(--gold); text-decoration: none; font-size: 12px; letter-spacing: .04em; }
.partial-banner a:hover { text-decoration: underline; }

/* ============ TABLERO ============ */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 28px; }
@media (min-width: 720px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

.kpi-card {
  background: var(--surface); border: 1px solid var(--gold-border);
  border-radius: 14px; padding: 22px 20px; position: relative; overflow: hidden;
  cursor: default; text-align: left;
}
.kpi-card[role="button"] { cursor: pointer; transition: border-color .25s, transform .25s; }
.kpi-card[role="button"]:hover { transform: translateY(-2px); }
.kpi-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at top right, rgba(184,152,42,0.08) 0%, transparent 60%);
}
.kpi-card > * { position: relative; z-index: 1; }
.kpi-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.kpi-label { font-size: 9.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); }
.kpi-info {
  color: var(--text-3); opacity: 0.7; cursor: help; line-height: 0; transition: color .2s;
}
.kpi-info:hover { color: var(--gold); opacity: 1; }
.kpi-value {
  font-family: var(--font-display); font-size: 26px; font-weight: 400;
  color: var(--text-light); line-height: 1; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums lining-nums;
  display: flex; align-items: center;
}
@media (min-width: 720px) { .kpi-value { font-size: 30px; } }
.kpi-value.positive { color: var(--positive); }
.kpi-value.critical { color: var(--critical); }
.kpi-value.warning  { color: var(--warning); }
.kpi-value.gold     { color: var(--gold); }

/* Metric cards */
.section-title { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--text-light); margin: 4px 0 16px; letter-spacing: -0.01em; }
.metric-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.metric-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; padding: 18px 20px; transition: border-color .2s, transform .15s; }
.metric-card[role="button"]:hover { border-color: var(--gold-border); }
.metric-card[role="button"]:active { transform: scale(.995); }
.kpi-card[role="button"]:active { transform: scale(.995); }
.metric-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.metric-label { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.metric-value { font-family: var(--font-display); font-size: 24px; font-weight: 400; color: var(--text-light); letter-spacing: -.01em; line-height: 1; font-variant-numeric: tabular-nums lining-nums; margin-top: 4px; display: inline-flex; align-items: center; }
.metric-unit { font-family: var(--font-ui); font-size: 13px; color: var(--text-2); margin-left: 6px; font-weight: 400; }
.metric-hint { font-size: 10px; color: var(--text-3); margin-top: 6px; letter-spacing: 0.04em; }

/* Distribution */
.distrib-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 26px 24px; }
.distrib-layout { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.distrib-rows { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 6px; }
.distrib-row {
  display: grid; grid-template-columns: 110px 1fr 90px; gap: 14px;
  align-items: center; padding: 8px 0; font-size: 13px;
}
.distrib-row .cat-label { color: var(--text-light); }
.distrib-row .bar-track {
  position: relative; height: 22px;
  background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden;
}
.distrib-row .bar-fill-100 {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 6px; transition: width .35s var(--ease);
}
.distrib-row .pct-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-light);
  letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  font-variant-numeric: tabular-nums;
}
.distrib-row .amount {
  text-align: right; color: var(--text-2);
  font-variant-numeric: tabular-nums; font-size: 12.5px;
}
.distrib-row.is-excedente .cat-label,
.distrib-row.is-excedente .amount { color: var(--positive); font-weight: 500; }
.distrib-row.is-excedente .pct-label { color: var(--text-light); text-shadow: 0 1px 2px rgba(0,0,0,0.7); }

/* Charts row — distribución + flujo side-by-side on desktop */
.tablero-charts-row {
  display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 28px;
  align-items: stretch;
}
@media (min-width: 1100px) {
  .tablero-charts-row.two-col { grid-template-columns: 1fr 1fr; }
}
.chart-section { display: flex; flex-direction: column; min-width: 0; }
.chart-section h3.section-title { margin-top: 0; }
.chart-section > .distrib-card,
.chart-section > .flujo-card,
.chart-section > .compare-table { flex: 1; display: flex; flex-direction: column; }
.chart-section > .flujo-card { justify-content: center; }
.distrib-card .distrib-layout { flex: 1; }

/* Comparativa table */
.compare-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 14px; overflow: hidden;
}
.compare-table th, .compare-table td {
  padding: 11px 14px; text-align: right; font-size: 13px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.compare-table th {
  background: rgba(255,255,255,0.02); color: var(--text-2);
  font-weight: 500; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
}
.compare-table th:first-child, .compare-table td:first-child { text-align: left; color: var(--text-light); }
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table tr.row-excedente td { background: rgba(74,222,128,0.04); }
.compare-table tr.row-excedente td:first-child { color: var(--positive); font-weight: 500; }
.compare-table .diff-pos { color: var(--positive); }
.compare-table .diff-neg { color: var(--critical); }

/* Flujo */
.flujo-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 22px 18px; }

/* Comparativa mes vs promedio */
.compare-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 22px 24px; margin-bottom: 22px; }
.compare-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.compare-row + .compare-row { border-top: 1px solid var(--border); margin-top: 4px; }
.compare-row .lbl { width: 110px; font-size: 11px; color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; }
.compare-row .bar-wrap { flex: 1; height: 6px; background: rgba(255,255,255,0.04); border-radius: 3px; overflow: hidden; }
.compare-row .bar-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width .35s var(--ease); }
.compare-row .bar-fill.prom { background: var(--text-3); }
.compare-row .val { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-light); }

/* Tablero CTA */
.tablero-cta { text-align: center; padding-top: 28px; }

/* ============ CAPTURAR ============ */
.tabs-row { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tabs-row::-webkit-scrollbar { display: none; }
.tab-pill { flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); padding: 9px 16px; border-radius: 100px; font-size: 12px; transition: all .2s; }
.tab-pill.active { background: var(--gold-dim); border-color: var(--gold-border); color: var(--gold); }
.tab-pill:hover:not(.active) { color: var(--text-light); }

.captura-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.captura-toolbar .segmented { margin-top: 0; }

/* Mobile category-view list */
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-row {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 14px 16px;
}
.cat-row-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-name-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text-light); font-size: 14px; font-weight: 400;
  padding: 4px 0; text-overflow: ellipsis;
}
.cat-name-input:focus { border-bottom: 1px solid var(--gold-border); }
.cat-total { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--gold); font-weight: 500; flex-shrink: 0; }
.cat-menu-btn { color: var(--text-3); padding: 4px; border-radius: 6px; transition: color .2s, background .2s; line-height: 0; }
.cat-menu-btn:hover { color: var(--text-light); background: var(--border-2); }
.cat-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
@media (min-width: 560px) { .cat-months { grid-template-columns: repeat(4, 1fr); } }
.month-cell { display: flex; flex-direction: column; gap: 2px; }
.month-cell label { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding-left: 8px; }
.month-cell input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: var(--text-light); font-variant-numeric: tabular-nums;
  font-size: 13px; outline: none; text-align: right; transition: border-color .2s, background .2s;
  min-width: 0; width: 100%;
}
.month-cell input:focus { border-color: var(--gold-border); background: rgba(184,152,42,0.04); }

/* Mobile month-view */
.mes-list { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; padding: 8px; }
.mes-row { display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; }
.mes-row:hover { background: rgba(255,255,255,0.02); }
.mes-row .nm { color: var(--text-light); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.mes-row input.amount {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text-light); font-variant-numeric: tabular-nums;
  font-size: 13px; outline: none; text-align: right; transition: border-color .2s;
}
.mes-row input.amount:focus { border-color: var(--gold-border); }

/* Desktop table */
.cap-table-wrap { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; overflow: auto; }
.cap-table { width: 100%; border-collapse: collapse; min-width: 720px; table-layout: auto; }
.cap-table th, .cap-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 12px; }
.cap-table th { font-weight: 500; color: var(--text-2); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; background: rgba(255,255,255,0.02); position: sticky; top: 0; }
.cap-table th:first-child, .cap-table td:first-child { text-align: left; min-width: 160px; max-width: 220px; position: sticky; left: 0; background: var(--surface); }
.cap-table th:not(:first-child):not(:last-child),
.cap-table td:not(:first-child):not(:last-child) { white-space: nowrap; }
.cap-table tbody tr:last-child td { border-bottom: none; }
.cap-table tr.is-total td { background: var(--gold-dim); border-top: 1px solid var(--gold-border); color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.cap-table tr.is-total td:first-child { background: var(--gold-dim); color: var(--text-light); }
.cap-table input.cell {
  background: transparent; border: 1px solid transparent;
  color: var(--text-light); font-variant-numeric: tabular-nums; text-align: right;
  padding: 5px 8px; border-radius: 6px; outline: none;
  font-size: 12.5px; transition: border-color .15s, background .15s;
  width: auto; min-width: 70px; max-width: none;
  field-sizing: content;
}
.cap-table input.cell:hover { background: rgba(255,255,255,0.025); }
.cap-table input.cell:focus { border-color: var(--gold-border); background: rgba(184,152,42,0.04); }
.cap-table input.name-input {
  background: transparent; border: none; outline: none; color: var(--text-light);
  font-size: 13px; padding: 4px 0; width: 100%; min-width: 0;
  text-overflow: ellipsis;
}
.cap-table input.name-input:focus { border-bottom: 1px solid var(--gold-border); }

.add-category {
  width: 100%; margin-top: 14px; padding: 14px;
  border-radius: 12px; background: transparent;
  border: 1px dashed var(--border-2); color: var(--text-2);
  font-size: 13px; transition: border-color .25s, color .25s;
}
.add-category:hover { border-color: var(--gold-border); color: var(--gold); }

/* Edit category dialog */
.dialog-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.66); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease-out both; }
.dialog {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px;
  padding: 28px 26px; max-width: 420px; width: 100%;
  animation: up .3s var(--ease) both;
}
.dialog h2 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin-bottom: 16px; color: var(--text-light); letter-spacing: -.01em; }
.dialog label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); padding: 14px 0; cursor: pointer; }
.dialog label input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--border-2); background: transparent;
  cursor: pointer; position: relative;
}
.dialog label input[type="checkbox"]:checked { background: var(--gold); border-color: var(--gold); }
.dialog label input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #0a0b0c;
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.dialog-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; }
.dialog .menu-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.dialog .menu-item {
  text-align: left; padding: 12px 14px; border-radius: 10px;
  color: var(--text-light); font-size: 13.5px; transition: background .15s;
  display: flex; align-items: center; gap: 10px;
}
.dialog .menu-item:hover { background: rgba(255,255,255,0.04); }
.dialog .menu-item.danger { color: var(--critical); }
.dialog .menu-item.danger:hover { background: rgba(239,68,68,0.06); }

/* Saldo actual list (deudas) */
.saldo-list { margin-top: 24px; }
.saldo-list h3 { font-family: var(--font-display); font-size: 18px; font-weight: 400; color: var(--text-light); margin-bottom: 12px; letter-spacing: -.01em; }
.saldo-table {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px;
  overflow: hidden;
}
.saldo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.saldo-row:last-child { border-bottom: none; }
.saldo-row .nm { color: var(--text-light); font-size: 14px; text-align: left; }
.saldo-row .nm .cat-name-input { text-align: left; }
.saldo-row input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text-light); font-variant-numeric: tabular-nums;
  text-align: right; outline: none; transition: border-color .2s;
}
.saldo-row input:focus { border-color: var(--gold-border); }
.saldo-hint { font-size: 11px; color: var(--text-3); margin-top: 10px; line-height: 1.6; }

/* ============ ESTRATEGIA ============ */
.estrategia-hero {
  background: var(--surface); border: 1px solid var(--gold-border);
  border-radius: 16px; padding: 36px 28px; margin-bottom: 24px;
  text-align: center; position: relative; overflow: hidden;
}
.estrategia-hero::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(184,152,42,0.10) 0%, transparent 60%); }
.estrategia-hero > * { position: relative; z-index: 1; }
.estrategia-hero .val { font-family: var(--font-display); font-size: 52px; font-weight: 400; color: var(--text-light); line-height: 1; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.02em; margin: 14px 0; }
.estrategia-hero .sub { font-size: 14px; color: var(--text-2); line-height: 1.7; max-width: 480px; margin: 0 auto; }

.strat-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 30px; }
@media (min-width: 880px) { .strat-cards { grid-template-columns: 1fr 1fr 1fr; align-items: stretch; } }
.strat-card {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 14px; padding: 26px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.strat-card.featured { border-color: var(--gold-border); background: rgba(184,152,42,0.04); }
.strat-pct { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.strat-amount { font-family: var(--font-display); font-size: 34px; font-weight: 400; color: var(--gold); line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; }
.strat-card.featured .strat-amount { font-size: 40px; }
.strat-title { font-family: var(--font-display); font-size: 18px; color: var(--text-light); font-weight: 400; }
.strat-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.strat-foot { text-align: center; padding: 30px 0 8px; }
.strat-foot p.q { font-family: var(--font-display); font-style: italic; font-size: 20px; color: var(--text-2); margin-bottom: 22px; line-height: 1.5; max-width: 540px; margin-left: auto; margin-right: auto; }
.strat-foot .row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ AJUSTES ============ */
.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.settings-list { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; overflow: hidden; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  transition: background .15s; text-align: left; width: 100%;
  color: var(--text-light); text-decoration: none;
}
.settings-row:last-child { border-bottom: none; }
.settings-row.interactive { cursor: pointer; }
.settings-row.interactive:hover { background: rgba(255,255,255,0.02); }
.settings-row .sl-label { font-size: 14px; color: var(--text-light); display: flex; align-items: center; gap: 10px; }
.settings-row .sl-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.settings-row .chev { color: var(--text-3); line-height: 0; }
.settings-row .ico { color: var(--text-2); line-height: 0; flex-shrink: 0; }
.settings-row.toast-warn { background: rgba(250,204,21,0.06); }
.settings-row.toast-warn .sl-meta { color: var(--warning); }

.about-card {
  background: var(--surface); border: 1px solid var(--gold-border);
  border-radius: 16px; padding: 36px 28px; text-align: center; margin-top: 12px;
}
.about-card img { width: 200px; height: 200px; object-fit: contain; margin-bottom: 20px; }
.about-card .name { font-family: var(--font-display); font-size: 22px; color: var(--text-light); margin-bottom: 4px; font-weight: 400; }
.about-card .role { font-size: 12px; color: var(--text-2); margin-bottom: 14px; letter-spacing: .04em; }
.about-card .privacy { font-size: 12px; color: var(--text-2); margin-top: 16px; line-height: 1.7; max-width: 320px; margin-left: auto; margin-right: auto; }
.about-card .version { font-size: 10px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; margin-top: 16px; }
.about-card .aviso { display: inline-block; margin-top: 10px; font-size: 11px; color: var(--text-3); text-decoration: underline; text-underline-offset: 4px; }

/* Footer */
.app-footer {
  padding: 20px 24px 28px; text-align: center;
  border-top: 1px solid var(--border);
  position: relative; z-index: 1;
}
.app-footer img { width: 112px; height: 112px; object-fit: contain; margin-bottom: 6px; opacity: 0.6; }
.app-footer .ft { font-size: 10px; color: var(--text-3); letter-spacing: .06em; }

/* Toast */
.toast-stack { position: fixed; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; pointer-events: none; padding: 0 16px; max-width: 460px; width: 100%; }
@media (min-width: 1024px) { .toast-stack { bottom: 32px; left: auto; right: 32px; transform: none; max-width: 380px; } }
.toast {
  background: rgba(17,19,21,0.95); backdrop-filter: blur(12px);
  border: 1px solid var(--gold-border); border-radius: 12px;
  padding: 14px 18px; font-size: 13px; color: var(--text-light);
  display: flex; align-items: flex-start; gap: 12px;
  animation: up .3s var(--ease) both; pointer-events: auto;
}
.toast .toast-actions { display: flex; gap: 6px; margin-left: auto; }
.toast button { font-size: 11px; padding: 5px 12px; border-radius: 8px; color: var(--text-2); transition: color .2s, background .2s; }
.toast button:hover { color: var(--gold); background: var(--gold-dim); }
.toast .dismiss { color: var(--text-3); padding: 5px 8px; line-height: 0; }

.empty-state {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 16px; padding: 56px 32px; text-align: center; max-width: 460px; margin: 32px auto;
}
.empty-state .ico { color: var(--text-3); margin-bottom: 22px; line-height: 0; display: inline-block; }
.empty-state h2 { font-family: var(--font-display); font-weight: 400; font-size: 22px; color: var(--text-light); margin-bottom: 12px; }
.empty-state p { font-size: 13px; color: var(--text-2); line-height: 1.7; margin-bottom: 24px; }

/* Accessibility */
:focus-visible { outline: 1px solid var(--gold-border); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
