/* ═══════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════ */
:root {
    --bg-app: #ffffff;
    --bg-card: #ffffff;
    --bg-card-rgb: 255,255,255;
    --bg-input: #f7f8fb;
    --ink: #1a1d26;
    --ink-secondary: #5e6278;
    --ink-muted: #9a9cae;
    --border: #e4e6ef;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --accent-rgb: 79,70,229;
    --bg-surface: #f7f8fb;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --orange: #ea580c;
    --orange-bg: #fff7ed;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow: 0 4px 20px rgba(0,0,0,.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.1);
    --transition: .22s cubic-bezier(.4,0,.2,1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-h: 68px;
    --top-bar-h: 45px;
    /* Typography scale */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-xs: .72rem;
    --text-sm: .82rem;
    --text-base: .92rem;
    --text-lg: 1.1rem;
    --text-xl: 1.35rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    /* Spacing scale */
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
}

/* ═══════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg-app);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Dashboard scroll — normal page flow */
body.dashboard-page .page-shell {
    padding: .75rem 1rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; max-width: 100%; }

/* ═══════════════════════════════════════
   TOP NAVBAR (desktop) — HIDDEN for super dynamic app
   ═══════════════════════════════════════ */
.top-nav {
    display: none;
}

.nav-links {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .25rem;
    min-width: auto;
    padding: .5rem 1rem;
    border-radius: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--ink-secondary);
    font-size: .75rem;
    font-weight: 600;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    white-space: nowrap;
}
.nav-item:hover {
    background: var(--bg-input);
    color: var(--accent);
}
.nav-item.active {
    background: var(--accent);
    color: #fff;
}
.nav-item svg {
    width: 20px;
    height: 20px;
}
.nav-item span {
    font-size: .7rem;
}

.menu-btn { display: none; }
.inline-form { display: inline; }

/* ═══════════════════════════════════════
   BOTTOM NAV (mobile super-app)
   ═══════════════════════════════════════ */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05);
    justify-content: space-around; align-items: flex-start; padding-top: .5rem;
}

.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    font-size: .68rem; font-weight: 600; color: var(--ink-muted);
    transition: color var(--transition); -webkit-tap-highlight-color: transparent;
}
.bottom-nav a:hover, .bottom-nav a.active { color: var(--accent); }
.bottom-nav a.active .nav-icon { transform: scale(1.15); }

.nav-icon { width: 26px; height: 26px; transition: transform var(--transition); }

.bottom-nav .fab-add {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff; display: flex; align-items: center; justify-content: center;
    margin-top: -18px;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), .4); font-size: 0;
    border: none; cursor: pointer; padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, box-shadow .15s ease;
}
.bottom-nav .fab-add:active { transform: scale(.9); }
.fab-add .nav-icon { width: 28px; height: 28px; }

/* ═══════════════════════════════════════
   PAGE SHELL
   ═══════════════════════════════════════ */
.page-shell { 
    width: 100%; 
    max-width: 1400px;
    margin: 0 auto; 
    padding: 2rem 1.5rem;
    min-height: 100dvh;
}

.dashboard-root {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-root > .section-gap {
    margin-bottom: 0;
}

.dashboard-scroll-area .tab-content {
    padding-right: .25rem;
}

/* ═══════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════ */
.auth-page {
    min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: radial-gradient(ellipse at 20% 50%, rgba(var(--accent-rgb), .10) 0%, transparent 60%), var(--bg-app);
}

.auth-shell {
    width: min(960px, 100%); display: grid; grid-template-columns: 1fr 1fr;
    border-radius: var(--radius-lg); overflow: hidden;
    background: var(--bg-card); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}

.auth-brand {
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .12), rgba(124,58,237,.08)), var(--bg-card);
    display: flex; flex-direction: column; justify-content: center; gap: .7rem;
}
.auth-brand h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; color: var(--accent); }
.auth-brand p, .auth-brand li { color: var(--ink-secondary); font-size: .92rem; }
.auth-brand ul { list-style: none; display: grid; gap: .5rem; margin-top: .5rem; }
.auth-brand li::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: .55rem; vertical-align: middle; }

.auth-card { padding: 2rem; display: flex; flex-direction: column; justify-content: center; }
.auth-card h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: .3rem; }

/* ═══════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════ */
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: .92rem; font-weight: 600; }
p { margin-bottom: .5rem; }
.muted { color: var(--ink-muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .78rem; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-accent { color: var(--accent); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem;
    box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }

/* KPI CARDS */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }

.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin-bottom: .2rem; }
.kpi-value { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.kpi-sub { font-size: .76rem; color: var(--ink-secondary); margin-top: .15rem; }
.kpi-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-row { display: flex; align-items: center; gap: .75rem; }

/* GRIDS */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }

/* ═══════════════════════════════════════
   INSIGHTS
   ═══════════════════════════════════════ */
.insight-list { display: grid; gap: .6rem; }

.insight {
    display: flex; gap: .7rem; align-items: flex-start;
    padding: .85rem 1rem; border-radius: var(--radius);
    border-left: 4px solid var(--border);
    background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.insight p { margin: 0; font-size: .9rem; line-height: 1.5; }

.insight-success { border-left-color: var(--green); background: var(--green-bg); }
.insight-warning { border-left-color: var(--orange); background: var(--orange-bg); }
.insight-critical { border-left-color: var(--red); background: var(--red-bg); }

.insight-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.insight-success .insight-icon { background: var(--green); color: #fff; }
.insight-warning .insight-icon { background: var(--orange); color: #fff; }
.insight-critical .insight-icon { background: var(--red); color: #fff; }
.insight-icon svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-grid { display: grid; gap: .85rem; grid-template-columns: repeat(2, 1fr); }
.form-grid .wide { grid-column: 1 / -1; }

label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-secondary); }

input, select, textarea {
    font: inherit; width: 100%; padding: .65rem .85rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-input); color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
textarea { resize: vertical; min-height: 72px; }

/* Phone input validation status */
.phone-input-wrap { position: relative; }
.phone-status { display: block; font-size: .75rem; min-height: 1.1em; margin-top: .3rem; transition: color .2s; }
.phone-status-ok { color: var(--green); }
.phone-status-error { color: var(--red); }
.phone-status-loading { color: var(--ink-secondary); }

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn, button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font: inherit; font-weight: 600; font-size: .92rem; padding: .7rem 1.3rem;
    border: none; border-radius: var(--radius-sm); cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:active, button[type="submit"]:active { transform: scale(.97); }

.btn-primary, button[type="submit"] { background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; box-shadow: 0 2px 12px rgba(var(--accent-rgb), .3); }
.btn-primary:hover, button[type="submit"]:hover { box-shadow: 0 4px 20px rgba(var(--accent-rgb), .45); }

.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); }

.btn-ghost { background: transparent; color: var(--ink-secondary); border: none; transition: all var(--transition); }
.btn-ghost:hover { background: var(--bg-input); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; border-radius: 8px; }

.button-link {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: var(--radius-sm);
    font-weight: 600; font-size: .88rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff;
    box-shadow: 0 2px 12px rgba(var(--accent-rgb), .3);
    transition: box-shadow var(--transition), transform var(--transition);
}
.button-link:hover { box-shadow: 0 4px 20px rgba(var(--accent-rgb), .45); color: #fff; }

/* ═══════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════ */
.alert {
    padding: .7rem 1rem; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 500; margin-bottom: .75rem;
    display: flex; align-items: center; gap: .5rem;
    animation: slideDown .3s ease-out;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }

@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); text-align: left; padding: .75rem .65rem; border-bottom: 2px solid var(--border); }
td { padding: .7rem .65rem; border-bottom: 1px solid var(--border); font-size: .88rem; white-space: nowrap; }
tbody tr { transition: background var(--transition); }
tbody tr:nth-child(even) { background: rgba(var(--bg-card-rgb), .5); }
tbody tr:hover { background: var(--accent-light); }

.badge { display: inline-flex; padding: .2rem .55rem; border-radius: var(--radius-full); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge-income { background: var(--green-bg); color: var(--green); }
.badge-expense { background: var(--red-bg); color: var(--red); }
.badge-individual { background: var(--accent-light); color: var(--accent); }
.badge-couple { background: var(--orange-bg); color: var(--orange); }
.badge-recurring { background: var(--accent-light); color: var(--accent); font-size: .65rem; }

/* ═══════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════ */
.progress-track { width: 100%; height: 10px; background: var(--bg-input); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--accent), #7c3aed); transition: width .6s cubic-bezier(.4,0,.2,1); }

/* GOALS */
.goal-list { display: grid; gap: .75rem; }
.goal-card h4 { margin-bottom: .35rem; }
.goal-meta { font-size: .82rem; color: var(--ink-secondary); margin: .35rem 0; }

/* MEMBERS */
.members { display: flex; flex-wrap: wrap; gap: .6rem; }
.member-card { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; }
.member-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .88rem; flex-shrink: 0; }

/* CHARTS */
.chart-container { position: relative; width: 100%; aspect-ratio: 2/1; min-height: 180px; }
.chart-container-donut { position: relative; width: 100%; max-width: 240px; aspect-ratio: 1; margin: 0 auto; }

/* SECTION */
.section-gap { margin-bottom: 1.25rem; }
.stack-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* MONTH PICKER */
.month-picker { display: flex; align-items: flex-end; gap: .5rem; }
.month-picker label { font-size: .82rem; }
.month-picker input[type="month"] { padding: .45rem .65rem; font-size: .88rem; }

/* INVITE CODE */
.invite-banner { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--accent-light); border: 1px dashed var(--accent); margin-bottom: 1rem; flex-wrap: wrap; }
.invite-code { font-family: 'Courier New', monospace; font-size: 1.1rem; font-weight: 800; letter-spacing: .1em; color: var(--accent); background: var(--bg-card); padding: .3rem .65rem; border-radius: 8px; border: 1px solid var(--border); user-select: all; }

/* TABS */
.tabs { display: flex; gap: .25rem; background: var(--bg-input); border-radius: var(--radius-sm); padding: .2rem; margin-bottom: 1rem; }
.tab-btn { flex: 1; padding: .5rem; border: none; background: transparent; border-radius: 8px; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--ink-muted); transition: background var(--transition), color var(--transition); }
.tab-btn.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* TX LIST (mobile cards) */
.tx-list { display: grid; gap: .5rem; }
.tx-item { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: background var(--transition); }
.tx-item:hover { background: var(--accent-light); }
.tx-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tx-icon-expense { background: var(--red-bg); color: var(--red); }
.tx-icon-income { background: var(--green-bg); color: var(--green); }
.tx-icon svg { width: 20px; height: 20px; }
.tx-info { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: .76rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-weight: 700; font-size: .95rem; white-space: nowrap; flex-shrink: 0; }
.tx-amount-expense { color: var(--red); }
.tx-amount-income { color: var(--green); }
.tx-date-header { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); padding: .5rem 0 .15rem; margin-top: .3rem; }

/* ═══════════════════════════════════════
   FORM COMPONENTS
   ═══════════════════════════════════════ */
.form-card { max-width: 560px; margin: 0 auto; }
.form-group { margin-bottom: .85rem; }
.form-label { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-secondary); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .03em; }
.form-control, .form-select { font: inherit; width: 100%; padding: .65rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--ink); transition: border-color var(--transition), box-shadow var(--transition); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }

/* TOGGLE RADIO GROUPS */
.toggle-group { display: flex; gap: .5rem; }
.toggle-option { flex: 1; }
.toggle-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-label { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem .8rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; cursor: pointer; transition: all var(--transition); background: var(--bg-input); color: var(--ink-secondary); text-align: center; }
.toggle-label:hover { border-color: var(--accent); }
.toggle-label.selected, .toggle-option input:checked + .toggle-label { background: var(--accent); color: #fff; border-color: var(--accent); }
.toggle-expense.selected { background: var(--red); border-color: var(--red); }
.toggle-income.selected { background: var(--green); border-color: var(--green); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--ink-muted); }
.empty-state svg { margin: 0 auto .5rem; }

/* ═══════════════════════════════════════
   BUDGET COMPONENTS
   ═══════════════════════════════════════ */
