/* ==========================================================================
   PayFlow — application styles
   Plain CSS, no build step. Served directly from public/css/app.css.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Cool slate neutrals that sit well next to indigo */
    --gray-25: #fcfcfe;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --page-bg: #f4f5fb;

    /* Brand: royal indigo (also used for Done). No green anywhere. */
    --brand-25: #f7f7ff;
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;
    --brand-950: #1e1b4b;

    /* Status colours: Pending = amber, Done = indigo, Inactive = grey */
    --amber-50: #fffbeb;
    --amber-200: #fde68a;
    --amber-400: #fbbf24;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --red-50: #fef2f2;
    --red-200: #fecaca;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --blue-50: #eff6ff;
    --blue-200: #bfdbfe;
    --blue-700: #1d4ed8;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18);

    --sidebar-width: 256px;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--page-bg);
    /* Faint payment pattern: coins, receipts, calendars, checks */
    background-image:
        radial-gradient(1200px 500px at 85% -10%, rgba(99, 102, 241, 0.10), transparent 60%),
        url('../images/pattern.svg');
    background-attachment: fixed;
}

h1, h2, h3, h4, p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

svg {
    display: block;
    flex-shrink: 0;
}

[x-cloak] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ---------- Icons ---------- */
.icon { width: 16px; height: 16px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 20px; height: 20px; }

/* ---------- Logo ---------- */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
    color: #fff;
    box-shadow: 0 4px 10px -4px rgba(79, 70, 229, 0.6);
}

.logo-mark svg {
    width: 18px;
    height: 18px;
}

.logo-text {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--gray-900);
}

/* ---------- App shell ---------- */
.mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--brand-100);
}

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(17, 24, 39, 0.3);
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background:
        radial-gradient(320px 260px at 0% 0%, rgba(129, 140, 248, 0.25), transparent 70%),
        linear-gradient(180deg, var(--brand-950) 0%, var(--brand-900) 100%);
    color: var(--brand-100);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

.sidebar.is-open {
    transform: translateX(0);
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 20px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: rgba(224, 231, 255, 0.72);
    transition: background-color 0.15s, color 0.15s;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    color: var(--brand-300);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.nav-link:hover svg {
    color: var(--brand-200);
}

.nav-link.is-active {
    position: relative;
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-link.is-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--amber-400);
}

.nav-link.is-active svg {
    color: var(--amber-400);
}

.sidebar .logo-text {
    color: #fff;
}

.sidebar .logo-mark {
    background: #fff;
    color: var(--brand-700);
    box-shadow: none;
}

.sidebar .icon-btn {
    color: var(--brand-200);
}

.sidebar .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Wallet, coins and receipt artwork above the account chip */
.sidebar-art {
    flex-shrink: 0;
    height: 180px;
    margin: 0 8px;
    background: url('../images/sidebar-art.svg') no-repeat center bottom / contain;
    pointer-events: none;
}

@media (max-height: 700px) {
    .sidebar-art { display: none; }
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .user-chip-name {
    color: #fff;
}

.sidebar .user-chip-email {
    color: var(--brand-300);
}

.sidebar .avatar {
    background: var(--amber-400);
    color: var(--brand-950);
    font-weight: 600;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
}

.user-chip-text {
    flex: 1;
    min-width: 0;
}

.user-chip-name,
.user-chip-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip-name {
    font-size: 14px;
    font-weight: 500;
}

.user-chip-email {
    font-size: 12px;
    color: var(--gray-500);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--radius);
    color: var(--gray-500);
    transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.app-main {
    min-width: 0;
}

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 16px;
}

.only-mobile { display: inline-flex; }

@media (min-width: 640px) {
    .container { padding: 32px 24px; }
}

