/* ============================================================
   personalEverything — Framework CSS
   Hybrid: Organic Aesthetic + Technical Data Design
   Supports: Light & Dark theme via data-theme attribute
   ============================================================ */

/* ── THEME VARIABLES ─────────────────────────────────────── */
:root[data-theme="light"], :root {
    --bg-body:      linear-gradient(135deg, #F4EBE0 0%, #FFF9F2 100%);
    --bg-nav:       rgba(255, 255, 255, 0.75);
    --bg-card:      rgba(255, 255, 255, 0.82);
    --bg-surface:   rgba(255, 255, 255, 0.5);
    --bg-input:     rgba(255, 255, 255, 0.7);
    --bg-hover:     rgba(122, 157, 126, 0.08);
    --bg-stripe:    rgba(122, 157, 126, 0.04);

    --text-primary:   #2C2C2C;
    --text-secondary: rgba(44, 44, 44, 0.72);
    --text-muted:     rgba(44, 44, 44, 0.62);
    --text-inverse:   #ffffff;

    --accent:       #7A9D7E;
    --accent-light: #A8C5A7;
    --accent-dark:  #5A7D5E;
    --clay:         #D4A59A;
    --water:        #6BA3C5;
    --sleep:        #8B7FA8;
    --danger:       #D97B6E;
    --warning-col:  #E8A87C;

    --border:       rgba(122, 157, 126, 0.18);
    --border-input: rgba(122, 157, 126, 0.28);
    --shadow-sm:    0 2px 10px rgba(0,0,0,0.06);
    --shadow:       0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 10px 35px rgba(122,157,126,0.15);
    --radius:       18px;
    --radius-sm:    10px;
}

:root[data-theme="dark"] {
    /* Rich layered dark — each surface level slightly lighter than below */
    --bg-body:      linear-gradient(135deg, #1a1d1f 0%, #243340 100%);
    --bg-nav:       #1e2428;
    --bg-card:      #252d33;
    --bg-surface:   #1e2428;
    --bg-input:     #1a2026;
    --bg-hover:     rgba(109, 184, 118, 0.1);
    --bg-stripe:    rgba(255, 255, 255, 0.025);

    --text-primary:   #eef2f0;
    --text-secondary: #b0bdb8;
    --text-muted:     #6e7d78;
    --text-inverse:   #1a1d1f;

    /* Brighter so they pop on dark backgrounds */
    --accent:       #6db876;
    --accent-light: #8fd49a;
    --accent-dark:  #4fa05a;
    --clay:         #e0a898;
    --water:        #70b8d8;
    --sleep:        #9d90c4;
    --danger:       #e8806e;
    --warning-col:  #f0b882;

    --border:       #2e3c44;
    --border-input: #384850;
    --shadow-sm:    0 2px 10px rgba(0,0,0,0.4);
    --shadow:       0 4px 24px rgba(0,0,0,0.5);
    --shadow-hover: 0 10px 40px rgba(0,0,0,0.6);
    color-scheme: dark;
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: clamp(14px, 1.5vw, 16px);
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* prevent horizontal page expansion on mobile */
}

/* ── TOP NAVIGATION ──────────────────────────────────────── */
.top-nav {
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 500;
    transition: background 0.3s ease, border-color 0.3s ease;
    /* Android status bar — push nav content below system UI */
    padding-top: env(safe-area-inset-top);
}

[data-theme="dark"] .top-nav {
    box-shadow: 0 1px 0 #2e3c44, 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .card {
    border-color: #2e3c44;
}

[data-theme="dark"] .data-table thead {
    background: #1e2428;
}

[data-theme="dark"] .data-table th {
    color: #8fd49a;
}

[data-theme="dark"] .btn-icon {
    background: #252d33;
    border-color: #2e3c44;
    color: #b0bdb8;
}

[data-theme="dark"] .btn-icon:hover {
    background: #2e3c44;
    color: #eef2f0;
}

[data-theme="dark"] .auth-card {
    background: #252d33;
    border-color: #2e3c44;
}

[data-theme="dark"] .tracker-item {
    background: #1e2428;
    border-color: #2e3c44;
}

[data-theme="dark"] .mobile-nav {
    background: #1e2428;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.nav-logo {
    font-family: 'Crimson Pro', serif;
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--accent-dark);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-logo span { color: var(--clay); font-weight: 300; }

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    min-height: 40px;
    line-height: 1;
}

/* On desktop nav-text is visible. On mobile (<900px) it's hidden — see responsive section. */
.nav-text { font-size: 0.9rem; }

.nav-link:hover  { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(122,157,126,0.18), rgba(168,197,167,0.1));
    color: var(--accent-dark);
    font-weight: 600;
}

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

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-icon:hover { background: var(--bg-hover); transform: scale(1.05); }