.budget-row { margin-bottom: 1rem; }
.budget-row:last-child { margin-bottom: 0; }
.budget-row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.budget-row-footer { display: flex; justify-content: space-between; align-items: center; margin-top: .25rem; }
.progress-over { background: linear-gradient(90deg, var(--red), #ef4444); }
.progress-warn { background: linear-gradient(90deg, var(--orange), #f59e0b); }

.budget-item { display: flex; align-items: center; justify-content: space-between; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.budget-item:last-child { border-bottom: none; }

/* ═══════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════ */
.profile-header { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.member-avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ═══════════════════════════════════════
   GOAL GRID
   ═══════════════════════════════════════ */
.goal-grid { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
/* UTILITIES */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-sm { gap: .4rem; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .5rem; }
.fw-600 { font-weight: 600; }
.btn-block { width: 100%; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    body { padding-bottom: 0; }
    .top-nav { display: none; }
    .bottom-nav { display: none; }
    .page-shell { padding: .75rem .75rem 1rem; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { padding: 1.5rem; }
    .auth-brand h1 { font-size: 1.3rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
    .kpi { padding: .7rem .8rem; }
    .kpi-value { font-size: 1.1rem; }
    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.05rem; }
    .table-desktop { display: none; }
    .tx-list-mobile { display: grid; }
    body.dashboard-page .page-shell { padding: .5rem .75rem; }
    .dashboard-root { gap: .75rem; }
    .dashboard-scroll-area .tab-content { padding-right: 0; }
}

@media (min-width: 769px) {
    .bottom-nav { display: none; }
    .tx-list-mobile { display: none; }
    .table-desktop { display: block; }
}

/* ANIMATIONS */
/* Removed fadeIn animation for better performance */

/* ═══════════════════════════════════════
   RECURRING MODULE
   ═══════════════════════════════════════ */
.recurring-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
    gap: .75rem;
}
.recurring-item:last-child { border: 0; }
.recurring-info { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 0; }
.recurring-actions { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }

/* ═══════════════════════════════════════
   DEBT MODULE
   ═══════════════════════════════════════ */
.debt-card { transition: var(--transition); }
.debt-card.debt-paid { opacity: .55; }
.debt-actions { flex-wrap: wrap; }
.progress-complete { background: var(--green) !important; }

/* ═══════════════════════════════════════
   FILTER MODULE (Transactions)
   ═══════════════════════════════════════ */
.filter-card { padding: .75rem 1rem; }
.filter-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink);
    list-style: none;
}
.filter-toggle::-webkit-details-marker { display: none; }
.filter-toggle svg { flex-shrink: 0; }
.filter-form { margin-top: .75rem; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
    margin-bottom: .5rem;
}
.filter-actions { display: flex; gap: .5rem; }

/* ═══════════════════════════════════════
   REPORTS & HEALTH SCORE
   ═══════════════════════════════════════ */
.health-score-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.health-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}
.health-ring-svg { width: 100%; height: 100%; }
.health-ring-svg circle { transition: stroke-dashoffset 1.5s ease-in-out; }
.health-score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.health-score-value { font-size: 1.8rem; font-weight: 800; color: var(--ink); }
.health-score-label { font-size: .75rem; color: var(--ink-muted); display: block; }
.health-details { flex: 1; min-width: 200px; }
.health-detail-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 0;
    font-size: .88rem;
    border-bottom: 1px solid var(--border);
}
.health-detail-row:last-child { border: 0; }
.health-detail-row span:last-child { margin-left: auto; }
.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.health-dot-good { background: var(--green); }
.health-dot-warning { background: var(--orange); }
.health-dot-bad { background: var(--red); }

/* Category trend mini bars */
.cat-trend-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}
.cat-trend-row:last-child { border: 0; }
.cat-trend-row > span:first-child { width: 110px; flex-shrink: 0; }
.cat-trend-bars {
    display: flex;
    gap: .25rem;
    flex: 1;
    align-items: flex-end;
    height: 40px;
}
.cat-trend-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.cat-trend-bar {
    width: 100%;
    max-width: 20px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height .3s ease;
}
.cat-trend-month-label { font-size: .6rem; color: var(--ink-muted); margin-top: 2px; }

/* Contribution bars */
.contrib-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.contrib-row:last-child { border: 0; }
.contrib-name { width: 100px; flex-shrink: 0; }
.contrib-bars { flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.contrib-bar-group { display: flex; flex-direction: column; gap: .15rem; }

/* ═══════════════════════════════════════
   KPI CARD (standard)
   ═══════════════════════════════════════ */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.kpi-card .kpi-label { font-size: .78rem; color: var(--ink-muted); font-weight: 500; }
.kpi-card .kpi-value { font-size: 1.25rem; font-weight: 800; }
.kpi-card a { text-decoration: none; }
.kpi-card a:hover { text-decoration: underline; }

/* Deposit form inline */
.deposit-form .form-control { font-size: .82rem; padding: .35rem .5rem; }

@media (max-width: 768px) {
    .health-score-card { flex-direction: column; text-align: center; }
    .health-score-ring { margin: 0 auto; }
    .cat-trend-row { flex-direction: column; align-items: flex-start; gap: .3rem; }
    .cat-trend-row > span:first-child { width: auto; }
    .contrib-row { flex-direction: column; align-items: flex-start; gap: .3rem; }
    .contrib-name { width: auto; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .debt-actions { flex-direction: column; }
}

@media (max-width: 480px) {
    .invite-banner { font-size: .85rem; gap: .5rem; }
    .invite-code { font-size: .95rem; }
    .kpi-value { font-size: 1.1rem; }
    .goal-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   SIMPLE LIST
   ═══════════════════════════════════════ */
.simple-list { list-style: none; display: grid; gap: .4rem; }
.simple-list li { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.simple-list li:last-child { border: 0; }

/* ═══════════════════════════════════════
   ACTION ICON BUTTONS
   ═══════════════════════════════════════ */
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: transparent; border: none; cursor: pointer;
    color: var(--ink-muted); transition: all var(--transition);
}
.btn-icon:hover { background: var(--accent-light); color: var(--accent); }
.btn-icon-danger:hover { background: var(--red-bg); color: var(--red); }

.tx-actions { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }

/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */
.pagination { display: flex; justify-content: center; align-items: center; gap: .35rem; flex-wrap: wrap; }
.pagination-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.2rem; height: 2.2rem; padding: 0 .6rem;
    border-radius: var(--radius-md); font-size: .85rem; font-weight: 500;
    color: var(--ink-secondary); background: var(--bg-card);
    border: 1px solid var(--border); text-decoration: none;
    transition: all var(--transition);
}
.pagination-link:hover:not(.disabled):not(.active) {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.pagination-link.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
    font-weight: 700; pointer-events: none;
}
.pagination-link.disabled { opacity: .4; pointer-events: none; }
.pagination-ellipsis { color: var(--ink-secondary); padding: 0 .25rem; }

/* ═══════════════════════════════════════
   SORTABLE TABLE HEADERS
   ═══════════════════════════════════════ */
.sort-header { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.sort-header:hover { color: var(--accent); }
.sort-icon { font-size: .7rem; opacity: .35; }
.sort-icon.active { opacity: 1; color: var(--accent); }

/* ═══════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .tab-btn:focus-visible, .cta-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}
a:focus-visible { outline-offset: 3px; border-radius: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15);
}
.quick-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-close:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ═══════════════════════════════════════
   DEPOSIT ROW
   ═══════════════════════════════════════ */
.deposit-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .35rem 0; border-bottom: 1px solid var(--border);
}
.deposit-row:last-child { border-bottom: none; }

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */
.toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: 9999;
    display: flex; flex-direction: column; gap: .5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1.25rem; border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn .35s ease-out, toastOut .35s ease-in forwards;
    animation-delay: 0s, 3.5s;
    max-width: 380px;
}
.toast-close { background: none; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; padding: 0 0 0 .5rem; opacity: .7; line-height: 1; }
.toast-close:hover { opacity: 1; }
.toast-success { background: var(--green); color: #fff; }
.toast-error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ═══════════════════════════════════════
   MORE PAGE
   ═══════════════════════════════════════ */
.more-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.more-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--ink);
}
.more-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--accent);
}
.more-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .25rem;
}
.more-icon svg {
    width: 24px;
    height: 24px;
}
.more-icon-green {
    background: var(--green-bg);
    color: var(--green);
}
.more-icon-red {
    background: var(--red-bg);
    color: var(--red);
}
.more-icon-accent {
    background: var(--accent-light);
    color: var(--accent);
}
.more-icon-orange {
    background: var(--orange-bg);
    color: var(--orange);
}
.more-icon-muted {
    background: var(--bg-input);
    color: var(--ink-muted);
}
.more-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}
.more-card p {
    margin: 0;
    flex: 1;
}
@media (max-width: 768px) {
    .more-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════
   DASHBOARD TABS
   ═══════════════════════════════════════ */
.dashboard-tabs {
    display: flex;
    gap: .3rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.dashboard-tabs::-webkit-scrollbar {
    height: 4px;
}
.dashboard-tabs::-webkit-scrollbar-track {
    background: transparent;
}
.dashboard-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--ink-secondary);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn:hover {
    background: var(--bg-input);
    border-color: var(--accent);
    color: var(--accent);
}
.tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.tab-btn svg {
    width: 16px;
    height: 16px;
}

/* tab-content rules moved to bottom for slide transitions */

.hero-balance {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    color: #fff;
    box-shadow: var(--shadow-lg);
}
.balance-label {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .85;
    margin-bottom: .5rem;
}
.balance-amount {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    margin-bottom: .75rem;
}
.balance-positive {
    color: #fff;
}
.balance-negative {
    color: #fee;
}
.balance-details {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .92rem;
    background: rgba(0,0,0,.15);
    border-radius: var(--radius-sm);
    padding: .55rem .85rem;
    margin-top: .25rem;
}
.balance-details strong {
    font-weight: 700;
}
.balance-details .text-green {
    color: #bbf7d0;
}
.balance-details .text-red {
    color: #fecaca;
}
.balance-details .text-orange {
    color: #fed7aa;
}
.balance-details .muted {
    color: rgba(255, 255, 255, .5);
}

.cta-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: var(--radius);
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), .3);
    transition: all var(--transition);
}
.cta-primary:hover {
    box-shadow: 0 6px 30px rgba(var(--accent-rgb), .45);
    transform: translateY(-2px);
    color: #fff;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem .75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 600;
    transition: all var(--transition);
}
.quick-action:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.quick-action-icon svg {
    width: 22px;
    height: 22px;
}
.quick-action-green {
    background: var(--green-bg);
    color: var(--green);
}
.quick-action-red {
    background: var(--red-bg);
    color: var(--red);
}
.quick-action-accent {
    background: var(--accent-light);
    color: var(--accent);
}
.quick-action-orange {
    background: var(--orange-bg);
    color: var(--orange);
}

@media (max-width: 768px) {
    .hero-balance {
        padding: 1.5rem 1rem;
    }
    .balance-amount {
        font-size: 2rem;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .balance-amount {
        font-size: 1.75rem;
    }
    .cta-primary {
        font-size: .95rem;
    }
}

/* ═══════════════════════════════════════
   QUICK-ADD MODAL (bottom-sheet mobile, center desktop)
   ═══════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.45);
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    -webkit-tap-highlight-color: transparent;
}
.modal-overlay.open {
    opacity: 1; visibility: visible;
}
.modal-sheet {
    width: 100%; max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: .5rem 1.25rem 1.5rem;
    max-height: 92dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.32,.72,0,1);
    box-shadow: 0 -8px 40px rgba(0,0,0,.15);
}
.modal-overlay.open .modal-sheet {
    transform: translateY(0);
}
.modal-handle {
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 0 auto .75rem;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.modal-head h2 {
    font-size: 1.15rem; font-weight: 800; margin: 0;
}
.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-input); border: none;
    font-size: 1.3rem; color: var(--ink-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

/* Type toggle pills */
.modal-type-toggle {
    display: flex; gap: .5rem; margin-bottom: 1.25rem;
}
.type-pill { flex: 1; cursor: pointer; }
.type-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill {
    display: flex; align-items: center; justify-content: center;
    padding: .6rem; border-radius: var(--radius-sm);
    font-weight: 700; font-size: .92rem;
    background: var(--bg-input); color: var(--ink-muted);
    border: 2px solid transparent;
    transition: all .18s ease;
}
.type-pill input:checked + .pill-expense {
    background: var(--red-bg); color: var(--red); border-color: var(--red);
}
.type-pill input:checked + .pill-income {
    background: var(--green-bg); color: var(--green); border-color: var(--green);
}

/* Hero amount input */
.modal-amount-wrap {
    display: flex; align-items: baseline; justify-content: center;
    gap: .4rem; margin-bottom: 1.25rem; padding: .5rem 0;
}
.modal-currency {
    font-size: 1.4rem; font-weight: 700; color: var(--ink-muted);
}
.modal-amount-input {
    border: none; background: transparent;
    font-size: 3rem; font-weight: 800;
    text-align: center; width: 100%; max-width: 220px;
    color: var(--ink);
    padding: 0; letter-spacing: -.03em;
    caret-color: var(--accent);
}
.modal-amount-input::placeholder { color: var(--border); }
.modal-amount-input:focus { outline: none; box-shadow: none; border: none; }

/* Category icon grid */
.modal-section { margin-bottom: 1rem; }
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .45rem;
    max-height: 240px;
    overflow-y: auto;
    padding: .15rem;
    scrollbar-width: thin;
}
.cat-grid::-webkit-scrollbar { width: 4px; }
.cat-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.cat-item { cursor: pointer; }
.cat-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.cat-cell {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .5rem .2rem;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1.5px solid transparent;
    transition: all .15s ease;
}
.cat-icon { font-size: 1.35rem; line-height: 1; }
.cat-name {
    font-size: .62rem; font-weight: 600; line-height: 1.15;
    color: var(--ink-secondary); text-align: center;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cat-cell:hover { border-color: var(--accent); }
.cat-item input:checked + .cat-cell {
    background: var(--accent); border-color: var(--accent);
}
.cat-item input:checked + .cat-cell .cat-name { color: #fff; }
.cat-item.cat-hidden { display: none; }

/* Scope toggle */
.modal-row { margin-bottom: 1rem; }
.scope-toggle { display: flex; gap: .5rem; }
.scope-opt { flex: 1; cursor: pointer; }
.scope-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.scope-label {
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .55rem .5rem;
    border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 600;
    background: var(--bg-input); color: var(--ink-secondary);
    border: 1.5px solid transparent;
    transition: all .15s ease;
}
.scope-label svg { flex-shrink: 0; }
.scope-opt input:checked + .scope-label {
    background: var(--accent-light); color: var(--accent); border-color: var(--accent);
}

/* Date + description */
.modal-extras {
    display: flex; gap: .6rem; margin-bottom: 1.25rem;
}
.modal-extra-field { display: flex; flex-direction: column; gap: .25rem; }
.modal-extra-field label { font-size: .75rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .03em; }
.modal-extra-field input {
    padding: .5rem .65rem; font-size: .85rem;
    border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--bg-input); color: var(--ink);
}
.modal-extra-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.1); }
.modal-extra-grow { flex: 1; }

