/* ============================================================================
   app.css — Expense Tracker · Forest design system
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&family=Spline+Sans+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Forest light (default) ────────────────────────────────────────────────── */
:root,
[data-theme="forest"] {
    --bg:          #e8efdf;
    --surface:     #fbfcf4;
    --soft:        #edf3e4;
    --track:       #dbe6cd;
    --hair:        #dde8d2;
    --ink:         #1b2a20;
    --ink2:        #52614e;
    --muted:       #79866e;
    --muted2:      #a3ae93;
    --accent:      #26845c;
    --accent2:     #15623f;
    --accent-soft: #d5e8d6;
    --on-accent:   #fbfcf4;
    --pos:         #bb8a24;
    --pos-soft:    #f3e9c8;
    --clay:        #c5824c;

    /* backward-compat aliases for existing class-based CSS */
    --color-primary:        var(--accent);
    --color-primary-hover:  var(--accent2);
    --color-primary-fg:     var(--on-accent);
    --color-primary-10:     rgba(38,132,92,0.10);
    --color-primary-20:     rgba(38,132,92,0.20);
    --color-primary-30:     rgba(38,132,92,0.30);
    --color-bg:             var(--bg);
    --color-surface:        var(--surface);
    --color-secondary:      var(--soft);
    --color-muted:          var(--track);
    --color-text:           var(--ink);
    --color-text-secondary: var(--ink2);
    --color-text-muted:     var(--muted);
    --color-border:         var(--hair);
    --color-ring:           var(--accent);
    --color-success:        #26845c;
    --color-warning:        #bb8a24;
    --color-danger:         #b04a35;
    --color-danger-hover:   #963d2c;
    --color-info:           #6b8cae;
    --color-warning-bg:     #f3e9c8;
    --color-warning-text:   #8a6a1a;
    --color-error-bg:       oklch(0.96 0.04 20);
    --color-error-text:     oklch(0.45 0.18 20);

    --sidebar-w: 248px;
    --radius:    0.875rem;
    --radius-sm: 0.625rem;
    --radius-lg: 1.125rem;

    --shadow:    0 1px 2px rgba(43,37,33,.04);
    --shadow-md: 0 4px 8px -2px rgba(43,37,33,.08);
    --shadow-lg: 0 14px 30px -16px rgba(21,98,63,.4);

    --font:   'Hanken Grotesk', system-ui, sans-serif;
    --serif:  'Newsreader', Georgia, serif;
    --mono:   'Spline Sans Mono', ui-monospace, monospace;
}

/* ── Forest dark ────────────────────────────────────────────────────────────── */
[data-theme="forest-dark"] {
    --bg:          #10201a;
    --surface:     #17261e;
    --soft:        #1e2d24;
    --track:       #2a3a30;
    --hair:        #2a3930;
    --ink:         #e9f0e5;
    --ink2:        #aebcb0;
    --muted:       #88978a;
    --muted2:      #67756b;
    --accent:      #2f9e6b;
    --accent2:     #1f6f4c;
    --accent-soft: #1c3328;
    --on-accent:   #fbfcf4;
    --pos:         #d2a23a;
    --pos-soft:    #2f2a17;
    --clay:        #cf8a54;

    --color-primary:        var(--accent);
    --color-primary-hover:  var(--accent2);
    --color-primary-fg:     var(--on-accent);
    --color-primary-10:     rgba(47,158,107,0.15);
    --color-primary-20:     rgba(47,158,107,0.25);
    --color-primary-30:     rgba(47,158,107,0.35);
    --color-bg:             var(--bg);
    --color-surface:        var(--surface);
    --color-secondary:      var(--soft);
    --color-muted:          var(--track);
    --color-text:           var(--ink);
    --color-text-secondary: var(--ink2);
    --color-text-muted:     var(--muted);
    --color-border:         var(--hair);
    --color-error-bg:       rgba(176,74,53,0.15);
    --color-error-text:     #e2816e;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background:  var(--bg);
    color:       var(--ink);
    line-height: 1.5;
    min-height:  100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); text-decoration: underline; }

