/* ========================================================
   NetWorth Design System
   components.css – buttons, forms, tables, labels, etc.
   ======================================================== */

/* -----------------------------
   Buttons
   ----------------------------- */

/* ===== BASE BUTTON ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;

    background: #ffffff;
    border: 1px solid transparent;
    color: #212529;

    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

/* layout helper for rows of buttons on the demo page */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

:root {
    --c-primary: #0d6efd;
    --c-secondary: #6c757d;
    --c-success: #28a745;
    --c-warning: #ffc107;
    --c-danger: #dc3545;
    --c-info: #0d6efd;
    --c-dark: #212529;

    --color-text: #1a202c;
        --color-text-secondary: #718096;
        --color-border: #e2e8f0;
        --color-background: #f7fafc;
        --color-white: #ffffff;
        --pill-green-bg: #e6fffa;
        --pill-green-text: #2c7a7b;
        --pill-yellow-bg: #fffaf0;
        --pill-yellow-text: #975a16;
        --pill-blue-bg: #ebf8ff;
        --pill-blue-text: #3182ce;
        --color-danger: #e53e3e;
        --color-danger-bg: #fff5f5;

        --green: #43a047;
            --light-green: #e8f5e9;
            --red: #f44336;
            --light-red: #ffebee;
            --yellow: #ff9800;
            --light-yellow: #fff3e0;
}

/* ===== OUTLINE BUTTONS ===== */
.btn-outline {
    background: #ffffff;
}

/* Normal state */
.btn-outline-primary {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

.btn-outline-secondary {
    border-color: var(--c-secondary);
    color: var(--c-secondary);
}

.btn-outline-success {
    border-color: var(--c-success);
    color: var(--c-success);
}

.btn-outline-warning {
    border-color: var(--c-warning);
    color: var(--c-warning);
}

.btn-outline-danger {
    border-color: var(--c-danger);
    color: var(--c-danger);
}

.btn-outline-info {
    border-color: var(--c-info);
    color: var(--c-info);
}

.btn-outline-dark {
    border-color: var(--c-dark);
    color: var(--c-dark);
}

/* Hover (active look) */
.btn-outline-primary:hover {
    background: var(--c-primary);
    color: #fff;
}

.btn-outline-secondary:hover {
    background: var(--c-secondary);
    color: #fff;
}

.btn-outline-success:hover {
    background: var(--c-success);
    color: #fff;
}

.btn-outline-warning:hover {
    background: var(--c-warning);
    color: #fff;
}

.btn-outline-danger:hover {
    background: var(--c-danger);
    color: #fff;
}

.btn-outline-info:hover {
    background: var(--c-info);
    color: #fff;
}

.btn-outline-dark:hover {
    background: var(--c-dark);
    color: #fff;
}

/* ===== GHOST BUTTONS ===== */
.btn-ghost {
    background: transparent;
    border-color: transparent;
}

/* Normal state (text color only) */
.btn-ghost-primary {
    color: var(--c-primary);
}

.btn-ghost-secondary {
    color: var(--c-secondary);
}

.btn-ghost-success {
    color: var(--c-success);
}

.btn-ghost-warning {
    color: var(--c-warning);
}

.btn-ghost-danger {
    color: var(--c-danger);
}

.btn-ghost-info {
    color: var(--c-info);
}

.btn-ghost-dark {
    color: var(--c-dark);
}

/* Hover (active look — same as outline active) */
.btn-ghost-primary:hover {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}

.btn-ghost-secondary:hover {
    background: var(--c-secondary);
    border-color: var(--c-secondary);
    color: #fff;
}

.btn-ghost-success:hover {
    background: var(--c-success);
    border-color: var(--c-success);
    color: #fff;
}

.btn-ghost-warning:hover {
    background: var(--c-warning);
    border-color: var(--c-warning);
    color: #fff;
}

.btn-ghost-danger:hover {
    background: var(--c-danger);
    border-color: var(--c-danger);
    color: #fff;
}

.btn-ghost-info:hover {
    background: var(--c-info);
    border-color: var(--c-info);
    color: #fff;
}

.btn-ghost-dark:hover {
    background: var(--c-dark);
    border-color: var(--c-dark);
    color: #fff;
}

/* ===== ICON BUTTONS ===== */
.btn-icon {
    background: #ffffff;
    border: 1px solid #e3e6ee;
    color: #212529;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Frozen state—no hover effect */
.btn-icon:hover,
.btn-icon:active,
.btn-icon:focus {
    background: #ffffff;
    border-color: #e3e6ee;
    color: #212529;
    box-shadow: none;
}

/* -----------------------------
   Form controls
   ----------------------------- */

.label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: var(--font-size-sm);
    color: var(--color-text-main);
}

.label span {
    font-weight: 500;
}

.label small {
    color: var(--color-text-muted);
}

/* -----------------------------
   Alerts
   ----------------------------- */

.alert.alert-success {
    background-color: var(--light-green);
    color: var(--green);
    border: 1px solid var(--green);
}

.alert.alert-danger {
    background-color: var(--light-red);
    color: var(--red);
    border: 1px solid var(--red);
}

.alert.alert-warning {
    background-color: var(--light-yellow);
    color: var(--yellow);
    border: 1px solid var(--yellow);
} 

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start; 
    gap: 0.5rem;
    border: 1px solid currentColor;
    font-size: 0.75rem;
}

