/* AFTOMind — estilos. Marca: Poppins, verde azulado #1A3C40 y menta #A8E6CF,
   organización tipo Notion. Modo claro y oscuro (cada uno con sus propios tonos,
   no una inversión automática). Fuentes incluidas localmente. */

@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url('../vendor/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url('../vendor/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-style: normal; font-display: swap; src: url('../vendor/fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url('../vendor/fonts/poppins-700.woff2') format('woff2'); }

:root {
  color-scheme: light;
  /* Marca (fondos oscuros que no cambian con el tema) */
  --brand: #1A3C40;
  --brand-2: #24504F;
  --brand-3: #2E6563;
  --mint: #A8E6CF;
  --mint-2: #C9F0E1;
  --mint-soft: #EAF8F2;
  /* Texto de acento: verde azulado en claro, menta en oscuro */
  --ink: #1A3C40;
  --ink-2: #24504F;
  --ink-3: #3B6B68;
  --ink-strong: #1A3C40;
  /* Superficies */
  --bg: #FFFFFF;
  --bg-page: #F3F6F5;
  --sidebar: #FAFBFA;
  --surface: #FFFFFF;
  --surface-alt: #F7F9F8;
  --hover: #EDF2F0;
  --border: #E2E8E6;
  --border-strong: #CFD8D5;
  --text-primary: #24302F;
  --text-strong: #1A3C40;
  --text-secondary: #5B6967;
  --text-muted: #879391;
  /* Estados (texto) */
  --success: #1F7A55;
  --success-bg: #E6F5EE;
  --warning: #9A6300;
  --warning-bg: #FFF4DC;
  --danger: #B3261E;
  --danger-bg: #FDECEA;
  --info: #2C5A85;
  --info-bg: #EAF2FB;
  /* Gráficos: paleta categórica validada (orden fijo) y estados */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --st-good: #0ca30c; --st-warn: #fab219; --st-serious: #ec835a; --st-crit: #d03b3b;
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #1c5cab;
  --grid: #E7ECEA; --axis: #C6CFCC; --spark: #B5C1BE; --gauge-track: #E6ECEA;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 42, 0.05), 0 1px 1px rgba(16, 40, 42, 0.03);
  --shadow: 0 16px 40px rgba(16, 40, 42, 0.14);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  /* Alias usados por vistas anteriores */
  --navy-900: var(--ink); --navy-800: var(--ink-2); --navy-700: var(--ink-3); --navy-600: var(--ink-3);
  --gold: var(--mint); --gold-light: var(--mint); --gold-dark: var(--ink-3); --accent-gold: #1F8A70;
}

/* Modo oscuro: por preferencia del sistema (si no se eligió claro) o elegido en la app. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #A8E6CF; --ink-2: #C9F0E1; --ink-3: #8FD3BA; --ink-strong: #CFE9E0;
    --mint-soft: #16302B; --mint-2: #1F453D;
    --bg: #111A19; --bg-page: #0D1413; --sidebar: #111A19; --surface: #16211F; --surface-alt: #1A2725; --hover: #213230;
    --border: #263634; --border-strong: #34483F;
    --text-primary: #E1EAE7; --text-strong: #F1F6F4; --text-secondary: #A8B7B3; --text-muted: #7F8F8B;
    --success: #4CC38A; --success-bg: #12302A; --warning: #F2B84B; --warning-bg: #33280F; --danger: #FF8A80; --danger-bg: #3A1B1A; --info: #8AB8EE; --info-bg: #15263A;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec;
    --grid: #22302E; --axis: #36463F; --spark: #4D615C; --gauge-track: #24332F;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #A8E6CF; --ink-2: #C9F0E1; --ink-3: #8FD3BA; --ink-strong: #CFE9E0;
  --mint-soft: #16302B; --mint-2: #1F453D;
  --bg: #111A19; --bg-page: #0D1413; --sidebar: #111A19; --surface: #16211F; --surface-alt: #1A2725; --hover: #213230;
  --border: #263634; --border-strong: #34483F;
  --text-primary: #E1EAE7; --text-strong: #F1F6F4; --text-secondary: #A8B7B3; --text-muted: #7F8F8B;
  --success: #4CC38A; --success-bg: #12302A; --warning: #F2B84B; --warning-bg: #33280F; --danger: #FF8A80; --danger-bg: #3A1B1A; --info: #8AB8EE; --info-bg: #15263A;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec;
  --grid: #22302E; --axis: #36463F; --spark: #4D615C; --gauge-track: #24332F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; background: var(--bg-page); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.2px; }
p { margin: 0 0 8px; line-height: 1.55; }
button { font-family: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
input, select, textarea { font-family: inherit; }
a { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
.ico { flex-shrink: 0; vertical-align: middle; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num-tab { font-variant-numeric: tabular-nums; }
.hl { background: var(--brand); color: #fff; padding: 0 8px; border-radius: 8px; display: inline-block; }
.hl-mint { background: var(--mint); color: var(--brand); padding: 0 8px; border-radius: 8px; display: inline-block; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto 18px;
  background: var(--warning-bg); border: 1px solid rgba(250, 178, 25, 0.45); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: var(--text-primary); }
.storage-warning { background: var(--danger-bg); color: var(--danger); padding: 10px 16px; font-size: 13px; text-align: center; position: sticky; top: 0; z-index: 50; }

/* --------------------------------- Login --------------------------------- */
#screen-auth { width: 100%; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(1200px 600px at 10% 0%, #B9EBD8 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #D5F2E6 0%, transparent 55%), var(--bg-page); }
:root[data-theme="dark"] #screen-auth { background: radial-gradient(1000px 600px at 10% 0%, #173A33 0%, transparent 60%), var(--bg-page); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #screen-auth { background: radial-gradient(1000px 600px at 10% 0%, #173A33 0%, transparent 60%), var(--bg-page); } }
.auth-shell { width: 100%; max-width: 440px; }
.auth-brand { margin-bottom: 22px; }
.auth-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: var(--mint); font-weight: 700; font-size: 22px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.auth-brand h1 { font-size: 34px; line-height: 1.15; margin-bottom: 8px; }
.auth-brand p { color: var(--text-secondary); font-size: 15px; }
.auth-forms-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 26px; }
.auth-panel { display: none; }
.panel-profiles { display: block; }
.auth-forms-wrap.show-login .panel-profiles, .auth-forms-wrap.show-create .panel-profiles { display: none; }
.auth-forms-wrap.show-login .panel-login, .auth-forms-wrap.show-create .panel-create { display: block; }
.back-link { background: none; border: none; color: var(--text-secondary); font-size: 13px; padding: 0; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
.profile-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; max-height: 320px; overflow-y: auto; }
.profile-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 10px 14px; text-align: left; transition: border-color .15s, background .15s; }
.profile-card:hover { border-color: var(--ink-3); background: var(--mint-soft); }
.profile-avatar { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; background: var(--brand); color: var(--mint); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.profile-info { display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-secondary); }
.profile-info strong { font-size: 14px; color: var(--text-strong); font-weight: 600; }
.auth-note { text-align: center; color: var(--text-secondary); font-size: 12px; margin-top: 14px; }