/* ── Type utilities ───────────────────────────────────────────────────────── */
.et-serif  { font-family: var(--serif); }
.et-mono   { font-family: var(--mono); }
.et-num    { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ── Logo mark ─────────────────────────────────────────────────────────────── */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.logo:hover { opacity: 0.85; text-decoration: none; }

.logo__leaf {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.logo__leaf-inner {
    width: 16px;
    height: 16px;
    background: linear-gradient(140deg, #2f9367, var(--accent2));
    border-radius: 1px 100% 1px 100%;
    transform: rotate(45deg);
    display: block;
}
.logo__wordmark {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--ink);
}
.logo__dot      { color: var(--accent); }
.logo__secondary { font-weight: 500; color: var(--ink2); }

/* ── App shell & sidebar ───────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 22px 16px;
    background: var(--surface);
    border-right: 1px solid var(--hair);
    z-index: 30;
    transition: background .25s ease, border-color .25s ease;
}

.sidebar__logo {
    padding: 4px 8px 18px;
}

.sidebar__household {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 11px;
    margin-bottom: 14px;
    background: var(--soft);
    border: 1px solid var(--hair);
    border-radius: 12px;
    text-align: left;
    text-decoration: none;
    color: var(--ink);
}
.sidebar__household:hover { text-decoration: none; border-color: var(--accent-soft); }
.sidebar__household-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex: 0 0 auto;
}
.sidebar__household-name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.sidebar__household-chevron { color: var(--muted2); font-size: 12px; flex: 0 0 auto; }

.sidebar__menu-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--muted2);
    padding: 0 11px 7px;
    text-transform: uppercase;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar__nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 11px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink2);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar__nav-link:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.sidebar__nav-link--active {
    color: var(--accent);
    font-weight: 700;
    background: var(--accent-soft);
}

.sidebar__spacer { flex: 1; }

.sidebar__theme-toggle {
    display: flex;
    gap: 4px;
    background: var(--soft);
    border: 1px solid var(--hair);
    border-radius: 12px;
    padding: 4px;
    margin-top: 12px;
}
.sidebar__theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 9px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s, box-shadow .15s;
}
.sidebar__theme-btn--active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0,0,0,.14);
    font-weight: 700;
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 2px;
    margin-top: 10px;
    border-top: 1px solid var(--track);
}
.sidebar__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex: 0 0 auto;
}
.sidebar__user-info { min-width: 0; line-height: 1.3; }
.sidebar__user-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 12px; color: var(--muted); }

/* ── Mobile top bar ─────────────────────────────────────────────────────────── */
.topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 25;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hair);
    transition: background .25s ease;
}
.topbar__theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid var(--hair);
    background: var(--soft);
    color: var(--ink2);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.topbar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex: 0 0 auto;
}

/* ── App content area ───────────────────────────────────────────────────────── */
.app-content {
    padding-left: var(--sidebar-w);
    min-height: 100vh;
}
.app-content__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 30px 40px 70px;
}

/* ── Mobile bottom nav ──────────────────────────────────────────────────────── */
.bottomnav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 25;
    align-items: center;
    justify-content: space-around;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--hair);
    transition: background .25s ease;
}
.bottomnav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    color: var(--muted2);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 0;
    transition: color .15s;
}
.bottomnav__item:hover { color: var(--ink2); text-decoration: none; }
.bottomnav__item--active { color: var(--accent); }

/* ── Auth/guest layout (no sidebar) ────────────────────────────────────────── */
.main { padding: 1.5rem 1.5rem 3rem; }

@media (max-width: 900px) {
    .sidebar     { display: none; }
    .topbar      { display: flex; }
    .bottomnav   { display: flex; }
    .app-content { padding-left: 0; padding-bottom: 94px; }
    .app-content__inner { padding: 20px 16px 40px; }
}

/* ── Page auth layout ───────────────────────────────────────────────────────── */
.page--auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 1.5rem 1rem;
}
.auth { width: 100%; max-width: 420px; }
.auth__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}
.auth__card {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}
.auth__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.auth__subtitle { font-size: 0.9rem; color: var(--muted); line-height: 1.5; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
    line-height: 1.5;
}
.alert--error   { background: var(--color-error-bg);   color: var(--color-error-text);   border-color: oklch(0.88 0.08 20); }
.alert--success { background: oklch(0.97 0.06 145);    color: oklch(0.35 0.15 145);      border-color: oklch(0.87 0.10 145); }
.alert--info    { background: oklch(0.97 0.04 250);    color: oklch(0.35 0.14 250);      border-color: oklch(0.87 0.08 250); }
.alert--warning { background: var(--color-warning-bg); color: var(--color-warning-text); border-color: oklch(0.88 0.09 85); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form        { display: flex; flex-direction: column; gap: 1rem; }
.form__group { display: flex; flex-direction: column; gap: 0.375rem; }
.form__label { font-size: 0.875rem; font-weight: 500; color: var(--ink); }

.form__input,
.form__select,
.form__textarea {
    padding: 0.625rem 0.75rem;
    height: 2.75rem;
    border: 1.5px solid var(--hair);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9375rem;
    width: 100%;
    background: var(--soft);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.form__textarea { height: auto; min-height: 6rem; }
.form__input::placeholder,
.form__select::placeholder,
.form__textarea::placeholder { color: var(--muted); }
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--color-primary-20);
}
.form__input[type="file"] { height: auto; padding: 0.5rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0 1rem;
    height: 2.25rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    white-space: nowrap;
    line-height: 1;
    user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-primary-30); }

