/* Controla — sistema visual propio.
   Inspiración: claridad y jerarquía de iOS (HIG). Vidrio solo en navegación y controles flotantes;
   contenido, cifras, tablas y formularios sobre superficies sólidas con buen contraste. */

:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --surface-3: #e7e9ef;
  --text: #15171d;
  --text-2: #565c6b;
  --text-3: #7d8392;
  --line: rgba(21, 23, 29, 0.09);
  --line-strong: rgba(21, 23, 29, 0.16);
  --accent: #3550e0;
  --accent-hover: #2a43c8;
  --accent-soft: #e7ebfd;
  --accent-text: #2b44c9;
  --on-accent: #ffffff;
  --logo-dot: #ffb648;
  --positive: #187a4d; --positive-soft: #e3f4ea;
  --warning: #995800; --warning-soft: #fdf0dc;
  --danger: #c4303a; --danger-soft: #fce8e9;
  --trial: #6a43c8; --trial-soft: #efe9fb;
  --chart-1: #3550e0; --chart-2: #9aa7f0; --chart-grid: rgba(21, 23, 29, 0.08);
  --glass: rgba(250, 250, 252, 0.72);
  --glass-line: rgba(255, 255, 255, 0.7);
  --glass-shadow: 0 8px 30px rgba(20, 24, 40, 0.10), 0 1px 0 rgba(255,255,255,0.6) inset;
  --shadow-1: 0 1px 2px rgba(20, 24, 40, 0.05), 0 1px 1px rgba(20, 24, 40, 0.03);
  --shadow-2: 0 12px 40px rgba(20, 24, 40, 0.16);
  --focus: 0 0 0 3px rgba(53, 80, 224, 0.45);
  --radius: 18px; --radius-s: 12px; --radius-xs: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;
  --sidebar: 248px;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0d11; --surface: #17181e; --surface-2: #1f2028; --surface-3: #2a2b35;
    --text: #f2f3f6; --text-2: #a8adbb; --text-3: #838897;
    --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #7b8fff; --accent-hover: #93a3ff; --accent-soft: rgba(123, 143, 255, 0.16); --accent-text: #a5b2ff; --on-accent: #0c0f24;
    --positive: #5fd39a; --positive-soft: rgba(95, 211, 154, 0.14);
    --warning: #f2b45c; --warning-soft: rgba(242, 180, 92, 0.14);
    --danger: #ff7a82; --danger-soft: rgba(255, 122, 130, 0.14);
    --trial: #b79bff; --trial-soft: rgba(183, 155, 255, 0.15);
    --chart-1: #7b8fff; --chart-2: #3d4680; --chart-grid: rgba(255, 255, 255, 0.08);
    --glass: rgba(28, 29, 36, 0.72); --glass-line: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255,255,255,0.06) inset;
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.04); --shadow-2: 0 20px 50px rgba(0, 0, 0, 0.6);
    --focus: 0 0 0 3px rgba(123, 143, 255, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0d11; --surface: #17181e; --surface-2: #1f2028; --surface-3: #2a2b35;
  --text: #f2f3f6; --text-2: #a8adbb; --text-3: #838897;
  --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #7b8fff; --accent-hover: #93a3ff; --accent-soft: rgba(123, 143, 255, 0.16); --accent-text: #a5b2ff; --on-accent: #0c0f24;
  --positive: #5fd39a; --positive-soft: rgba(95, 211, 154, 0.14);
  --warning: #f2b45c; --warning-soft: rgba(242, 180, 92, 0.14);
  --danger: #ff7a82; --danger-soft: rgba(255, 122, 130, 0.14);
  --trial: #b79bff; --trial-soft: rgba(183, 155, 255, 0.15);
  --chart-1: #7b8fff; --chart-2: #3d4680; --chart-grid: rgba(255, 255, 255, 0.08);
  --glass: rgba(28, 29, 36, 0.72); --glass-line: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255,255,255,0.06) inset;
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.04); --shadow-2: 0 20px 50px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 3px rgba(123, 143, 255, 0.55);
}
@media (prefers-reduced-motion: reduce) { :root { --dur: 0ms; } *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 32px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }
.icon { display: inline-flex; flex: none; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 14px; }
.stack-s { display: grid; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; }
.main { padding: 12px 16px calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin: 14px 0 18px; flex-wrap: wrap; }
.page-head .lead { color: var(--text-2); margin-top: 4px; }
.page-head .spacer { min-width: 0; }