@media (min-width: 1024px) {
    .mobile-bar,
    .backdrop,
    .only-mobile {
        display: none !important;
    }

    .sidebar {
        transform: none;
    }

    .app-main {
        padding-left: var(--sidebar-width);
    }

    .container {
        padding: 40px 40px;
    }
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-description {
    margin-top: 4px;
    font-size: 14px;
    color: var(--gray-500);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

@media (min-width: 640px) {
    .page-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

/* Banner with a payment illustration on the right */
.page-header.has-art {
    position: relative;
    overflow: hidden;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 148px;
    padding: 22px 20px;
    background:
        radial-gradient(260px 180px at 100% 100%, var(--brand-100), transparent 70%),
        linear-gradient(115deg, #fff 0%, #fff 50%, var(--brand-50) 100%);
    border: 1px solid var(--brand-100);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 2px rgba(49, 46, 129, 0.05), 0 8px 24px -16px rgba(49, 46, 129, 0.25);
}

.page-header.has-art::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: -6px;
    width: 220px;
    height: 110px;
    background: var(--art-img) no-repeat right bottom / contain;
    opacity: 0.35;
    pointer-events: none;
}

.page-header.has-art > * {
    position: relative;
    z-index: 1;
}

.page-header.has-art .page-title {
    color: var(--brand-950);
}

@media (min-width: 768px) {
    .page-header.has-art {
        padding: 26px 320px 26px 28px;
    }

    .page-header.has-art::after {
        right: 12px;
        top: 50%;
        bottom: auto;
        width: 300px;
        height: 150px;
        transform: translateY(-50%);
        opacity: 1;
    }
}

.art-checklist  { --art-img: url('../images/header-checklist.svg'); }
.art-recipients { --art-img: url('../images/header-recipients.svg'); }
.art-amounts    { --art-img: url('../images/header-amounts.svg'); }
.art-history    { --art-img: url('../images/header-history.svg'); }
.art-settings   { --art-img: url('../images/header-settings.svg'); }
.art-insights   { --art-img: url('../images/header-insights.svg'); }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -22px rgba(49, 46, 129, 0.35);
}

.card-body {
    padding: 20px;
}

/* ---------- Empty state ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    background:
        radial-gradient(360px 200px at 50% 0%, var(--brand-50), transparent 70%),
        #fff;
    border: 1px dashed var(--brand-200);
    border-radius: var(--radius-xl);
}

.empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.7);
}

.empty-state-icon svg {
    width: 20px;
    height: 20px;
}

.empty-state-title {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
}

.empty-state-text {
    max-width: 380px;
    margin-top: 4px;
    font-size: 14px;
    color: var(--gray-500);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn:focus-visible {
    outline: 2px solid var(--brand-300);
    outline-offset: 2px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-primary {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    border-color: var(--brand-700);
    color: #fff;
    box-shadow: 0 1px 2px rgba(49, 46, 129, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--brand-600), var(--brand-800));
}

.btn-secondary {
    background: #fff;
    border-color: var(--gray-300);
    color: var(--gray-700);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
}

.btn-danger {
    background: var(--red-600);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover:not(:disabled) {
    background: var(--red-500);
}

.btn-ghost {
    color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-900);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* ---------- Forms ---------- */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.input,
.select,
.textarea {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 20px;
    color: var(--gray-900);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
    min-height: 84px;
    resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--gray-400);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.input.has-error,
.select.has-error,
.textarea.has-error {
    border-color: var(--red-200);
}

.input.has-error:focus,
.select.has-error:focus,
.textarea.has-error:focus {
    box-shadow: 0 0 0 3px var(--red-50);
}

.field-error,
.field-hint {
    margin-top: 6px;
    font-size: 12px;
}

.field-error {
    color: var(--red-600);
}

.field-hint {
    color: var(--gray-500);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-600);
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-600);
}

/* ---------- Auth pages ---------- */
.auth-split {
    display: grid;
    min-height: 100vh;
}

/* Indigo illustration panel (top banner on phones, left half on desktop) */
.auth-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px 0;
    color: var(--brand-100);
    background:
        radial-gradient(500px 360px at 20% 0%, rgba(129, 140, 248, 0.35), transparent 70%),
        radial-gradient(420px 320px at 100% 100%, rgba(251, 191, 36, 0.14), transparent 70%),
        linear-gradient(160deg, var(--brand-950) 0%, var(--brand-900) 55%, var(--brand-700) 100%);
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/pattern.svg');
    filter: invert(1);
    opacity: 0.6;
    pointer-events: none;
}