.alert__icon {
    flex-shrink: 0;
}

.alert__title {
    font-weight: 600;
    color: #263238;
    margin-bottom: 4px;
}

.alert__desc {
    color: #546e7a;
}

.no-support {
    align-content: center;
    background-color: #000d;
    color: #fff;
    display: grid;
    gap: 1em;
    inset: 0;
    place-items: center;
    position: fixed;
    z-index: 10;

    a {
        color: inherit;
    }
}
/* Base input/textarea/select */
label {
    line-height: 1.25rem;
}

input {
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: #ffffff;
    border: 1px solid #d2d6dc;
    padding: 7px 11px;
    box-shadow: inset 0px 1px 3px rgba(107, 114, 128, 0.2),
        0 0 0 1px rgba(28, 100, 242, 0);
    border-radius: 4px;
    transition: box-shadow 0.25s cubic-bezier(0.64, 0, 0.35, 1) 0s,
        border 0.25s cubic-bezier(0.64, 0, 0.35, 1) 0s;

    &:focus {
        border: 1px solid rgb(28, 100, 242);
        box-shadow: inset 0px 1px 3px rgba(107, 114, 128, 0),
            0 0 0 1px rgba(28, 100, 242, 1);
        outline: 0;
    }

    &::placeholder {
        color: #9FA6B2;
    }
}

select {
    font-size: 0.875rem;
    line-height: 1.25rem;
    padding: 7px 35px 7px 11px;
    border: 1px solid #d2d6dc;
    box-shadow: 0 0 0 1px rgba(28, 100, 242, 0), 0px 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M12.7798 6.21995C12.9203 6.36058 12.9992 6.5512 12.9992 6.74995C12.9992 6.9487 12.9203 7.13933 12.7798 7.27995L8.52985 11.53C8.38922 11.6704 8.1986 11.7493 7.99985 11.7493C7.8011 11.7493 7.61047 11.6704 7.46985 11.53L3.21985 7.27995C3.08737 7.13778 3.01524 6.94973 3.01867 6.75543C3.0221 6.56113 3.10081 6.37574 3.23822 6.23833C3.37564 6.10092 3.56102 6.0222 3.75532 6.01878C3.94963 6.01535 4.13767 6.08747 4.27985 6.21995L7.99985 9.93995L11.7198 6.21995C11.8605 6.0795 12.0511 6.00061 12.2498 6.00061C12.4486 6.00061 12.6392 6.0795 12.7798 6.21995V6.21995Z' fill='%23374151'/%3E%3C/svg%3E%0A"),
        linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    transition: box-shadow 0.25s cubic-bezier(0.64, 0, 0.35, 1) 0s,
        border 0.25s cubic-bezier(0.64, 0, 0.35, 1) 0s;

    background-repeat: no-repeat, repeat;
    background-position: right 0.75rem top 50%, 0 0;
    background-size: 1rem auto, 100%;

    &:focus {
        border: 1px solid rgb(28, 100, 242);
        box-shadow: 0 0 0 1px rgba(28, 100, 242, 1), 0px 1px 2px rgba(0, 0, 0, 0.05);
        outline: 0;
    }

    &:active {
        background: #fff;
    }
}