.btn--primary       { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent2); border-color: var(--accent2); text-decoration: none; color: var(--on-accent); }

.btn--danger        { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn--danger:hover  { background: var(--color-danger-hover); border-color: var(--color-danger-hover); text-decoration: none; color: #fff; }

.btn--ghost         { background: transparent; border-color: var(--hair); color: var(--ink); }
.btn--ghost:hover   { background: var(--soft); text-decoration: none; color: var(--ink); }

.btn--sm    { height: 1.875rem; padding: 0 0.625rem; font-size: 0.8125rem; }
.btn--full  { width: 100%; height: 2.75rem; font-size: 0.9375rem; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.card__title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 1rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

/* ── Expense list ─────────────────────────────────────────────────────────── */
.expense-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.expense-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.expense-item:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); }

.expense-item__date   { color: var(--muted); font-size: 0.8rem; min-width: 78px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.expense-item__cat    { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--soft); border: 1px solid var(--hair); white-space: nowrap; font-weight: 500; color: var(--ink2); }
.expense-item__desc   { flex: 1; color: var(--muted); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-item__amount { font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.expense-item__actions { display: flex; gap: 0.375rem; }

/* ── Summary ──────────────────────────────────────────────────────────────── */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.summary__item {
    text-align: center;
    padding: 1.125rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--hair);
}
.summary__value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.summary__label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Loading / empty states ───────────────────────────────────────────────── */
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; font-size: 0.875rem; line-height: 1.6; }
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--hair); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    box-shadow: var(--shadow);
}
.filter-bar__btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.filter-bar__btn:hover     { background: var(--soft); color: var(--ink); }
.filter-bar__btn--active   { background: var(--ink); color: var(--bg); }

/* ── Edit expense dialog ──────────────────────────────────────────────────── */
.expense-dialog {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    width: min(500px, 92vw);
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 20px 50px -20px rgba(42,37,33,.5);
}
.expense-dialog::backdrop { background: oklch(0 0 0 / 0.45); backdrop-filter: blur(4px); }
.expense-dialog__inner    { padding: 1.5rem; }

/* ── Charts ───────────────────────────────────────────────────────────────── */
.charts-card { padding: 1.5rem; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.chart-section__title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.75rem;
}
.chart-container--donut,
.chart-container--bar   { position: relative; height: 220px; }
.chart-empty            { text-align: center; color: var(--muted); font-size: 0.875rem; padding: 1rem 0; }

/* ── Expense list header ──────────────────────────────────────────────────── */
.expense-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.75rem;
}
.expense-list-count { font-size: 0.8rem; color: var(--muted); }

/* ── Section label ────────────────────────────────────────────────────────── */
.section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.6rem;
}

/* ── Income bar ───────────────────────────────────────────────────────────── */
.income-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}
.income-bar__tile { padding: 0.75rem 0.5rem; }
.income-bar__sep  { width: 1px; height: 2.5rem; background: var(--hair); }
.income-bar__value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.income-bar__label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.income-bar__value--income   { color: var(--accent); }
.income-bar__value--expense  { color: var(--color-danger); }
.income-bar__value--positive { color: var(--accent); }
.income-bar__value--negative { color: var(--color-danger); }

/* ── Budget grid & progress bar ───────────────────────────────────────────── */
.budget-grid { display: flex; flex-direction: column; gap: 0.125rem; }