/* Simple form fields for goal/debt/recurring/budget modals */
.modal-field { 
    display: flex; flex-direction: column; gap: .35rem; 
    margin-bottom: 1rem;
}
.modal-field label { 
    font-size: .8rem; font-weight: 700;
    color: var(--ink-muted); text-transform: uppercase;
    letter-spacing: .02em;
}
.modal-field input,
.modal-field select {
    padding: .6rem .75rem; font-size: .95rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-input); color: var(--ink);
    font-family: inherit;
}
.modal-field input:focus,
.modal-field select:focus { 
    border-color: var(--accent); outline: none; 
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.1);
}

/* Submit button */
.modal-submit {
    width: 100%; padding: .85rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff; border: none; border-radius: var(--radius-sm);
    font: inherit; font-size: 1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb),.3);
    transition: all .2s ease;
}
.modal-submit:hover { box-shadow: 0 6px 30px rgba(var(--accent-rgb),.45); transform: translateY(-1px); }
.modal-submit:active { transform: scale(.98); }
.modal-submit:disabled { opacity: .6; pointer-events: none; }

.modal-submit-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 20px rgba(220,38,38,.28);
}
.modal-submit-danger:hover {
    box-shadow: 0 6px 28px rgba(220,38,38,.38);
}

.toast-action {
    margin-left: .5rem;
    border: 1px solid rgba(255,255,255,.35);
    background: transparent;
    color: inherit;
    padding: .15rem .45rem;
    border-radius: 6px;
    font: inherit;
    font-size: .75rem;
    cursor: pointer;
}

.skeleton-stack { display: grid; gap: .6rem; }
.skeleton-item {
    height: 66px;
    border-radius: 12px;
    background: linear-gradient(90deg, #f3f4f6 25%, #eceff3 37%, #f3f4f6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.1s infinite linear;
    border: 1px solid var(--border);
}
@keyframes shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

.command-palette-sheet { max-width: 620px; }
.command-list {
    max-height: min(46dvh, 360px);
    overflow: auto;
    display: grid;
    gap: .35rem;
}
.command-item {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 10px;
    padding: .65rem .75rem;
    font: inherit;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.command-item:hover,
.command-item.active {
    border-color: var(--accent);
    background: var(--accent-light);
}
.command-kbd {
    font-size: .72rem;
    color: var(--ink-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .1rem .35rem;
    background: var(--bg-input);
}

/* Success state */
.modal-submit.success {
    background: var(--green); box-shadow: 0 4px 20px rgba(22,163,74,.3);
}

/* Desktop: centered card instead of bottom-sheet */
@media (min-width: 769px) {
    .modal-overlay { align-items: center; }
    .modal-sheet {
        border-radius: var(--radius-lg);
        max-width: 440px;
        transform: translateY(30px) scale(.97);
        max-height: 85vh;
    }
    .modal-overlay.open .modal-sheet {
        transform: translateY(0) scale(1);
    }
    .modal-handle { display: none; }
}

@media (max-width: 480px) {
    .modal-amount-input { font-size: 2.5rem; }
    .modal-extras { flex-direction: column; }
}

/* CTA as button (not link) */
button.cta-primary {
    width: 100%; border: none; cursor: pointer;
    font: inherit;
}

/* ═══════════════════════════════════════
   40 PREMIUM IMPROVEMENTS
   ═══════════════════════════════════════ */

/* #2 — Card styling */
.card {
    transition: border-color var(--transition);
}

/* #3 — Input focus micro-interaction */
.modal-field:focus-within label {
    color: var(--accent);
}

/* #4 — Bottom nav bar (mobile) */
@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    .page-shell { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + .5rem); }
    body.dashboard-page .page-shell { padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); }
}

/* #5 — FAB floating (mobile dashboard) */
.fab-dashboard {
    display: none;
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 1rem);
    right: 1rem;
    z-index: 190;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    align-items: center; justify-content: center;
    border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb),.4);
    transition: transform .15s ease, box-shadow .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.fab-dashboard:active { transform: scale(.88); }
.fab-dashboard svg { width: 28px; height: 28px; }
@media (max-width: 768px) {
    .fab-dashboard { display: flex; }
    .cta-primary-section { display: none; }
}

/* #6 — Tab badge counters */
.tab-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; border-radius: 9px;
    background: rgba(255,255,255,.25);
    font-size: .62rem; font-weight: 700;
    padding: 0 5px; margin-left: 4px;
    line-height: 1;
}
.tab-btn:not(.active) .tab-badge {
    background: var(--accent-light); color: var(--accent);
}

/* #7 — Offline indicator */
.offline-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
    padding: .5rem 1rem;
    background: var(--red); color: #fff;
    text-align: center; font-size: .82rem; font-weight: 600;
    transform: translateY(-100%);
    transition: transform .3s ease;
}
.offline-bar.visible { transform: translateY(0); }

/* #8 — Session timeout warning */
.timeout-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9998;
    padding: .5rem 1rem;
    background: var(--orange); color: #fff;
    text-align: center; font-size: .82rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    transform: translateY(-100%);
    transition: transform .3s ease;
}
.timeout-bar.visible { transform: translateY(0); }
.timeout-bar button {
    background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
    color: #fff; padding: .2rem .6rem; border-radius: 6px;
    cursor: pointer; font: inherit; font-size: .78rem;
}

/* #9 — Budget alert (static red border) */
.budget-over-pulse {
    box-shadow: 0 0 0 2px rgba(220,38,38,.25);
}

/* #10 — Confetti (removed) */
/* #11 — Print stylesheet */
@media print {
    .bottom-nav, .fab-dashboard, .modal-overlay, .toast-container,
    .offline-bar, .timeout-bar, .cta-primary, .inline-edit, .inline-delete,
    .btn-sm, .tip-card, .copy-btn,
    .scroll-top-btn, .quick-pills, .weekly-banner, .dash-search,
    .ptr-indicator, .scroll-progress, .notification-bell,
    canvas { display: none !important; }
    body { font-size: 12pt; color: #000 !important; background: #fff !important; position: static !important; overflow: auto !important; line-height: 1.6; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
    .hero-balance { background: #f0f0f0 !important; color: #000 !important; }
    .balance-amount, .balance-details span, .balance-details .text-green,
    .balance-details .text-red, .balance-details .text-orange { color: #000 !important; }
    .page-shell { padding: 0; max-width: 100%; }
    table { page-break-inside: avoid; }
    tr { page-break-inside: avoid; }
    a[href]::after { content: " (" attr(href) ")"; font-size: .8em; color: #666; }
    a[href^="/"]::after, a[href^="#"]::after, a[href^="javascript"]::after { content: none; }
    .tx-item { break-inside: avoid; border-bottom: 1px solid #ddd; }
    * { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; }
}

/* #12 — Trend comparison arrows */
.trend-up, .trend-down {
    font-size: .72rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: .1rem;
}
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-neutral { color: var(--ink-muted); font-size: .72rem; }

/* #13 — Pull to refresh indicator */
.ptr-indicator {
    text-align: center; padding: .5rem;
    color: var(--accent); font-size: .82rem; font-weight: 600;
    height: 0; overflow: hidden;
    transition: height .2s, opacity .2s;
    opacity: 0;
}
.ptr-indicator.visible { height: 36px; opacity: 1; }

/* #14 — Loading spinner button */
.btn-loading {
    position: relative; color: transparent !important; pointer-events: none;
}
.btn-loading::after {
    content: ''; position: absolute;
    width: 18px; height: 18px; top: 50%; left: 50%;
    margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%;
    animation: btnSpin .6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* #15 — Scroll progress bar */
.scroll-progress {
    position: sticky; top: 0; height: 2px;
    background: var(--accent);
    transform-origin: left; transform: scaleX(0);
    transition: transform 60ms; z-index: 10; border-radius: 1px;
}

/* #16 — Improved empty states */
.empty-state svg { opacity: .3; }
.empty-hint {
    font-size: .78rem; color: var(--ink-muted);
    margin-top: .35rem; font-style: italic;
}

/* #17 — Savings tip card */
.tip-card {
    background: linear-gradient(135deg, var(--accent-light), rgba(124,58,237,.06));
    border: 1px dashed var(--accent);
    border-radius: var(--radius); padding: .75rem 1rem;
    font-size: .82rem; color: var(--ink);
    display: flex; align-items: flex-start; gap: .6rem;
    margin-bottom: .75rem;
}
.tip-card strong { color: var(--accent); }
.tip-icon { flex-shrink: 0; width: 24px; height: 24px; color: var(--accent); }

/* #18 — Copy button */
.copy-btn {
    background: transparent; border: 1px solid var(--accent);
    color: var(--accent); padding: .1rem .4rem;
    border-radius: 6px; cursor: pointer;
    font-size: .7rem; font-weight: 600;
    transition: all var(--transition);
    margin-left: .35rem;
}
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn.copied { background: var(--green); border-color: var(--green); color: #fff; }

/* #19 — ETA badge */
.eta-badge {
    font-size: .72rem; color: var(--accent); font-weight: 600;
    display: inline-flex; align-items: center; gap: .2rem;
}

/* #20 — Improved modal spring animation */
.modal-sheet {
    transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}

/* #21 — Skeleton variety */
.skeleton-row {
    display: flex; align-items: center; gap: .75rem;
}
.skeleton-circle {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(90deg, #f3f4f6 25%, #eceff3 37%, #f3f4f6 63%);
    background-size: 400% 100%; animation: shimmer 1.1s infinite linear;
}
.skeleton-line {
    height: 14px; border-radius: 7px; flex: 1;
    background: linear-gradient(90deg, #f3f4f6 25%, #eceff3 37%, #f3f4f6 63%);
    background-size: 400% 100%; animation: shimmer 1.1s infinite linear;
}
.skeleton-line-short { max-width: 60%; }

/* #22 — Inline form validation (enhanced) */
.field-error {
    font-size: .72rem; color: var(--red); margin-top: .15rem;
    display: flex; align-items: center; gap: .25rem;
    animation: slideDownError .25s ease-out;
}
.field-error::before { content: '⚠'; font-weight: 700; font-size: .65rem; }
@keyframes slideDownError {
    from { opacity: 0; transform: translateY(-4px); max-height: 0; }
    to { opacity: 1; transform: translateY(0); max-height: 2rem; }
}
input.invalid, select.invalid {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220,38,38,.12);
    animation: fieldShake .4s ease-in-out;
}
@keyframes fieldShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}
input.valid, select.valid {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}

/* #23 — Quick deposit form */
.quick-deposit {
    display: flex; gap: .35rem; margin-top: .5rem;
}
.quick-deposit input {
    flex: 1; padding: .3rem .5rem; font-size: .82rem;
    border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--bg-input);
}
.quick-deposit button {
    padding: .3rem .55rem; font-size: .75rem; white-space: nowrap;
}

/* #24 — Spending streak */
.streak-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .15rem .5rem; border-radius: var(--radius-full);
    background: var(--green-bg); color: var(--green);
    font-size: .7rem; font-weight: 700;
}

/* #25 — Payoff months badge */
.payoff-badge {
    font-size: .72rem; color: var(--orange); font-weight: 600;
}

/* ============================
   PREMIUM v3 STYLES
   ============================ */

/* Top bar with notification bell */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem 1rem; position: sticky; top: 0; z-index: 50;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.top-bar-left { display: flex; align-items: center; gap: .5rem; }
.top-bar-back { display: none; align-items: center; gap: .35rem; }
.top-bar-page-title { font-size: .9rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }

/* Desktop navigation inside top-bar */
.desktop-nav { display: none; align-items: center; gap: .25rem; }
.desktop-nav a {
    padding: .4rem .75rem; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 600; color: var(--ink-muted);
    text-decoration: none; transition: color .15s, background .15s;
    white-space: nowrap;
}
.desktop-nav a:hover { color: var(--ink); background: var(--bg-input); }
.desktop-nav a.active { color: var(--accent); background: rgba(99, 102, 241, .08); }

/* Mobile sub-page top-bar: show back+title, hide avatar */
@media (max-width: 768px) {
    .top-bar--sub .top-bar-left { display: none; }
    .top-bar--sub .top-bar-back { display: flex; }
}

/* Desktop: show nav, always show avatar */
@media (min-width: 769px) {
    .desktop-nav { display: flex; }
    .top-bar-back { display: none !important; }
    .top-bar { padding: .5rem 1.5rem; }
}
.top-bar-greeting { font-size: .85rem; font-weight: 600; color: var(--ink); }
.top-bar-right { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-input); border: none; cursor: pointer;
    color: var(--ink); transition: background .2s;
    position: relative; text-decoration: none;
}
.icon-btn:hover { background: var(--border); }
.notification-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--red); border: 2px solid var(--bg-surface);
}

/* Notification cards */
.notification-card { transition: background .2s, border .2s; }
.notification-unread {
    border-left: 3px solid var(--accent);
    background: rgba(99, 102, 241, .04);
}

/* Page transitions (#18 — removed for instant load) */

/* Badges grid (#37) */
.badges-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
}
.badge-card {
    padding: .75rem; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border); text-align: center;
    transition: transform .2s, box-shadow .2s;
}
.badge-card:hover { transform: translateY(-2px); }
.badge-unlocked {
    border-color: var(--accent);
    background: rgba(99, 102, 241, .04);
}
.badge-locked { opacity: .45; filter: grayscale(1); }
.badge-icon { font-size: 2rem; margin-bottom: .35rem; }
.badge-name { font-size: .85rem; font-weight: 700; margin-bottom: .15rem; }
.badge-desc { line-height: 1.3; }
.badge-date { color: var(--accent); margin-top: .25rem; }