.form-checkbox {
    &:focus {
        border: 1px solid rgb(28, 100, 242);
        box-shadow: inset 0px 1px 3px rgba(107, 114, 128, 0),
            0 0 0 1px rgba(28, 100, 242, 1);
        outline: 0;
    }

    &:checked {
        background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.7798 6.28009C11.9123 6.13792 11.9844 5.94987 11.981 5.75557C11.9776 5.56127 11.8989 5.37588 11.7615 5.23847C11.6241 5.10106 11.4387 5.02234 11.2444 5.01892C11.0501 5.01549 10.862 5.08761 10.7198 5.22009L6.74985 9.19009L5.27985 7.72009C5.13767 7.58761 4.94963 7.51549 4.75532 7.51892C4.56102 7.52234 4.37564 7.60106 4.23822 7.73847C4.10081 7.87588 4.0221 8.06127 4.01867 8.25557C4.01524 8.44987 4.08737 8.63792 4.21985 8.78009L6.21985 10.7801C6.36047 10.9205 6.5511 10.9994 6.74985 10.9994C6.9486 10.9994 7.13922 10.9205 7.27985 10.7801L11.7798 6.28009Z' fill='white'/%3E%3C/svg%3E");

        &:focus {
            border: 1px solid rgb(30, 66, 159);
            box-shadow: inset 0px 1px 3px rgba(107, 114, 128, 0),
                0 0 0 1px rgba(30, 66, 159, 1);
        }
    }
}

.input,
.select,
.textarea {
    width: 100%;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid #d2d6dc;
    background-color: var(--color-surface);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--color-text-soft);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary-soft);
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--space-3);
}

.field-help {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.field-error {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
}

/* Input with prefix/suffix */

.input-group {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle);
    overflow: hidden;
    background: var(--color-surface);
}

.input-group-addon {
    padding: 0 var(--space-2);
    display: inline-flex;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-soft);
    background: #f3f4f6;
    border-right: 1px solid var(--color-border-subtle);
}

.input-group .input {
    border: none;
    border-radius: 0;
}

.input-group:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary-soft);
}

/* -----------------------------
   Labels & Status Indicators
   ----------------------------- */

/* Text-only labels */
.label-status {
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
}

/* Common status colors */
.label-success {
    color: var(--color-success);
}

.label-warning {
    color: var(--color-warning);
}

.label-danger {
    color: var(--color-danger);
}

.label-info {
    color: var(--color-info);
}

.label-muted {
    color: var(--color-muted-strong);
}

/* Provider-specific labels */
.label-src-yahoo {
    color: var(--color-provider-yahoo);
}

.label-src-av {
    color: var(--color-provider-av);
}

.label-src-finnhub {
    color: var(--color-provider-finnhub);
}

.label-src-cache {
    color: var(--color-provider-cache);
}

.label-src-basis {
    color: var(--color-provider-basis);
}

.label-src-failed {
    color: var(--color-provider-failed);
}

.label-src-info {
    color: var(--color-provider-info);
}

.label-src-unknown {
    color: var(--color-provider-unknown);
}

/* Inline arrangement */
.label-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Dot indicator (•) using currentColor */
.label-dot::before {
    content: "•";
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}

/* Ring indicator (hollow circle) using currentColor */
.label-ring::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid currentColor;
    box-sizing: border-box;
}

.label-ring-lg::before {
    width: 16px;
    height: 16px;
}

/* Table spacing presets for status labels */
.table-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
}

.table-status-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
}

/* -----------------------------
   Badges / Tags
   ----------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-subtle);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    background: #f9fafb;
}

.badge-primary {
    border-color: var(--color-primary-soft);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}

.badge-danger {
    border-color: rgba(220, 38, 38, 0.15);
    background: #fef2f2;
    color: var(--color-danger);
}

/* lightweight text tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    padding: 1px 6px;
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle);
    background: #f9fafb;
    color: var(--color-text-soft);
    width: max-content;
}

/* -----------------------------
   Tables
   ----------------------------- */

.table-shell {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    padding: var(--space-3);
    box-shadow: var(--shadow-subtle);
    overflow-x: auto;
}

/* Components – Tables */
.table-container {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.table {
    width: 100%; 
    border-collapse: collapse;
    font-size: var(--font-size-md);
    max-width: 1200px;
}

.table th,
.table td {
    padding: 16px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}

.table thead th {
font-size: var(--font-size-md);
    font-weight: 600;
    background: #fafafa;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--bg-hover, #f3f4f6);
}

.table-sm th,
.table-sm td {
    padding: 0.25rem 0.5rem;
}

.table-align-middle td {
    vertical-align: middle;
}

.table-number,
.table-currency {
    text-align: right;
    white-space: nowrap;
}

.table-checkbox {
    width: 40px;
    text-align: center;
}

/* Sticky header */
.table-sticky-header thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f9fafb;
}

/* Ellipsis cell helpers */
.cell-lines {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cell-main {
    font-size: var(--font-size-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-sub {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frozen columns helpers: apply to <th>/<td> in col1/col2 */
.col-sticky-1 {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--color-surface);
}

.col-sticky-2 {
    position: sticky;
    left: 40px;
    /* width of checkbox column */
    z-index: 3;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border-subtle);
}

/* Table filters row */
.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    align-items: center;
}

.table-filter-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
}