.auth-visual > * {
    position: relative;
}

.auth-visual-logo,
.auth-visual-copy,
.auth-visual-points {
    display: none;
}

.auth-visual-img {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    margin-bottom: -40px;
}

.auth-visual .logo-text { color: #fff; }

.auth-visual .logo-mark {
    background: #fff;
    color: var(--brand-700);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px 48px;
}

.auth-logo {
    margin-bottom: 24px;
}

@media (min-width: 960px) {
    .auth-split {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    }

    .auth-visual {
        justify-content: space-between;
        align-items: flex-start;
        gap: 24px;
        padding: 40px 48px;
        min-height: 100vh;
    }

    .auth-visual-logo,
    .auth-visual-copy {
        display: block;
    }

    .auth-visual-logo {
        display: flex;
    }

    .auth-visual-title {
        font-size: 32px;
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1.15;
        color: #fff;
    }

    .auth-visual-text {
        max-width: 380px;
        margin-top: 10px;
        font-size: 15px;
        color: var(--brand-200);
    }

    .auth-visual-img {
        align-self: center;
        max-width: 480px;
        margin: 0;
    }

    .auth-visual-points {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .auth-visual-points li {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 7px 12px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.07);
        font-size: 13px;
        color: var(--brand-100);
    }

    .auth-visual-points svg {
        width: 15px;
        height: 15px;
        color: var(--amber-400);
    }

    .auth-panel .auth-logo {
        display: none;
    }
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--brand-100);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 2px rgba(49, 46, 129, 0.05), 0 16px 40px -20px rgba(49, 46, 129, 0.35);
}

@media (min-width: 640px) {
    .auth-card {
        padding: 32px;
    }
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    margin-top: 4px;
    font-size: 14px;
    color: var(--gray-500);
}

.auth-form {
    margin-top: 24px;
}

.auth-switch {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--gray-500);
}

.auth-switch a {
    font-weight: 500;
    color: var(--brand-700);
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-tagline {
    margin-top: 24px;
    font-size: 12px;
    color: var(--gray-400);
}

/* ---------- Input with prefix (currency) ---------- */
.input-group {
    position: relative;
}

.input-prefix {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 12px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--gray-500);
    pointer-events: none;
}

.input-group .input {
    padding-left: var(--prefix-pad, 44px);
}

.input:disabled {
    background: var(--gray-50);
    color: var(--gray-500);
    cursor: not-allowed;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px 2px 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
}

.badge svg {
    width: 13px;
    height: 13px;
}

.badge-active,
.badge-done {
    background: var(--brand-50);
    border-color: var(--brand-200);
    color: var(--brand-700);
}

.badge-pending {
    background: var(--amber-50);
    border-color: var(--amber-200);
    color: var(--amber-700);
}

.badge-inactive {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-600);
}

.badge-info {
    background: var(--blue-50);
    border-color: var(--blue-200);
    color: var(--blue-700);
}

.badge-deleted {
    background: var(--red-50);
    border-color: var(--red-200);
    color: var(--red-700);
}

/* ---------- Toolbar: tabs + search ---------- */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 640px) {
    .toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--gray-100);
    border-radius: var(--radius);
    align-self: flex-start;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.tab:hover {
    color: var(--gray-900);
}

.tab.is-active {
    background: #fff;
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}

.tab.is-active .tab-count {
    color: var(--brand-400);
}

.tab-count {
    font-size: 12px;
    color: var(--gray-400);
}

.search {
    position: relative;
    width: 100%;
}

@media (min-width: 640px) {
    .search {
        width: 260px;
    }
}

.search svg {
    position: absolute;
    top: 50%;
    left: 11px;
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    transform: translateY(-50%);
    pointer-events: none;
}

.search .input {
    padding-left: 34px;
}