/* Gamification level */
.gamification-level {
    font-size: 1.4rem; font-weight: 800;
    color: var(--accent); letter-spacing: -.02em;
}
.gamification-xp {
    font-size: 1rem; font-weight: 600;
    color: var(--ink-muted);
}

/* Challenge cards (#39) */
.challenge-card { transition: transform .2s, border-color .2s; }
.challenge-complete {
    border-color: var(--green);
    background: rgba(16, 185, 129, .04);
}

/* Health score (#6) */
.health-score-big {
    font-size: 3rem; font-weight: 800; color: var(--accent);
    line-height: 1; margin: .5rem 0;
}
.health-sub {
    padding: .5rem; background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* Tags chip (#16) */
.tag-chip {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .25rem .65rem; border-radius: var(--radius-full);
    background: var(--accent); color: #fff;
    font-size: .8rem; font-weight: 600;
}
.tag-delete {
    background: none; border: none; color: rgba(255,255,255,.7);
    cursor: pointer; font-size: .85rem; padding: 0; line-height: 1;
}
.tag-delete:hover { color: #fff; }

/* Section title */
.section-title {
    font-size: 1rem; font-weight: 700; color: var(--ink);
    margin-bottom: .5rem; letter-spacing: -.01em;
}

/* Range slider (#56) */
.range-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; border-radius: 3px;
    background: var(--bg-input); outline: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

/* Amortization table (#59) */
.amort-table { border-collapse: collapse; }
.amort-table th {
    background: var(--bg-input); padding: .35rem .5rem;
    text-align: left; font-weight: 700; font-size: .75rem;
    border-bottom: 2px solid var(--border);
}
.amort-table td {
    padding: .3rem .5rem; border-bottom: 1px solid var(--border);
    font-size: .78rem;
}
.amort-table tr:hover td { background: rgba(99, 102, 241, .03); }

/* Badge/pill helpers */
.badge {
    display: inline-flex; padding: .1rem .45rem;
    border-radius: var(--radius-full); background: var(--bg-input);
    font-size: .72rem; font-weight: 600; color: var(--ink-muted);
}
.text-xs { font-size: .75rem; }
.text-orange { color: var(--orange); }

/* Hidden utility */
.hidden { display: none !important; }

/* ETA badge for goals */
.eta-badge {
    font-size: .72rem; color: var(--accent); font-weight: 600;
}

/* More grid enhancements */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }

/* Focus mode (#19) */
.focus-mode .card:not(.focus-highlight),
.focus-mode .more-card:not(.focus-highlight) {
    opacity: .3; filter: grayscale(.5);
    pointer-events: none; transition: all .3s;
}

/* Onboarding wizard (#11) */
.onboarding-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.onboarding-card {
    background: var(--bg-surface); border-radius: var(--radius);
    padding: 2rem; max-width: 420px; width: 90%;
    text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.onboarding-step { margin-bottom: 1rem; }
.onboarding-dots { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }
.onboarding-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); transition: background .2s;
}
.onboarding-dot.active { background: var(--accent); }

/* Weekly bars in report */
.weekly-bars { padding-bottom: .5rem; }

/* Budget exceeded animation */

/* ═══════════════════════════════════════
   AVATAR INITIALS
   ═══════════════════════════════════════ */
.avatar-initials {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff; font-size: .7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: .02em; flex-shrink: 0;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════
   QUICK ACTION PILLS
   ═══════════════════════════════════════ */
.quick-pills {
    display: flex; gap: .5rem; overflow-x: auto;
    padding: .25rem 0; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.quick-pills::-webkit-scrollbar { display: none; }
.quick-pill {
    display: flex; align-items: center; gap: .35rem;
    padding: .5rem .85rem; border-radius: var(--radius-full);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--ink-secondary); font-size: .78rem; font-weight: 600;
    white-space: nowrap; cursor: pointer; text-decoration: none;
    transition: all var(--transition); flex-shrink: 0;
}
.quick-pill:hover, .quick-pill:active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}
.quick-pill svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ═══════════════════════════════════════
   SPENDING VELOCITY WIDGET
   ═══════════════════════════════════════ */
.velocity-strip {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 1rem; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: .82rem; color: var(--ink-secondary);
}
.velocity-strip .velocity-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.velocity-strip .velocity-icon.pace-good { background: var(--green-bg); color: var(--green); }
.velocity-strip .velocity-icon.pace-warn { background: var(--orange-bg); color: var(--orange); }
.velocity-strip .velocity-icon.pace-bad { background: var(--red-bg); color: var(--red); }
.velocity-strip strong { color: var(--ink); }

/* ═══════════════════════════════════════
   FINANCIAL HEALTH SCORE
   ═══════════════════════════════════════ */
.health-widget {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1rem; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border);
}
.health-ring {
    width: 48px; height: 48px; position: relative; flex-shrink: 0;
}
.health-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.health-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.health-ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.health-ring-label {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 800; color: var(--ink);
}
.health-info { flex: 1; min-width: 0; }
.health-title { font-size: .82rem; font-weight: 700; color: var(--ink); margin-bottom: .15rem; }
.health-desc { font-size: .72rem; color: var(--ink-muted); line-height: 1.3; }

/* Health score colors */
.health-excellent .health-ring-fg { stroke: var(--green); }
.health-good .health-ring-fg { stroke: #22d3ee; }
.health-fair .health-ring-fg { stroke: var(--orange); }
.health-poor .health-ring-fg { stroke: var(--red); }

/* ═══════════════════════════════════════
   MINI CHART CONTAINER
   ═══════════════════════════════════════ */
.dash-chart-wrap {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .75rem;
    margin-bottom: .5rem;
}
.dash-chart-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .5rem;
}
.dash-chart-title { font-size: .82rem; font-weight: 700; color: var(--ink); }
.dash-chart-canvas { width: 100%; max-height: 160px; }

/* ═══════════════════════════════════════
   CATEGORY EMOJIS
   ═══════════════════════════════════════ */
.cat-emoji {
    font-size: 1.1rem; line-height: 1; flex-shrink: 0;
}
.tx-item .cat-emoji {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════
   ENHANCED EMPTY STATES
   ═══════════════════════════════════════ */
.empty-state .btn {
    margin-top: .75rem;
}

/* ═══════════════════════════════════════
   SCROLL-TO-TOP BUTTON
   ═══════════════════════════════════════ */
.scroll-top-btn {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 4.5rem);
    right: 1rem;
    z-index: 180;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--ink-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0; transform: translateY(10px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
}
.scroll-top-btn.visible {
    opacity: 1; transform: translateY(0); pointer-events: auto;
}
.scroll-top-btn:hover { background: var(--accent-light); color: var(--accent); }
.scroll-top-btn svg { width: 20px; height: 20px; }

/* ═══════════════════════════════════════
   ACCENT COLOR PICKER
   ═══════════════════════════════════════ */
.color-picker-row {
    display: flex; gap: .5rem; flex-wrap: wrap; padding: .25rem 0;
}
.color-swatch {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    border: 3px solid transparent; transition: all .2s;
    position: relative;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--ink);
}
.color-swatch.active::after {
    content: '✓'; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .7rem; font-weight: 700;
}

/* ═══════════════════════════════════════
   PROGRESS RING (BUDGETS)
   ═══════════════════════════════════════ */
.budget-ring-wrap {
    display: flex; align-items: center; gap: .75rem;
}
.budget-ring {
    width: 40px; height: 40px; flex-shrink: 0;
}
.budget-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.budget-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.budget-ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.budget-ring-fg.safe { stroke: var(--green); }
.budget-ring-fg.warn { stroke: var(--orange); }
.budget-ring-fg.over { stroke: var(--red); }

/* ═══════════════════════════════════════
   STREAK COUNTER
   ═══════════════════════════════════════ */
.streak-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .6rem; border-radius: var(--radius-full);
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff; font-size: .72rem; font-weight: 700;
    box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.streak-badge .streak-fire { font-size: .85rem; }

/* ═══════════════════════════════════════
   SPARKLINE INLINE
   ═══════════════════════════════════════ */
.sparkline-wrap {
    display: inline-flex; align-items: flex-end; gap: 1px;
    height: 20px; vertical-align: middle;
}
.sparkline-bar {
    width: 3px; border-radius: 1px;
    background: rgba(var(--accent-rgb), .4);
    transition: height .3s ease;
}
.sparkline-bar:last-child {
    background: var(--accent);
}

/* ═══════════════════════════════════════
   TAB SLIDE TRANSITIONS
   ═══════════════════════════════════════ */
.tab-content {
    display: none;
    opacity: 0;
    --slide-dir: 8px;
}
.tab-content.active {
    display: block;
    animation: tabSlideIn .28s ease-out forwards;
}
@keyframes tabSlideIn {
    from { opacity: 0; transform: translateX(var(--slide-dir, 8px)); }
    to { opacity: 1; transform: translateX(0); }
}
.tab-content.tab-exit {
    animation: tabSlideOut .15s ease-in forwards;
}
@keyframes tabSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(var(--slide-dir, -8px)); }
}

/* ═══════════════════════════════════════
   DASHBOARD SEARCH BAR
   ═══════════════════════════════════════ */
.dash-search {
    position: relative; margin-bottom: var(--space-3);
}
.dash-search-input {
    width: 100%; padding: .6rem .75rem .6rem 2.25rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--ink);
    font-size: var(--text-sm); font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.dash-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
}
.dash-search-input::placeholder { color: var(--ink-muted); }
.dash-search-icon {
    position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--ink-muted); pointer-events: none;
}

/* ═══════════════════════════════════════
   GLOBAL DASHBOARD SKELETON
   ═══════════════════════════════════════ */
.dash-skeleton {
    display: flex; flex-direction: column; gap: var(--space-4);
    padding: var(--space-4);
}
.skel-hero {
    height: 160px; border-radius: var(--radius-lg);
    background: linear-gradient(90deg, var(--bg-input) 0%, var(--border) 50%, var(--bg-input) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}
.skel-row {
    display: flex; gap: var(--space-3);
}
.skel-pill {
    height: 36px; width: 90px; border-radius: var(--radius-full);
    background: var(--bg-input);
    animation: shimmer 1.2s linear infinite;
}
.skel-card {
    height: 70px; border-radius: var(--radius-sm);
    background: var(--bg-input);
    animation: shimmer 1.2s linear infinite;
}

/* ═══════════════════════════════════════
   INCOME vs EXPENSE MINI BARS
   ═══════════════════════════════════════ */
.ie-compare {
    display: flex; gap: var(--space-3); align-items: stretch;
}
.ie-bar-wrap {
    flex: 1; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: var(--space-3);
    display: flex; flex-direction: column; gap: var(--space-1);
}
.ie-bar-label {
    font-size: var(--text-xs); font-weight: 600;
    color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em;
}
.ie-bar-amount {
    font-size: var(--text-lg); font-weight: 800; color: var(--ink);
}
.ie-bar-track {
    height: 6px; border-radius: 3px; background: var(--bg-input);
    overflow: hidden; margin-top: auto;
}
.ie-bar-fill {
    height: 100%; border-radius: 3px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
}
.ie-bar-fill.income { background: var(--green); }
.ie-bar-fill.expense { background: var(--red); }

/* ═══════════════════════════════════════
   BUDGET MINI PROGRESS BARS (DASHBOARD)
   ═══════════════════════════════════════ */
.budget-mini {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) 0;
}
.budget-mini-label {
    font-size: var(--text-sm); font-weight: 600;
    color: var(--ink); min-width: 80px;
}
.budget-mini-track {
    flex: 1; height: 8px; border-radius: 4px;
    background: var(--bg-input); overflow: hidden;
}
.budget-mini-fill {
    height: 100%; border-radius: 4px;
    transition: width .5s ease;
}
.budget-mini-fill.safe { background: var(--green); }
.budget-mini-fill.warn { background: var(--orange); }
.budget-mini-fill.over { background: var(--red); }
.budget-mini-pct {
    font-size: var(--text-xs); font-weight: 700;
    min-width: 36px; text-align: right; color: var(--ink-secondary);
}

/* ═══════════════════════════════════════
   HEALTH SCORE TOOLTIP
   ═══════════════════════════════════════ */
.health-widget {
    cursor: pointer; position: relative;
}
.health-tooltip {
    display: none; position: absolute;
    bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: var(--space-3);
    box-shadow: var(--shadow); z-index: 100;
    font-size: var(--text-xs); color: var(--ink-secondary);
    white-space: nowrap; min-width: 180px;
}
.health-tooltip::after {
    content: ''; position: absolute;
    top: 100%; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--border);
}
.health-widget:hover .health-tooltip,
.health-widget:focus .health-tooltip {
    display: block;
    animation: tooltipIn .2s ease-out;
}
@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.health-factor {
    display: flex; justify-content: space-between; padding: 2px 0;
}
.health-factor-good { color: var(--green); }
.health-factor-bad { color: var(--red); }

