@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Sora:wght@600;700;800&display=swap');

:root {
    /* Surfaces */
    --bg: #0a1019;
    --ink: #eaf1fb;
    --muted: #8ea3bf;
    --faint: #5b6b82;

    /* Brand */
    --accent: #2f6fed;
    --accent-lite: #5aa0ff;
    --mint: #1fb87a;
    --mint-lite: #3fd39a;
    --accent-soft: rgba(90, 160, 255, 0.16);

    /* Category accents (fallback swatches only — real categories use their
       own stored Category.color; these back the "Other categories" chart
       slice and any UI needing a neutral accent) */
    --cat-mint: #3f9e7c;
    --cat-blue: #4a79c9;
    --cat-violet: #8878c4;
    --cat-amber: #c79a4e;
    --cat-red: #c76b6b;

    /* Glass card surface */
    --card: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.09);
    --shadow: none;

    --radius-lg: 26px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --radius-pill: 999px;

    --glow-accent: 0 12px 26px -6px rgba(31, 184, 122, 0.6);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, "Segoe UI", sans-serif;
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: radial-gradient(140% 90% at 50% -10%, #16324f 0%, #0e1726 40%, #0a1019 75%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-family: 'Sora', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 1.25rem;
}

/* ---------- App header ---------- */
.app-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 0 0.5rem;
    max-width: 760px;
    margin: 0 auto;
}
.header-icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}
.header-icon-btn.round { border-radius: 50%; }
.app-header .header-center {
    flex: 1;
    text-align: center;
    min-width: 0;
}
.app-header .header-eyebrow {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}
.app-header .header-title {
    font-family: 'Sora', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-header .brand {
    color: var(--ink);
    text-decoration: none;
}

.container { padding: 0.5rem 1.25rem 6.5rem; max-width: 760px; margin: 0 auto; }

/* ---------- Bottom tab bar ---------- */
.tab-bar {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 40;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.6rem 0.6rem;
    background: rgba(12, 17, 27, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    font-size: 1.1rem;
    color: var(--faint);
    text-decoration: none;
}
.tab span {
    font-size: 0.6rem;
    font-weight: 600;
}
.tab.active { color: var(--accent-lite); }
.scan-fab {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    margin-top: -26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    box-shadow: var(--glow-accent);
    text-decoration: none;
}

/* ---------- Hamburger drawer ---------- */
.drawer-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 14, 0.6);
    z-index: 49;
}
.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 84%;
    max-width: 320px;
    z-index: 50;
    background: linear-gradient(180deg, #111d2e, #0b1320);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3.25rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
}
.drawer-scrim.open { display: block; }
.drawer.open { transform: translateX(0); }
.drawer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.4rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 0.5rem;
}
.drawer-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--mint));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.drawer-user .name { font-weight: 700; font-size: 0.95rem; }
.drawer-user .email { font-size: 0.75rem; color: var(--muted); }
.drawer-section-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 700;
    padding: 0.75rem 0.75rem 0.25rem;
}
.drawer-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-sm);
    color: #c7d3e3;
    font-size: 0.9rem;
    text-decoration: none;
}
.drawer-link i { width: 18px; color: var(--muted); text-align: center; }
.drawer-link.active { background: rgba(47, 111, 237, 0.16); color: #fff; }
.drawer-link.active i { color: var(--accent-lite); }
.drawer-signout { margin-top: auto; color: var(--muted); }

/* ---------- Month navigator ---------- */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.month-nav .month-label {
    font-weight: 700;
    font-size: 1rem;
    min-width: 9rem;
    text-align: center;
}
.month-nav .nav-arrow {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
}

/* ---------- Hero stat ---------- */
.hero-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem 1.75rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.hero-card .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
}
.hero-card .amount {
    font-family: 'Sora', sans-serif;
    font-size: 3.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0.35rem 0 0.15rem;
}
.hero-card .amount small {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--muted);
    margin-left: 0.35rem;
}
@media (max-width: 640px) {
    .hero-card .amount { font-size: 2.5rem; }
}
.balance-minis { display: flex; gap: 0.6rem; margin-top: 1rem; }
.balance-mini {
    flex: 1;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    text-align: left;
    text-decoration: none;
    color: inherit;
}
.balance-mini.mint { background: rgba(31, 184, 122, 0.14); border: 1px solid rgba(31, 184, 122, 0.25); }
.balance-mini.blue { background: rgba(47, 111, 237, 0.16); border: 1px solid rgba(47, 111, 237, 0.3); }
.balance-mini .mini-label { font-size: 0.7rem; color: var(--mint-lite); font-weight: 600; }
.balance-mini.blue .mini-label { color: #9dbcff; }
.balance-mini .mini-value { font-weight: 800; font-size: 0.95rem; margin-top: 0.15rem; }
.balance-mini .mini-value.negative { color: #e08d8d; }

.section-title-row { display: flex; align-items: baseline; justify-content: space-between; margin: 1.75rem 0 0.75rem; }
.section-title-row .section-label { margin: 0; }
.section-title-row a { font-size: 0.82rem; font-weight: 700; color: var(--accent-lite); text-decoration: none; }

/* ---------- Category breakdown ---------- */
.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 1.75rem 0 0.75rem;
}
.category-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 0.6rem;
}
.category-card .row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.category-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.category-card .cat-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.category-card .cat-amount {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.progress-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
}
.progress-fill.near-budget { background: #fab219; }
.progress-fill.over-budget { background: #d03b3b; }

.chart-card {
    margin-bottom: 0.6rem;
    position: relative;
    max-width: 100%;
}
.chart-card canvas {
    max-width: 100%;
}

/* ---------- Receipts list ---------- */
.receipt-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.6rem;
    text-decoration: none;
    color: inherit;
}
.receipt-card .icon-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-lite);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.receipt-card .details { flex: 1; min-width: 0; }
.receipt-card .merchant {
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.receipt-card .meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.1rem;
}
.receipt-card .total {
    font-weight: 800;
    font-size: 1.05rem;
    white-space: nowrap;
}
.edit-link {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-lite);
    text-decoration: none;
}
.edit-link:hover { text-decoration: underline; }