/* ---------- Data table ---------- */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    padding: 10px 16px;
    background: var(--brand-25);
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    color: var(--gray-500);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover td {
    background: var(--gray-25);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .actions {
    text-align: right;
    white-space: nowrap;
}

.table tr.is-muted .cell-title,
.table tr.is-muted .num {
    color: var(--gray-500);
}

.cell-title {
    font-weight: 500;
    color: var(--gray-900);
}

.cell-sub {
    margin-top: 2px;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--gray-500);
}

.cell-muted {
    color: var(--gray-500);
    white-space: nowrap;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Stack table rows as cards on small screens */
@media (max-width: 767px) {
    .table-stack thead {
        display: none;
    }

    .table-stack,
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        position: relative;
        padding: 14px 16px;
        border-bottom: 1px solid var(--gray-100);
    }

    .table-stack tbody tr:last-child {
        border-bottom: 0;
    }

    .table-stack td {
        padding: 0;
        border: 0;
    }

    .table-stack tbody tr:hover td {
        background: none;
    }

    .table-stack td[data-label] {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-top: 8px;
        text-align: right;
    }

    .table-stack td[data-label]::before {
        content: attr(data-label);
        font-size: 13px;
        color: var(--gray-500);
        text-align: left;
    }

    .table-stack .actions {
        margin-top: 10px;
        text-align: left;
    }

    .cell-sub {
        max-width: none;
        white-space: normal;
    }
}

.table-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--gray-500);
}

/* ---------- Notices ---------- */
.notice {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
    font-size: 13px;
    color: var(--gray-600);
}

.notice svg {
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

.notice-warning {
    background: var(--amber-50);
    border-color: var(--amber-200);
    color: var(--amber-700);
}

.notice-danger {
    background: var(--red-50);
    border-color: var(--red-200);
    color: var(--red-700);
}

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .modal {
        align-items: flex-start;
        padding: 10vh 16px 32px;
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
}

.modal-panel {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 640px) {
    .modal-panel {
        border-radius: var(--radius-xl);
    }
}

.modal-sm { max-width: 420px; }
.modal-md { max-width: 500px; }
.modal-lg { max-width: 640px; }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-description {
    margin-top: 4px;
    font-size: 14px;
    color: var(--gray-500);
}

.modal-body {
    padding: 20px;
}

.modal-foot {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    padding: 14px 20px;
    background: var(--gray-25);
    border-top: 1px solid var(--gray-100);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

@media (min-width: 640px) {
    .modal-foot {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ---------- Toasts ---------- */
.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 640px) {
    .toasts {
        left: auto;
        align-items: flex-end;
    }
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    padding: 10px 10px 10px 14px;
    background: var(--brand-950);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: #fff;
    font-size: 14px;
    pointer-events: auto;
}

.toast .icon-btn {
    color: var(--gray-400);
}

.toast .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.toast-icon svg {
    width: 18px;
    height: 18px;
}

.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon { color: #f87171; }

.toast-text {
    flex: 1;
}

/* ---------- Choice cards (radio) ---------- */
.choice-group {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

@media (min-width: 480px) {
    .choice-group {
        grid-template-columns: 1fr 1fr;
    }

    .choice-group .label {
        grid-column: 1 / -1;
    }
}

/* A <legend> sits outside the grid, so it needs the same 6px gap as other labels. */
.choice-group .label {
    margin-bottom: 6px;
    padding: 0;
}

.choice {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.choice:hover {
    border-color: var(--gray-400);
}

.choice.is-selected {
    background: var(--brand-25);
    border-color: var(--brand-600);
    box-shadow: 0 0 0 1px var(--brand-600);
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice:has(input:focus-visible) {
    outline: 2px solid var(--brand-300);
    outline-offset: 2px;
}

.choice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    color: var(--gray-600);
}

.choice-icon svg {
    width: 15px;
    height: 15px;
}

.choice.is-selected .choice-icon {
    background: var(--brand-600);
    color: #fff;
}

.choice-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
}

.choice-text {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--gray-500);
}

/* Variable-amount marker in tables */
.amount-variable {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--blue-700);
}

.amount-variable svg {
    width: 14px;
    height: 14px;
}

/* ---------- Links ---------- */
.link,
.link-btn {
    font-weight: 500;
    color: var(--brand-700);
    text-decoration: underline;
    text-decoration-color: var(--brand-200);
    text-underline-offset: 3px;
}

.link:hover,
.link-btn:hover {
    text-decoration-color: var(--brand-700);
}

.link-btn {
    font-size: inherit;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
}

.back-link:hover {
    color: var(--gray-900);
}

.back-link svg {
    width: 14px;
    height: 14px;
}

/* ---------- Reminder banner ---------- */
.banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--amber-50);
    border: 1px solid var(--amber-200);
    border-radius: var(--radius-lg);
    font-size: 13px;
    color: var(--amber-700);
}

.banner-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--amber-200);
}

