:root {
  color-scheme: dark;
  --color-primary: #a855f7;
  --color-primary-600: #9333ea;
  --color-accent: #ec4899;
  --color-accent-600: #db2777;
  --color-gradient: linear-gradient(135deg, #a855f7, #ec4899);
  --bg: #0b0614;
  --surface: #171025;
  --surface-2: #1f1533;
  --border: #2a1d3d;
  --text: #f5f0ff;
  --text-muted: #a89cc0;
  --text-faint: #75688d;
  --shadow: 0 22px 70px rgba(0, 0, 0, .34);
  --sidebar-width: 244px;
  --sidebar-collapsed-width: 68px;
  font-family: 'Inter', sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf8ff;
  --surface: #ffffff;
  --surface-2: #f3eefc;
  --border: #e9e4f5;
  --text: #1a0f2e;
  --text-muted: #6b5e87;
  --text-faint: #9186a5;
  --shadow: 0 22px 70px rgba(48, 26, 78, .12);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); font-family: 'Inter', sans-serif; font-size: 18.7px; line-height: 1.6; transition: background-color .2s ease, color .2s ease; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
[hidden] { display: none !important; }

.loading-screen, .login-screen { min-height: 100vh; display: grid; place-items: center; }
.loading-screen { align-content: center; gap: 16px; color: var(--text-muted); font-size: 19.14px; }
.loading-screen img { filter: drop-shadow(0 8px 24px rgba(168, 85, 247, .3)); }
.login-screen { position: relative; padding: 32px 20px 72px; overflow: hidden; background: radial-gradient(ellipse at 50% 42%, rgba(168, 85, 247, .12), transparent 52%), var(--bg); }
.login-screen::before { position: absolute; inset: 0; content: ''; pointer-events: none; opacity: .22; background-image: linear-gradient(rgba(168,85,247,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(168,85,247,.08) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom, black, transparent 72%); }
.login-card { position: relative; width: min(100%, 420px); padding: 38px; border: 1px solid var(--border); border-radius: 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow), 0 0 65px rgba(168, 85, 247, .07); backdrop-filter: blur(18px); }
.login-logo { display: block; margin-bottom: 25px; filter: drop-shadow(0 7px 16px rgba(168, 85, 247, .25)); }
.eyebrow { margin: 0 0 10px; color: var(--color-primary); font-family: 'JetBrains Mono', monospace; font-size: 13.2px; font-weight: 500; letter-spacing: .15em; }
h1, h2, h3 { font-family: 'Manrope', sans-serif; }
.login-card h1 { margin: 0; font-size: clamp(30.8px, 7.59vw, 37.4px); letter-spacing: -.045em; }
.login-description { margin: 9px 0 27px; color: var(--text-muted); font-size: 16.5px; }
.login-card form { display: grid; gap: 9px; }
.login-card label { margin-top: 7px; color: var(--text); font-size: 15.4px; font-weight: 600; }
.login-card input { width: 100%; height: 52px; font-size: 17.6px; padding: 0 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--bg); transition: border-color .18s ease, box-shadow .18s ease; }
.login-card input::placeholder { color: var(--text-faint); }
.login-card input:focus { border-color: var(--color-primary); outline: 0; box-shadow: 0 0 0 3px rgba(168, 85, 247, .14); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle { position: absolute; top: 0; right: 4px; width: 40px; height: 52px; display: grid; place-items: center; border: 0; color: var(--text-muted); background: transparent; cursor: pointer; }
.password-toggle:hover { color: var(--text); }
.password-toggle svg, .icon-button svg, .chevron-icon, .nav-icon, .module-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.form-message { min-height: 17px; margin: 2px 0 0; color: #fb7185; font-size: 17.16px; line-height: 1.6; }
.form-message.is-success { color: #4ade80; }
.button { min-height: 50px; font-size: 17.6px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 600; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .65; cursor: wait; }
.button-primary { color: white; background: var(--color-gradient); box-shadow: 0 7px 20px rgba(168, 85, 247, .2); }
.button-primary:hover { box-shadow: 0 9px 26px rgba(168, 85, 247, .32); }
.button-secondary { border-color: var(--border); color: var(--text); background: var(--surface-2); }
.button-secondary:hover { border-color: var(--color-primary); }
.button-ghost { color: var(--text-muted); background: transparent; }
.button-ghost:hover { color: var(--text); background: var(--surface-2); }
.login-submit { width: 100%; margin-top: 2px; }
.text-button { display: block; margin: 17px auto 0; padding: 4px; border: 0; color: var(--text-muted); background: transparent; font-size: 15.4px; cursor: pointer; }
.text-button:hover { color: var(--color-primary); }
.login-caption { position: absolute; bottom: 27px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; font-size: 13.2px; letter-spacing: .08em; }
.login-caption span { padding: 0 5px; color: var(--color-accent); }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: 62px minmax(0, 1fr) 34px; }
.topbar { position: relative; z-index: 30; height: 62px; display: flex; align-items: center; gap: 13px; padding: 0 22px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: blur(16px); }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid transparent; border-radius: 8px; color: var(--text-muted); background: transparent; cursor: pointer; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.icon-button:hover { border-color: var(--border); color: var(--text); background: var(--surface-2); }
.icon-button svg { width: 22px; height: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: 'Manrope', sans-serif; font-size: 19.8px; font-weight: 800; letter-spacing: .12em; }
.brand img { filter: drop-shadow(0 3px 10px rgba(168,85,247,.25)); }
.topbar-spacer { flex: 1; }
.theme-toggle .sun-icon { display: block; }
.theme-toggle .moon-icon { display: none; }
:root[data-theme="light"] .theme-toggle .sun-icon { display: none; }
:root[data-theme="light"] .theme-toggle .moon-icon { display: block; }
.user-menu-wrap { position: relative; }
.user-menu-toggle { max-width: 230px; height: 38px; display: flex; align-items: center; gap: 9px; padding: 3px 8px 3px 4px; border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; }
.user-menu-toggle:hover, .user-menu-toggle[aria-expanded="true"] { border-color: var(--border); background: var(--surface-2); }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; color: white; background: var(--color-gradient); font-family: 'Manrope', sans-serif; font-size: 15.84px; font-weight: 800; }
.user-email { overflow: hidden; color: var(--text-muted); font-size: 14.85px; text-overflow: ellipsis; white-space: nowrap; }
.chevron-icon { width: 15px; height: 15px; color: var(--text-faint); }
.user-dropdown { position: absolute; top: calc(100% + 9px); right: 0; z-index: 40; width: 218px; padding: 7px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); animation: menu-in .14s ease-out; }
.user-dropdown-email { overflow: hidden; padding: 10px 9px; color: var(--text-faint); font-size: 14.3px; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-action { width: 100%; padding: 10px 9px; border: 0; border-radius: 7px; color: var(--text); background: transparent; text-align: left; font-size: 15.4px; cursor: pointer; }
.dropdown-action:hover { color: #fb7185; background: rgba(251, 113, 133, .08); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.workspace { position: relative; min-height: 0; display: flex; }
.sidebar { position: relative; z-index: 20; width: var(--sidebar-width); min-width: var(--sidebar-width); display: flex; flex-direction: column; padding: 24px 12px 15px; overflow: hidden; border-right: 1px solid var(--border); background: var(--surface); transition: all 0.3s ease-in-out; }
.sidebar-section-label { overflow: hidden; padding: 0 12px 12px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; font-size: 12.1px; letter-spacing: .12em; white-space: nowrap; }
.module-nav { display: grid; gap: 4px; }
.nav-link { position: relative; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px; overflow: hidden; border: 1px solid transparent; border-radius: 9px; color: var(--text-muted); text-decoration: none; white-space: nowrap; transition: color .16s ease, background .16s ease, border-color .16s ease; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"] { border-color: rgba(168, 85, 247, .16); color: var(--text); background: linear-gradient(100deg, rgba(168,85,247,.13), rgba(236,72,153,.06)); }
.nav-link[aria-current="page"]::before { position: absolute; top: 9px; bottom: 9px; left: -1px; width: 3px; border-radius: 0 3px 3px 0; background: var(--color-gradient); content: ''; }
.nav-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-emoji-icon { width: 20px; flex: 0 0 auto; font-size: 22.44px; line-height: 1; text-align: center; }
.module-emoji-icon { font-size: 25.08px; line-height: 1; }
.nav-label { overflow: hidden; font-size: 15.95px; font-weight: 500; text-overflow: ellipsis; }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 13px 12px 3px; overflow: hidden; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 13.2px; white-space: nowrap; }
.sidebar-status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #a855f7; box-shadow: 0 0 11px rgba(168,85,247,.65); }
.app-shell.is-collapsed .sidebar { width: 0; min-width: 0; padding: 0; border-right: 0; opacity: 0; pointer-events: none; }
.app-shell.is-collapsed .sidebar-section-label, .app-shell.is-collapsed .nav-label, .app-shell.is-collapsed .sidebar-bottom > :not(.sidebar-status-dot) { width: 0; opacity: 0; }
.app-shell.is-collapsed .sidebar-section-label { padding-right: 0; padding-left: 0; }
.app-shell.is-collapsed .nav-link { justify-content: center; padding: 0; }
.app-shell.is-collapsed .nav-link:hover::after, .app-shell.is-collapsed .nav-link:focus-visible::after { position: absolute; left: calc(100% + 12px); z-index: 50; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); content: attr(data-tooltip); font-size: 15.84px; }
.app-shell.is-collapsed .sidebar .nav-link:hover::after, .app-shell.is-collapsed .sidebar .nav-link:focus-visible::after { display: none; }
.app-shell.is-collapsed .sidebar-bottom { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar-overlay { position: fixed; inset: 62px 0 0; z-index: 15; background: rgba(8, 4, 14, .62); backdrop-filter: blur(2px); }
.main-content { width: 0; min-width: 0; flex: 1; padding: clamp(25px, 5vw, 58px); overflow: auto; outline: none; }
.main-inner { width: min(100%, 1040px); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 31px; }
.page-heading h1 { margin: 0; font-size: clamp(33px, 5.06vw, 44px); font-weight: 700; letter-spacing: -.055em; }
.page-heading p { margin: 8px 0 0; color: var(--text-muted); font-size: 19.14px; }
.home-kicker { display: block; margin-bottom: 9px; color: var(--color-primary); font-family: 'JetBrains Mono', monospace; font-size: 15.84px; letter-spacing: .12em; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-card { min-height: 180px; display: flex; flex-direction: column; align-items: flex-start; padding: 20px; border: 1px solid var(--border); border-radius: 13px; color: var(--text); background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 96%, white 4%), var(--surface)); text-align: left; cursor: pointer; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease, background .2s ease; }
.module-card:hover { transform: translateY(-3px); border-color: rgba(168, 85, 247, .55); background: linear-gradient(145deg, rgba(168,85,247,.10), var(--surface) 65%); box-shadow: 0 13px 36px rgba(0, 0, 0, .13); }
.module-card-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.module-icon-wrap { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid rgba(168,85,247,.2); border-radius: 10px; color: #c084fc; background: rgba(168,85,247,.1); }
.module-icon-wrap .module-icon { width: 19px; height: 19px; }
.module-arrow { color: var(--text-faint); font-size: 22.44px; transition: color .18s ease, transform .18s ease; }
.module-card:hover .module-arrow { transform: translate(2px, -2px); color: var(--color-primary); }
.module-card h2 { margin: 19px 0 0; font-size: 18.7px; font-weight: 650; letter-spacing: -.02em; }
.module-card p { margin: 6px 0 0; color: var(--text-faint); font-size: 14.85px; }
.module-placeholder { min-height: min(480px, 66vh); display: grid; place-items: center; }
.placeholder-card { width: min(100%, 450px); padding: 47px 25px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg, rgba(168,85,247,.055), var(--surface) 43%); text-align: center; }
.placeholder-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 23px; border: 1px solid rgba(168,85,247,.22); border-radius: 18px; color: #c084fc; background: rgba(168,85,247,.1); }
.placeholder-icon .module-icon { width: 29px; height: 29px; }
.placeholder-card h1 { margin: 0; font-size: 31.9px; letter-spacing: -.04em; }
.placeholder-card p { margin: 11px 0 0; color: var(--text-muted); font-size: 16.5px; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid rgba(168,85,247,.18); border-radius: 999px; color: #c084fc; background: rgba(168,85,247,.09); font-size: 13.2px; font-weight: 600; }
.app-footer { display: flex; align-items: center; gap: 8px; padding: 0 23px; border-top: 1px solid var(--border); color: var(--text-faint); font-family: 'JetBrains Mono', monospace; font-size: 12.1px; letter-spacing: .04em; }
.app-footer > span:first-child { color: var(--text-muted); font-weight: 500; }
.footer-separator { color: var(--color-primary); }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; }
.toast { max-width: min(360px, calc(100vw - 36px)); padding: 12px 15px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); font-size: 17.16px; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .topbar { padding: 0 14px; }
  .app-shell .sidebar { position: fixed; top: 62px; bottom: 34px; left: 0; z-index: 25; width: min(280px, 82vw); min-width: 0; transform: translateX(-102%); box-shadow: var(--shadow); }
  .app-shell.mobile-sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.is-collapsed .sidebar { width: min(280px, 82vw); min-width: 0; padding: 24px 12px 15px; border-right: 1px solid var(--border); opacity: 1; pointer-events: auto; }
  .app-shell.is-collapsed .sidebar-section-label, .app-shell.is-collapsed .nav-label, .app-shell.is-collapsed .sidebar-bottom > :not(.sidebar-status-dot) { width: auto; opacity: 1; }
  .app-shell.is-collapsed .sidebar-section-label { padding: 0 12px 12px; }
  .app-shell.is-collapsed .nav-link { justify-content: flex-start; padding: 0 12px; }
  .app-shell.is-collapsed .sidebar-bottom { justify-content: flex-start; padding: 13px 12px 3px; }
  .app-shell.mobile-sidebar-open .sidebar-overlay { display: block !important; }
  .app-shell.is-collapsed .sidebar .nav-link:hover::after, .app-shell.is-collapsed .sidebar .nav-link:focus-visible::after { display: none; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content { padding: 34px clamp(19px, 5vw, 42px); }
}
@media (min-width: 901px) {
  .sidebar-overlay { display: none !important; }
}
@media (max-width: 560px) {
  .app-shell { grid-template-rows: 58px minmax(0, 1fr) 32px; }
  .topbar { height: 58px; gap: 9px; }
  .app-shell .sidebar { top: 58px; bottom: 32px; }
  .sidebar-overlay { inset: 58px 0 0; }
  .brand { gap: 8px; font-size: 18.48px; }
  .brand img { width: 27px; height: 27px; }
  .user-menu-toggle { gap: 5px; padding-right: 3px; }
  .user-email, .chevron-icon { display: none; }
  .module-grid { grid-template-columns: 1fr; gap: 10px; }
  .module-card { min-height: 180px; padding: 16px; }
  .module-card h2 { margin-top: 14px; }
  .page-heading { margin-bottom: 22px; }
  .main-content { padding: 27px 17px; }
  #onix-main:has(#finanzas-app-root) { overflow-x: hidden; }
  .login-card { padding: 30px 24px; }
  .app-footer { padding: 0 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

h1 { font-size: 2.42em; }
h2 { font-size: 1.81em; }
h3 { font-size: 1.42em; }

body { font-size: 18.5px; }
.eyebrow { font-size: 13px; }
.nav-label { font-size: 16px; }
.login-description { font-size: 16.5px; }
.login-card input { height: 58px; font-size: 17.5px; }
.password-toggle { height: 58px; }
.button { min-height: 55px; font-size: 17.5px; }
.login-card label { font-size: 15.5px; }
.nav-link { min-height: 53px; }


/* Cifras monetarias alineadas con dígitos tabulares en toda la app. */
:is(.resumen-valor, .monto-valor, .saldo-valor, .precio-valor, .tasa-valor, .balance-valor, [class*="moneda-valor"], [class*="amount"], [class*="price"], [class*="balance"], .valor-numerico, .moneda-monto, .cuenta-saldo, .card-saldo, .transaccion-monto, .presupuesto-valor):is(strong, b, span, output, input), .finanzas-transaction-amounts > strong, .finanzas-budget-card dd { font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1, 'zero' 1; letter-spacing: -.02em; }

/* 2026 design system: quiet native-feeling controls and scrollbars. */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--border); transition: background .2s ease; }
*::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

:root :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea) {
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text);
}
:root :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea):focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
}

.button-primary {
  transition: all .2s ease;
}
.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(168, 85, 247, .34);
}
.button-primary:active { transform: translateY(1px); }