/* ---------- Generic components ---------- */
.login-box { text-align: center; margin-top: 4rem; }
.login-box h1 { font-family: 'Sora', sans-serif; font-size: 1.7rem; letter-spacing: -0.02em; }
.login-box .tagline { color: var(--muted); font-size: 0.95rem; margin: -0.5rem 0 1.75rem; }
.login-logo {
    width: 66px;
    height: 66px;
    border-radius: 19px;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: var(--glow-accent);
    margin: 0 auto 1.25rem;
}
.google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    color: white;
    font-weight: 700;
    border-radius: var(--radius-pill);
    text-decoration: none;
    box-shadow: var(--glow-accent);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* ---------- Receipt photo viewer ---------- */
.receipt-photo {
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.receipt-photo img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}
.photo-dialog {
    border: none;
    padding: 0;
    background: black;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
}
.photo-dialog::backdrop { background: rgba(0, 0, 0, 0.85); }
.photo-dialog img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.photo-dialog-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    border: none;
    font-size: 1.1rem;
    z-index: 10;
}

form label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
}
input, select, button {
    font-family: inherit;
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
input, select {
    background: var(--card);
    color: var(--ink);
    margin-top: 0.35rem;
    width: 100%;
    color-scheme: dark;
}
input::placeholder { color: var(--faint); }
button {
    background: linear-gradient(135deg, var(--accent), var(--mint));
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    box-shadow: var(--glow-accent);
}
button:hover { filter: brightness(1.05); }

@media (max-width: 640px) {
    .btn-block { display: block; width: 100%; text-align: center; }
}

.items-table { width: 100%; border-collapse: collapse; margin-top: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); }
.items-table th, .items-table td { border-bottom: 1px solid var(--border); padding: 0.65rem 0.85rem; text-align: left; }
.items-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.items-table tr:last-child td { border-bottom: none; }
.items-table .td-label { display: none; }

/* Below 640px a multi-column items table becomes unreadable (columns get
   crushed to a few px each), so each row is restacked into its own card
   with a labeled field per line instead of squeezing columns further. */
@media (max-width: 640px) {
    .items-table { background: none; box-shadow: none; border-radius: 0; overflow: visible; }
    .items-table thead { display: none; }
    .items-table, .items-table tbody, .items-table tr, .items-table td {
        display: block;
        width: 100%;
    }
    .items-table tr {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow);
        padding: 0.9rem 1rem 1rem;
        margin-bottom: 0.7rem;
    }
    .items-table td {
        border-bottom: none;
        padding: 0.4rem 0;
    }
    .items-table td:first-child { padding-top: 0; }
    .items-table td:last-child { padding-bottom: 0; }
    .items-table .td-label {
        display: block;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
        font-weight: 700;
    }
    .items-table td .remove-row-btn {
        width: 100%;
        margin-top: 0.35rem;
    }
}

.hint { color: var(--muted); font-size: 0.9rem; }
.hint a { color: var(--accent-lite); font-weight: 600; }
.error { color: #e08d8d; font-weight: 600; }
.empty-state {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--muted);
}
.empty-state a { color: var(--accent-lite); font-weight: 700; text-decoration: none; }