/* ═══════════════════════════════════════
   WEEKLY SUMMARY BANNER
   ═══════════════════════════════════════ */
.weekly-banner {
    background: linear-gradient(135deg, var(--accent-light), rgba(var(--accent-rgb), .08));
    border: 1px solid rgba(var(--accent-rgb), .15);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    display: flex; align-items: center; gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.weekly-banner-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 1.1rem;
}
.weekly-banner-body {
    flex: 1; min-width: 0; font-size: var(--text-sm);
    color: var(--ink); line-height: 1.4;
}
.weekly-banner-text {
    flex: 1; min-width: 0;
}
.weekly-banner-title {
    font-size: var(--text-sm); font-weight: 700; color: var(--ink);
    margin-bottom: 2px;
}
.weekly-banner-desc {
    font-size: var(--text-xs); color: var(--ink-secondary);
}
.weekly-banner-dismiss {
    background: none; border: none; cursor: pointer;
    color: var(--ink-muted); padding: var(--space-1);
}
.weekly-banner-close {
    background: none; border: none; cursor: pointer;
    color: var(--ink-muted); font-size: 1.3rem; line-height: 1;
    padding: var(--space-1); opacity: .6; transition: opacity .15s;
}
.weekly-banner-close:hover { opacity: 1; }

/* ═══════════════════════════════════════
     MONTH COMPARISON BADGES
   ═══════════════════════════════════════ */
.month-diff-badge {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .15rem .45rem; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
}
.month-diff-badge.up {
    background: var(--green-bg); color: var(--green);
}
.month-diff-badge.down {
    background: var(--red-bg); color: var(--red);
}

/* ═══════════════════════════════════════
   GREETING TIME-BASED EMOJI
   ═══════════════════════════════════════ */
.greeting-emoji {
    font-size: 1.1rem; vertical-align: middle; margin-right: .2rem;
}

/* ═══════════════════════════════════════
   RESPONSIVE FIXES FOR NEW WIDGETS
   ═══════════════════════════════════════ */
@media (max-width: 480px) {
    .ie-compare { flex-direction: column; }
    .velocity-strip { font-size: .75rem; }
    .health-tooltip { left: 0; transform: none; }
    .health-tooltip::after { left: 24px; transform: none; }
}

/* ═══════════════════════════════════════
   PREMIUM v6 — ACCESSIBILITY & POLISH
   ═══════════════════════════════════════ */

/* ─── Reduced Motion (a11y) ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}

/* ─── Skip navigation link ─── */
.skip-link {
    position: absolute; top: -40px; left: 0;
    background: var(--accent); color: #fff;
    padding: .5rem 1rem; z-index: 10001;
    font-weight: 600; font-size: var(--text-sm);
    border-radius: 0 0 var(--radius-sm) 0;
    transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ─── Enhanced link transitions ─── */
a {
    transition: color var(--transition), opacity var(--transition);
}

/* ─── Input transitions ─── */
input, select, textarea {
    transition: border-color var(--transition), box-shadow var(--transition);
}

/* ─── Badge pop animation ─── */
@keyframes badgePop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.tab-badge-count {
    animation: badgePop .35s cubic-bezier(.34,1.56,.64,1);
}
.badge, .badge-income, .badge-expense, .badge-individual, .badge-couple {
    animation: badgePop .3s cubic-bezier(.34,1.56,.64,1);
}

/* ─── Card entrance micro-interaction ─── */
@keyframes cardFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.card {
    animation: cardFadeUp .4s ease-out both;
}
.section-gap:nth-child(2) .card { animation-delay: .05s; }
.section-gap:nth-child(3) .card { animation-delay: .1s; }
.section-gap:nth-child(4) .card { animation-delay: .15s; }

/* ─── Empty state bob animation ─── */
@keyframes emptyBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.empty-state svg {
    animation: emptyBob 3s ease-in-out infinite;
    margin-left: auto; margin-right: auto;
}

/* ─── Button press feedback ─── */
.btn:active, .cta-primary:active, .quick-pill:active {
    transform: scale(.97);
    transition-duration: .08s;
}

/* ─── Improved tooltip for all small screens ─── */
@media (hover: none) {
    .health-widget { cursor: default; }
    .health-tooltip { display: none !important; }
}

/* ─── Enhanced skeleton in dark mode ─── */
/* ─── Dark mode input placeholder fix ─── */
/* ─── Selection color ─── */
::selection {
    background: rgba(var(--accent-rgb), .2);
    color: var(--ink);
}

/* ─── Scroll snap for quick pills ─── */
.quick-pills {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.quick-pill {
    scroll-snap-align: start;
}

/* ─── Enhanced tab button transitions ─── */
.tab-btn {
    transition: all .25s cubic-bezier(.4,0,.2,1);
    position: relative; overflow: hidden;
}
.tab-btn::after {
    content: ''; position: absolute; bottom: 0; left: 50%;
    width: 0; height: 2px; background: var(--accent);
    transition: all .25s cubic-bezier(.4,0,.2,1);
    transform: translateX(-50%);
}
.tab-btn.active::after {
    width: 60%;
}

/* ─── Smooth number transition ─── */
.balance-amount, .ie-bar-amount {
    font-variant-numeric: tabular-nums;
}

/* ─── Toast entrance improvement ─── */
.toast {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ─── Modal overlay blur ─── */
.modal-overlay.open {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ─── Card hover lift (non-touch) ─── */
@media (hover: hover) {
    .card {
        transition: transform .25s ease, box-shadow .25s ease;
    }
    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }
    .quick-pill:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }
    .tx-item {
        transition: background .15s, transform .15s;
    }
    .tx-item:hover {
        transform: translateX(3px);
    }
    .ie-bar-fill {
        transition: width .8s cubic-bezier(.4,0,.2,1);
    }
}

/* ─── Scroll thumb styling ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--ink-muted);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-secondary); }
/* ─── Loading state for whole sections ─── */
.section-loading {
    position: relative; pointer-events: none;
}
.section-loading::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(var(--bg-card-rgb), .7);
    border-radius: inherit; z-index: 5;
}

/* ─── Notification dot pulse ─── */
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: .5; }
}
.notification-dot {
    animation: dotPulse 2s ease-in-out infinite;
}

/* ─── Data attribute tooltips ─── */
[data-tip] {
    position: relative; cursor: help;
}
[data-tip]::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--ink); color: var(--bg-app);
    padding: .3rem .6rem; border-radius: 6px;
    font-size: var(--text-xs); font-weight: 500;
    white-space: nowrap; pointer-events: none;
    opacity: 0; transition: all .2s ease;
    z-index: 100;
}
[data-tip]:hover::after {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ─── Progress bar glow in dark mode ─── */
/* ═══════════════════════════════════════
   PREMIUM v7 — WORLD-CLASS POLISH
   ═══════════════════════════════════════ */

/* ─── 1. Gradient text for section titles ─── */
.gradient-text,
.dash-chart-title, .health-title {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
/* hero balance-label — solid white */
.hero-balance .balance-label {
    color: rgba(255,255,255,.92);
}

/* ─── 2. Glassmorphism cards (beyond hero) ─── */
.glass-card, .velocity-strip, .ie-bar-wrap, .weekly-banner {
    background: rgba(var(--bg-card-rgb), .65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--accent-rgb), .08);
}
/* ─── 3. Animated gradient border on active tab ─── */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes borderRotate {
    to { --angle: 360deg; }
}
.tab-btn.active {
    border-image: linear-gradient(var(--angle), var(--accent), #a855f7, #ec4899, var(--accent)) 1;
    animation: borderRotate 3s linear infinite;
}

/* ─── 4. Animated streak flame ─── */
@keyframes flameDance {
    0%, 100% { transform: scaleY(1) scaleX(1); }
    25% { transform: scaleY(1.15) scaleX(.9); }
    50% { transform: scaleY(.95) scaleX(1.05); }
    75% { transform: scaleY(1.1) scaleX(.95); }
}
.streak-fire {
    display: inline-block;
    animation: flameDance .8s ease-in-out infinite;
}

/* ─── 5. Floating label inputs ─── */
.float-field {
    position: relative; margin-bottom: var(--space-4);
}
.float-field input, .float-field select {
    width: 100%; padding: 1rem .85rem .5rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-input); font-size: var(--text-base);
    transition: all var(--transition);
}
.float-field label {
    position: absolute; left: .85rem; top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-sm); color: var(--ink-muted);
    pointer-events: none; transition: all .2s ease;
    background: transparent; padding: 0 .2rem;
}
.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label,
.float-field select:focus + label,
.float-field select:valid + label {
    top: 0; transform: translateY(-50%);
    font-size: var(--text-xs); font-weight: 600;
    color: var(--accent);
    background: var(--bg-card);
}
/* Autofill: float label up + neutralize browser background */
.float-field input:-webkit-autofill + label {
    top: 0; transform: translateY(-50%);
    font-size: var(--text-xs); font-weight: 600;
    color: var(--accent);
    background: var(--bg-card);
}
.float-field input:-webkit-autofill,
.float-field input:-webkit-autofill:hover,
.float-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ─── 6. Bouncing dot loader ─── */
@keyframes bounceDot {
    0%, 80%, 100% { transform: scale(0); opacity: .4; }
    40% { transform: scale(1); opacity: 1; }
}
.dot-loader {
    display: inline-flex; gap: .25rem; align-items: center;
    justify-content: center; padding: .5rem;
}
.dot-loader span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); display: block;
    animation: bounceDot 1.4s infinite ease-in-out both;
}
.dot-loader span:nth-child(1) { animation-delay: -.32s; }
.dot-loader span:nth-child(2) { animation-delay: -.16s; }

/* ─── 7. AI Insight card styling ─── */
.ai-insight-card {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .06), rgba(168,85,247,.06));
    border: 1px solid rgba(var(--accent-rgb), .12);
    border-radius: var(--radius);
    padding: var(--space-4); display: flex;
    align-items: flex-start; gap: var(--space-3);
    position: relative; overflow: hidden;
}
.ai-insight-card::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .08), transparent 70%);
    pointer-events: none;
}
.ai-insight-icon {
    width: 36px; height: 36px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.ai-insight-body { flex: 1; min-width: 0; }
.ai-insight-title {
    font-size: var(--text-sm); font-weight: 700;
    color: var(--ink); margin-bottom: .15rem;
}
.ai-insight-text {
    font-size: var(--text-xs); color: var(--ink);
    line-height: 1.45;
}

/* ─── 8. Spending heatmap calendar ─── */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px; padding: var(--space-2) 0;
}
.heatmap-cell {
    aspect-ratio: 1; border-radius: 3px;
    background: var(--bg-input); transition: all .15s ease;
    position: relative; cursor: default;
}
.heatmap-cell.level-0 { background: var(--bg-input); }
.heatmap-cell.level-1 { background: rgba(var(--accent-rgb), .15); }
.heatmap-cell.level-2 { background: rgba(var(--accent-rgb), .3); }
.heatmap-cell.level-3 { background: rgba(var(--accent-rgb), .5); }
.heatmap-cell.level-4 { background: rgba(var(--accent-rgb), .75); }
.heatmap-cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 3px; margin-bottom: 2px;
}
.heatmap-days span {
    text-align: center; font-size: .55rem;
    font-weight: 600; color: var(--ink-muted);
    text-transform: uppercase;
}
.heatmap-legend {
    display: flex; align-items: center; gap: .2rem;
    justify-content: flex-end; margin-top: var(--space-2);
    font-size: .6rem; color: var(--ink-muted);
}
.heatmap-legend span {
    width: 10px; height: 10px; border-radius: 2px;
}

/* ─── 9. Keyboard shortcut overlay ─── */
.shortcut-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
    padding: var(--space-4);
}
.shortcut-overlay.open { display: flex; }
.shortcut-sheet {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: var(--space-6); max-width: 480px; width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 80vh; overflow-y: auto;
}
.shortcut-sheet h2 {
    font-size: var(--text-xl); margin-bottom: var(--space-4);
    display: flex; align-items: center; gap: var(--space-2);
}
.shortcut-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.shortcut-item {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}
.shortcut-item span { font-size: var(--text-sm); color: var(--ink-secondary); }
.shortcut-key {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; padding: .15rem .5rem;
    font-size: var(--text-xs); font-weight: 700; font-family: monospace;
    color: var(--ink); box-shadow: 0 2px 0 var(--border);
    min-width: 28px; text-align: center;
}

/* ─── 10. Sync indicator ─── */
.sync-indicator {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: var(--text-xs); font-weight: 600;
    padding: .2rem .5rem; border-radius: var(--radius-full);
    transition: all .3s ease;
}
.sync-indicator.synced {
    color: var(--green); background: var(--green-bg);
}
.sync-indicator.saving {
    color: var(--orange); background: var(--orange-bg);
}
@keyframes syncSpin {
    to { transform: rotate(360deg); }
}
.sync-indicator.saving .sync-icon {
    animation: syncSpin .8s linear infinite;
}