.budget-row {
    display: grid;
    grid-template-columns: 130px 1fr 160px 110px auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.375rem;
    border-bottom: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.budget-row:last-child { border-bottom: none; }
.budget-row:hover { background: var(--soft); }

.budget-row__cat              { font-weight: 500; font-size: 0.9rem; }
.budget-row__nums             { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.85rem; white-space: nowrap; }
.budget-row__nums--muted      { color: var(--muted); }
.budget-row__spent            { color: var(--ink); }
.budget-row__sep              { color: var(--muted); margin: 0 0.1rem; }
.budget-row__limit            { color: var(--muted); }
.budget-row__remaining        { font-size: 0.8rem; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.budget-row__remaining--over  { color: var(--color-danger); font-weight: 600; }
.budget-row__remaining--ok    { color: var(--accent); }
.budget-row__actions          { display: flex; gap: 0.375rem; }

.budget-progress { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.budget-progress__bar         { height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.budget-progress__bar--ok     { background: var(--accent); }
.budget-progress__bar--warn   { background: var(--pos); }
.budget-progress__bar--over   { background: var(--color-danger); }
.budget-progress__bar--empty  { background: var(--hair); }

/* ── Project budget cards ─────────────────────────────────────────────────── */
.project-card {
    border: 1px solid var(--hair);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.project-card:last-child { margin-bottom: 0; }
.project-card:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); }

.project-card__header    { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.project-card__title-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.project-card__name      { font-weight: 600; font-size: 1rem; color: var(--ink); }
.project-card__actions   { display: flex; gap: 0.375rem; flex-shrink: 0; }
.project-card__metrics   { display: flex; gap: 1.5rem; margin-bottom: 0.5rem; }

.project-metric           { text-align: center; }
.project-metric__value    { display: block; font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1rem; }
.project-metric__value--spent    { color: var(--color-danger); }
.project-metric__value--upcoming { color: var(--pos); }
.project-metric__value--over     { color: var(--color-danger); }
.project-metric__label    { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

/* ── Item table ───────────────────────────────────────────────────────────── */
.item-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 0.5rem; }
.item-table th {
    text-align: left;
    padding: 0.35rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--hair);
}
.item-table td                   { padding: 0.5rem; vertical-align: middle; }
.item-row + .item-row td         { border-top: 1px solid var(--hair); }
.item-row--paid .item-row__desc  { color: var(--muted); text-decoration: line-through; }
.item-row--cancelled             { opacity: 0.5; }
.item-row__amount  { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.item-row__date    { font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.item-row__actions { display: flex; gap: 0.3rem; white-space: nowrap; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 0.175rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.status-badge--active    { background: oklch(0.97 0.07 145); color: oklch(0.38 0.18 145); }
.status-badge--completed { background: oklch(0.97 0.05 250); color: oklch(0.38 0.14 250); }
.status-badge--cancelled { background: var(--track); color: var(--muted); }
.status-badge--planned   { background: oklch(0.97 0.07 85);  color: oklch(0.45 0.14 75); }
.status-badge--paid      { background: oklch(0.97 0.07 145); color: oklch(0.38 0.18 145); }

/* ── Income source rows ───────────────────────────────────────────────────── */
.income-source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.375rem;
    border-bottom: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.income-source-row:last-of-type { border-bottom: none; }
.income-source-row:hover { background: var(--soft); }
.income-source-row__info    { display: flex; flex-direction: column; gap: 0.15rem; }
.income-source-row__name    { font-weight: 500; font-size: 0.9rem; }
.income-source-row__meta    { font-size: 0.8rem; color: var(--muted); }
.income-source-row__actions { display: flex; gap: 0.375rem; flex-shrink: 0; }

/* ── Income entry rows ────────────────────────────────────────────────────── */
.income-entry-row {
    display: grid;
    grid-template-columns: 90px 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.375rem;
    border-bottom: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.income-entry-row:last-of-type { border-bottom: none; }
.income-entry-row:hover { background: var(--soft); }
.income-entry-row__date   { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.income-entry-row__desc   { font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.income-entry-row__amount { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); white-space: nowrap; }
.income-entry-row__actions { display: flex; gap: 0.375rem; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-muted { color: var(--muted); font-size: 0.875em; }
.container  { max-width: 1024px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    user-select: none;
    border: 2px solid var(--surface);
    box-shadow: var(--shadow);
}
.avatar--xs { width: 1.5rem;  height: 1.5rem;  font-size: 0.65rem; }
.avatar--sm { width: 2rem;    height: 2rem;    font-size: 0.75rem; }
.avatar--lg { width: 4rem;    height: 4rem;    font-size: 1.4rem; }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--accent);
    color: var(--on-accent);
    vertical-align: middle;
}
.badge--muted { background: var(--track); color: var(--muted); }
.badge--ai { background: var(--pos-soft); color: var(--pos); border: 1px solid var(--pos-soft); }
.badge--ai-off { background: var(--soft); color: var(--muted); border: 1px solid var(--hair); }

/* ── Insight cards ────────────────────────────────────────────────────────── */
.insight-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.insight-card {
    border-left: 4px solid transparent;
    border-radius: 14px;
    padding: 16px 18px;
}
.insight-card--warn { background: var(--accent-soft); border-left-color: var(--accent); }
.insight-card--info { background: var(--surface); border: 1px solid var(--hair); border-left: 4px solid #6b8cae; }
.insight-card--good { background: var(--pos-soft); border-left-color: var(--pos); }
.insight-card__tag { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }
.insight-card__statement { font-size: 16.5px; font-weight: 600; line-height: 1.4; margin: 7px 0 5px; }
.insight-card__meta { font-size: 13.5px; color: var(--muted); }
.insight-card__actions { display: flex; gap: 8px; margin-top: 13px; }
.insight-footer-note {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 720px;
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px dashed var(--muted2);
    border-radius: 14px;
    background: var(--soft);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── Settings page ────────────────────────────────────────────────────────── */
.settings-section { margin-bottom: 0; }
.settings-flash   { margin-bottom: 1rem; }
.settings-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--hair);
}
.settings-profile__name  { font-weight: 600; font-size: 1rem; }
.settings-profile__email { font-size: 0.875rem; color: var(--muted); margin-top: 0.125rem; }
.settings-hint { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; line-height: 1.6; }
.settings-hint strong { color: var(--ink); }
.settings-form { max-width: 480px; }
.settings-form--inline { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.settings-form--inline .form__input { flex: 1; min-width: 180px; }

/* ── Invite-link copy box ─────────────────────────────────────────────────── */
.invite-link-box { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.invite-link-box .form__input { font-family: var(--mono); font-size: 0.8rem; }

/* ── Family member list ───────────────────────────────────────────────────── */
.family-member-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.family-member-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}
.family-member-item:hover { border-color: var(--accent-soft); }
.family-member-item__name   { flex: 1; font-size: 0.9rem; }
.family-member-item__action { margin-left: auto; }

/* ── Expense list — attribution ───────────────────────────────────────────── */
.expense-item__attribution { display: inline-flex; align-items: center; margin-right: 0.25rem; }

/* ── Expense history panel ────────────────────────────────────────────────── */
.expense-history {
    margin-top: 1rem;
    border-top: 1px solid var(--hair);
    padding-top: 0.75rem;
}
.expense-history__toggle { cursor: pointer; font-size: 0.85rem; color: var(--muted); font-weight: 600; user-select: none; }
.expense-history__toggle:hover { color: var(--ink); }
.expense-history__list { list-style: none; margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.expense-history__item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.expense-history__who  { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: var(--ink); }
.expense-history__when { font-size: 0.75rem; }
.expense-history__before { font-style: italic; }

/* ── Invite page ──────────────────────────────────────────────────────────── */
.main--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 1.5rem 1rem;
}
.invite-card { width: 100%; max-width: 480px; }
.invite-card__logo-wrap { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.invite-card__intro { margin-bottom: 1.5rem; color: var(--muted); line-height: 1.6; }
.invite-card__intro strong { color: var(--ink); }
.invite-card__login-hint { margin-top: 1.25rem; font-size: 0.875rem; color: var(--muted); line-height: 1.6; }
.invite-card__login-hint a { color: var(--accent); }
.invite-card__login-hint a:hover { text-decoration: underline; }

/* ── Header (kept for backward compat, now replaced by sidebar) ───────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--hair);
    box-shadow: var(--shadow);
}
.header__nav  { display: flex; align-items: center; gap: 0.125rem; }
.header__user { color: var(--muted); font-size: 0.8125rem; padding: 0 0.625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.header__logout-form { display: flex; }
.header__logout {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    font-family: var(--font);
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    height: 2rem;
}
.header__logout:hover { color: var(--ink); background: var(--soft); text-decoration: none; }
.header__nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    height: 2rem;
}
.header__nav-link:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.header__nav-link--active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
/* ── Sidebar "Add expense" button ─────────────────────────────────────────── */
.sidebar__add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 13px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 16px -6px rgba(0,0,0,.2);
    transition: background .15s, box-shadow .15s;
    margin-bottom: 4px;
}
.sidebar__add-btn:hover { background: var(--accent2); color: var(--on-accent); text-decoration: none; box-shadow: 0 8px 20px -6px rgba(0,0,0,.28); }

/* ── Dashboard greeting ───────────────────────────────────────────────────── */
.dash-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.dash-header--simple { align-items: flex-start; }
.dash-eyebrow {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.3px;
}
.dash-greeting {
    margin: 3px 0 0;
    font-size: 31px;
    font-weight: 500;
    letter-spacing: -0.3px;
    white-space: nowrap;
    line-height: 1.2;
}
.dash-note { font-size: 14px; color: var(--muted); margin: 4px 0 0; }

/* ── Quick-add card ───────────────────────────────────────────────────────── */
.quick-add { padding: 16px; }
.quick-add__row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.quick-add__amount-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--soft);
    border: 1.5px solid var(--hair);
    border-radius: 13px;
    padding: 0 14px;
    height: 52px;
    flex: 1 1 120px;
    transition: border-color .15s;
}
.quick-add__amount-wrap:focus-within { border-color: var(--accent); }
.quick-add__dollar {
    font-size: 22px;
    font-weight: 700;
    color: var(--muted2);
    line-height: 1;
    flex: 0 0 auto;
}
.quick-add__amount-input {
    border: none;
    background: none;
    outline: none;
    font-size: 22px;
    font-weight: 700;
    width: 100%;
    min-width: 70px;
    color: var(--ink);
    font-family: var(--font);
}
.quick-add__amount-input::placeholder { color: var(--muted2); }
.quick-add__currency {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-left: 1px solid var(--hair);
    background: none;
    outline: none;
    height: 100%;
    padding: 0 4px 0 12px;
    margin-left: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink2);
    font-family: var(--font);
    flex: 0 0 auto;
    max-width: 84px;
}
.quick-add__desc {
    border: 1.5px solid var(--hair);
    background: var(--soft);
    border-radius: 13px;
    padding: 0 16px;
    height: 52px;
    font-size: 15px;
    outline: none;
    flex: 2 1 200px;
    color: var(--ink);
    font-family: var(--font);
    transition: border-color .15s;
}
.quick-add__desc::placeholder { color: var(--muted); }
.quick-add__desc:focus { border-color: var(--accent); }
.quick-add__tag-select {
    height: 52px;
    max-width: 150px;
    min-width: 0;
    flex: 0 1 130px;
    border: 1.5px solid var(--hair);
    background: var(--soft);
    border-radius: 13px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--ink);
    font-family: var(--font);
}
.quick-add__submit {
    height: 52px;
    padding: 0 26px;
    font-size: 15px;
    font-weight: 700;
    flex: 0 0 auto;
    border-radius: 13px;
    white-space: nowrap;
    box-shadow: 0 6px 16px -7px rgba(0,0,0,.2);
}
.quick-add__chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.quick-add__chip {
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1.5px solid var(--hair);
    background: var(--surface);
    color: var(--ink2);
    cursor: pointer;
    font-family: var(--font);
    transition: background .15s, color .15s, border-color .15s;
}
.quick-add__chip:hover { background: var(--soft); }
.quick-add__chip--active {
    background: var(--chip-bg, var(--accent));
    color: var(--on-accent);
    border-color: var(--chip-bg, var(--accent));
}

/* ── Hero card ────────────────────────────────────────────────────────────── */
.hero-card {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--on-accent);
    border-radius: 20px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 14px 30px -16px rgba(0,0,0,.2);
}
.hero-card__period {
    font-size: 13px;
    font-weight: 600;
    opacity: .85;
}
.hero-card__spend {
    font-size: 46px;
    font-weight: 500;
    letter-spacing: -0.5px;
    margin: 2px 0 6px;
    line-height: 1.1;
}
.hero-card__budget-note { font-size: 13.5px; opacity: .85; }
.hero-card__right { text-align: right; min-width: 120px; }
.hero-card__left-label { font-size: 13px; font-weight: 600; opacity: .85; }
.hero-card__left-amount { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.hero-card__bar-track {
    width: 130px;
    height: 8px;
    background: rgba(255,255,255,.28);
    border-radius: 999px;
    margin: 9px 0 0 auto;
    overflow: hidden;
}
.hero-card__bar { height: 100%; background: var(--on-accent); border-radius: 999px; transition: width .4s ease; }

/* ── Stat tiles ───────────────────────────────────────────────────────────── */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 18px;
    padding: 16px;
}
.stat-tile__label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}
.stat-tile__value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-top: 3px;
}
.stat-tile__value--pos { color: var(--pos); }

/* ── Charts row ───────────────────────────────────────────────────────────── */
.charts-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.chart-card { flex: 1 1 290px; padding: 20px; }

/* ── CSS Donut chart ──────────────────────────────────────────────────────── */
.donut-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.donut-chart {
    width: 124px;
    height: 124px;
    border-radius: 50%;
    flex: 0 0 auto;
    position: relative;
}
.donut-inner {
    position: absolute;
    inset: 26px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.donut-inner__label { font-size: 11px; color: var(--muted); font-weight: 600; }
.donut-inner__value { font-size: 16px; font-weight: 800; }
.donut-legend { flex: 1 1 130px; display: flex; flex-direction: column; gap: 9px; }
.donut-legend-item { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.donut-legend-item__swatch { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }
.donut-legend-item__name { flex: 1; color: var(--ink2); }
.donut-legend-item__pct { color: var(--muted); font-weight: 600; }

/* ── CSS Bar chart ────────────────────────────────────────────────────────── */
.bar-chart-wrap { margin-top: 8px; }
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 130px;
}
.bar-chart__group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}
.bar-chart__bar {
    width: 100%;
    min-height: 6px;
    border-radius: 7px 7px 0 0;
    transition: height .4s ease;
}
.bar-chart__label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ── Activity feed ────────────────────────────────────────────────────────── */
.activity-card { padding: 8px 20px 12px; }
.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 6px;
}
.activity-header__title { font-size: 15px; font-weight: 700; }
.activity-header__count { font-size: 13px; color: var(--accent); font-weight: 600; }
.activity-feed { list-style: none; }
.expense-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 0;
    border-top: 1px solid var(--hair);
}
.activity-dot {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.activity-dot__inner {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}
.activity-item__info { flex: 1; min-width: 0; }
.activity-item__desc {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-item__meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.activity-item__amount { font-size: 16px; font-weight: 700; white-space: nowrap; }
.expense-item__actions { display: flex; gap: .375rem; margin-left: 4px; }
.expense-item__actions--readonly { display: none; }

/* ── Date range popover ───────────────────────────────────────────────────── */
.filter-wrap { position: relative; }
.date-range-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 16px 38px -14px rgba(0,0,0,.34);
    width: 272px;
}
.date-range-popover__title { font-size: 13.5px; font-weight: 700; margin-bottom: 11px; }
.date-range-popover__fields { display: flex; flex-direction: column; gap: 9px; }
.date-range-popover__label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; }
.date-range-popover__actions { display: flex; gap: 8px; margin-top: 13px; }
.date-range-popover__actions .btn--primary { flex: 1; }