.table-filter-label {
    color: var(--color-text-muted);
    white-space: nowrap;
}

.table-filter-input,
.table-filter-select {
    font-size: var(--font-size-sm);
    padding: 4px 8px;
    border: 1px solid var(--color-border-subtle);
    background: var(--color-surface);
    color: var(--color-text-main);
    min-width: 140px;
}

.table-filter-input {
    max-width: 220px;
}

.table-filter-date {
    min-width: 150px;
}

.table-filter-actions {
    margin-left: auto;
    display: inline-flex;
    gap: 6px;
}

.table-filter-button {
    font-size: var(--font-size-sm);
    padding: 4px 10px;
    border: 1px solid var(--color-border-subtle);
    background: var(--color-surface);
    color: var(--color-text-main);
    cursor: pointer;
}

.table-filter-button-primary {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

/* -----------------------------
   Dropdown menus
   ----------------------------- */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 35px;
    right: 0;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 250px;
    z-index: 10;
    overflow: hidden;
    display: none;
}


.dropdown-menu-right {
    right: 0;
    left: auto;
}

.dropdown-menu.is-open {
    display: block;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item,
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.dropdown-item {
    text-decoration: none;
    color: var(--color-text);
    cursor: pointer;
}

.dropdown-header {
    color: var(--color-text-secondary);
    font-size: 12px;
    padding-bottom: 5px;
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: var(--color-background);
}

.dropdown-item-danger {
    color: var(--color-danger);
}

.dropdown-item.danger {
    color: var(--color-danger);
}

.dropdown-item.danger:hover {
    background-color: var(--color-danger-bg);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 6px 0;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--color-text-secondary);
}

.dropdown-item.danger svg {
    color: var(--color-danger);
}

/* User profile menu */
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    background: var(--color-surface);
    cursor: pointer;
    font-size: var(--font-size-sm);
}

.user-menu-trigger:hover {
    background: #f3f4f6;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
}

/* -----------------------------
   Cards
   ----------------------------- */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card-title {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.card-title i {
    margin-right: 8px;
    color: var(--primary);
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.card-detail {
    font-size: 14px;
    color: var(--gray);
    margin-top: 5px;
}

.highlight {
    color: var(--primary);
    font-weight: 600;
}
/* -----------------------------
   Kebab menu (inside tables/cards)
   ----------------------------- */

.kebab-wrap {
    position: relative;
    text-align: right;
}

.kebab-button {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 18px;
    line-height: 1;
}

.kebab-menu {
    position: absolute;
    top: 35px;
    right: 0;
    background-color: #ffffff;
    border: 1px solid var(--color-subtle);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 250px;
    z-index: 20;
    overflow: hidden;
    display: none;
}

.kebab-menu.is-open {
    display: block;
}

.kebab-item {
    padding: 7px 12px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.kebab-item:hover {
    background: #f3f4f6;
}

.kebab-item-danger {
    color: var(--color-danger);
}

.kebab-cell {
    width: 50px;
    text-align: right;
    position: relative;
}

.kebab-btn {
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    background: transparent;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-soft);
    font-size: 18px;
    line-height: 0;
}

.kebab-btn:hover {
    border-color: var(--border-subtle);
    background: #f9fafb;
    color: var(--text-main);
}

.kebab-menu.open {
    display: block;
}

.kebab-item.delete {
    color: var(--danger);
}

/* Duplicate kebab */

/* -----------------------------
   Tabs
   ----------------------------- */

.tabs {
    border-bottom: 1px solid var(--color-border-subtle);
    margin-bottom: var(--space-3);
}

.tab-list {
    display: inline-flex;
    gap: var(--space-2);
}

.tab {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--color-text-muted);
}

.tab.active {
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}

.tab-panel {
    display: none;
    padding-top: var(--space-2);
}

.tab-panel.active {
    display: block;
}

/* -----------------------------
   Modals
   ----------------------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-subtle);
    max-width: 480px;
    width: 100%;
    padding: var(--space-4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-body {
    margin-bottom: var(--space-3);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* -----------------------------
   Metrics / Stat Tiles
   ----------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    padding: var(--space-3);
    box-shadow: var(--shadow-subtle);
}

.stat-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-soft);
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-trend {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.subheader {
    font-size: .75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        line-height: 1rem;
        color: var(--tblr-secondary);
        margin-bottom: var(--space-2);
}


/* Narrow card layout (e.g., import / wizard pages) */
.card-narrow {
    margin: 0 auto;
    max-width: 720px;
}

/* -----------------------------
   Toast notifications
   ----------------------------- */

.toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
}