/* ─── 11. Achievement notification popup ─── */
@keyframes achievementSlide {
    from { transform: translateY(-100%) scale(.9); opacity: 0; }
    20% { transform: translateY(0) scale(1.02); opacity: 1; }
    30% { transform: scale(1); }
    85% { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-120%); opacity: 0; }
}
.achievement-popup {
    position: fixed; top: calc(var(--top-bar-h) + var(--space-3));
    left: 50%; transform: translateX(-50%);
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-3) var(--space-5);
    box-shadow: var(--shadow-lg); z-index: 9999;
    display: flex; align-items: center; gap: var(--space-3);
    animation: achievementSlide 4s ease-in-out forwards;
}
.achievement-popup .ach-icon {
    font-size: 1.5rem;
}
.achievement-popup .ach-body { min-width: 0; }
.achievement-popup .ach-title {
    font-size: var(--text-sm); font-weight: 800;
    color: var(--accent);
}
.achievement-popup .ach-desc {
    font-size: var(--text-xs); color: var(--ink-secondary);
}

/* ─── 12. Enhanced login/register page ─── */
.auth-card {
    max-width: 420px; margin: 2rem auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-8); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.auth-card::before {
    content: ''; position: absolute;
    top: -40%; right: -30%; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .08), transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.auth-card::after {
    content: ''; position: absolute;
    bottom: -30%; left: -20%; width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(168,85,247,.06), transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.auth-logo {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-2); margin-bottom: var(--space-6);
}
.auth-logo-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: var(--radius-sm); display: flex;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), .3);
}
.auth-logo-text {
    font-size: var(--text-xl); font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-divider {
    display: flex; align-items: center; gap: var(--space-3);
    color: var(--ink-muted); font-size: var(--text-xs);
    margin: var(--space-5) 0;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px;
    background: var(--border);
}
.auth-footer {
    text-align: center; margin-top: var(--space-5);
    font-size: var(--text-sm); color: var(--ink-secondary);
}
.auth-footer a { font-weight: 700; }

/* ─── 13. Progress ring animation on goal cards ─── */
@keyframes progressRingFill {
    from { stroke-dashoffset: var(--ring-circumference); }
    to { stroke-dashoffset: var(--ring-offset); }
}
.goal-progress-ring circle.ring-fill {
    animation: progressRingFill .8s cubic-bezier(.4,0,.2,1) forwards;
    animation-delay: .2s;
}

/* ─── 14. Card reveal expand animation ─── */
@keyframes expandReveal {
    from { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
    to { max-height: 500px; opacity: 1; }
}
.card-details-reveal {
    overflow: hidden;
    animation: expandReveal .35s ease-out forwards;
}

/* ─── 15. Better empty state illustrations with motion ─── */
.empty-state-premium {
    text-align: center; padding: var(--space-8) var(--space-4);
}
.empty-state-premium svg {
    width: 80px; height: 80px; margin: 0 auto var(--space-4);
    color: var(--ink-muted); opacity: .5;
}
.empty-state-premium h3 {
    font-size: var(--text-lg); font-weight: 700;
    color: var(--ink); margin-bottom: var(--space-2);
}
.empty-state-premium p {
    font-size: var(--text-sm); color: var(--ink-secondary);
    max-width: 280px; margin: 0 auto var(--space-4);
    line-height: 1.5;
}

/* ─── 16. Stat counter cards grid ─── */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}
.stat-mini {
    text-align: center; padding: var(--space-3);
    background: var(--bg-input); border-radius: var(--radius-sm);
    transition: transform .2s;
}
.stat-mini:hover { transform: translateY(-2px); }
.stat-mini-value {
    font-size: var(--text-lg); font-weight: 800;
    color: var(--ink); display: block;
}
.stat-mini-label {
    font-size: var(--text-xs); color: var(--ink-muted);
    font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em;
}

/* ─── 17. Month comparison side by side ─── */
.month-compare {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: var(--space-3); align-items: center;
}
.month-compare-col { text-align: center; }
.month-compare-vs {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--bg-input); color: var(--ink-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs); font-weight: 800;
}
.month-compare-value {
    font-size: var(--text-xl); font-weight: 800;
    display: block;
}
.month-compare-label {
    font-size: var(--text-xs); color: var(--ink-muted);
    font-weight: 600;
}

/* ─── 18. Long-press context menu ─── */
.context-menu {
    position: fixed; z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2); min-width: 180px;
    display: none;
}
.context-menu.open { display: block; }
.context-menu-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm); color: var(--ink);
    border-radius: 6px; cursor: pointer;
    transition: background .1s;
}
.context-menu-item:hover { background: var(--bg-input); }
.context-menu-item.danger { color: var(--red); }
.context-menu-sep { height: 1px; background: var(--border); margin: var(--space-1) 0; }

/* ─── 19. High contrast theme ─── */
@media (prefers-contrast: more) {
    :root {
        --bg-app: #ffffff;
        --ink: #000000;
        --ink-secondary: #1a1a1a;
        --border: #000000;
        --shadow: none;
        --shadow-sm: none;
    }
    .card { border: 2px solid #000; }
    .btn, .tab-btn { border: 2px solid currentColor; }
}

/* ─── 20. Color-blind safe palette variables ─── */
:root {
    --cb-blue: #0077bb;
    --cb-orange: #ee7733;
    --cb-cyan: #33bbee;
    --cb-magenta: #ee3377;
    --cb-grey: #bbbbbb;
}

/* ─── 21. Enhanced scrollbar on touch (wider) ─── */
@media (pointer: coarse) {
    ::-webkit-scrollbar { width: 3px; height: 3px; }
}

/* Shine effect removed */

/* ─── 23. Transaction swipe hint ─── */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); opacity: 0; }
    50% { transform: translateX(-6px); opacity: .6; }
}
.tx-item::after {
    content: ''; position: absolute; right: var(--space-2);
    top: 50%; transform: translateY(-50%);
    width: 4px; height: 24px; border-radius: 4px;
    background: var(--accent); opacity: 0;
}
.tx-item:first-child::after {
    animation: swipeHint 3s ease-in-out 2s 2;
}

/* ─── 24. Responsive improvements ─── */
@media (min-width: 768px) {
    .dashboard-root { max-width: 640px; margin: 0 auto; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .shortcut-grid { grid-template-columns: 1fr 1fr; }
    .ie-compare { gap: var(--space-4); }
}
@media (min-width: 1024px) {
    .dashboard-root { max-width: 720px; }
    .auth-card { margin-top: 4rem; }
}

/* ─── 25. Smooth number odometer effect ─── */
@keyframes countUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.counter-animate {
    display: inline-block;
    animation: countUp .5s cubic-bezier(.2,.6,.3,1) forwards;
}

/* ─── 26. Category bubble chart ─── */
.cat-bubbles {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    justify-content: center; padding: var(--space-3) 0;
}
.cat-bubble {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 50%; background: rgba(var(--accent-rgb), .08);
    transition: transform .2s;
    border: 2px solid transparent;
}
.cat-bubble:hover { transform: scale(1.08); }
.cat-bubble-emoji { font-size: 1.1rem; }
.cat-bubble-amount {
    font-size: .55rem; font-weight: 700; color: var(--ink);
    margin-top: 1px;
}

/* ─── 27. Pulse dot on live data ─── */
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .4); }
    70% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); display: inline-block;
    animation: livePulse 2s infinite;
    vertical-align: middle; margin-right: .25rem;
}

/* ─── 28. Smooth accordion for card details ─── */
.accordion-content {
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease;
}
.accordion-content.open { grid-template-rows: 1fr; }
.accordion-inner { overflow: hidden; }

/* ─── 29. Status pills ─── */
.status-pill {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .15rem .5rem; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
}
.status-pill.active { background: var(--green-bg); color: var(--green); }
.status-pill.paused { background: var(--orange-bg); color: var(--orange); }
.status-pill.overdue { background: var(--red-bg); color: var(--red); }
.status-pill::before {
    content: ''; width: 6px; height: 6px;
    border-radius: 50%; background: currentColor;
}

/* ─── 30. Better page-shell spacing on large screens ─── */
@media (min-width: 768px) {
    .page-shell {
        max-width: 720px; margin: 0 auto;
        padding-left: var(--space-6); padding-right: var(--space-6);
    }
}

/* ═══════════════════════════════════════
   PREMIUM v8 — ULTRA POLISH
   ═══════════════════════════════════════ */

/* ─── V8-2. Modal backdrop glass blur ─── */
.modal-overlay, .overlay {
    backdrop-filter: blur(6px) saturate(1.3);
    -webkit-backdrop-filter: blur(6px) saturate(1.3);
    background: rgba(0,0,0,.35);
}
/* ─── V8-3. Staggered modal field entrance ─── */
@keyframes fieldSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal.open .float-field,
.modal.open label,
.modal.open .form-grid > * {
    animation: fieldSlideIn .35s ease both;
}
.modal.open .form-grid > *:nth-child(1) { animation-delay: .05s; }
.modal.open .form-grid > *:nth-child(2) { animation-delay: .1s; }
.modal.open .form-grid > *:nth-child(3) { animation-delay: .15s; }
.modal.open .form-grid > *:nth-child(4) { animation-delay: .2s; }
.modal.open .form-grid > *:nth-child(5) { animation-delay: .25s; }
.modal.open .form-grid > *:nth-child(6) { animation-delay: .3s; }
.modal.open .form-grid > *:nth-child(7) { animation-delay: .35s; }

/* ─── V8-4. Input focus glow underline ─── */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="month"]),
select, textarea {
    position: relative;
    transition: border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="month"]):focus,
select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
    background-color: var(--bg-card);
}

/* ─── V8-5. Button press depth + ripple on FAB ─── */
.cta-primary:active, .btn:active { transform: scale(.97) translateY(1px); }
.fab:active { transform: scale(.9); }
.fab { transition: transform .15s ease, box-shadow .15s ease; }
.fab:hover { transform: scale(1.06); box-shadow: 0 8px 25px rgba(var(--accent-rgb), .35); }

/* ─── V8-6. Card hover glow ring ─── */
.card:hover, .kpi-card:hover, .ai-insight-card:hover {
    box-shadow: var(--shadow), 0 0 0 1px rgba(var(--accent-rgb), .06);
}
/* ─── V8-7. Link underline sweep ─── */
a:not(.btn):not(.quick-pill):not(.tab-btn):not(.nav-link) {
    text-decoration: none;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .25s ease;
}
a:not(.btn):not(.quick-pill):not(.tab-btn):not(.nav-link):hover {
    background-size: 100% 1.5px;
}

/* ─── V8-8. Animated progress bar striping ─── */
@keyframes progressStripe {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}
.progress-fill {
    background-image: linear-gradient(
        45deg,
        rgba(255,255,255,.15) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,.15) 50%,
        rgba(255,255,255,.15) 75%, transparent 75%
    );
    background-size: 40px 40px;
    animation: progressStripe 1s linear infinite;
}

/* ─── V8-9. Budget exceeded indicator ─── */
.progress-over-90, .budget-over {
    box-shadow: 0 0 0 2px rgba(220,38,38,.25);
}
.progress-fill.over-budget {
    background-color: var(--red);
    background-image: linear-gradient(
        45deg,
        rgba(255,255,255,.2) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,.2) 50%,
        rgba(255,255,255,.2) 75%, transparent 75%
    );
}

/* ─── V8-10. Notification bell bounce ─── */
@keyframes bellShake {
    0% { transform: rotate(0); }
    15% { transform: rotate(12deg); }
    30% { transform: rotate(-10deg); }
    45% { transform: rotate(6deg); }
    60% { transform: rotate(-3deg); }
    75% { transform: rotate(1deg); }
    100% { transform: rotate(0); }
}
.notification-btn:hover svg, .notification-btn.has-unread svg {
    animation: bellShake .6s ease-in-out;
}
.notification-dot {
    animation: livePulse 2s infinite;
}

/* ─── V8-11. Avatar entrance animation ─── */
@keyframes avatarPop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.user-avatar, .member-avatar {
    animation: avatarPop .4s cubic-bezier(.34,1.56,.64,1) both;
}