/* ---------- Categories CRUD ---------- */
.inline-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.inline-form input[type="text"] {
    flex: 1;
    min-width: 140px;
    margin-top: 0;
}
.inline-form .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    flex-shrink: 0;
}
.inline-form .toggle-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.color-swatch-input {
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    background: none;
}
.category-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 0.6rem;
}
.category-row .delete-form { margin-top: 0.6rem; }
.btn-danger {
    background: rgba(255, 255, 255, 0.06);
    color: #e08d8d;
    border: 1px solid rgba(199, 107, 107, 0.4);
    box-shadow: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
.btn-danger:hover { background: rgba(199, 107, 107, 0.12); }

/* ---------- Bottom-sheet / modal dialogs (category editor, etc.) ---------- */
.category-row-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-align: left;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    box-shadow: none;
    color: var(--ink);
    font-weight: 400;
    cursor: pointer;
}
.category-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.category-row-info .cat-name { font-weight: 700; font-size: 0.95rem; }
.category-row-info .cat-meta { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.sheet-dialog {
    border: none;
    padding: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #132133, #0b1320);
    color: var(--ink);
    width: min(92vw, 440px);
    max-height: 86vh;
    overflow-y: auto;
}
.sheet-dialog::backdrop { background: rgba(4, 8, 14, 0.6); }
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: inherit;
}
.sheet-header .sheet-title {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    flex: 1;
    text-align: center;
}
.sheet-header button {
    background: none;
    box-shadow: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
}
.sheet-body { padding: 1.1rem; }
.sheet-body label { margin-bottom: 0.9rem; }
.icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin: 0.35rem 0 1rem;
}
.icon-choice {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid transparent;
    box-shadow: none;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
}
.icon-choice.selected {
    border-color: var(--accent-lite);
    background: rgba(90, 160, 255, 0.18);
    color: var(--accent-lite);
}
.sheet-footer { display: flex; gap: 0.75rem; padding: 0 1.1rem 1.1rem; }
.sheet-footer button, .sheet-footer .btn-danger { flex: 1; }

/* ---------- Segmented control ---------- */
.seg {
    display: flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
    margin-bottom: 1rem;
}
.seg a {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
}
.seg a.active { background: rgba(47, 111, 237, 0.9); color: #fff; }

/* ---------- Stat tiles ---------- */
.stat-tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.stat-tile {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem;
    text-align: center;
}
.stat-tile .stat-value { font-weight: 800; font-size: 1rem; }
.stat-tile .stat-value.mint { color: var(--mint-lite); }
.stat-tile .stat-label { font-size: 0.68rem; color: var(--muted); margin-top: 0.15rem; }

/* ---------- Category badge pill ---------- */
.cat-badge {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--mint-lite);
    background: rgba(63, 158, 124, 0.16);
    border: 1px solid rgba(63, 158, 124, 0.3);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
}

/* ---------- Receipt detail ---------- */
.detail-hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0.25rem 0 1.1rem; }
.detail-hero .category-icon { width: 60px; height: 60px; font-size: 1.4rem; border-radius: var(--radius-md); }
.detail-hero .detail-merchant { font-size: 1.25rem; font-weight: 800; margin-top: 0.75rem; }
.detail-hero .detail-meta { font-size: 0.8rem; color: var(--muted); }
.detail-hero .detail-total { font-family: 'Sora', sans-serif; font-size: 2.4rem; font-weight: 900; letter-spacing: -0.02em; margin-top: 0.6rem; }

.line-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 1rem; }
.line-row { display: flex; justify-content: space-between; padding: 0.7rem 1rem; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.line-row:last-child { border-bottom: none; }
.line-row.muted { color: var(--muted); }

.action-row { display: flex; gap: 0.7rem; }
.ghost-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.7rem;
    text-decoration: none;
}
.ghost-btn.danger { color: #e08d8d; }

/* ---------- Saved confirmation ---------- */
.saved-check {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(31, 184, 122, 0.25), transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem auto 0.5rem;
}
.saved-check-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: var(--glow-accent);
}

/* ---------- Stats bar chart ---------- */
.stat-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    height: 120px;
    margin-top: 0.75rem;
}
.stat-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.stat-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent-lite), var(--mint));
    opacity: 0.75;
    min-height: 2px;
}
.stat-bar-col:last-child .stat-bar,
.stat-bar-col.peak .stat-bar { opacity: 1; box-shadow: 0 0 14px -2px rgba(31,184,122,.6); }
.stat-bar-labels { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.stat-bar-labels span { flex: 1; text-align: center; font-size: 0.6rem; color: var(--faint); }
.stat-compare { font-size: 0.8rem; font-weight: 700; text-align: right; }
.stat-compare.up { color: #e08d8d; }
.stat-compare.down { color: var(--mint-lite); }

/* ---------- Pills (type filters) ---------- */
.pill-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pill-row a {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
}
.pill-row a.active { background: rgba(47, 111, 237, 0.9); color: #fff; border-color: transparent; }

/* ---------- Transaction / ledger rows ---------- */
.txn-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.txn-row:last-child { border-bottom: none; }
.txn-row .amount { font-weight: 800; font-size: 0.9rem; white-space: nowrap; }
.txn-row .amount.income { color: var(--mint-lite); }