/* ── Budget / flow chart ──────────────────────────────────────────────────── */
.budget-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 13px;
}
.budget-section-title { font-size: 16px; font-weight: 700; }

.flow-chart { padding: 20px; }
.flow-chart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.flow-chart__title { font-size: 15px; font-weight: 700; }
.flow-chart__saved-label { font-size: 14px; font-weight: 700; }
.flow-chart__bars {
    display: flex;
    align-items: flex-end;
    gap: 28px;
    height: 150px;
}
.flow-chart__group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    height: 100%;
    justify-content: flex-end;
}
.flow-chart__amt { font-size: 14px; font-weight: 700; }
.flow-chart__bar-wrap { flex: 1; display: flex; align-items: flex-end; }
.flow-chart__bar {
    width: 46px;
    border-radius: 8px 8px 0 0;
    transition: height .5s ease;
    min-height: 8px;
}
.flow-chart__bar--in    { background: var(--accent); }
.flow-chart__bar--out   { background: var(--clay); }
.flow-chart__bar--saved { background: var(--pos); }
.flow-chart__lbl { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ── Envelope cards ───────────────────────────────────────────────────────── */
.envelope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}
.envelope-card {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 16px;
    padding: 16px;
    transition: border-color .15s, box-shadow .15s;
}
.envelope-card:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); }
.envelope-card--empty { opacity: 0.7; }
.envelope-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}
.envelope-card__name-row { display: flex; align-items: center; gap: 9px; }
.envelope-swatch { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }
.envelope-card__name { font-size: 15px; font-weight: 700; }
.envelope-card__nums { font-size: 13.5px; color: var(--muted); }
.envelope-progress {
    height: 9px;
    background: var(--track);
    border-radius: 999px;
    overflow: hidden;
}
.envelope-progress__fill {
    height: 100%;
    border-radius: 999px;
    transition: width .5s ease;
}
.envelope-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.envelope-card__pct { font-size: 12px; font-weight: 600; }
.envelope-card__actions { display: flex; gap: .3rem; }