/* -------------------------------- Formularios -------------------------------- */
form label, .field { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; font-weight: 500; }
form input, form select, form textarea, .input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary); background: var(--surface); }
form input:focus, form select:focus, form textarea:focus, .input:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(168, 230, 207, 0.45); }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: -6px; margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-primary); margin-bottom: 12px; }
.check-label input { width: auto; margin: 0; }
.seg { display: inline-flex; background: var(--hover); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.seg button.on { background: var(--surface); color: var(--text-strong); font-weight: 600; box-shadow: var(--shadow-sm); }

/* --------------------------------- Botones --------------------------------- */
.btn { border: 1px solid transparent; border-radius: 999px; padding: 9px 18px; font-size: 13.5px; font-weight: 600; transition: background .15s, border-color .15s, transform .1s; display: inline-flex; align-items: center; gap: 6px; }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--mint); color: var(--brand); }
.btn-primary:hover { background: #95DFC2; }
.btn-secondary { background: var(--brand); color: #fff; }
.btn-secondary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--mint-soft); border-color: var(--ink-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-icon { background: none; border: none; padding: 4px 8px; font-size: 14px; color: var(--text-secondary); border-radius: 6px; }
.btn-icon:hover { background: var(--hover); color: var(--danger); }
.link-btn { background: none; border: none; color: var(--ink-3); font-weight: 600; padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------- App shell --------------------------------- */
.app-shell { width: 100%; }
.sidebar { width: 252px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-mini { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text-strong); padding: 6px 8px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--mint); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.brand-sub { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.2px; }
.nav-list { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; padding: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: none; color: var(--text-secondary); padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.nav-item:hover { background: var(--hover); color: var(--text-strong); }
.nav-item.active { background: var(--mint-2); color: var(--text-strong); font-weight: 600; }
.nav-item.active .ico { color: var(--ink); }
.nav-new { margin-left: auto; font-size: 9.5px; font-weight: 700; background: var(--mint); color: var(--brand); border-radius: 999px; padding: 1px 7px; letter-spacing: .3px; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.trm-pill { font-size: 12px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; line-height: 1.4; }
.trm-pill strong { color: var(--text-strong); }
.current-user { font-size: 13px; color: var(--text-secondary); padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .btn { flex: 1; justify-content: center; }

.main-content { flex: 1; min-width: 0; padding: 30px 40px 90px; }
.view-container > * { min-width: 0; }
.view-container { display: flex; flex-direction: column; gap: 18px; max-width: 1180px; margin: 0 auto; }
.page-icon { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.ph-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 320px; }
.ph-left > div { min-width: 0; }
.ph-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--mint-soft); color: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--mint-2); }
.page-head h2 { font-size: 26px; margin: 0; }
.page-head .subtitle { color: var(--text-secondary); font-size: 13.5px; margin: 2px 0 0; max-width: 680px; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.view-header h2 { font-size: 26px; margin: 0; }
.view-header .subtitle { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; max-width: 680px; }
.month-switcher { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px; }
.month-switcher button { background: none; border: none; font-size: 12px; color: var(--ink); padding: 4px 8px; border-radius: 999px; }
.month-switcher button:hover { background: var(--hover); }
.month-switcher span { font-weight: 600; font-size: 13px; min-width: 120px; text-align: center; text-transform: capitalize; color: var(--text-strong); }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 4px 0 0; }

/* ------------------------------- Bloques/tarjetas ------------------------------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); min-width: 0; }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.clickable:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.card-sub { font-size: 12.5px; color: var(--text-secondary); margin: -8px 0 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-wide { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4, .form-row, .form-row-3 { grid-template-columns: minmax(0, 1fr); } }

.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.3px; }
.stat-card .stat-value.positive { color: var(--success); }
.stat-card .stat-value.negative { color: var(--danger); }
.stat-caption { font-size: 12px; color: var(--text-muted); }

/* Indicador (KPI) con mini tendencia */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-value { font-size: 23px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.4px; line-height: 1.15; }
.kpi-foot { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; }
.delta.good { color: var(--success); } .delta.bad { color: var(--danger); } .delta.flat { color: var(--text-muted); }

.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--mint-soft); border: 1px solid var(--mint-2); border-radius: var(--radius); padding: 14px 16px; font-size: 13.5px; }
.callout .callout-icon { font-size: 20px; line-height: 1.2; }
.callout.warn { background: var(--warning-bg); border-color: rgba(250, 178, 25, 0.45); }
.callout.danger { background: var(--danger-bg); border-color: rgba(208, 59, 59, 0.35); }
.callout.info { background: var(--info-bg); border-color: rgba(42, 120, 214, 0.25); }

.hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-3) 100%); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; border: none; box-shadow: var(--shadow-sm); }
.hero .hero-label { font-size: 13px; color: rgba(255, 255, 255, 0.78); display: flex; align-items: center; gap: 4px; }
.hero .hero-value { font-size: 40px; font-weight: 700; color: var(--mint); margin: 4px 0; letter-spacing: -0.8px; line-height: 1.1; }
.hero p { color: rgba(255, 255, 255, 0.78); font-size: 12.5px; margin: 0; }
.hero strong { color: #fff; }
.hero .hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.14); }
.hero .hs-l { font-size: 11.5px; color: rgba(255,255,255,0.7); }
.hero .hs-v { font-size: 17px; font-weight: 700; color: #fff; }
.hero .btn-primary { margin-top: 12px; }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--hover); color: var(--text-secondary); }
.badge-ink { background: var(--brand); color: #fff; }
.badge-mint { background: var(--mint); color: var(--brand); }

/* Estado con ícono + texto (nunca solo color) */
.st-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px 2px 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st-good { background: var(--success-bg); color: var(--success); }
.st-warn { background: var(--warning-bg); color: var(--warning); }
.st-bad { background: var(--danger-bg); color: var(--danger); }
.st-none { background: var(--hover); color: var(--text-secondary); }

/* ------------------------------ Opciones de pago ------------------------------ */
.options-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.options-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .options-grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .options-grid { grid-template-columns: minmax(0, 1fr); } }
.option-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.option-card .opt-name { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.option-card .opt-amount { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.3px; }
.option-card .opt-meta { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.option-card .opt-meta strong { color: var(--text-strong); }
.option-card.opt-medida, .option-card.opt-best { background: var(--mint-soft); border-color: var(--mint-2); }
.option-card .input { margin-top: 2px; }

/* --------------------------------- Tablas --------------------------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--surface-alt); }
table.data-table td.num, table.data-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data-table tfoot td { font-weight: 700; color: var(--text-strong); border-top: 2px solid var(--border-strong); }
table.edit-table input, table.edit-table select { width: 100%; min-width: 70px; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; font-size: 12.5px; background: transparent; font-family: inherit; color: var(--text-primary); }
table.edit-table input:hover, table.edit-table select:hover { border-color: var(--border); }
table.edit-table input:focus, table.edit-table select:focus { outline: none; border-color: var(--ink-3); background: var(--surface); }
table.edit-table input.num { text-align: right; }
table.edit-table select { min-width: 96px; }
table.edit-table input[type="date"] { min-width: 128px; }
table.data-table tr.group-row td { background: var(--mint-soft); border-top: 1px solid var(--mint-2); }
table.data-table tr.muted td { color: var(--text-muted); }
table.data-table tr.hs-row:hover td { background: var(--mint-soft); }
.amount-income { color: var(--success); font-weight: 600; }
.amount-expense { color: var(--danger); font-weight: 600; }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 4px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 9px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--text-strong); border-bottom-color: var(--ink); font-weight: 600; }

/* --------------------------------- Progreso --------------------------------- */
.progress-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }
.progress-meta { font-size: 12px; color: var(--text-muted); }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--hover); overflow: visible; }
.meter-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.meter-good { background: rgba(12, 163, 12, 0.16); } .meter-good .meter-fill { background: var(--st-good); }
.meter-warn { background: rgba(250, 178, 25, 0.2); } .meter-warn .meter-fill { background: var(--st-warn); }
.meter-bad { background: rgba(208, 59, 59, 0.16); } .meter-bad .meter-fill { background: var(--st-crit); }
.meter-info { background: rgba(42, 120, 214, 0.16); } .meter-info .meter-fill { background: var(--s1); }
.meter-none .meter-fill { background: var(--border-strong); }
.meter-mark { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text-strong); border-radius: 2px; }