.toast {
    min-width: 260px;
    max-width: 340px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.toast-title {
    font-weight: 500;
}

.toast-body {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.toast-icon {
    font-size: 16px;
    margin-top: 1px;
}

.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
}

.toast-success .toast-icon {
    color: var(--color-success);
}

.toast-danger {
    border-color: rgba(220, 38, 38, 0.3);
}

.toast-danger .toast-icon {
    color: var(--color-danger);
}

/* -----------------------------
   Form validation state helpers
   ----------------------------- */

.input-error,
.select-error,
.textarea-error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.2);
}

.input-success,
.select-success,
.textarea-success {
    border-color: var(--color-success);
    box-shadow: 0 0 0 1px rgba(32, 201, 151, 0.2);
}

.field-error-text {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
    margin-top: 2px;
}

/* -----------------------------
   Responsive tweaks
   ----------------------------- */

@media (max-width: 768px) {
    .table-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .table-filter-actions {
        margin-left: 0;
        align-self: flex-start;
    }
}

/* ---------------------------------
   Accounts – inline editing & activity
   ----------------------------------*/

/* Make table cells clickable inline editors */
.acct-inline {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: background-color 0.08s ease, border-color 0.08s ease;
    display: block;
    /* make entire cell clickable */
    width: 100%;
    min-height: 1.5rem;
    /* small click target even when empty */
}

.acct-inline:hover {
    background-color: #f8f9fa;
    border-bottom-color: #ced4da;
}

.acct-inline-editing {
    border-bottom-color: transparent;
}

.acct-inline-input,
.acct-inline-select-input,
.acct-inline-textarea {
    width: 100%;
    font-size: inherit;
    line-height: inherit;
    padding: 0.15rem 0.25rem;
    box-sizing: border-box;
}

.acct-inline-textarea {
    resize: vertical;
    min-height: 2.2rem;
}

/* Status pill acts like a button, reusing .change-pill look */
.acct-status-pill {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.acct-status-pill:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 1px;
}

/* Activity column: sparkline + sync label */
.acct-activity {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.acct-sparkline-wrapper {
    cursor: pointer;
}

.acct-sparkline {
    width: 100%;
    height: 24px;
}

.acct-sparkline-path {
    fill: none;
    stroke-width: 1.5;
}

.acct-sparkline-path-fresh {
    stroke: #0d6efd;
    /* blue for fresh */
}

.acct-sparkline-path-stale {
    stroke: #adb5bd;
    /* gray for stale */
}

.acct-sparkline-placeholder {
    font-size: 0.75rem;
}

.acct-sync-label {
    font-size: 0.75rem;
}

.acct-sync-fresh {
    color: #198754;
    /* green */
}

.acct-sync-stale {
    color: #dc3545;
    /* red */
}

.acct-spark-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 4px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.08s ease;
}

/* ---------------------------------
   Auth pages (login / register / reset)
   ---------------------------------- */

/* Layout wrapper & card */
.auth-wrapper {
    display: flex;
    justify-content: center;
    padding-top: 70px;
    padding-bottom: 70px;
}

.auth-card {
    width: 100%;
    max-width: 550px;
    background: #ffffff;
    padding: 0 8px;
    text-align: center;
}

/* Headings */
.auth-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    margin-top: 0;
}

.auth-subtitle {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 28px;
    margin-top: 0;
}

/* Form layout */
.auth-form {
    text-align: left;
}

.auth-field-group,
.auth-field-wide {
    margin-bottom: 22px;
}

/* Slightly more breathing room for full-name and email */
.auth-field-wide {
    margin-bottom: 26px;
}

.auth-label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: #111827;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    background: #fff;
    transition: border-color .2s;
}

.auth-input:focus {
    border-color: #111;
    outline: none;
}