/* ── Income two-column layout ─────────────────────────────────────────────── */
.income-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Accounts & loans summary tiles ───────────────────────────────────────── */
.acct-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.acct-summary__tile {
    border-radius: 18px;
    padding: 20px 22px;
}
.acct-summary__tile--cash {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--on-accent);
}
.acct-summary__tile--debt {
    background: var(--surface);
    border: 1px solid var(--hair);
}
.acct-summary__label {
    font-size: 13px;
    font-weight: 600;
}
.acct-summary__tile--cash .acct-summary__label { opacity: .85; }
.acct-summary__tile--debt .acct-summary__label { color: var(--muted); }
.acct-summary__value {
    font-size: 34px;
    font-weight: 500;
    margin-top: 2px;
}
.acct-summary__tile--debt .acct-summary__value {
    font-size: 30px;
    font-weight: 800;
    color: var(--clay);
}
.acct-summary__note {
    font-size: 12.5px;
    opacity: .8;
    margin-top: 2px;
}
.acct-summary__breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 8px;
}
.acct-summary__breakdown span { font-size: 12px; color: var(--muted); }
.acct-summary__breakdown b { color: var(--ink2); }

/* ── Account rows ─────────────────────────────────────────────────────────── */
.account-list {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 26px;
}
.account-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 18px;
    border-top: 1px solid var(--hair);
}
.account-row:first-child { border-top: none; }
.account-row__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--accent);
}
.account-row__dot--neg { background: var(--clay); }
.account-row__info { flex: 1; min-width: 0; }
.account-row__name { font-size: 15px; font-weight: 600; }
.account-row__meta { font-size: 12.5px; color: var(--muted); }
.account-row__balance { font-size: 16px; font-weight: 700; }
.account-row__balance--neg { color: var(--clay); }
.account-row__actions { display: flex; gap: .3rem; flex: 0 0 auto; }