/* ─── V8-12. KPI card number shimmer ─── */
@keyframes kpiShimmer {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.kpi-value, .health-score-value {
    animation: kpiShimmer .5s ease .2s both;
}

/* ─── V8-13. Password strength meter ─── */
.pw-strength {
    display: flex; gap: 4px; margin-top: var(--space-2);
}
.pw-strength-seg {
    flex: 1; height: 4px; border-radius: 2px;
    background: var(--border);
    transition: background .3s ease;
}
.pw-strength.level-1 .pw-strength-seg:nth-child(-n+1) { background: var(--red); }
.pw-strength.level-2 .pw-strength-seg:nth-child(-n+2) { background: var(--orange); }
.pw-strength.level-3 .pw-strength-seg:nth-child(-n+3) { background: #eab308; }
.pw-strength.level-4 .pw-strength-seg:nth-child(-n+4) { background: var(--green); }
.pw-strength-label {
    font-size: var(--text-xs); font-weight: 600;
    margin-top: .2rem; transition: color .3s;
}

/* ─── V8-14. Skeleton shimmer for loading states ─── */
@keyframes skeletonShimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(
        90deg, var(--bg-input) 25%, rgba(var(--accent-rgb), .04) 50%, var(--bg-input) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: .9rem; width: 70%; margin-bottom: .4rem; }
.skeleton-text.short { width: 40%; }
.skeleton-circle { width: 36px; height: 36px; border-radius: 50%; }

/* ─── V8-15. Toast with icons + stacking ─── */
.toast { position: relative; }
.toast + .toast { margin-top: var(--space-2); }
.toast-icon {
    font-size: 1.1rem; flex-shrink: 0;
    animation: avatarPop .3s cubic-bezier(.34,1.56,.64,1) both;
}
.toast-success .toast-icon::before { content: '✅'; }
.toast-error .toast-icon::before { content: '❌'; }
.toast-info .toast-icon::before { content: 'ℹ️'; }

/* ─── V8-16. Swipe-to-delete track styling ─── */
.tx-item-swipe-bg {
    position: absolute; inset: 0;
    display: flex; align-items: center;
    justify-content: flex-end; padding-right: var(--space-4);
    background: var(--red); color: #fff;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm); font-weight: 700;
    opacity: 0; transition: opacity .2s;
}
.tx-item.swiping ~ .tx-item-swipe-bg,
.tx-item.swiping .tx-item-swipe-bg { opacity: 1; }
.tx-item {
    position: relative;
    touch-action: pan-y;
}

/* ─── V8-17. Goal card premium hover ─── */
.goal-card, .debt-card, .recurring-card, .budget-row {
    transition: transform .2s ease, box-shadow .2s ease;
}
.goal-card:hover, .debt-card:hover, .recurring-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ─── V8-18. Chip/tag selection animation ─── */
@keyframes chipSelect {
    0% { transform: scale(1); }
    50% { transform: scale(.92); }
    100% { transform: scale(1); }
}
.chip.active, .tag.active, .cat-chip.active {
    animation: chipSelect .2s ease;
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ─── V8-19. Page load fade-in ─── */
@keyframes pageContentIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-shell, .dashboard-root, .auth-card {
    animation: pageContentIn .4s ease both;
}

/* ─── V8-20. Scroll-triggered reveal for sections ─── */
.section-gap {
    animation: pageContentIn .4s ease both;
}
.section-gap:nth-child(2) { animation-delay: .05s; }
.section-gap:nth-child(3) { animation-delay: .1s; }
.section-gap:nth-child(4) { animation-delay: .15s; }
.section-gap:nth-child(5) { animation-delay: .2s; }
.section-gap:nth-child(6) { animation-delay: .25s; }
.section-gap:nth-child(7) { animation-delay: .3s; }
.section-gap:nth-child(8) { animation-delay: .35s; }
.section-gap:nth-child(9) { animation-delay: .4s; }
.section-gap:nth-child(10) { animation-delay: .45s; }

/* ─── V8-21. Savings tip card premium ─── */
.tip-card {
    position: relative;
    overflow: hidden;
}
.tip-card::before {
    content: ''; position: absolute;
    top: -50%; left: -30%;
    width: 150px; height: 150px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .06), transparent 70%);
    pointer-events: none;
}

/* ─── V8-22. Donut chart entry animation ─── */
@keyframes donutGrow {
    from { transform: scale(.5) rotate(-90deg); opacity: 0; }
    to { transform: scale(1) rotate(0deg); opacity: 1; }
}
.dash-chart-canvas {
    animation: donutGrow .6s cubic-bezier(.34,1.56,.64,1) .3s both;
}

/* ─── V8-23. Quick pill hover micro-interaction ─── */
.quick-pill {
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.quick-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), .1);
}
.quick-pill:active { transform: scale(.96); }
.quick-pill svg {
    transition: transform .2s ease;
}
.quick-pill:hover svg { transform: scale(1.1); }

/* ─── V8-24. Nav icon active state bounce ─── */
@keyframes navBounce {
    0% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}
.nav-link.active svg {
    animation: navBounce .35s ease;
}

/* ─── V8-25. Smooth tab indicator slide ─── */
.dashboard-tabs {
    position: relative;
}
.dashboard-tabs::after {
    content: '';
    position: absolute; bottom: 0;
    height: 2.5px; border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    transition: left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
}

/* ─── V8-26. Debt card color coding ─── */
.debt-card[data-priority="high"] {
    border-left: 3px solid var(--red);
}
.debt-card[data-priority="medium"] {
    border-left: 3px solid var(--orange);
}
.debt-card[data-priority="low"] {
    border-left: 3px solid var(--green);
}

/* ─── V8-27. Scroll-aware top bar shadow ─── */
.top-bar.scrolled {
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
/* ─── V8-28. Profile stat cards glow ─── */
.profile-stat {
    transition: transform .2s ease, box-shadow .2s ease;
}
.profile-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), .08);
}

/* ─── V8-29. Typewriter effect for insights ─── */
@keyframes blink {
    50% { opacity: 0; }
}
.typewriter-cursor::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent); font-weight: 300;
    margin-left: 1px;
}

/* ─── V8-30. Print polished layout ─── */
@media print {
    .nav-bottom, .fab, .top-bar, .cta-primary-section,
    .weekly-banner-close, .dash-search, .shortcut-overlay,
    .context-menu, .toast-container, .achievement-popup { display: none !important; }
    .card { break-inside: avoid; border: 1px solid #ddd; box-shadow: none; }
    .hero-balance { border: 2px solid #333; padding: 1rem; }
    body { font-size: 12pt; }
}

/* Scroll shadow removed for cleanliness */

/* ─── V8-32. Gradient CTA button ─── */
.cta-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    position: relative; overflow: hidden;
}
.cta-primary::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, #7c3aed, var(--accent));
    opacity: 0; transition: opacity .3s ease;
}
.cta-primary:hover::before { opacity: 1; }
.cta-primary svg, .cta-primary span { position: relative; z-index: 1; }

/* ─── V8-33. Month picker styled ─── */
.month-picker input[type="month"] {
    background: var(--bg-input); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: .4rem .6rem;
    font-size: var(--text-sm); font-weight: 600;
    color: var(--ink); cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.month-picker input[type="month"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
    outline: none;
}

/* ─── V8-34. Contribution row premium ─── */
.contrib-row {
    transition: background .15s ease;
    border-radius: var(--radius-sm);
    padding: var(--space-3);
}
.contrib-row:hover {
    background: rgba(var(--accent-rgb), .03);
}

/* ─── V8-35. Responsive grid improvements ─── */
@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .balance-details { flex-wrap: wrap; justify-content: center; }
    .shortcut-grid { grid-template-columns: 1fr; }
}

/* ─── V8-36. Selection highlight premium ─── */
::selection {
    background: rgba(var(--accent-rgb), .2);
    color: var(--ink);
}
/* ─── V8-37. Reduced motion respect for v8 ─── */
@media (prefers-reduced-motion: reduce) {
    .card, .auth-card, .stat-mini, .quick-pill, .goal-card,
    .debt-card, .recurring-card, .fab, .cta-primary,
    .dash-chart-canvas, .section-gap, .page-shell,
    .dashboard-root, .user-avatar, .member-avatar,
    .kpi-value, .health-score-value, .nav-link svg,
    .progress-fill, .notification-btn svg, .streak-fire,
    .tx-item::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   PREMIUM v9 — NEXT-GEN POLISH (25 rules)
   ═══════════════════════════════════════════════════════════ */

/* ─── V9-1. Custom Scrollbar ─── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* ─── V9-2. text-wrap: balance for headings ─── */
h1, h2, h3, h4 { text-wrap: balance; }

/* ─── V9-3. scroll-snap for dashboard tabs ─── */
.dashboard-tabs { scroll-snap-type: x mandatory; scroll-padding: .5rem; }
.dashboard-tabs .tab-btn { scroll-snap-align: center; }

/* ─── V9-4. Enhanced modal backdrop with saturate ─── */
.modal-overlay {
    backdrop-filter: blur(14px) saturate(1.2) brightness(.92);
    -webkit-backdrop-filter: blur(14px) saturate(1.2) brightness(.92);
}

/* ─── V9-5. Gradient border accent on active cards ─── */
.card:focus-within,
.goal-card:focus-within,
.debt-card:focus-within {
    border-color: transparent;
    background-image: linear-gradient(var(--bg-card), var(--bg-card)),
                      linear-gradient(135deg, var(--accent), #7c3aed);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* ─── V9-6. 3D tilt on KPI cards ─── */
.kpi-card {
    perspective: 800px;
    transform-style: preserve-3d;
}
.kpi-card:hover {
    transform: rotateX(4deg) rotateY(-3deg) scale(1.02);
    box-shadow: 0 14px 28px rgba(0,0,0,.12), 0 0 0 1px rgba(var(--accent-rgb),.12);
}

/* ─── V9-7. Container query for adaptive cards ─── */
@supports (container-type: inline-size) {
    .dashboard-root { container-type: inline-size; container-name: dash; }
    @container dash (max-width: 480px) {
        .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: .4rem !important; }
        .kpi-value { font-size: 1rem !important; }
    }
}

/* ─── V9-8. :has() powered smart parent styling ─── */
@supports selector(:has(*)) {
    .form-group:has(input:focus),
    .float-field:has(input:focus),
    .float-field:has(select:focus) {
        background: rgba(var(--accent-rgb), .03);
        border-radius: var(--radius-sm);
    }
    .tx-item:has(.tx-amount-expense) { border-left: 3px solid var(--red); }
    .tx-item:has(.tx-amount-income) { border-left: 3px solid var(--green); }
    .card:has(.progress-over) { border-color: var(--red); }
    .goal-card:has(.progress-fill[style*="100%"]) {
        background: linear-gradient(135deg, rgba(var(--accent-rgb),.06), rgba(22,163,74,.06));
    }
}

/* ─── V9-9. Glassmorphism stat cards ─── */
.stats-grid .stat-mini {
    background: rgba(var(--bg-card-rgb), .7);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    border: 1px solid rgba(var(--accent-rgb), .1);
}

/* ─── V9-10. Animated gradient text for balance ─── */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
/* Only apply gradient text outside of hero (hero stays white) */
.health-score-value {
    background: linear-gradient(90deg, var(--accent), #7c3aed, var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}
/* Hero balance-amount: white text */
.hero-balance .balance-amount {
    color: #fff;
}

/* ─── V9-11. Neon glow on FAB button ─── */
.fab-add {
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), .35),
                0 0 40px rgba(var(--accent-rgb), .15);
}
.fab-add:hover {
    box-shadow: 0 6px 30px rgba(var(--accent-rgb), .5),
                0 0 60px rgba(var(--accent-rgb), .25);
}

/* ─── V9-12. Staggered list entrance for tx items ─── */
@keyframes txSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}
.tx-list .tx-item {
    animation: txSlideIn .35s ease-out both;
}
.tx-list .tx-item:nth-child(1)  { animation-delay: 0s; }
.tx-list .tx-item:nth-child(2)  { animation-delay: .04s; }
.tx-list .tx-item:nth-child(3)  { animation-delay: .08s; }
.tx-list .tx-item:nth-child(4)  { animation-delay: .12s; }
.tx-list .tx-item:nth-child(5)  { animation-delay: .16s; }
.tx-list .tx-item:nth-child(6)  { animation-delay: .20s; }
.tx-list .tx-item:nth-child(7)  { animation-delay: .24s; }
.tx-list .tx-item:nth-child(8)  { animation-delay: .28s; }
.tx-list .tx-item:nth-child(9)  { animation-delay: .32s; }
.tx-list .tx-item:nth-child(10) { animation-delay: .36s; }

/* ─── V9-13. Pagination hover micro-interaction ─── */
.pagination-link {
    position: relative;
    overflow: hidden;
}
.pagination-link::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    opacity: 0;
    transition: opacity .25s;
    border-radius: inherit;
    z-index: -1;
}
.pagination-link:hover::before { opacity: 1; }
.pagination-link:hover:not(.active):not(.disabled) { color: #fff; border-color: transparent; }

/* ─── V9-14. Filter card accordion animation ─── */
details.filter-card[open] .filter-form {
    animation: filterExpand .3s ease-out;
}
@keyframes filterExpand {
    from { opacity: 0; max-height: 0; transform: translateY(-8px); }
    to   { opacity: 1; max-height: 500px; transform: translateY(0); }
}

/* ─── V9-15. Toggle group enhanced with glow on selection ─── */
.toggle-option input:checked + .toggle-label {
    box-shadow: 0 2px 16px rgba(var(--accent-rgb), .35);
}
.toggle-expense.selected,
.toggle-option input:checked + .toggle-expense {
    box-shadow: 0 2px 16px rgba(220,38,38,.3);
}
.toggle-income.selected,
.toggle-option input:checked + .toggle-income {
    box-shadow: 0 2px 16px rgba(22,163,74,.3);
}

/* ─── V9-16. Premium invite banner shine animation ─── */
@keyframes inviteShine {
    0%   { left: -100%; }
    100% { left: 200%; }
}
.invite-banner {
    position: relative;
    overflow: hidden;
}
.invite-banner::after {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
    animation: inviteShine 3s ease-in-out infinite;
    pointer-events: none;
}

/* ─── V9-17. Badge pill micro-bounce on appear ─── */
@keyframes badgePop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.badge {
    animation: badgePop .3s cubic-bezier(.34,1.56,.64,1) both;
}

/* ─── V9-18. Table row hover slide indicator ─── */
tbody tr {
    position: relative;
}
tbody tr::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--accent);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: transform .2s ease;
}
tbody tr:hover::before { transform: scaleY(1); }

/* ─── V9-19. More-card icon entrance spin ─── */
@keyframes iconSpin {
    from { transform: rotate(-90deg) scale(.7); opacity: 0; }
    to   { transform: rotate(0) scale(1); opacity: 1; }
}
.more-icon {
    animation: iconSpin .4s cubic-bezier(.34,1.56,.64,1) both;
}

/* ─── V9-20. Empty state illustration float ─── */
@keyframes emptyFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.empty-state svg,
.empty-state-premium .empty-icon {
    animation: emptyFloat 3s ease-in-out infinite;
}

