:root {
    color-scheme: light;
    --navy-950: #0b1222;
    --navy-900: #101a31;
    --navy-800: #14213d;
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --teal-600: #0d9488;
    --emerald-600: #059669;
    --emerald-100: #d1fae5;
    --rose-600: #e11d48;
    --rose-100: #ffe4e6;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --slate-950: #0f172a;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --surface: #ffffff;
    --canvas: #f4f6f8;
    --text: #172033;
    --muted: #667085;
    --border: #e5e9ef;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 4px rgba(16, 24, 40, .04);
    --shadow-md: 0 14px 35px rgba(16, 24, 40, .09);
    --shadow-lg: 0 30px 70px rgba(6, 13, 28, .18);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --sidebar: 264px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
    color-scheme: dark;
    --surface: #151e2f;
    --canvas: #0d1422;
    --text: #edf2f7;
    --muted: #9daabd;
    --border: #283449;
    --slate-50: #111b2d;
    --slate-100: #192438;
    --slate-200: #2a374d;
    --slate-700: #c9d3e1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .22);
    --shadow-md: 0 18px 40px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 200; top: 8px; left: 8px; transform: translateY(-150%); border-radius: 8px; background: var(--navy-950); color: white; padding: 10px 16px; }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: 2px; }

/* Acceso */
.login-screen { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(480px, 1.08fr) minmax(440px, .92fr); background: var(--surface); }
.login-visual { position: relative; isolation: isolate; min-height: 100vh; overflow: hidden; background: var(--navy-950); color: #fff; display: flex; flex-direction: column; padding: clamp(32px, 4.8vw, 72px); }
.login-visual::before { content: ""; position: absolute; z-index: -2; inset: 0; background: radial-gradient(circle at 20% 15%, rgba(59, 130, 246, .42), transparent 32%), radial-gradient(circle at 88% 72%, rgba(13, 148, 136, .28), transparent 35%), linear-gradient(145deg, #14213d 0%, #07101f 68%); }
.login-visual::after { content: ""; position: absolute; z-index: -1; width: 540px; height: 540px; right: -170px; top: 9%; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; box-shadow: 0 0 0 90px rgba(255,255,255,.025), 0 0 0 180px rgba(255,255,255,.018); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 760; letter-spacing: -.02em; }
.brand-light { color: #fff; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--blue-600); color: #fff; box-shadow: 0 10px 25px rgba(37,99,235,.32); }
.brand-mark svg { width: 22px; height: 22px; }
.login-copy { margin: auto 0; max-width: 720px; padding: 70px 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--blue-600); font-size: 11px; font-weight: 780; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow svg { width: 15px; height: 15px; }
.login-copy .eyebrow { color: #93c5fd; }
.login-copy h1 { max-width: 700px; margin: 22px 0 22px; font-size: clamp(42px, 5vw, 70px); font-weight: 690; letter-spacing: -.052em; line-height: 1.02; text-wrap: balance; }
.login-copy > p { max-width: 610px; margin: 0; color: rgba(255,255,255,.7); font-size: clamp(17px, 1.7vw, 21px); line-height: 1.65; }
.proof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; max-width: 650px; margin-top: 58px; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: var(--radius); background: rgba(255,255,255,.13); }
.proof-grid div { display: flex; flex-direction: column; gap: 2px; background: rgba(12,24,46,.78); padding: 20px 22px; backdrop-filter: blur(8px); }
.proof-grid strong { font-size: 24px; letter-spacing: -.03em; }
.proof-grid span { color: rgba(255,255,255,.58); font-size: 12px; }
.login-quote { display: flex; align-items: center; gap: 14px; max-width: 660px; color: rgba(255,255,255,.68); font-size: 13px; }
.login-quote p { margin: 0; }
.avatar { display: inline-grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); font-size: 12px; font-weight: 800; }
.login-quote .avatar { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.09); color: white; }
.login-panel { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px clamp(28px, 6vw, 88px); }
.login-card { width: 100%; max-width: 430px; }
.login-mobile-brand { display: none; width: 100%; max-width: 430px; margin-bottom: 50px; }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin: 18px 0 6px; font-size: 30px; line-height: 1.2; letter-spacing: -.035em; }
.login-heading p { margin: 0; color: var(--muted); }
.secure-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--slate-600); padding: 6px 10px; font-size: 11px; font-weight: 720; text-transform: uppercase; letter-spacing: .07em; }
.secure-chip svg { width: 13px; height: 13px; color: var(--emerald-600); }
.field-group { display: block; margin-bottom: 18px; }
.field-group > span:first-child, .form-label { display: block; margin-bottom: 7px; color: var(--slate-700); font-size: 13px; font-weight: 680; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 11px 13px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
input:hover, select:hover, textarea:hover { border-color: var(--slate-300); }
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
input::placeholder, textarea::placeholder { color: var(--slate-400); }
textarea { min-height: 94px; resize: vertical; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 46px; }
.field-icon { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); display: grid; width: 34px; height: 34px; place-items: center; border-radius: 7px; background: transparent; color: var(--slate-500); }
.field-icon:hover { background: var(--slate-100); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; border-radius: var(--radius-sm); padding: 10px 15px; font-weight: 700; transition: transform .16s var(--ease), background .16s, box-shadow .16s; }
.button svg { width: 17px; height: 17px; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-block { width: 100%; }
.button-primary { background: var(--blue-600); color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.18); }
.button-primary:hover { background: var(--blue-700); box-shadow: 0 10px 24px rgba(37,99,235,.25); }
.button-secondary { border: 1px solid var(--border); background: var(--surface); color: var(--slate-700); box-shadow: var(--shadow-sm); }
.button-secondary:hover, .button-ghost:hover { background: var(--slate-50); }
.button-ghost { border: 1px solid var(--border); background: transparent; color: var(--slate-700); }
.button-danger { background: var(--rose-100); color: var(--rose-600); }
.divider { display: flex; align-items: center; gap: 12px; margin: 23px 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 0; color: var(--muted); font-size: 11px; }
.privacy-note svg { width: 13px; height: 13px; }
.first-install-help { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--slate-50); margin-top: 14px; padding: 10px 12px; color: var(--muted); font-size: 11px; }
.first-install-help summary { cursor: pointer; color: var(--slate-700); font-size: 12px; font-weight: 720; }
.first-install-help p { margin: 8px 0 0; }
.first-install-help strong { color: var(--text); }
.login-footer { margin: 54px 0 0; color: var(--muted); font-size: 11px; }
.form-alert { border: 1px solid #fecdd3; border-radius: 8px; background: #fff1f2; color: #be123c; margin: 0 0 16px; padding: 10px 12px; font-size: 13px; }

/* Aplicación */
.app-shell { min-height: 100vh; background: var(--canvas); }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.07); background: var(--navy-950); color: #dce5f1; transition: transform .25s var(--ease); }
.sidebar-head { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.sidebar .brand-mark { width: 35px; height: 35px; border-radius: 9px; }
.sidebar-close { display: none; color: #b8c4d5; }
.household-card { display: flex; align-items: center; gap: 11px; margin: 6px 12px 18px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.045); padding: 10px; }
.household-initial { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: linear-gradient(135deg, var(--blue-600), var(--teal-600)); color: #fff; font-size: 13px; font-weight: 800; }
.household-card > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.household-card small, .user-card small { color: #77869d; font-size: 10px; }
.household-card strong, .user-card strong { overflow: hidden; color: #f5f8fb; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 0 10px 16px; scrollbar-width: thin; }
.nav-section { margin: 18px 10px 7px; color: #607089; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-item { position: relative; width: 100%; display: flex; align-items: center; gap: 11px; border-radius: 8px; background: transparent; color: #96a6bb; margin: 2px 0; padding: 9px 11px; text-align: left; font-size: 13px; font-weight: 620; transition: background .15s, color .15s; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #f5f8fb; }
.nav-item.active { background: rgba(59,130,246,.15); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--blue-500); }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 12px; }
.user-card { display: grid; grid-template-columns: 38px 1fr 34px; align-items: center; gap: 10px; }
.user-card > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.user-card .icon-button { color: #8190a4; }
.main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; z-index: 35; top: 0; height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); padding: 0 clamp(20px, 3vw, 42px); backdrop-filter: blur(12px); }
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-title p { margin: 0 0 1px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .04em; }
.topbar-title h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { position: relative; display: inline-grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 9px; background: transparent; color: var(--slate-600); }
.icon-button:hover { background: var(--slate-100); color: var(--text); }
.icon-button svg { width: 19px; height: 19px; }
.sidebar .sidebar-close { display: none; }
.menu-button { display: none; }
.notification-button span { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--rose-600); }
.search-trigger { width: min(25vw, 235px); display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--slate-50); color: var(--muted); padding: 8px 9px; font-size: 12px; text-align: left; }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger span { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
kbd, .key-button { border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--muted); padding: 1px 5px; font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; box-shadow: 0 1px 0 var(--border); }
.content { max-width: 1580px; margin: 0 auto; padding: clamp(20px, 3vw, 42px); padding-bottom: 90px; }
.mobile-nav { display: none; }