/* ── Savings goal cards ───────────────────────────────────────────────────── */
.goal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 12px;
}
.goal-card {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.goal-card--new {
    border: 1.5px dashed var(--muted2);
    background: var(--soft);
    justify-content: center;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    min-height: 64px;
}
.goal-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.goal-ring__inner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.goal-card__info { flex: 1; min-width: 0; }
.goal-card__name { font-size: 16px; font-weight: 700; line-height: 1.25; }
.goal-card__nums { font-size: 14px; color: var(--ink2); margin-top: 2px; }
.goal-card__due { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.goal-card__actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.goal-card__add-funds { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.goal-card__add-funds input {
    width: 80px;
    border: 1px solid var(--hair);
    background: var(--soft);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 13px;
    color: var(--ink);
}

/* ── Settings: section labels ─────────────────────────────────────────────── */
.settings-section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--muted2);
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* ── Settings: household member rows ─────────────────────────────────────── */
.household-member {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border-top: 1px solid var(--hair);
}
.household-member:first-child { border-top: none; }
.household-member__info { flex: 1; min-width: 0; }
.household-member__name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.household-member__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.household-member__bar-track {
    height: 6px;
    background: var(--track);
    border-radius: 999px;
    overflow: hidden;
    max-width: 220px;
}
.household-member__bar { height: 100%; border-radius: 999px; transition: width .5s ease; }

/* ── Settings: preferences card rows ─────────────────────────────────────── */
.prefs-card .prefs-row { border-top: 1px solid var(--hair); }
.prefs-card .prefs-row:first-child { border-top: none; }
.prefs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
}
.prefs-row__label { font-size: 15px; font-weight: 600; }
.prefs-row__value { font-size: 14px; color: var(--muted); }

/* ── Responsive additions ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header           { padding: 0 1rem; height: 56px; }
    .header__user     { display: none; }
    .main             { padding: 1rem 1rem 2rem; }
    .form__row        { grid-template-columns: 1fr; }
    .expense-item__desc { display: none; }
    .expense-item__date { min-width: auto; }
    .charts-grid      { grid-template-columns: 1fr; }
    .chart-container--donut,
    .chart-container--bar { height: 200px; }
    .income-bar { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
    .income-bar__sep { display: none; }
    .budget-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
    }
    .budget-row > .budget-progress { grid-column: 1 / -1; }
    .budget-row__remaining { display: none; }
    .project-card__metrics { flex-wrap: wrap; gap: 0.75rem; }
    .income-entry-row { grid-template-columns: 80px 1fr auto; }
    .income-entry-row__actions { display: none; }
    .income-columns { grid-template-columns: 1fr; }

    /* New component mobile overrides */
    .dash-greeting { font-size: 24px; }
    .stat-tiles    { grid-template-columns: 1fr 1fr; }
    .hero-card     { flex-direction: column; gap: 12px; }
    .hero-card__right { text-align: left; }
    .hero-card__bar-track { margin-left: 0; }
    .quick-add__row { flex-direction: column; align-items: stretch; }
    .quick-add__amount-wrap { flex: none; }
    .charts-row    { flex-direction: column; }
    .activity-item__desc { font-size: 14px; }
}