/* ─── V9-21. Auth page gradient pulse background ─── */
@keyframes authPulse {
    0%, 100% { background-position: 20% 50%; }
    50%      { background-position: 80% 50%; }
}
.auth-page {
    background-size: 200% 200%;
    animation: authPulse 8s ease infinite;
}

/* ─── V9-22. Deposit row alternating highlight ─── */
.deposit-row:nth-child(even) {
    background: rgba(var(--accent-rgb), .02);
    border-radius: var(--radius-sm);
    padding-left: .5rem;
    padding-right: .5rem;
}

/* ─── V9-23. Health ring glow based on score ─── */
.health-score-ring svg circle:last-child {
    filter: drop-shadow(0 0 6px currentColor);
}

/* ─── V9-24. Alert auto-dismiss progress bar ─── */
.alert {
    position: relative;
    overflow: hidden;
}
.alert::after {
    content: '';
    position: absolute; bottom: 0; left: 0;
    height: 2px; width: 100%;
    background: currentColor; opacity: .3;
    animation: alertCountdown 5s linear forwards;
}
@keyframes alertCountdown {
    from { width: 100%; } to { width: 0%; }
}

/* ─── V9-25. Smooth color transition on theme toggle ─── */
html {
    transition: background-color .4s ease, color .4s ease;
}
html * {
    transition-property: background-color, color, border-color, box-shadow, opacity;
    transition-duration: .35s;
    transition-timing-function: ease;
}
html *::before, html *::after {
    transition-property: background-color, color, border-color, opacity;
    transition-duration: .35s;
}

/* ─── V9-26. Reduced motion respect for v9 ─── */
@media (prefers-reduced-motion: reduce) {
    .tx-list .tx-item,
    .badge,
    .more-icon,
    .empty-state svg, .empty-state-premium .empty-icon,
    .auth-page,
    .invite-banner::after,
    .health-score-value,
    .alert::after {
        animation: none !important;
    }
    html *, html *::before, html *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════
   PREMIUM v10 — MEGA VISUAL UPGRADE
   ═══════════════════════════════════════ */

/* ─── V10-1. Button ripple effect ─── */
.btn-primary, .btn-outline, .btn-ghost, .btn-danger {
    position: relative;
    overflow: hidden;
}
.btn-primary .ripple-circle, .btn-outline .ripple-circle,
.btn-ghost .ripple-circle, .btn-danger .ripple-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.35);
    transform: scale(0);
    animation: rippleExpand .6s ease-out forwards;
    pointer-events: none;
}
@keyframes rippleExpand {
    to { transform: scale(4); opacity: 0; }
}

/* ─── V10-2. Card lift & glow on hover ─── */
.card {
    transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s cubic-bezier(.4,0,.2,1);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(var(--accent-rgb), .10), var(--shadow);
}

/* ─── V10-3. Skeleton loading placeholders ─── */
@keyframes skeletonPulse {
    0%, 100% { opacity: .35; }
    50% { opacity: .15; }
}
.skeleton {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    animation: skeletonPulse 1.6s ease-in-out infinite;
}
.skeleton-line {
    height: .85rem;
    margin-bottom: .5rem;
    border-radius: 4px;
    background: var(--bg-input);
    animation: skeletonPulse 1.6s ease-in-out infinite;
}
.skeleton-line:last-child { width: 60%; }
.skeleton-circle {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    animation: skeletonPulse 1.6s ease-in-out infinite;
}

/* ─── V10-4. Category color system ─── */
.cat-tag {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 600;
    white-space: nowrap;
}
.cat-tag[data-cat="Supermercado"] { background: #ecfdf5; color: #065f46; }
.cat-tag[data-cat="Comida fuera"] { background: #fff7ed; color: #9a3412; }
.cat-tag[data-cat="Arriendo/Alquiler"] { background: #eff6ff; color: #1e40af; }
.cat-tag[data-cat="Servicios"] { background: #fefce8; color: #854d0e; }
.cat-tag[data-cat="Transporte"] { background: #f0fdf4; color: #166534; }
.cat-tag[data-cat="Gasolina"] { background: #fef3c7; color: #92400e; }
.cat-tag[data-cat="Salud"] { background: #fdf2f8; color: #9d174d; }
.cat-tag[data-cat="Educación"] { background: #eef2ff; color: #3730a3; }
.cat-tag[data-cat="Entretenimiento"] { background: #faf5ff; color: #6b21a8; }
.cat-tag[data-cat="Ropa"] { background: #fdf4ff; color: #86198f; }
.cat-tag[data-cat="Mascotas"] { background: #fff1f2; color: #9f1239; }
.cat-tag[data-cat="Deudas"] { background: #fef2f2; color: #991b1b; }
.cat-tag[data-cat="Ahorro"] { background: #ecfdf5; color: #065f46; }
.cat-tag[data-cat="Inversión"] { background: #eff6ff; color: #1e40af; }
.cat-tag[data-cat="Internet"] { background: #f0f9ff; color: #075985; }
.cat-tag[data-cat="Teléfono"] { background: #ecfeff; color: #155e75; }
.cat-tag[data-cat="Electricidad"] { background: #fffbeb; color: #92400e; }
.cat-tag[data-cat="Agua"] { background: #f0f9ff; color: #0369a1; }
.cat-tag[data-cat="Gas"] { background: #fff7ed; color: #c2410c; }
.cat-tag[data-cat="Seguros"] { background: #f5f3ff; color: #5b21b6; }
.cat-tag[data-cat="Suscripciones"] { background: #fdf4ff; color: #7e22ce; }
.cat-tag[data-cat="Viajes"] { background: #ecfeff; color: #0e7490; }
.cat-tag[data-cat="Cuidado personal"] { background: #fdf2f8; color: #be185d; }
.cat-tag[data-cat="Deporte"] { background: #f0fdf4; color: #15803d; }
.cat-tag[data-cat="Tecnología"] { background: #eef2ff; color: #4338ca; }
.cat-tag[data-cat="Regalos"] { background: #fff1f2; color: #e11d48; }
.cat-tag[data-cat="Hogar"] { background: #eff6ff; color: #1d4ed8; }
.cat-tag[data-cat="Salario"] { background: #ecfdf5; color: #047857; }
.cat-tag[data-cat="Freelance"] { background: #f5f3ff; color: #6d28d9; }
.cat-tag[data-cat="Ingreso extra"] { background: #fef9c3; color: #a16207; }
.cat-tag[data-cat="Otros"] { background: var(--bg-input); color: var(--ink-secondary); }
/* ─── V10-5. Enhanced auth brand with animated dots ─── */
.auth-brand li::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    margin-right: .55rem;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(var(--accent-rgb), .4);
}
.auth-brand h1 {
    font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em;
    background: linear-gradient(135deg, var(--accent), #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animated gradient border removed */

/* ─── V10-7. Premium input glow on focus ─── */
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15), 0 0 20px rgba(var(--accent-rgb), .06);
}

/* ─── V10-8. Stat counter animated underline ─── */
.stat-mini-value {
    position: relative;
}
.stat-mini-value::after {
    content: '';
    position: absolute;
    bottom: -3px; left: 10%; right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
    opacity: .4;
}

/* ─── V10-9. Enhanced transaction item hover ─── */
.tx-item {
    transition: transform .2s ease, background .2s ease;
}
.tx-item:hover {
    background: rgba(var(--accent-rgb), .03);
    transform: translateX(4px);
}
.tx-item:active {
    transform: scale(.98);
}

/* ─── V10-10. Animated progress bars ─── */
@keyframes progressFill {
    from { width: 0; }
}
.progress-fill, .budget-fill, .goal-progress-fill {
    animation: progressFill .8s cubic-bezier(.4,0,.2,1) forwards;
}

/* ─── V10-11. Enhanced empty state with floating illustration ─── */
@keyframes emptyFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-8px) rotate(1deg); }
    66% { transform: translateY(-4px) rotate(-1deg); }
}
.empty-state-premium {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.empty-state-premium .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    animation: emptyFloat 4s ease-in-out infinite;
}
.empty-state-premium .empty-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .35rem;
}
.empty-state-premium .empty-desc {
    font-size: var(--text-sm);
    color: var(--ink-secondary);
    max-width: 280px;
    margin: 0 auto .75rem;
}

/* ─── V10-12. Floating action button pulse ring ─── */
@keyframes fabPulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .4); }
    70% { box-shadow: 0 0 0 15px rgba(var(--accent-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}
.fab-add {
    animation: fabPulse 2.5s cubic-bezier(.4,0,.6,1) infinite;
}

/* ─── V10-13. Premium modal entrance ─── */
@keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes modalBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-overlay.open {
    animation: modalBackdrop .25s ease-out;
}
.modal-overlay.open .modal-sheet {
    animation: modalSlideUp .35s cubic-bezier(.22, 1, .36, 1);
}

/* ─── V10-14. Scroll progress indicator ─── */
.scroll-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #a855f7, #ec4899);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 9999;
    transition: transform .15s ease-out;
    pointer-events: none;
}

/* ─── V10-15. Enhanced badge animations ─── */
@keyframes badgeUnlock {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.badge.just-unlocked {
    animation: badgeUnlock .6s cubic-bezier(.22, 1, .36, 1) forwards;
}

/* ─── V10-16. Enhanced member avatar ring ─── */
.member-avatar {
    position: relative;
}
.member-avatar::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--accent), #a855f7, #ec4899, var(--accent));
    z-index: -1;
    opacity: .6;
}

/* ─── V10-17. Quick-add category pill enhancements ─── */
.quick-pill {
    transition: all .2s cubic-bezier(.4,0,.2,1);
}
.quick-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), .15);
}
.quick-pill:active {
    transform: scale(.95);
}

/* ─── V10-18. Enhanced savings tip pulsing border ─── */
@keyframes tipBorderPulse {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: #a855f7; }
}
.tip-card {
    animation: tipBorderPulse 3s ease-in-out infinite;
}

/* ─── V10-19. Toast notification slide-in ─── */
@keyframes toastSlideIn {
    from { transform: translateY(-100%) scale(.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(-100%) scale(.95); opacity: 0; }
}
.toast {
    animation: toastSlideIn .35s cubic-bezier(.22, 1, .36, 1);
}
.toast.toast-exit {
    animation: toastSlideOut .25s ease-in forwards;
}

/* ─── V10-20. Chart card enhancement ─── */
.chart-card {
    overflow: hidden;
    position: relative;
}
.chart-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #a855f7, transparent);
    opacity: .3;
}

/* ─── V10-21. Heatmap enhanced cell interaction ─── */
.heatmap-cell {
    transition: transform .15s ease, box-shadow .15s ease;
}
.heatmap-cell:hover {
    transform: scale(1.25);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), .2);
    z-index: 2;
}

/* ─── V10-22. Enhanced invite banner ─── */
.invite-banner {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .08), rgba(124,58,237,.04));
    border: 1px solid rgba(var(--accent-rgb), .15);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    display: flex; align-items: center; gap: .5rem;
    position: relative;
    overflow: hidden;
}
.invite-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .1em;
    background: rgba(var(--accent-rgb), .08);
    padding: .2rem .5rem;
    border-radius: 6px;
}

/* ─── V10-23. Smooth scroll-to-top button ─── */
.scroll-top-btn {
    position: fixed;
    bottom: calc(var(--nav-h) + 70px);
    right: 1rem;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), .3);
    opacity: 0;
    transform: translateY(20px);
    transition: all .3s cubic-bezier(.4,0,.2,1);
    z-index: 100;
    pointer-events: none;
}
.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.scroll-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), .45);
}

/* ─── V10-24. Enhanced dark mode contrast ─── */
/* ─── V10-25. Diagnostic page styles ─── */
.diag-page { padding: 1.5rem; max-width: 800px; margin: 0 auto; }
.diag-section { margin-bottom: 1.5rem; }
.diag-section h3 { margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.diag-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: .5rem;
}
@media (max-width: 480px) { .diag-grid { grid-template-columns: 1fr; } }
.diag-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: var(--text-sm);
}
.diag-item .diag-status {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.diag-status.pass { background: var(--green); box-shadow: 0 0 6px rgba(22,163,74,.4); }
.diag-status.fail { background: var(--red); box-shadow: 0 0 6px rgba(220,38,38,.4); }
.diag-status.warn { background: var(--orange); box-shadow: 0 0 6px rgba(234,88,12,.4); }
.diag-summary {
    display: flex; gap: 1rem; padding: 1rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .06), rgba(124,58,237,.04));
    border: 1px solid rgba(var(--accent-rgb), .12);
    margin-bottom: 1.5rem;
    font-size: var(--text-sm);
}
.diag-summary .diag-count { font-size: 1.5rem; font-weight: 800; }
.diag-summary .pass-count { color: var(--green); }
.diag-summary .fail-count { color: var(--red); }
.diag-summary .warn-count { color: var(--orange); }

/* ─── V10-26. Reduced motion v10 ─── */
@media (prefers-reduced-motion: reduce) {
    .card:hover { transform: none; }
    .tx-item:hover { transform: none; }
    .quick-pill:hover { transform: none; }
    .fab-add { animation: none; }
    .tip-card { animation: none; }
    .heatmap-cell:hover { transform: none; }
    .scroll-top-btn { transition: opacity .15s; }
    .progress-fill, .budget-fill, .goal-progress-fill { animation: none; }
}