/* Error messages */
.auth-error {
    background: #fdecea;
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-error-small {
    margin-top: 4px;
    color: #b91c1c;
    font-size: 13px;
}

/* Row: remember + forgot */
.auth-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.auth-checkbox {
    font-size: 14px;
    color: #111827;
}

.auth-forgot {
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
}

.auth-forgot:hover {
    text-decoration: underline;
}

/* Primary button */
.auth-button {
    width: 100%;
    padding: 14px 0;
    background: #111111;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    transition: opacity .2s;
}

.auth-button:hover {
    opacity: 0.9;
}

.auth-button .arrow {
    padding-left: 6px;
}

/* Terms & signup links */
.auth-terms {
    margin-top: 20px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.auth-terms a {
    color: #3b82f6;
    text-decoration: none;
}

.auth-register {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.auth-register a {
    color: #3b82f6;
    text-decoration: none;
}

/* Two-column row for password fields */
.auth-row-two {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}

.auth-half {
    flex: 1;
}

/* Input with show/hide toggle */
.auth-input-with-toggle {
    position: relative;
}

.auth-input-with-toggle .auth-input {
    padding-right: 70px;
    /* space for toggle */
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    padding: 0;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
}

/* Password strength meter */
.password-strength {
    margin-top: 4px;
    margin-bottom: 22px;
}

.password-strength-bar {
    height: 4px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    width: 0%;
    background: #e5e7eb;
    transition: width .2s ease, background-color .2s ease;
}

.password-strength-label {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

/* Success state */
.auth-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    border: 2px solid #16a34a;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 12px auto 4px auto;
}

.auth-button-link {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
}

.auth-success {
    background: #ecfdf3;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Auth spacing helpers (remove inline styles) */

.auth-success-dev {
    margin-top: 8px;
    font-size: 12px;
}

/* e.g. "Remembered your password?" under a primary button */
.auth-register-spaced {
    margin-top: 16px;
}

/* Extra space under subtitles */
.auth-subtitle-spaced {
    margin-top: 12px;
}

.auth-subtitle-spaced-sm {
    margin-top: 8px;
}

/* Slight extra gap above two-column row */
.auth-row-two-spaced {
    margin-top: 18px;
}

/* ---------------------------------
   Generic table helpers (from table.css)
   ----------------------------------*/

.inline-link {
    border: none;
    background: none;
    padding: 0;
    margin-left: 8px;
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.inline-link:hover {
    text-decoration: underline;
}

.cell-sub {
    font-size: 14px;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------
   Liabilities dashboard card
   ----------------------------------*/

.liab-card {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    padding: 12px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: visible;
}

/* Header */

.liab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.liab-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
}

.liab-range {
    position: relative;
    font-size: 12px;
}

.liab-range-toggle {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 999px;
    cursor: pointer;
}

.liab-range-toggle:hover {
    background: #f3f4f6;
}

.liab-range-chevron {
    font-size: 10px;
    line-height: 1;
}

/* Range menu */

.liab-range-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    list-style: none;
    padding: 4px 0;
    background: #111827;
    color: #e5e7eb;
    border-radius: 8px;
    min-width: 120px;
    font-size: 12px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.3);
    display: none;
    z-index: 20;
}

.liab-range-menu.is-open {
    display: block;
}

.liab-range-menu li {
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.liab-range-menu li:hover {
    background: rgba(55, 65, 81, 0.8);
}

.liab-range-menu li.is-active {
    font-weight: 600;
    background: rgba(55, 65, 81, 0.9);
}

/* Main value row */

.liab-main {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
}

.liab-total {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
}

.liab-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
}

.liab-change-pct {
    color: #111827;
}

.liab-change-icon {
    display: inline-flex;
    align-items: center;
}

.liab-icon-up,
.liab-icon-down {
    width: 20px;
    height: 20px;
    display: none;
}

.liab-icon-up path,
.liab-icon-down path {
    fill: currentColor;
}

/* Color states */

.liab-change--up .liab-change-pct {
    color: #059669;
    /* green */
}

.liab-change--up .liab-icon-up {
    display: inline-block;
}

.liab-change--down .liab-change-pct {
    color: #dc2626;
    /* red */
}

.liab-change--down .liab-icon-down {
    display: inline-block;
}

/* Ratio line under main value */

.liab-ratio {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 2px;
}

/* Sparkline */

.liab-sparkline-wrap {
    position: relative;
    margin-top: 4px;
    height: 52px;
    overflow: visible;
}

.liab-sparkline {
    width: 100%;
    height: 100%;
}

/* Current period solid line */
.liab-line-current {
    fill: none;
    stroke: #2563eb;
    stroke-width: 1.6;
}

/* Previous period dashed line */
.liab-line-prev {
    fill: none;
    stroke: #9ca3af;
    stroke-width: 1.4;
    stroke-dasharray: 3 3;
}

/* Hover line & dot */

.liab-hover-line {
    stroke: rgba(15, 23, 42, 0.4);
    stroke-width: 1;
    stroke-dasharray: 2 2;
}

.liab-hover-dot {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-width: 1;
}

/* Hover dot for previous period (gray) */
.liab-hover-dot-current,
.liab-hover-dot-prev {
    stroke: #ffffff;
    stroke-width: 1;
}

.liab-hover-dot-current {
    fill: #2563eb;
    /* blue – current period */
}

.liab-hover-dot-prev {
    fill: #9ca3af;
    /* grey – previous period */
}

/* Tooltip side positioning */
.liab-tooltip--left {
    transform: translateX(0);
}

.liab-tooltip--right {
    transform: translateX(-100%);
}

/* Tooltip */

.liab-tooltip {
    position: absolute;
    top: 4px;
    transform: translateX(-50%);
    background: #020617;
    color: #f9fafb;
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 6px;
    min-width: 110px;
    pointer-events: none;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.5);
}

.liab-tooltip-date {
    font-weight: 600;
    margin-bottom: 4px;
}

.liab-tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.liab-dot-current,
.liab-dot-prev {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    display: inline-block;
}

.liab-dot-current {
    background: #2563eb;
}

.liab-dot-prev {
    background: #9ca3af;
}

.liab-tooltip-prev {
    margin-top: 2px;
}

/* Hide previous row when no prev data */
.liab-tooltip-prev[data-hidden="1"] {
    display: none;
}

/* Clickable entire card row in dashboard grids */
.dashboard-row-link {
    cursor: pointer;
}

@media (max-width: 576px) {
    .liab-card {
        padding: 12px 12px 10px;
    }

    .liab-total {
        font-size: 20px;
    }
}

/* Section headings */
.section-title {
    margin: 0;
}

/* Layout for a page section header: title + optional right-side info */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

/* Secondary text under a section title */
.section-subtitle {
    margin-top: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    max-width: 640px;
}

/* Small helper / hint text on the right side of a header */
.section-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-soft);
    max-width: 280px;
    text-align: right;
}