/* Componentes */
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-intro h2 { margin: 0; font-size: clamp(22px, 2.4vw, 29px); letter-spacing: -.04em; }
.page-intro p { max-width: 620px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid rgba(59,130,246,.2); border-radius: var(--radius); background: rgba(59,130,246,.08); margin-bottom: 22px; padding: 11px 15px; color: var(--blue-700); font-size: 12px; }
[data-theme="dark"] .demo-banner { color: #93c5fd; }
.demo-banner strong { font-weight: 760; }
.demo-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 13px; }
.demo-banner a, .demo-banner button { background: transparent; color: inherit; padding: 2px 0; font-size: 11px; font-weight: 740; text-decoration: underline; text-underline-offset: 3px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel, .data-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card { position: relative; overflow: hidden; padding: 19px; }
.metric-card::after { content: ""; position: absolute; width: 80px; height: 80px; right: -30px; top: -34px; border-radius: 50%; background: color-mix(in srgb, var(--accent, var(--blue-600)) 9%, transparent); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-head > span:first-child { color: var(--muted); font-size: 11px; font-weight: 680; letter-spacing: .02em; }
.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--accent, var(--blue-600)) 12%, transparent); color: var(--accent, var(--blue-600)); }
.metric-icon svg { width: 17px; height: 17px; }
.metric-value { margin: 14px 0 2px; font-size: clamp(23px, 2.2vw, 31px); font-weight: 740; letter-spacing: -.045em; }
.metric-note { display: flex; align-items: center; gap: 5px; margin: 0; color: var(--muted); font-size: 10px; }
.metric-note.good { color: var(--emerald-600); }
.metric-note.bad { color: var(--rose-600); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 16px; margin-top: 16px; }
.panel { min-width: 0; padding: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-title h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.text-button { display: inline-flex; align-items: center; gap: 4px; background: transparent; color: var(--blue-600); padding: 3px; font-size: 11px; font-weight: 700; }
.text-button svg { width: 13px; height: 13px; }
.cashflow-chart { width: 100%; height: 225px; overflow: visible; }
.cashflow-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.cashflow-chart .income-area { fill: url(#incomeFill); stroke: none; }
.cashflow-chart .income-line { fill: none; stroke: var(--blue-600); stroke-width: 2.5; }
.cashflow-chart .expense-line { fill: none; stroke: var(--rose-600); stroke-width: 2; stroke-dasharray: 5 5; }
.cashflow-chart circle { fill: var(--surface); stroke-width: 2; }
.chart-legend { display: flex; gap: 18px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-600); }
.legend-dot.expense { background: var(--rose-600); }
.health-score { display: grid; grid-template-columns: 106px 1fr; align-items: center; gap: 18px; }
.score-ring { --score: 50; position: relative; display: grid; width: 106px; height: 106px; place-items: center; border-radius: 50%; background: conic-gradient(var(--score-color, var(--emerald-600)) calc(var(--score) * 1%), var(--slate-100) 0); }
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.score-ring strong { position: relative; font-size: 27px; letter-spacing: -.04em; }
.score-ring small { position: absolute; top: 64px; color: var(--muted); font-size: 9px; }
.health-copy strong { display: block; margin-bottom: 5px; }
.health-copy p { margin: 0; color: var(--muted); font-size: 11px; }
.insight { display: flex; gap: 10px; border-radius: 9px; background: var(--slate-50); margin-top: 18px; padding: 11px; font-size: 11px; }
.insight svg { flex: 0 0 auto; color: var(--blue-600); }
.stack { display: grid; gap: 12px; }
.progress-item { display: grid; gap: 7px; }
.progress-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.progress-label strong { font-size: 12px; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: var(--slate-100); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue-600); }
.progress-track span.warning { background: var(--amber-600); }
.progress-track span.danger { background: var(--rose-600); }
.dashboard-lower { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 16px; margin-top: 16px; }
.category-list { display: grid; gap: 13px; }
.category-row { display: grid; grid-template-columns: 12px minmax(70px, 1fr) minmax(80px, 2fr) auto; align-items: center; gap: 9px; font-size: 11px; }
.category-color { width: 9px; height: 9px; border-radius: 3px; }
.bill-list { display: grid; gap: 4px; }
.bill-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding: 9px 0; }
.bill-row:last-child { border-bottom: 0; }
.date-block { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; background: var(--slate-100); color: var(--slate-700); font-size: 11px; font-weight: 780; line-height: 1; }
.bill-row strong { display: block; font-size: 12px; }
.bill-row small { color: var(--muted); font-size: 10px; }
.bill-row > strong { font-size: 12px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.filter-input { min-width: 210px; padding: 9px 11px; font-size: 12px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--border); margin-bottom: 16px; }
.summary-strip > div { background: var(--surface); padding: 14px 16px; }
.summary-strip span { display: block; color: var(--muted); font-size: 10px; }
.summary-strip strong { display: block; margin-top: 3px; font-size: 17px; letter-spacing: -.025em; }
.table-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: var(--slate-50); color: var(--muted); padding: 10px 14px; text-align: left; font-size: 9px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { border-top: 1px solid var(--border); padding: 12px 14px; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--slate-50); }
.cell-main { min-width: 160px; }
.cell-main strong { display: block; color: var(--text); font-size: 12px; }
.cell-main small { color: var(--muted); font-size: 10px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 720; white-space: nowrap; }
.amount.income { color: var(--emerald-600); }
.amount.expense { color: var(--rose-600); }
.amount.transfer { color: var(--blue-600); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; background: var(--slate-100); color: var(--slate-600); padding: 4px 8px; font-size: 9px; font-weight: 760; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.income, .badge.active, .badge.paid, .badge.good { background: var(--emerald-100); color: #047857; }
.badge.expense, .badge.overdue, .badge.danger { background: var(--rose-100); color: #be123c; }
.badge.transfer, .badge.pending, .badge.info { background: var(--blue-100); color: var(--blue-700); }
.badge.warning { background: var(--amber-100); color: #b45309; }
[data-theme="dark"] .badge.income, [data-theme="dark"] .badge.active, [data-theme="dark"] .badge.paid, [data-theme="dark"] .badge.good { background: rgba(5,150,105,.16); color: #6ee7b7; }
[data-theme="dark"] .badge.expense, [data-theme="dark"] .badge.overdue, [data-theme="dark"] .badge.danger { background: rgba(225,29,72,.16); color: #fda4af; }
[data-theme="dark"] .badge.transfer, [data-theme="dark"] .badge.pending, [data-theme="dark"] .badge.info { background: rgba(37,99,235,.18); color: #93c5fd; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .icon-button { width: 31px; height: 31px; }
.row-actions .icon-button svg { width: 15px; height: 15px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.data-card { padding: 18px; }
.data-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.data-card-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--card-color, var(--blue-600)) 12%, transparent); color: var(--card-color, var(--blue-600)); }
.data-card-icon svg { width: 19px; height: 19px; }
.data-card h3 { margin: 13px 0 2px; font-size: 14px; }
.data-card p { margin: 0; color: var(--muted); font-size: 11px; }
.data-card .big-value { margin-top: 17px; color: var(--text); font-size: 24px; font-weight: 740; letter-spacing: -.04em; }
.data-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); margin-top: 15px; padding-top: 12px; }
.data-card-footer small { color: var(--muted); }
.empty-state { display: grid; min-height: 210px; place-items: center; border: 1px dashed var(--slate-300); border-radius: var(--radius); background: var(--surface); padding: 30px; text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 13px; background: var(--slate-100); color: var(--slate-500); margin: 0 auto 12px; }
.empty-state h3 { margin: 0 0 5px; font-size: 14px; }
.empty-state p { max-width: 370px; margin: 0; color: var(--muted); font-size: 11px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skeleton { position: relative; height: 128px; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(148,163,184,.13), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Informes */
.report-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 20px; }
.donut { --segments: conic-gradient(var(--blue-600) 0 100%); position: relative; width: 146px; height: 146px; border-radius: 50%; background: var(--segments); }
.donut::after { content: ""; position: absolute; inset: 29px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 17px; }
.donut-center small { color: var(--muted); font-size: 9px; }
.report-legend { display: grid; gap: 9px; }
.report-legend div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; font-size: 10px; }
.report-legend i { width: 8px; height: 8px; border-radius: 3px; }

/* Formularios y diálogos */
.modal { width: 100%; max-width: none; height: 100%; max-height: none; border: 0; background: transparent; padding: 0; }
.modal[open] { display: grid; place-items: center; }
.modal::backdrop { background: rgba(3, 10, 24, .63); backdrop-filter: blur(3px); }
.modal-card { width: min(680px, calc(100vw - 28px)); max-height: min(880px, calc(100vh - 40px)); overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-lg); animation: modal-in .2s var(--ease); }
@keyframes modal-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); padding: 18px 20px; }
.modal-head h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.03em; }
.modal-body { max-height: calc(100vh - 150px); overflow-y: auto; padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-group { min-width: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-group small { display: block; color: var(--muted); margin-top: 5px; font-size: 10px; }
.check-group { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.check-group input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.check-group span { font-size: 12px; font-weight: 620; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 16px; }
.search-modal .modal-card { align-self: start; width: min(670px, calc(100vw - 28px)); margin-top: 11vh; }
.search-box { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.search-box svg { color: var(--muted); }
.search-box input { border: 0; background: transparent; padding: 7px 0; font-size: 15px; box-shadow: none; }
.search-results { max-height: 430px; overflow-y: auto; padding: 10px; }
.search-results > p { color: var(--muted); padding: 25px; text-align: center; font-size: 12px; }
.search-result { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; border-radius: 9px; background: transparent; padding: 9px; text-align: left; }
.search-result:hover { background: var(--slate-50); }
.search-result > span:first-child { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; background: var(--slate-100); }
.search-result strong { display: block; font-size: 12px; }
.search-result small { color: var(--muted); font-size: 10px; }
.toast-region { position: fixed; z-index: 150; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 280px; max-width: 380px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); padding: 11px 13px; animation: toast-in .2s var(--ease); pointer-events: auto; }
.toast > span:first-child { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; background: var(--emerald-100); color: var(--emerald-600); }
.toast.error > span:first-child { background: var(--rose-100); color: var(--rose-600); }
.toast strong { display: block; font-size: 11px; }
.toast small { color: var(--muted); font-size: 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
    .login-screen { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { padding: 34px 24px; }
    .login-mobile-brand { display: inline-flex; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .sidebar .sidebar-close, .menu-button { display: inline-grid; }
    .sidebar-overlay { position: fixed; z-index: 45; inset: 0; background: rgba(4,11,24,.52); }
    .main { margin-left: 0; }
    .dashboard-grid, .dashboard-lower, .report-grid { grid-template-columns: 1fr; }
    .search-trigger { width: 42px; justify-content: center; border: 0; background: transparent; }
    .search-trigger span, .search-trigger kbd { display: none; }
}

@media (max-width: 720px) {
    body { font-size: 14px; }
    .topbar { height: 62px; padding: 0 14px; }
    .topbar-title p { display: none; }
    .topbar-title h1 { font-size: 17px; }
    .quick-add span { display: none; }
    .quick-add { width: 38px; min-height: 38px; padding: 0; }
    .content { padding: 18px 14px 92px; }
    .demo-banner { align-items: flex-start; flex-direction: column; gap: 8px; }
    .metric-grid { gap: 9px; }
    .metric-card { padding: 14px; }
    .metric-value { font-size: 20px; }
    .metric-note { display: none; }
    .metric-head > span:first-child { font-size: 10px; }
    .panel { padding: 15px; }
    .page-intro { align-items: flex-start; margin-bottom: 17px; }
    .page-intro p { display: none; }
    .page-intro h2 { font-size: 20px; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-left, .toolbar-right { width: 100%; flex-wrap: wrap; }
    .toolbar-left > label { min-width: 135px; flex: 1; }
    .toolbar-left [data-report-apply] { width: 100%; }
    .filter-input { min-width: 0; flex: 1; }
    .summary-strip { grid-template-columns: repeat(2, 1fr); }
    .card-grid { grid-template-columns: 1fr; }
    .donut-wrap { grid-template-columns: 120px 1fr; gap: 12px; }
    .donut { width: 116px; height: 116px; }
    .donut::after { inset: 23px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full, .form-actions { grid-column: auto; }
    .form-actions .button { flex: 1; }
    .mobile-nav { position: fixed; z-index: 34; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); padding: 5px max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); backdrop-filter: blur(14px); }
    .mobile-nav button { display: grid; gap: 1px; place-items: center; border-radius: 7px; background: transparent; color: var(--muted); padding: 5px 2px; font-size: 8px; }
    .mobile-nav button svg { width: 18px; height: 18px; }
    .mobile-nav button.active { color: var(--blue-600); }
    .toast-region { right: 10px; bottom: 74px; left: 10px; }
    .toast { min-width: 0; width: 100%; }
}

@media (max-width: 430px) {
    .login-panel { justify-content: flex-start; padding: 26px 20px; }
    .login-mobile-brand { margin-bottom: 52px; }
    .login-heading h2 { font-size: 26px; }
    .login-footer { margin-top: auto; padding-top: 40px; text-align: center; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric-icon { width: 29px; height: 29px; }
    .metric-value { font-size: 18px; }
    .health-score { grid-template-columns: 90px 1fr; gap: 12px; }
    .score-ring { width: 88px; height: 88px; }
    .score-ring strong { font-size: 22px; }
    .score-ring small { top: 53px; }
    .modal-card { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 13px; }
    .modal-head, .modal-body { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