.banner-icon svg {
    width: 16px;
    height: 16px;
}

.banner-text {
    flex: 1;
    min-width: 200px;
}

.banner-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

/* ---------- Amount change ---------- */
.amount-change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    white-space: nowrap;
}

.amount-change svg {
    width: 13px;
    height: 13px;
}

/* ---------- Previous → new comparison ---------- */
.compare {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
}

.compare-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.compare-label {
    font-size: 12px;
    color: var(--gray-500);
}

.compare-value {
    margin-top: 2px;
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}

.compare-sub {
    font-size: 12px;
    color: var(--gray-500);
}

.compare-arrow {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

/* ---------- History timeline ---------- */
.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0 0 18px 22px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 14px;
    bottom: -2px;
    left: 5px;
    width: 1px;
    background: var(--gray-200);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    top: 5px;
    left: 0;
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid var(--gray-300);
}

.timeline-dot.is-current {
    background: var(--brand-600);
    border-color: var(--brand-600);
}

.timeline-dot.is-scheduled {
    border-color: var(--blue-700);
    border-style: dashed;
}

.timeline-body {
    flex: 1;
    min-width: 0;
}

.timeline-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.timeline-row .amount-change {
    margin-top: 0;
}

.timeline-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--gray-500);
}

/* ---------- Annual review ---------- */
.review-date {
    width: 100%;
    max-width: 220px;
}

.review-date-hint {
    max-width: 420px;
    font-size: 13px;
}

@media (min-width: 640px) {
    .review-date-hint {
        text-align: right;
    }
}

.review-input {
    min-width: 160px;
}

.review-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 12px;
}

.review-result .amount-change {
    margin-top: 0;
    font-size: 13px;
    color: var(--gray-900);
}

@media (max-width: 767px) {
    .review-input {
        min-width: 0;
        width: 60%;
    }

    .review-result {
        align-items: flex-end;
    }
}

.form-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    margin-top: 16px;
}

@media (min-width: 640px) {
    .form-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ---------- Settings ---------- */
.settings-grid {
    display: grid;
    gap: 20px;
    max-width: 640px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
}

.section-text {
    margin-top: 2px;
    font-size: 13px;
    color: var(--gray-500);
}

.card-foot {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px;
    background: var(--gray-25);
    border-top: 1px solid var(--gray-100);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ---------- Checklist: cycle bar ---------- */
.cycle-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--brand-100);
    border-left: 4px solid var(--brand-600);
    border-radius: var(--radius-lg);
}

@media (min-width: 640px) {
    .cycle-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cycle-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    font-size: 13px;
}

.cycle-name {
    font-size: 14px;
    font-weight: 600;
}

/* Paid / left amounts for the open cycle */
.cycle-sums {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
}

.cycle-sums > div {
    display: flex;
    flex-direction: column;
}

.cycle-sums dt {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-500);
}

.cycle-sums dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}

.cycle-sums dd.is-paid {
    color: var(--brand-700);
}

.cycle-sums dd.is-missing {
    font-size: 13px;
    line-height: 22px;
    color: var(--amber-700);
}

@media (min-width: 640px) {
    .cycle-bar {
        flex-wrap: wrap;
        gap: 12px 24px;
    }

    .cycle-meta {
        flex-direction: column;
        gap: 2px;
    }
}

.cycle-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--gray-600);
}

.cycle-progress-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.cycle-progress-text strong {
    color: var(--gray-900);
}