.tabbar { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(6, 1fr); align-items: center; padding: 6px; border-radius: 26px;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; border-radius: 20px; color: var(--text-2); font-size: 11px; font-weight: 600; transition: background var(--dur) var(--ease), color var(--dur); }
.tab:hover { text-decoration: none; color: var(--text); }
.tab[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
.fab { position: fixed; z-index: 31; right: 18px; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer; background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 24px rgba(53, 80, 224, 0.35); transition: transform var(--dur) var(--ease); }
.fab:hover { transform: scale(1.04); }
.fab:active { transform: scale(0.96); }
.sidebar { display: none; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .topbar.mobile-only, .tabbar, .fab { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%); }
  .sidebar .brand { padding: 4px 10px 18px; }
  .side-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; color: var(--text-2); font-weight: 550; font-size: 15px; }
  .side-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
  .side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
  .side-add { margin: 4px 0 14px; }
  .side-foot { margin-top: auto; display: grid; gap: 4px; }
  .side-btn { border: 0; background: none; cursor: pointer; width: 100%; font: inherit; text-align: left; }
  .main { padding: 18px 36px 60px; width: 100%; }
  h1 { font-size: 34px; }
}

/* ---------- Superficies ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 17px; }
.card-head .spacer + a, .card-head a { font-size: 14px; font-weight: 550; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 22px 4px 8px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1.35fr 1fr; align-items: start; } .grid-2.even { grid-template-columns: 1fr 1fr; } }

/* Lista agrupada estilo iOS */
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.group > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; color: var(--text); width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
a.item:hover, button.item:hover { background: var(--surface-2); text-decoration: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .end { text-align: right; flex: none; }
.item .end .amount { font-weight: 650; font-variant-numeric: tabular-nums; }
.item .chev { color: var(--text-3); }
.kv { display: flex; gap: 12px; padding: 12px 16px; align-items: baseline; }
.kv dt { color: var(--text-2); flex: 0 0 42%; font-size: 14.5px; }
.kv dd { margin: 0; flex: 1; text-align: right; font-weight: 550; overflow-wrap: anywhere; }

.mark { position: relative; overflow: hidden; display: inline-grid; place-items: center; flex: none; border-radius: 12px; font-weight: 700; color: hsl(var(--h) 55% 30%); background: hsl(var(--h) 70% 92%); }
.mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 14%; background: #fff; opacity: 0; transition: opacity var(--dur); }
.mark.has-logo { color: transparent; box-shadow: inset 0 0 0 1px var(--line); background: #fff; }
.mark.has-logo img { opacity: 1; }
:root[data-theme="dark"] .mark { color: hsl(var(--h) 80% 82%); background: hsl(var(--h) 35% 22%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { color: hsl(var(--h) 80% 82%); background: hsl(var(--h) 35% 22%); } }

/* ---------- Cifras ---------- */
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.metric .label { font-size: 13px; color: var(--text-2); font-weight: 550; display: flex; gap: 6px; align-items: center; }
.metric .value { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.metric .value .money-list { display: grid; gap: 2px; }
.metric .value .sep { display: none; }
.metric .foot { font-size: 12.5px; color: var(--text-3); }
.metric.hero { grid-column: 1 / -1; padding: 20px; background: linear-gradient(135deg, var(--accent) 0%, #5b4fe0 100%); color: #fff; }
.metric.hero .label, .metric.hero .foot { color: rgba(255,255,255,0.85); }
.metric.hero .value { font-size: 34px; }
:root[data-theme="dark"] .metric.hero { background: linear-gradient(135deg, #2c3a8f 0%, #3b2f86 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .metric.hero { background: linear-gradient(135deg, #2c3a8f 0%, #3b2f86 100%); } }
.info-btn { border: 0; background: none; padding: 0; color: inherit; opacity: 0.75; cursor: pointer; display: inline-flex; }
.info-btn:hover { opacity: 1; }

/* ---------- Píldoras ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-neutral { background: var(--surface-2); color: var(--text-2); }
.pill-positive { background: var(--positive-soft); color: var(--positive); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-trial { background: var(--trial-soft); color: var(--trial); }
.pill-muted { background: var(--surface-2); color: var(--text-3); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 13px; border: 0; cursor: pointer; font-weight: 600; font-size: 15.5px; transition: background var(--dur), transform var(--dur) var(--ease), opacity var(--dur); text-decoration: none !important; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: none; color: var(--accent-text); padding: 0 10px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-s { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-accent) transparent var(--on-accent) transparent; animation: spin 0.8s linear infinite; }
.btn-secondary.is-busy::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; flex: none; position: relative; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .actions .btn { flex: 0 0 auto; } }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text); }
.field .optional { font-weight: 500; color: var(--text-3); }
.input { width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; transition: border-color var(--dur), box-shadow var(--dur); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea.input { min-height: 86px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.hint { font-size: 13px; color: var(--text-2); }
.error-text { font-size: 13px; color: var(--danger); min-height: 0; }
.error-text:empty { display: none; }
.field.has-error .input { border-color: var(--danger); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 11px 14px; border-radius: 12px; font-size: 14.5px; font-weight: 550; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
.amount-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
details.more { border-radius: var(--radius-s); background: var(--surface-2); }
details.more > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform var(--dur); }
details.more[open] > summary::after { transform: rotate(-135deg); }
details.more > .more-body { padding: 4px 16px 18px; display: grid; gap: 14px; }

/* Control segmentado (vidrio moderado) */
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 8px 13px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background var(--dur), color var(--dur); text-align: center; flex: 1; }
.segmented input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.segmented input:focus-visible + label { box-shadow: var(--focus); }
.segmented.full { display: flex; width: 100%; }

/* Chips de filtro */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 40px; }

/* ---------- Hojas modales ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 18, 0.38); display: flex; align-items: flex-end; justify-content: center; animation: fade var(--dur) var(--ease); }
.overlay.out { opacity: 0; transition: opacity 180ms; }
.sheet { width: 100%; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-2); animation: rise 240ms var(--ease); padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px 20px; }
.sheet-head h2 { flex: 1; font-size: 19px; }
.sheet-body { padding: 4px 20px 22px; overflow-y: auto; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { width: min(560px, 94vw); border-radius: 22px; } .sheet.wide { width: min(760px, 94vw); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top)); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; font-weight: 550; font-size: 15px; background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); animation: rise 220ms var(--ease); transition: opacity 250ms; }
.toast.out { opacity: 0; }
.toast-positive { color: var(--positive); }
.toast-danger { color: var(--danger); }

/* ---------- Banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius-s); font-size: 14.5px; }
.banner .icon { margin-top: 1px; }
.banner-info { background: var(--accent-soft); color: var(--accent-text); }
.banner-warning { background: var(--warning-soft); color: var(--warning); }
.banner-demo { background: var(--trial-soft); color: var(--trial); }
.banner strong { font-weight: 650; }
.banner .btn { margin-left: auto; }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 34px 20px; display: grid; gap: 10px; justify-items: center; }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty p { color: var(--text-2); max-width: 380px; }

/* ---------- Calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 12px; font-weight: 600; color: var(--text-3); text-align: center; padding: 4px 0; }
.cal .day { min-height: 52px; border-radius: 12px; padding: 6px; background: var(--surface); border: 1px solid transparent; display: grid; align-content: start; gap: 3px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.cal .day:hover { border-color: var(--line-strong); }
.cal .day.out { background: transparent; cursor: default; }
.cal .day.today .n { background: var(--accent); color: var(--on-accent); }
.cal .day[aria-pressed="true"] { border-color: var(--accent); }
.cal .n { font-size: 13px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.cal .dot.manual { background: var(--warning); }
.cal .dot.trial_end, .cal .dot.deadline { background: var(--trial); }
.cal .dot.access_ends { background: var(--text-3); }
.cal .sum { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; display: none; }
@media (min-width: 900px) { .cal .day { min-height: 92px; } .cal .sum { display: block; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--text-2); font-size: 10.5px; font-family: var(--font); }
.chart .grid { stroke: var(--chart-grid); }
.chart .bar-c { fill: var(--chart-1); }
.chart .bar-e { fill: var(--chart-2); }
.chart .val { fill: var(--text); font-weight: 600; }
.hbar { display: grid; gap: 10px; }
.hbar .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 14px; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--chart-1); border-radius: 4px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); font-size: 13px; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.data td.r, table.data th.r { text-align: right; }
.toggle-view { font-size: 13.5px; }

.formula { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-s); padding: 12px 14px; display: grid; gap: 6px; }
.formula b { color: var(--text); }

/* ---------- Autenticación ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--trial-soft), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); display: grid; gap: 18px; }
.auth-theme { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 5; }
.auth-card .card { padding: 24px; }
.auth-brand { display: grid; justify-items: center; gap: 10px; text-align: center; }
.auth-brand p { color: var(--text-2); }
.steps { display: flex; gap: 6px; justify-content: center; }
.steps span { width: 28px; height: 5px; border-radius: 3px; background: var(--surface-3); }
.steps span.on { background: var(--accent); }

/* Detalle */
.detail-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 18px; }
.detail-head .mark { border-radius: 16px; }
.big-amount { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.link-actions { display: grid; gap: 8px; }
.timeline { display: grid; gap: 0; }
.timeline .ev { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 8px 0; font-size: 14px; }
.timeline .ev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-weight: 550; margin: 4px 0 0 -6px; padding: 6px; }
.loading { padding: 60px 0; text-align: center; color: var(--text-3); }
.notice-list .item { align-items: flex-start; }
.mail-box { white-space: pre-wrap; font-size: 14px; background: var(--surface-2); padding: 12px; border-radius: 12px; }

/* ---------- Recorrido guiado ---------- */
.tour-blocker { position: fixed; inset: 0; z-index: 90; background: transparent; }
.tour-blocker.dim { background: rgba(8, 10, 18, 0.55); }
.tour-spot { position: fixed; z-index: 91; pointer-events: none; box-shadow: 0 0 0 9999px rgba(8, 10, 18, 0.55), 0 0 0 3px var(--accent); transition: left var(--dur) var(--ease), top var(--dur) var(--ease), width var(--dur) var(--ease), height var(--dur) var(--ease), opacity var(--dur); }
.tour-pop { position: fixed; z-index: 92; display: grid; gap: 10px; padding: 16px 18px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); border: 1px solid var(--line); animation: rise 200ms var(--ease); }
.tour-pop h2 { font-size: 18px; }
.tour-pop p { color: var(--text-2); font-size: 15px; line-height: 1.5; }

.review-card { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.review-card .mark { border-radius: 18px; margin-bottom: 4px; }

/* ---------- Legal: aviso de cookies (colores de Controla), pie y páginas ---------- */
:root:not(#lk) { --lk-bg: var(--surface); --lk-ink: var(--text); --lk-muted: var(--text-2); --lk-line: var(--line-strong); --lk-acc: var(--accent); --lk-acc-ink: var(--on-accent); }
.lk-root { z-index: 2000; }
@media (max-width: 899px) { body:has(.tabbar) .lk-root:not(.lk-modal) { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom, 0px)); padding-bottom: 8px; } }
.legal-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; padding: 28px 0 8px; font-size: 13px; color: var(--text-3); }
.legal-foot a, .link-btn { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.legal-foot a:hover, .link-btn:hover { color: var(--text); }
.legal-page { min-height: 100dvh; background: var(--bg); }
.legal-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.legal-main { max-width: 820px; margin: 0 auto; padding: 24px 16px 40px; }
.legal-main .lg-doc { margin: 0 auto; }
.legal-main .lg-doc a { color: var(--accent-text, var(--accent)); }

/* ---------- Fase 2: Balance ---------- */
.metrics.three { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 640px) { .metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.metric.hero.hero-neg { background: linear-gradient(135deg, #c23b4a 0%, #8f2433 100%); }
.metric .value.pos { color: var(--positive); }
.chart .bar-in { fill: var(--positive); }
.chart .bar-out { fill: var(--chart-1); }
.legend::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend.in::before { background: var(--positive); }
.legend.out::before { background: var(--chart-1); }
.mv-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.mv-ico.income { background: var(--positive-soft); color: var(--positive); }
.mv-ico.expense { background: var(--accent-soft); color: var(--accent-text, var(--accent)); }