/* ---------------------------------
   Budgets page components
   --------------------------------- */

/* Budgets page */

.budget-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.budget-header .section-title {
    margin: 0;
}

.budget-header .section-subtitle {
    margin: 0.25rem 0 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.budget-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.budget-month-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.budget-rollforward-form {
    display: inline-flex;
    align-items: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 900px) {
    .budget-header {
        flex-direction: column;
        align-items: stretch;
    }

    .budget-header-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Generic 2-column split layout (e.g., form + list) */
.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: flex-start;
    margin-top: var(--space-4);
}

@media (max-width: 1000px) {
    .split-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.table-wrapper {
    overflow-x: auto;
}

/* Inline editor */

.budget-row-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.budget-roll-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #4b5563;
}

.budget-roll-label input[type="checkbox"] {
    margin: 0;
}

.budget-save-btn {
    padding-inline: 10px;
    font-size: 0.8rem;
}

.budget-add-row {
    background-color: #f9fafb;
}

/* Charts */

.budget-charts {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 1.5rem;
    align-items: flex-start;
}

@media (max-width: 1100px) {
    .budget-charts {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Expenses page: single full-width chart card */
.budget-charts--single {
    grid-template-columns: minmax(0, 1fr);
}

.budget-charts--single .budget-chart-card {
    width: 100%;
}

.budget-chart-card {
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.chart-title,
.budget-chart-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Group header toggle */
.budget-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    padding: 4px 0;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.budget-group-caret {
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid #64748b;
    /* slate-ish */
    transition: transform 0.16s ease;
}

/* Rotate caret when collapsed */
.budget-group-row.is-collapsed .budget-group-caret {
    transform: rotate(-90deg);
}

/* Ensures legend grid can size/wrap correctly inside a grid column */
.report-top-legend {
    margin-top: 30px;
    display: flex;
    min-width: 0;
}

/* Optional: tighten vertical spacing in trend / YoY cards */
.budget-trend-card,
.budget-yoy-card {
    margin-top: 0.5rem;
}

.budget-trend-canvas-wrapper {
    margin-top: 0.5rem;
}

/* Optional: ensure tooltip never causes scrollbars */
.budget-trend-canvas-wrapper {
    position: relative;
    overflow: visible;
}

/* Expenses top card layout */
.expenses-top-card-inner {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
}

.expenses-top-card-chart {
    flex: 0 0 280px;
    /* donut column */
}

.expenses-top-card-categories {
    flex: 1 1 auto;
    margin-top: 30px;
}

/* 4-column category grid (shrinks on smaller screens) */
#expenses-category-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: var(--space-4);
    row-gap: var(--space-2);
    padding-left: 0;
}

@media (max-width: 1200px) {
    #expenses-category-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .expenses-top-card-inner {
        flex-direction: column;
    }

    #expenses-category-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Expenses metric toggle active state */
.btn.btn-outline.is-active,
[data-expenses-metric].is-active {
    border-color: var(--color-primary-500, #2563eb);
    color: var(--color-primary-700, #1d4ed8);
    background-color: rgba(37, 99, 235, 0.06);
    /* subtle tint */
}

/* -----------------------------------------
   Reusable: report top area (chart + legend)
------------------------------------------ */

.report-top-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
}

@media (max-width: 900px) {
    .report-top-grid {
        grid-template-columns: 1fr;
    }
}

/* Left chart wrapper */
.chart-canvas-wrap {
    min-width: 0;
}

.chart-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* -----------------------------------------
   Reusable: chart legend
------------------------------------------ */

.chart-legend {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* Stacked (default list) */
.chart-legend--stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Grid legend */
.chart-legend--grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: var(--space-4);
    row-gap: var(--space-2);
}

@media (max-width: 1200px) {
    .chart-legend--grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .chart-legend--grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--color-border-subtle);
    flex-shrink: 0;
}

.chart-legend-label {
    color: #020617;
    font-weight: 500;
    font-size: 14px;
}

/* Amount $ vs Rate % visibility (universal via mode classes) */
.chart-legend.mode-amount .chart-legend-money {
    display: inline;
}

.chart-legend.mode-amount .chart-legend-pct {
    display: none;
}

.chart-legend.mode-rate .chart-legend-money {
    display: none;
}

.chart-legend.mode-rate .chart-legend-pct {
    display: inline;
}

/* Money coloring driven by data attribute */
.money[data-sign="pos"] {
    color: var(--success-600, #16a34a);
}

.money[data-sign="neg"] {
    color: var(--danger-600, #dc2626);
}

.money[data-sign="zero"] {
    color: var(--text-muted, #6b7280);
}

.money {
    white-space: nowrap;
}

/* -----------------------------
   Loans page components
   ----------------------------- */

   .nw-badge {
       display: inline-block;
       padding: 2px 8px;
       font-size: 12px;
       border-radius: 999px;
       font-weight: 500;
   }

   .nw-badge--success {
       background: #e6f6ee;
       color: #137a4a;
   }

   .nw-badge--warning {
       background: #fff4e5;
       color: #9a5b00;
   }

   .nw-badge--info {
       background: #eef4ff;
       color: #2a5bd7;
   }

   .nw-badge--muted {
       background: #f1f3f5;
       color: #6b7280;
   }

   .nw-amount {
       font-weight: 600;
   }

   .nw-row-hover:hover {
       background: #fafafa;
   }

   .nw-empty {
       text-align: center;
       padding: 48px 24px;
   }

   .nw-empty__title {
       font-size: 18px;
       font-weight: 600;
       margin-bottom: 8px;
   }

   .nw-empty__text {
       color: #6b7280;
       margin-bottom: 16px;
   }

   .loan-overview {
       display: grid;
       grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
       gap: 20px;
       margin-bottom: 30px;
   }
   .loan-status {
       display: inline-block;
       background-color: rgba(76, 201, 240, 0.2);
       color: var(--success);
       padding: 5px 12px;
       border-radius: 20px;
       font-size: 14px;
       font-weight: 600;
       margin-left: 15px;
   }
/** -----------------------------
   Tabs
   ----------------------------- */
   :root {
       --primary: #4361ee;
       --primary-light: #4895ef;
       --secondary: #3f37c9;
       --light: #f8f9fa;
       --dark: #212529;
       --gray: #6c757d;
       --gray-light: #e9ecef;
       --border-radius: 10px;
       --transition: all 0.3s ease;
   }

   .f-tabs-container {
       margin: 20px;
   }

   .f-tabs {
       display: flex;
       border-bottom: 1px solid var(--gray-light);
       margin-bottom: 25px;
   }

   .f-tab {
       padding: 12px 20px;
       cursor: pointer;
       font-weight: 600;
       color: var(--gray);
       border-bottom: 3px solid transparent;
       transition: var(--transition);
       position: relative;
   }

   .f-tab:hover {
       color: var(--primary);
   }

   .f-tab.active {
       color: var(--primary);
       border-bottom: 3px solid var(--primary);
   }

   .f-tab-content {
       display: none;
       padding: 20px;
       background-color: white;
       border-radius: 0 0 var(--border-radius) var(--border-radius);
   }

   .f-tab-content.active {
       display: block;
       animation: fadeIn 0.3s ease;
   }

   @keyframes fadeIn {
       from {
           opacity: 0;
       }

       to {
           opacity: 1;
       }
   }