.progress {
    flex: 1;
    min-width: 120px;
    height: 6px;
    overflow: hidden;
    background: var(--gray-200);
    border-radius: 999px;
}

@media (min-width: 640px) {
    .progress {
        flex: none;
        width: 160px;
    }
}

.progress-bar {
    display: block;
    height: 100%;
    background: var(--brand-600);
    border-radius: 999px;
    transition: width 0.25s ease;
}

/* ---------- Checklist rows ---------- */
.checklist {
    font-size: 14px;
}

.checklist-head,
.checklist-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px 190px 64px;
    align-items: center;
    column-gap: 16px;
    padding: 0 16px;
}

.checklist-head {
    padding-top: 10px;
    padding-bottom: 10px;
    background: var(--gray-25);
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
}

.checklist-row {
    min-height: 64px;
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.checklist-row:last-child {
    border-bottom: 0;
}

.checklist-row:hover {
    background: var(--gray-25);
}

.checklist-row.is-done .cell-title,
.checklist-row.is-done .amount {
    color: var(--gray-500);
}

.checklist-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.checklist .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.checklist-amount .amount {
    font-weight: 600;
    white-space: nowrap;
}

.amount-edit {
    margin-left: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

.checklist-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.paid-at {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.checklist-action {
    display: flex;
    justify-content: center;
}

.bill-form {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 6px;
    text-align: left;
}

.bill-input {
    width: 140px;
}

.bill-input .input {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* Paid checkbox */
.check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    color: transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.check svg {
    width: 16px;
    height: 16px;
}

.check:hover {
    border-color: var(--brand-600);
    color: var(--brand-200);
}

.check:focus-visible {
    outline: 2px solid var(--brand-300);
    outline-offset: 2px;
}

.check.is-checked {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.check.is-checked:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
}

.check:disabled {
    opacity: 0.6;
    cursor: wait;
}

.footnote {
    margin-top: 12px;
    font-size: 13px;
    color: var(--gray-500);
}

/* Mobile: name + checkbox on top, amount + status below */
@media (max-width: 767px) {
    .checklist-head {
        display: none;
    }

    .checklist-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name action"
            "amount status";
        row-gap: 8px;
        padding: 14px 16px;
    }

    .checklist-name { grid-area: name; }

    /* Right-aligned so every checkbox lines up, however wide the status below it is. */
    .checklist-action {
        grid-area: action;
        justify-content: flex-end;
    }

    .checklist-amount {
        grid-area: amount;
        text-align: left !important;
    }

    .checklist-status {
        grid-area: status;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .bill-form {
        justify-content: flex-start;
    }

    .check {
        width: 32px;
        height: 32px;
    }
}

/* ---------- History: filters ---------- */
.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    padding: 12px;
    background: var(--gray-25);
    border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 768px) {
    .filters {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
    }

    .filter {
        width: 160px;
    }
}

.filter-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
}

.filter .input,
.filter .select {
    padding-top: 6px;
    padding-bottom: 6px;
}

.filter-clear {
    display: flex;
    align-items: flex-end;
    width: auto;
}

.filters-error {
    margin: 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
}

/* ---------- Clickable rows ---------- */
.row-link {
    position: relative;
    cursor: pointer;
}

.stretched {
    text-align: left;
}

.stretched::after {
    content: '';
    position: absolute;
    inset: 0;
}

.stretched:hover {
    color: var(--brand-700);
    text-decoration: underline;
    text-decoration-color: var(--brand-200);
    text-underline-offset: 3px;
}

.stretched:focus-visible {
    outline: none;
}

.stretched:focus-visible::after {
    outline: 2px solid var(--brand-300);
    outline-offset: -2px;
}

.row-chevron {
    display: inline-block;
    color: var(--gray-400);
}

@media (max-width: 767px) {
    .table-stack .row-chevron {
        position: absolute;
        top: 16px;
        right: 16px;
    }

    .table-stack .row-link .actions {
        margin: 0;
    }
}

/* ---------- Pagination ---------- */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
}

.pager-info,
.pager-page {
    font-size: 13px;
    color: var(--gray-500);
}

.pager-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Detail list ---------- */
.details {
    display: grid;
    gap: 12px;
    margin: 0;
}

.details > div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
}