/* ------------------------------- Gráficos ------------------------------- */
.viz { width: 100%; position: relative; }
.viz-svg { display: block; overflow: visible; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-axis { stroke: var(--axis); stroke-width: 1; }
.viz-tick { font-size: 11px; fill: var(--text-muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.viz-value { font-size: 11.5px; fill: var(--text-strong); font-weight: 600; font-family: var(--font); }
.viz-label { font-size: 12px; fill: var(--text-primary); font-weight: 600; font-family: var(--font); }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:hover, .viz-hit:focus { fill: var(--text-strong); fill-opacity: 0.04; }
.viz-cross { stroke: var(--text-muted); stroke-width: 1; opacity: 0; pointer-events: none; }
.viz-xband:hover .viz-cross, .viz-xband:focus-within .viz-cross { opacity: 1; }
.viz-link { opacity: 0.32; transition: opacity .15s; outline: none; }
.viz-link:hover, .viz-link:focus { opacity: 0.6; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.vl-item { display: inline-flex; align-items: center; gap: 6px; }
.vl-rect { width: 10px; height: 10px; border-radius: 3px; }
.vl-line { width: 14px; height: 2px; border-radius: 2px; }
.viz-tip { position: fixed; z-index: 300; pointer-events: none; background: var(--surface); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12px; min-width: 120px; display: none; }
.vt-title { color: var(--text-secondary); font-size: 11.5px; margin-bottom: 4px; }
.vt-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.vt-row strong { color: var(--text-strong); font-variant-numeric: tabular-nums; }
.vt-key { width: 12px; height: 2px; border-radius: 2px; flex-shrink: 0; }
.vt-label { color: var(--text-muted); }
.viz-table { margin-top: 10px; }
.viz-table summary { cursor: pointer; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.viz-table[open] summary { margin-bottom: 6px; }
.spark { display: block; }
.gauge { display: flex; justify-content: center; }
.gauge-num { font-size: 40px; font-weight: 700; fill: var(--text-strong); font-family: var(--font); letter-spacing: -1px; }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { outline: none; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.hbar-label { color: var(--text-primary); font-weight: 500; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-ico { font-size: 14px; }
.hbar-val { color: var(--text-strong); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--hover); }
.hbar-fill { height: 100%; border-radius: 0 999px 999px 0; min-width: 4px; }
.hbar:hover .hbar-track, .hbar:focus .hbar-track { background: var(--border); }
.stackbar { display: flex; gap: 2px; height: 16px; border-radius: 999px; overflow: hidden; }
.stack-seg { min-width: 4px; outline: none; }
.stack-seg:hover, .stack-seg:focus { filter: brightness(1.1); }

.heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hm-head { font-size: 11px; color: var(--text-muted); text-align: center; padding-bottom: 2px; }
.hm-cell { aspect-ratio: 1 / 1; border-radius: 6px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 3px 5px; font-size: 10.5px; color: var(--text-secondary); outline: none; max-height: 52px; }
.hm-cell:hover, .hm-cell:focus { box-shadow: inset 0 0 0 2px var(--text-strong); }
.hm-0 { background: var(--hover); }
.hm-1 { background: var(--seq-1); } .hm-2 { background: var(--seq-2); } .hm-3 { background: var(--seq-3); color: #fff; } .hm-4 { background: var(--seq-4); color: #fff; } .hm-5 { background: var(--seq-5); color: #fff; }
.hm-scale { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.hm-scale i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Compatibilidad: leyendas anteriores */
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { flex: 1; color: var(--text-primary); font-weight: 500; }
.legend-value { color: var(--text-muted); }

/* ------------------------------ Inicio (centro de mando) ------------------------------ */
.dash-top { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1100px) { .dash-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-top .hero { grid-column: 1 / -1; order: -1; } }
@media (max-width: 640px) { .dash-top { grid-template-columns: minmax(0, 1fr); } }
.score-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.score-card .score-level { font-weight: 700; color: var(--text-strong); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.score-card .score-tip { font-size: 12.5px; color: var(--text-secondary); max-width: 280px; }
.debt-card .dc-value { font-size: 28px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.5px; }
.debt-card .dc-rows { margin-top: 10px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.mini-row:last-child { border-bottom: none; }
.mini-row strong { color: var(--text-strong); font-variant-numeric: tabular-nums; }

/* Calendario y quincenas */
.cal-list { display: flex; flex-direction: column; }
.cal-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cal-item:last-child { border-bottom: none; }
.cal-date { text-align: center; border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--border); padding: 3px 0; line-height: 1.1; }
.cal-date b { display: block; font-size: 16px; color: var(--text-strong); }
.cal-date span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.cal-what { min-width: 0; }
.cal-what strong { display: block; font-size: 13px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-what span { font-size: 11.5px; color: var(--text-muted); }
.cal-amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }
.cal-amt.in { color: var(--success); } .cal-amt.out { color: var(--text-strong); } .cal-amt.info { color: var(--text-muted); font-weight: 500; }
.qgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .qgrid { grid-template-columns: minmax(0, 1fr); } }
.qcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.qcard.now { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--mint-soft); }
.qcard h4 { font-size: 13.5px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qbig { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.3px; }

/* Indicadores de salud */
.ind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .ind-grid { grid-template-columns: minmax(0, 1fr); } }
.ind-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.ind-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ind-name { font-weight: 600; color: var(--text-strong); font-size: 13.5px; display: flex; align-items: center; }
.ind-value { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.3px; }
.ind-meta { font-size: 12px; color: var(--text-muted); }
.ind-detail { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.ind-tip { font-size: 12.5px; background: var(--surface-alt); border-radius: 8px; padding: 8px 10px; color: var(--text-primary); line-height: 1.45; }

/* ------------------------------ Tips / insights ------------------------------ */
.insight-list { display: flex; flex-direction: column; gap: 8px; }
.insight-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; background: var(--surface-alt); border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.insight-item.warning { border-color: rgba(250, 178, 25, 0.45); background: var(--warning-bg); }
.insight-item.danger { border-color: rgba(208, 59, 59, 0.35); background: var(--danger-bg); }
.insight-item.success { border-color: rgba(12, 163, 12, 0.3); background: var(--success-bg); }
.insight-item.info { border-color: rgba(42, 120, 214, 0.25); background: var(--info-bg); }
.insight-icon { font-size: 16px; }

/* ------------------------------ Ayuda / guía ------------------------------ */
.help-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-3);
  font-size: 11.5px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-left: 6px; vertical-align: middle; flex-shrink: 0; }
.help-btn:hover { background: var(--brand); color: var(--mint); border-color: var(--brand); }
.hero .help-btn, .real-main .help-btn { background: rgba(255,255,255,0.12); color: var(--mint); border-color: rgba(255,255,255,0.3); }
.help-body p { font-size: 14px; color: var(--text-primary); margin-bottom: 10px; }
.help-body strong { color: var(--text-strong); }
.guide-list { display: flex; flex-direction: column; gap: 6px; }
.guide-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-alt); }
.guide-item summary { cursor: pointer; font-weight: 600; color: var(--text-strong); font-size: 14px; }
.guide-item[open] { background: var(--surface); }
.guide-item .help-body { margin-top: 10px; }
.tip-rank { font-size: 11px; font-weight: 700; color: var(--text-strong); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; white-space: nowrap; align-self: flex-start; }

/* ------------------------------- Pago real ------------------------------- */
.real-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 900px) { .real-hero { grid-template-columns: minmax(0, 1fr); } }
.real-main { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-3) 100%); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; }
.real-main .rl { font-size: 13px; color: rgba(255,255,255,0.78); display: flex; align-items: center; }
.real-main .rv { font-size: 36px; font-weight: 700; color: var(--mint); letter-spacing: -0.5px; margin: 4px 0 6px; }
.real-main .rs { font-size: 12.5px; color: rgba(255,255,255,0.78); line-height: 1.5; }
.real-side { display: flex; flex-direction: column; gap: 10px; }
.real-compare { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; }
.real-compare .rc-row { display: flex; justify-content: space-between; padding: 4px 0; }
.real-compare .rc-row strong { color: var(--text-strong); font-variant-numeric: tabular-nums; }
.income-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.income-row:last-child { border-bottom: none; }
.income-row strong { font-variant-numeric: tabular-nums; color: var(--text-strong); }

.checks-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.checks-list .ok { color: var(--success); }
.checks-list .bad { color: var(--danger); }

/* ------------------------------ Carga de extractos ------------------------------ */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px; text-align: center; background: var(--surface-alt); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--ink-3); background: var(--mint-soft); }
.dropzone .dz-icon { font-size: 34px; }
.dropzone strong { color: var(--text-strong); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 13px; margin-top: 10px; }
.diag-text { width: 100%; min-height: 220px; font-family: Consolas, monospace; font-size: 11.5px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface-alt); color: var(--text-primary); }