/* Mobile Nav */
.mobile-menu-btn { display: none; }

.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 900;
    padding: 2rem;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

.mobile-nav.open { display: flex; }

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.mobile-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1;
}

.mobile-nav-links { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-nav-links .nav-link { padding: 1rem 1.25rem; font-size: 1.1rem; border-radius: 12px; }

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    animation: fadeIn 0.5s ease;
    width: 100%;          /* never exceed viewport width */
    box-sizing: border-box;
}

/* ── BOTTOM NAV (mobile only) ────────────────────────── */
.bottom-nav {
    display: none; /* hidden on desktop */
}

.page-header { margin-bottom: 2rem; }

.page-title {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.page-subtitle { color: var(--text-muted); font-size: 1rem; }

/* ── GRID ────────────────────────────────────────────────── */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Finance stat row — always 3 columns even on mobile */
.grid-3.stat-row { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ── CARD ────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.35s ease;
    animation: cardIn 0.5s ease both;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.icon-sage   { background: linear-gradient(135deg, var(--accent-light), var(--accent)); }
.icon-clay   { background: linear-gradient(135deg, var(--clay), #C69586); }
.icon-water  { background: linear-gradient(135deg, var(--water), #5A8FA8); }
.icon-sleep  { background: linear-gradient(135deg, var(--sleep), #7A6E95); }
.icon-money  { background: linear-gradient(135deg, var(--warning-col), #D89560); }
.icon-danger { background: linear-gradient(135deg, var(--danger), #C46B5E); }

.card-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ── STAT BLOCKS ─────────────────────────────────────────── */
.stat-large {
    font-size: clamp(2rem, 5vw, 2.6rem);
    font-weight: 700;
    color: var(--accent-dark);
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-label { color: var(--text-muted); font-size: 0.9rem; }

.text-sage   { color: var(--accent-dark); }
.text-warn   { color: var(--warning-col); }
.text-danger { color: var(--danger); }

/* ── Feature guide — 3-pill nav showing Tasks / Goals / Habits distinction ── */
.feature-guide {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.83rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.feature-pill:hover { border-color: var(--accent); color: var(--accent-dark); }
.feature-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.feature-pill strong { font-weight: 700; }
.pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255,255,255,0.3);
    color: inherit;
    margin-left: 0.25rem;
}
.feature-pill:not(.active) .pill-count {
    background: var(--accent);
    color: white;
}

/* Compact stat cards — centred, icon above number */
.stat-card {
    text-align: center;
    padding: 1.25rem 1rem;
}

.stat-card .card-icon,
.stat-icon {
    margin: 0 auto 0.6rem;
}

.stat-card-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}

/* mobile-hide — hide on ≤900px (applied via media query below) */
.mobile-hide { }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-wrap {
    height: 10px;
    background: var(--bg-surface);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.progress-fill.water { background: linear-gradient(90deg, var(--water), #5A8FA8); }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;  /* never wider than its container */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.82rem, 1.4vw, 0.93rem);
    /* No min-width — let table-wrap scroll if needed, don't expand the page */
}

.data-table thead {
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table td {
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr { transition: background 0.2s ease; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table.striped tbody tr:nth-child(even) { background: var(--bg-stripe); }
.data-table.striped tbody tr:nth-child(even):hover { background: var(--bg-hover); }

.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-sage    { background: rgba(122,157,126,0.15); color: var(--accent-dark); }
.badge-clay    { background: rgba(212,165,154,0.2);  color: #b08070; }
.badge-water   { background: rgba(107,163,197,0.15); color: #4a8aaa; }
.badge-danger  { background: rgba(217,123,110,0.15); color: var(--danger); }
.badge-warning { background: rgba(232,168,124,0.2);  color: #c07840; }
.badge-muted   { background: var(--bg-surface);      color: var(--text-muted); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-control::placeholder { color: var(--text-muted); }
.form-control option       { background: var(--bg-card); color: var(--text-primary); }

.form-control:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(122,157,126,0.12);
}

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }

/* 2-col form grid — collapses to 1 col on mobile */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(122,157,126,0.35); }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); transform: translateY(-1px); }

.btn-danger {
    background: rgba(217,123,110,0.15);
    color: var(--danger);
    border: 1px solid rgba(217,123,110,0.3);
}
.btn-danger:hover { background: rgba(217,123,110,0.25); }

.btn-warning {
    background: rgba(232,168,124,0.15);
    color: #c07840;
    border: 1px solid rgba(232,168,124,0.3);
}
.btn-warning:hover { background: rgba(232,168,124,0.25); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ── ALERT ───────────────────────────────────────────────── */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.alert-danger  { background: rgba(217,123,110,0.12); color: var(--danger);  border: 1px solid rgba(217,123,110,0.25); }
.alert-success { background: rgba(122,157,126,0.12); color: var(--accent-dark); border: 1px solid rgba(122,157,126,0.25); }

/* ── TRACKER CARD ────────────────────────────────────────── */
.tracker-item {
    background: var(--bg-surface);
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: border-color 0.25s ease;
    margin-bottom: 1rem;
}

.tracker-item:hover { border-color: var(--accent); }

.tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tracker-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
}

.tracker-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-dark);
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }
.empty-state p { font-size: 0.95rem; }

/* ── FILTER TABS ─────────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.filter-tab:hover, .filter-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── AUTH PAGES ──────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg-body);
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(255,255,255,0.06);
    animation: cardIn 0.5s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-logo-text {
    font-family: 'Crimson Pro', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.auth-logo-text span { color: var(--clay); font-weight: 300; }

.auth-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a { color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* ── UTILITY ─────────────────────────────────────────────── */
.flex              { display: flex; }
.flex-wrap         { flex-wrap: wrap; }
.items-center      { align-items: center; }
.justify-between   { justify-content: space-between; }
.justify-end       { justify-content: flex-end; }
.gap-1             { gap: 0.5rem; }
.gap-2             { gap: 1rem; }
.w-100             { width: 100%; }
.mb-0              { margin-bottom: 0; }
.mb-1              { margin-bottom: 0.5rem; }
.mb-2              { margin-bottom: 1rem; }
.mb-3              { margin-bottom: 1.5rem; }
.mt-1              { margin-top: 0.5rem; }
.mt-2              { margin-top: 1rem; }
.fw-600            { font-weight: 600; }
.text-accent       { color: var(--accent-dark); }
.text-danger       { color: var(--danger); }
.text-muted        { color: var(--text-muted); }
.text-success      { color: var(--accent-dark); }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
    /* Top nav — hide text labels, keep icons only on mobile */
    .nav-text         { display: none; }
    .nav-links        { display: none; }
    .nav-desktop-only { display: none; }
    .nav-container    { padding: 0.75rem 1rem; }

    /* Page content — extra bottom padding so bottom nav doesn't cover content */
    .page-wrapper {
        padding: 1.25rem 0.9rem;
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }

    /* Cards */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .card   { padding: 1rem; border-radius: 14px; }

    /* Table */
    .data-table th, .data-table td { padding: 0.6rem 0.7rem; }
    .form-row { flex-direction: column; gap: 0; }

    /* Form inputs — bigger touch targets */
    .form-control { padding: 0.8rem 0.9rem; font-size: 1rem; }
    .btn          { padding: 0.75rem 1.2rem; font-size: 0.95rem; }

    /* Bottom nav — show on mobile */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 600;
        background: var(--bg-nav);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.1rem 0.4rem;
        text-decoration: none;
        color: var(--text-muted);
        transition: all 0.2s ease;
        min-height: 56px;
        gap: 0.12rem;
    }

    .bottom-nav-item:active { opacity: 0.7; transform: scale(0.95); }

    .bottom-nav-item.active {
        color: var(--accent-dark);
    }

    .bottom-nav-icon {
        font-size: 1.15rem;
        line-height: 1;
    }

    .bottom-nav-label {
        font-size: 0.58rem;
        font-weight: 600;
        letter-spacing: 0.02em;
    }

    /* Active tab indicator */
    .bottom-nav-item.active .bottom-nav-icon {
        filter: drop-shadow(0 0 4px var(--accent));
    }

    [data-theme="dark"] .bottom-nav {
        background: #1e2428;
        border-top-color: #2e3c44;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    }

    /* Compact page header on mobile */
    .page-header { margin-bottom: 1.25rem; }
    .page-title  { font-size: 1.5rem; }

    /* Stat cards — smaller on mobile */
    .stat-large  { font-size: 1.7rem; }
    .stat-card   { padding: 0.9rem 0.75rem; }

    /* hide less-important table cols on mobile */
    .mobile-hide { display: none !important; }

    /* Dashboard 4 stat cards → 2×2 grid on mobile */
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 0.75rem; }

    /* Finance stat row — 3 equal compact columns */
    .grid-3.finance-stats { gap: 0.6rem; }
    .card-icon   { width: 38px; height: 38px; font-size: 1.1rem; }

    /* Finance compact — labels smaller, less gap */
    .form-group  { margin-bottom: 0.75rem; }
    .form-label  { font-size: 0.82rem; margin-bottom: 0.3rem; }

    /* Form 2-col grid → single col on mobile */
    .form-grid-2 { grid-template-columns: 1fr; }

    /* Finance tabs — wrap to 2 rows on mobile so Settings is always visible */
    .fin-tabs {
        flex-wrap: wrap;
        gap: 0.2rem;
        padding-bottom: 0;
        border-bottom: none;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 0.35rem;
        margin-bottom: 1.25rem;
    }
    .fin-tab {
        flex: 1 1 calc(33.33% - 0.4rem);
        min-width: 0;
        justify-content: center;
        padding: 0.55rem 0.4rem;
        font-size: 0.78rem;
        border-bottom: none;
        border-radius: 10px;
        margin-bottom: 0;
        text-align: center;
    }
    .fin-tab.active {
        background: var(--bg-card);
        border-bottom: none;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
        color: var(--accent-dark);
    }
}

@media (max-width: 480px) {
    .auth-card      { padding: 1.75rem 1.25rem; }
    .nav-container  { padding: 0.65rem 0.85rem; }
    .nav-logo       { font-size: 1.15rem; }
    .card           { padding: 0.9rem; border-radius: 12px; }
    .card-title     { font-size: 1.05rem; }
    .tracker-value  { font-size: 1.2rem; }
    .btn            { padding: 0.7rem 1rem; font-size: 0.9rem; }
    /* Table — hide less important cols via class */
    .mobile-hide    { display: none; }
}

/* ── SETUP CHECKLIST (dashboard) ────────────────────────── */
.setup-checklist {
    background: var(--bg-card);
    border: 1px solid rgba(122, 157, 126, 0.3);
    border-left: 4px solid var(--accent-dark);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    animation: cardIn 0.4s ease;
}
.setup-cl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.setup-cl-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}
.setup-cl-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.setup-cl-dismiss:hover { color: var(--text-primary); }
.setup-cl-items {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.setup-cl-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.45rem 0.5rem;
    border-radius: 7px;
    transition: background 0.15s;
}
.setup-cl-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.setup-cl-item.done {
    color: var(--text-muted);
    text-decoration: line-through;
}
.setup-cl-item.done:hover {
    background: none;
    cursor: default;
}
.setup-cl-check {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--accent-dark);
}
.setup-cl-item:not(.done) .setup-cl-check {
    color: var(--text-muted);
    font-weight: 400;
}