.details dt {
    font-size: 13px;
    color: var(--gray-500);
}

.details dd {
    margin: 0;
    font-size: 14px;
}

.details-note {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--gray-500);
}

/* ---------- Small text helpers ---------- */
.text-muted { color: var(--gray-500); }
.text-strong { font-weight: 600; color: var(--gray-900); }
.mt-1 { margin-top: 4px; }

/* ---------- Livewire loading helpers ---------- */
[wire\:loading],
[wire\:loading\.delay] {
    display: none;
}

/* ==========================================================================
   Insights: key figures and charts (plain CSS, no chart library)
   ========================================================================== */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

@media (min-width: 900px) {
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat {
    position: relative;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    background: var(--brand-50);
    color: var(--brand-600);
}

.stat-icon svg { width: 17px; height: 17px; }

.stat.is-warning .stat-icon {
    background: var(--amber-50);
    color: var(--amber-600);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
}

.stat-value {
    margin-top: 2px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--brand-950);
    overflow-wrap: anywhere;
}

.stat-of {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
}

.stat-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--gray-500);
}

.chart-card {
    padding: 20px;
    margin-bottom: 16px;
}

.chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 16px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 12px;
    color: var(--gray-500);
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--brand-600);
}

.legend-dot.is-open {
    background: repeating-linear-gradient(135deg, var(--brand-300) 0 3px, var(--brand-200) 3px 6px);
}

.chart-empty {
    margin-top: 16px;
    padding: 24px 0;
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
}

/* Column chart: 12 months */
.colchart-scroll {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.colchart {
    min-width: 520px;
}

.colchart-plot {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    height: 220px;
    padding-top: 4px;
    border-bottom: 2px solid var(--gray-200);
    background: repeating-linear-gradient(to top, transparent 0 54px, var(--gray-100) 54px 55px);
}

.colchart-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
}

.colchart-value {
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--brand-800);
    white-space: nowrap;
}

.colchart-bar {
    display: block;
    width: 100%;
    max-width: 38px;
    min-height: 3px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
    transition: filter 0.15s;
}

.colchart-bar.is-open {
    background: repeating-linear-gradient(135deg, var(--brand-300) 0 5px, var(--brand-200) 5px 10px);
}

.colchart-col:hover .colchart-bar {
    filter: brightness(1.12);
}

.colchart-none {
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--gray-300);
}

.colchart-labels {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
}

.insights-grid {
    display: grid;
    gap: 16px;
}

.insights-grid .chart-card {
    margin-bottom: 0;
}

@media (min-width: 900px) {
    .insights-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Utility bills: last bill, change, and a 12-month mini chart */
.bills {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
}

.bill-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--gray-100);
}

.bill-row:first-child {
    border-top: 0;
}

.bill-info {
    flex: 1;
    min-width: 0;
}

.bill-name {
    font-weight: 600;
}

.bill-last {
    margin-top: 2px;
    font-size: 13px;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-600);
}

.trend svg { width: 13px; height: 13px; }

/* A higher bill is a warning (amber); a lower one is good news (indigo). */
.trend.is-up {
    background: var(--amber-50);
    color: var(--amber-700);
}

.trend.is-down {
    background: var(--brand-50);
    color: var(--brand-700);
}

.spark {
    display: grid;
    grid-template-columns: repeat(12, 8px);
    align-items: end;
    gap: 3px;
    height: 44px;
    flex-shrink: 0;
}

.spark-col {
    display: flex;
    align-items: flex-end;
    height: 100%;
    border-radius: 2px;
    background: var(--gray-100);
}

.spark-bar {
    display: block;
    width: 100%;
    border-radius: 2px;
    background: var(--amber-400);
}

/* Paid per recipient: horizontal bars */
.hbars {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.hbar-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.hbar-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hbar-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hbar-track {
    display: block;
    height: 8px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--brand-50);
    overflow: hidden;
}

.hbar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-400), var(--brand-700));
}

.hbar-sub {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--gray-500);
}