.product-card .pc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.product-card .pc-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--mint-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.product-card .pc-title { font-weight: 600; color: var(--text-strong); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--text-secondary); }
.kv span:nth-child(even) { text-align: right; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }

.empty-hint { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.empty-state { text-align: center; padding: 36px 20px; color: var(--text-muted); }
.empty-state .empty-emoji { font-size: 34px; margin-bottom: 8px; }

/* --------------------------------- Modal --------------------------------- */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-root.modal-open { pointer-events: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 26, 28, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; padding: 22px; }
.modal-wide { max-width: 760px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 15px; color: var(--text-muted); border-radius: 6px; padding: 4px 8px; }
.modal-close:hover { background: var(--hover); color: var(--danger); }
.confirm-text { font-size: 14px; color: var(--text-secondary); }

/* --------------------------------- Toast / FAB --------------------------------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--brand); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.toast-show { opacity: 1; transform: translateY(0); }
.toast-success { background: #1F7A55; }
.toast-error { background: #B3261E; }
.fab-add { position: fixed; bottom: 26px; right: 26px; width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: var(--mint); font-size: 26px; font-weight: 500; border: none; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; z-index: 40; }
.fab-add:hover { background: var(--brand-2); }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 30; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .brand-mini { padding: 0 12px 0 0; }
  .brand-sub, .nav-group, .sidebar-footer, .nav-new { display: none; }
  .nav-list { flex-direction: row; flex: 1; }
  .nav-item { flex-shrink: 0; }
  .main-content { padding: 20px 16px 90px; }
  .hero .hero-value { font-size: 32px; }
}
@media print {
  .sidebar, .fab-add, .toast-root, .demo-banner { display: none !important; }
  .main-content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
