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

/* ── Bootstrap dark theme token overrides ── */
[data-bs-theme="dark"] {
    --bs-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --bs-body-bg: #0a0d14;
    --bs-body-color: #e1e7ef;

    --bs-secondary-color: #8892a8;
    --bs-secondary-bg: #141825;
    --bs-tertiary-bg: #1a1e2e;

    --bs-card-bg: #111520;
    --bs-card-border-color: rgba(255,255,255,0.06);
    --bs-card-cap-bg: rgba(255,255,255,0.03);

    --bs-border-color: #252a3d;
    --bs-border-color-translucent: rgba(255,255,255,0.06);

    --bs-primary: #5a67d8;
    --bs-primary-rgb: 90,103,216;
    --bs-success: #27ae60;
    --bs-danger: #e74c3c;
    --bs-warning: #f39c12;

    --bs-link-color: #7b8ff5;
    --bs-link-hover-color: #a5b0ff;

    --bs-table-color: #e1e7ef;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,0.025);
    --bs-table-hover-bg: rgba(255,255,255,0.04);
    --bs-table-border-color: #1e2335;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

/* prevent iOS double-tap zoom on buttons/links */
button, a { touch-action: manipulation; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #252a3d; border-radius: 2px; }

/* ── Navbar ── */
.navbar {
    background: #080b12 !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0.6rem 1.25rem;
    min-height: 56px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: #e1e7ef !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #5a67d8 0%, #7b5ea7 100%);
    border-radius: 7px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7a9a !important;
    transition: color 0.15s;
    padding: 0.5rem 0.75rem !important;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.nav-link:hover { color: #e1e7ef !important; }

/* ── Main layout ── */
main.container {
    max-width: 960px;
    padding-bottom: 96px; /* space for bottom nav on mobile */
}

@media (min-width: 768px) {
    main.container { padding-bottom: 2rem; }
}


/* Blazor's FocusOnNavigate focuses headings with tabindex=-1 after route changes.
   Keep that programmatic focus target without drawing a form-control-like ring. */
main h1[tabindex="-1"]:focus,
main h2[tabindex="-1"]:focus {
    outline: none;
}
/* ── Page headings ── */
h1.h3 { font-weight: 700; letter-spacing: -0.03em; }
h2.h5, h2.h6 { font-weight: 600; letter-spacing: -0.02em; }
.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7a9a;
    margin-bottom: 0.75rem;
}

/* ── Cards ── */
.card {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    background: #111520;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.15);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: rgba(90,103,216,0.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 1px rgba(90,103,216,0.08);
}

.card-body { padding: 1.125rem; }

.card-footer {
    background: rgba(255,255,255,0.02) !important;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-radius: 0 0 14px 14px;
    padding: 0.75rem 1.125rem;
}


/* Groups overview */
.groups-page {
    width: min(100%, 820px);
    margin: 0 auto;
    padding-top: clamp(1rem, 3vw, 2.25rem);
}

.groups-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.groups-page-header .btn-primary {
    flex-shrink: 0;
    padding-inline: 1.15rem;
    font-weight: 700;
    box-shadow: 0 10px 28px rgba(90,103,216,0.25);
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 380px));
    justify-content: center;
    gap: 1rem;
}

.group-card-col {
    min-width: 0;
}

.group-card {
    height: 100%;
    min-height: 168px;
    overflow: hidden;
}

.group-card .card-title {
    font-size: 1.05rem;
    line-height: 1.25;
}

@media (max-width: 575px) {
    .groups-page {
        padding-top: 0.25rem;
    }

    .groups-page-header {
        align-items: stretch;
        flex-direction: column;
        margin-bottom: 1.25rem;
    }

    .groups-page-header .btn-primary {
        width: 100%;
    }

    .groups-grid {
        grid-template-columns: 1fr;
    }
}
/* group card accent strip */
.group-card-header {
    height: 4px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, #5a67d8, #7b5ea7);
}

.group-card.clickable {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.group-card.clickable:hover {
    border-color: rgba(90,103,216,0.4);
    box-shadow: 0 6px 20px rgba(0,0,0,0.45), 0 0 0 1px rgba(90,103,216,0.15);
}

.group-card.clickable:active { transform: scale(0.99); }

/* ── Buttons ── */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 9px;
    transition: all 0.15s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-lg { min-height: 52px; font-size: 1rem; border-radius: 12px; }
.btn-sm { min-height: 34px; font-size: 0.8125rem; border-radius: 7px; }

.btn-primary { background: #5a67d8; border-color: #5a67d8; }
.btn-primary:hover { background: #4c5bc4; border-color: #4c5bc4; box-shadow: 0 0 0 3px rgba(90,103,216,0.25); }

.btn-success { background: #27ae60; border-color: #27ae60; }
.btn-success:hover { background: #219a52; border-color: #219a52; box-shadow: 0 0 0 3px rgba(39,174,96,0.2); }

.btn-outline-primary { color: #7b8ff5; border-color: #2d3454; }
.btn-outline-primary:hover { background: #5a67d8; border-color: #5a67d8; color: #fff; }

.btn-outline-danger { color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.btn-outline-danger:hover { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.5); color: #f19c95; }

.btn-outline-light { color: #6b7a9a; border-color: #1e2335; font-size: 0.8125rem; }
.btn-outline-light:hover { background: rgba(255,255,255,0.05); color: #e1e7ef; }

/* Small icon-only action button (pen/trash/check/cancel) — rounded square, not
   a full pill, so a row of them next to a name doesn't compete for attention. */
.icon-btn-square {
    width: 34px;
    height: 34px;
    min-height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #252a3d;
    background: #141825;
    color: #8892a8;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn-square:hover { background: #1a1e2e; border-color: #353b56; color: #e1e7ef; }
.icon-btn-square.icon-btn-danger:hover { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.5); color: #f19c95; }
.icon-btn-square.icon-btn-success:hover { background: rgba(39,174,96,0.12); border-color: rgba(39,174,96,0.5); color: #5fce8c; }

.category-preset-chip {
    background: #141825;
    border: 1px solid #252a3d;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.8125rem;
    color: #c8d0df;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.category-preset-chip:hover { background: #1a1e2e; border-color: #5a67d8; }

/* ── Forms ── */
.form-control, .form-select {
    background: #141825;
    border: 1px solid #252a3d;
    color: #e1e7ef;
    border-radius: 9px;
    /* 16px minimum prevents iOS auto-zoom */
    font-size: 16px;
    padding: 0.625rem 0.875rem;
    min-height: 48px;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus, .form-select:focus {
    background: #141825;
    border-color: #5a67d8;
    color: #e1e7ef;
    box-shadow: 0 0 0 3px rgba(90,103,216,0.2);
    outline: none;
}

.form-control::placeholder { color: #353b56; }

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7a9a;
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-check-input {
    background-color: #141825;
    border-color: #353b56;
    border-radius: 4px;
    width: 1.1em;
    height: 1.1em;
}
.form-check-input:checked { background-color: #5a67d8; border-color: #5a67d8; }
.form-check-label { font-size: 0.875rem; color: #c8d0df; }

/* ── Amount input (calculator-style) ── */
.amount-wrapper {
    text-align: center;
    padding: 1.5rem 0 1rem;
}

.amount-currency-symbol {
    font-size: 1.75rem;
    font-weight: 700;
    color: #6b7a9a;
    vertical-align: middle;
    margin-right: 0.15rem;
}

.amount-input {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 2px solid #1e2335;
    border-radius: 0;
    color: #e1e7ef;
    width: 100%;
    max-width: 280px;
    padding: 0.25rem 0;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.amount-input:focus {
    outline: none;
    border-bottom-color: #5a67d8;
    box-shadow: none;
    background: transparent;
}

/* hide number input arrows */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-input[type=number] { -moz-appearance: textfield; }

/* ── Alerts ── */
.alert-danger {
    background: rgba(231,76,60,0.08);
    border: 1px solid rgba(231,76,60,0.25);
    color: #f19c95;
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    background: rgba(39,174,96,0.08);
    border: 1px solid rgba(39,174,96,0.25);
    color: #5fce8c;
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

/* ── Badges ── */
.badge {
    font-weight: 500;
    font-size: 0.7rem;
    border-radius: 5px;
    padding: 0.28em 0.55em;
    letter-spacing: 0.02em;
}

.bg-secondary { background: #1a1e2e !important; color: #7c869e !important; }
.bg-light { background: #1a1e2e !important; }
.text-dark { color: #c8d0df !important; }

/* ── Progress bars ── */
.progress {
    background: #1a1e2e;
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 99px;
    font-size: 0;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

.bg-success { background: linear-gradient(90deg, #27ae60, #2ecc71) !important; }
.bg-danger { background: linear-gradient(90deg, #c0392b, #e74c3c) !important; }

/* ── Tables ── */
.table {
    font-size: 0.875rem;
    --bs-table-color: #c8d0df;
}

.table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7a9a;
    border-bottom: 1px solid #1e2335;
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}

.table td {
    border-color: #161a28;
    vertical-align: middle;
    padding: 0.75rem;
}

.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover td { background: rgba(90,103,216,0.04); }

/* ── List group ── */
.list-group-item {
    background: #111520;
    border-color: #1e2335;
    color: #e1e7ef;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
}

/* ── Group nav (pill/underline style) — visible on all sizes, scrolls
   horizontally on narrow viewports instead of competing with the fixed
   bottom-nav for screen space. */
.group-nav-desktop {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #1e2335;
    margin-bottom: 1.5rem !important;
    padding-bottom: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
}

.group-nav-desktop::-webkit-scrollbar { display: none; }
.group-nav-desktop .nav-item { flex-shrink: 0; }

.group-nav-desktop .nav-link {
    border-radius: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7a9a !important;
    padding: 0.65rem 1rem !important;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    min-height: unset;
    white-space: nowrap;
}

.group-nav-desktop .nav-link:hover { color: #c8d0df !important; background: none; }

.group-nav-desktop .nav-link.active {
    background: none !important;
    color: #e1e7ef !important;
    border-bottom-color: #5a67d8;
}

/* ── Mobile bottom nav ── */
.bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(8,11,18,0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255,255,255,0.07);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 200;
        justify-content: space-around;
        align-items: stretch;
    }
}

.bottom-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.25rem;
    color: #6b7a9a;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    gap: 0.25rem;
    transition: color 0.18s ease, transform 0.15s ease;
    min-height: 56px;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover { color: #c8d0df; }
.bottom-nav-item:active { transform: scale(0.94); }

.bottom-nav-item.active { color: #e1e7ef; }

/* Small dot above the active tab instead of relying on emoji colour, which
   can't be tinted with CSS — these icons are text glyphs so `color` works. */
.bottom-nav-item.active::before {
    content: "";
    position: absolute;
    top: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #5a67d8;
}

.bottom-nav-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.bottom-nav-item .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
    display: block;
    transition: transform 0.15s ease;
}

.bottom-nav-item:hover .nav-icon { transform: translateY(-1px); }

.bottom-nav-item.primary-action {
    color: #5a67d8;
    flex: 0 0 auto;
    width: 64px;
    padding: 0;
}

.bottom-nav-item.primary-action .nav-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #5a67d8 0%, #7b5ea7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 300;
    box-shadow: 0 4px 14px rgba(90,103,216,0.45);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bottom-nav-item.primary-action:hover .nav-icon {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 6px 20px rgba(90,103,216,0.55);
}

.bottom-nav-item.primary-action:active .nav-icon {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(90,103,216,0.4);
}

/* Same FAB slot, different job: a form is open and this now confirms it
   instead of starting a new one — green + a distinct glyph so it doesn't
   read as "add another thing". */
.bottom-nav-item.primary-action.submit-mode .nav-icon {
    background: linear-gradient(135deg, #27ae60 0%, #1f9e56 100%);
    box-shadow: 0 4px 14px rgba(39,174,96,0.45);
    font-size: 1.3rem;
    font-weight: 700;
}

.bottom-nav-item.primary-action.submit-mode:hover .nav-icon {
    box-shadow: 0 6px 20px rgba(39,174,96,0.55);
}

.bottom-nav-item.primary-action.submit-mode:disabled {
    cursor: default;
}

.bottom-nav-item.primary-action.submit-mode:disabled .nav-icon {
    opacity: 0.5;
    box-shadow: none;
    transform: none;
}

/* ── Expense row (mobile-friendly list) ──
   Always a column flex container so detail/edit sections can stack below the
   summary line without needing a layout-mode class switch. */
.expense-row {
    display: flex;
    flex-direction: column;
    padding: 0.875rem;
    border-bottom: 1px solid #161a28;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    border-radius: 10px;
}

.expense-row:hover { background: rgba(90,103,216,0.04); }
.expense-row.expanded { background: #131828; border-color: rgba(90,103,216,0.3); }
.expense-row:last-child { border-bottom: none; }

.expense-row-summary {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.expense-edit-form { width: 100%; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.06); }
.edit-label { font-size: 0.72rem; color: #6b7a9a; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; display: block; }

.expense-meta { flex: 1; min-width: 0; }
.expense-desc {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.expense-sub { font-size: 0.75rem; color: #6b7a9a; }
.expense-amount {
    font-weight: 700;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: #e1e7ef;
}
.expense-currency { color: #6b7a9a; font-size: 0.75rem; font-weight: 400; }

.expense-detail {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.expense-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.75rem;
    font-size: 0.8rem;
    margin: 0 0 0.875rem;
}
.expense-detail-grid dt { color: #6b7a9a; font-weight: 500; }
.expense-detail-grid dd { margin: 0; color: #e1e7ef; text-align: right; }

/* Tinted by the selected budget's colour (--budget-color custom property, set
   inline per-render since it's per-budget data, not a fixed theme value). */
.quick-log-card {
    border-left: 4px solid var(--budget-color, rgba(255,255,255,0.06));
    transition: border-color 0.2s;
}

/* Mobile submits via the bottom-nav FAB (submit-mode) instead — this in-form
   button is only needed where there's no bottom-nav to take over that job. */
@media (max-width: 767px) {
    .desktop-submit-only { display: none; }
}

/* ── Budget picker cards (replaces the budget <select> on the quick-log form) ── */
.budget-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}

.budget-picker-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
    text-align: left;
    background: #141825;
    border: 1px solid #252a3d;
    border-left: 4px solid var(--budget-color, #5a67d8);
    border-radius: 9px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.budget-picker-card:hover { background: #181d2c; transform: translateY(-1px); }

.budget-picker-card.selected {
    background: #1a1e2e;
    border-color: var(--budget-color, #5a67d8);
    box-shadow: 0 0 0 1px var(--budget-color, #5a67d8);
}

.budget-picker-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #e1e7ef;
}

.budget-picker-remaining {
    font-size: 0.72rem;
    color: #8892a8;
}

.budget-picker-check {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    color: var(--budget-color, #5a67d8);
    font-weight: 700;
    font-size: 0.85rem;
}

/* ── Quick log section header ── */
.quick-log-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-log-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Validation ── */
.valid.modified:not([type=checkbox]) { border-color: rgba(39,174,96,0.5) !important; }
.invalid { border-color: rgba(231,76,60,0.5) !important; }
.validation-message { color: #f19c95; font-size: 0.8rem; margin-top: 0.2rem; }
.validation-summary-errors { color: #f19c95; font-size: 0.8rem; }
.validation-summary-errors ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: #160e0e;
    border-top: 1px solid rgba(231,76,60,0.25);
    bottom: 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    display: none;
    left: 0;
    padding: 0.75rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #f19c95;
    font-size: 0.875rem;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.75rem; color: #7c869e; }
#blazor-error-ui a { color: #7b8ff5; }

.blazor-error-boundary {
    background: rgba(231,76,60,0.08);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: 10px;
    padding: 1rem;
    color: #f19c95;
}

/* Toggle button showing a budget's current colour; opens the ColorPalette popover. */
.budget-color-swatch {
    width: 32px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.15s;
}
.budget-color-swatch:hover { transform: scale(1.08); border-color: rgba(255,255,255,0.35); }

.color-palette-popover {
    position: relative;
}
.color-palette-popover .color-palette {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    /* Without an explicit width, an absolutely-positioned flex container with
       wrap shrinks to fit one swatch per line instead of laying out a grid —
       fix the width so it always wraps 5-across. */
    width: 210px;
    background: #1a1e2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.6rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 500;
}

/* ── Colour palette (replaces the native <input type="color"> picker) ── */
.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.12);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.color-swatch:hover { transform: scale(1.12); border-color: rgba(255,255,255,0.4); }
.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 0 0 3px rgba(255,255,255,0.5);
}
.color-swatch-check {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ── Budget tap-to-log cards ── */
.budget-tap-card {
    background: #111520;
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 4px solid var(--budget-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 1rem 1.125rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.budget-tap-card:hover {
    border-color: rgba(90,103,216,0.3);
    box-shadow: 0 0 0 1px rgba(90,103,216,0.1), 0 4px 16px rgba(0,0,0,0.3);
}

.budget-tap-card.expanded {
    border-color: rgba(90,103,216,0.5);
    background: #131828;
    box-shadow: 0 0 0 2px rgba(90,103,216,0.2), 0 8px 24px rgba(0,0,0,0.4);
}

/* ── Overall-this-month summary, above the per-budget cards ── */
.overview-card {
    background: linear-gradient(135deg, rgba(90,103,216,0.12), rgba(123,94,167,0.06));
    border-color: rgba(90,103,216,0.25);
}

/* ── Expense history by month ── */
.history-month-header { cursor: pointer; user-select: none; }
.history-month-header:hover { background: rgba(255,255,255,0.02); border-radius: 14px; }
.history-month-label { font-weight: 600; font-size: 0.9375rem; color: #e1e7ef; }
.history-month-total { font-weight: 600; color: #5fce8c; }
.history-chevron { color: #6b7a9a; font-size: 0.7rem; }

.overview-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa6c9;
}

.overview-remaining {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5fce8c;
    white-space: nowrap;
}
.overview-remaining.over { color: #f19c95; }

.overview-progress { height: 7px; margin-bottom: 0.5rem; }

.overview-sub { font-size: 0.78rem; color: #8892a8; }

.budget-tap-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.budget-tap-name {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: #e1e7ef;
}

.budget-tap-remaining {
    font-size: 0.8rem;
    font-weight: 600;
    color: #5fce8c;
    white-space: nowrap;
}

.budget-tap-remaining.over {
    color: #f19c95;
}

.budget-tap-progress {
    margin-bottom: 0.4rem;
    height: 5px;
}

.budget-tap-sub {
    font-size: 0.72rem;
    color: #6b7a9a;
}

.budget-log-inline {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.budget-log-inline .amount-wrapper {
    padding: 0.75rem 0 0.5rem;
}

.budget-log-inline .amount-input {
    font-size: clamp(2rem, 9vw, 3.5rem);
    max-width: 240px;
}

.loading-text {
    color: #6b7a9a;
    font-size: 0.875rem;
    padding: 2rem 0;
    text-align: center;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ── Misc ── */
.text-muted { color: #8892a8 !important; }
.loading-text { color: #8892a8; font-size: 0.875rem; padding: 2rem 0; text-align: center; }

/* ── Tiel mascot (calopsita) — flat, minimalist cockatiel used on empty/loading
   states. Colours centralised here rather than inline on the SVG so re-theming
   or a future dark/light variant is a one-place edit. ── */
.tiel-icon { display: inline-block; }
.tiel-perch { fill: #a97c50; }
.tiel-feet { fill: #8a8f97; }
.tiel-tail { fill: #9ea3ab; }
.tiel-body { fill: #b7bcc4; }
.tiel-belly { fill: #f4f1ea; }
.tiel-head { fill: #f5e1a4; }
.tiel-crest { fill: #f0d585; }
.tiel-cheek { fill: #f0a45c; }
.tiel-eye { fill: #2b2320; }
.tiel-beak { fill: #b0a99a; }

@keyframes tiel-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.tiel-icon-animated { animation: tiel-bob 2.2s ease-in-out infinite; transform-origin: bottom center; }

.expense-row-deleted { opacity: 0.5; }
.expense-row-deleted .expense-desc,
.expense-row-deleted .expense-amount { text-decoration: line-through; }

/* ── History: "by category" columnar (kanban-style) view ── */
.category-columns {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
}
.category-column {
    flex: 0 0 260px;
    background: #111520;
    border: 1px solid #1e2335;
    border-radius: 10px;
    padding: 0.875rem;
}
.expense-card {
    background: #161a28;
    border-radius: 8px;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
}
.expense-card:last-child { margin-bottom: 0; }
.expense-card .expense-desc { font-weight: 500; font-size: 0.875rem; }
.expense-card .expense-sub { font-size: 0.7rem; color: #6b7a9a; margin: 0.15rem 0; }
.expense-card .expense-amount { font-weight: 700; font-size: 0.875rem; font-variant-numeric: tabular-nums; }

.tiel-loading { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.5rem 0; }
.tiel-loading .loading-text { padding: 0; }
.tiel-empty { text-align: center; padding: 1rem 0; }
.tiel-empty .tiel-icon { margin-bottom: 0.5rem; }