/* ===== Check The Pockets – Brand Design System ===== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* === Dark theme (default) === */

    /* Surfaces */
    --bg:           #1a1a1a;
    --nav-top:      #111111;
    --nav-sub:      #161616;
    --surface:      #242424;
    --surface-2:    #2c2c2c;
    --border:       #363636;

    /* Brand accents */
    --orange:       #FF9800;
    --orange-dark:  #e08600;
    --orange-bg:    rgba(255, 152, 0, 0.10);
    --sky:          #40C4FF;
    --sky-dark:     #2ba8e0;
    --sky-bg:       rgba(64, 196, 255, 0.10);

    /* Text */
    --text:         #F0F0F0;
    --text-white:   #FFFFFF;
    --muted:        #888888;
    --dim:          #555555;

    /* Semantic amounts */
    --green:        #4ade80;
    --green-bg:     rgba(74, 222, 128, 0.10);
    --red:          #f87171;
    --red-bg:       rgba(248, 113, 113, 0.10);

    /* === Semantic / theme-aware aliases === */

    /* Typography – shared across both themes */
    --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;

    /* Nav */
    --nav-bg:                var(--nav-top);
    --nav-sub-bg:            var(--nav-sub);
    --nav-border:            var(--border);
    --nav-link-color:        var(--muted);
    --nav-link-active-color: var(--orange);
    --nav-active-border:     var(--orange);
    --subnav-link-color:     var(--muted);
    --subnav-active-color:   var(--orange);
    --subnav-active-border:  var(--orange);
    --subnav-active-bg:      transparent;

    /* Page */
    --page-title-color: var(--text-white);
    --primary:          var(--sky);

    /* Legacy aliases – keep all templates working */
    --ctp-navy:       var(--text-white);
    --ctp-denim:      var(--sky);
    --ctp-denim-dark: var(--sky-dark);
    --ctp-coin:       var(--orange);
    --ctp-coin-dark:  var(--orange-dark);
    --ctp-check:      var(--green);
    --ctp-bg:         var(--bg);
    --ctp-surface:    var(--surface);
    --ctp-card:       var(--surface);
    --ctp-border:     var(--border);
    --ctp-text:       var(--text);
    --ctp-muted:      var(--muted);
    --ctp-danger:     var(--red);
    --ctp-danger-bg:  var(--red-bg);
    --ctp-radius:     8px;
    --ctp-radius-sm:  6px;
    --ctp-shadow:     0 4px 20px rgba(0, 0, 0, 0.55);
    --ctp-shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.40);
}

/* ===== Light Theme (Banani) ===== */
[data-theme="light"] {
    /* Surfaces */
    --bg:           #F8F9FA;
    --nav-top:      #234C75;
    --nav-sub:      #1d3f62;
    --surface:      #FFFFFF;
    --surface-2:    #F0F4F8;
    --border:       #DDE1E7;

    /* Brand accents */
    --orange:       #F28C28;
    --orange-dark:  #d97a1e;
    --orange-bg:    rgba(242, 140, 40, 0.10);
    --sky:          #5DADE2;
    --sky-dark:     #4a9bc9;
    --sky-bg:       rgba(93, 173, 226, 0.10);

    /* Text */
    --text:         #1A2332;
    --text-white:   #FFFFFF;
    --muted:        #6B7A8D;
    --dim:          #9AA5B4;

    /* Semantic amounts */
    --green:        #27AE60;
    --green-bg:     rgba(39, 174, 96, 0.10);
    --red:          #E74C3C;
    --red-bg:       rgba(231, 76, 60, 0.10);

    /* Nav – navy background, white links */
    --nav-bg:                #234C75;
    --nav-sub-bg:            #1d3f62;
    --nav-border:            rgba(255, 255, 255, 0.12);
    --nav-link-color:        rgba(255, 255, 255, 0.65);
    --nav-link-active-color: #FFFFFF;
    --nav-active-border:     #F28C28;
    --subnav-link-color:     rgba(255, 255, 255, 0.65);
    --subnav-active-color:   #FFFFFF;
    --subnav-active-border:  #F28C28;
    --subnav-active-bg:      rgba(255, 255, 255, 0.12);

    /* Page */
    --page-title-color: #234C75;
    --primary:          #234C75;

    /* Shadows */
    --ctp-shadow:    0 4px 20px rgba(0, 0, 0, 0.12);
    --ctp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-white);
}

a { color: var(--sky); text-decoration: none; }
a:hover { color: var(--sky-dark); }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.container.container-wide {
    max-width: 100%;
    padding: 2rem 2rem;
}

/* ===== Navbar ===== */
.navbar-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Main nav bar */
.nav-main {
    background: var(--nav-bg);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0;
    height: 52px;
    position: relative;
    border-bottom: 1px solid var(--nav-border);
}

/* When sub-nav exists, brand column spans both bars */
.navbar-wrapper:has(.nav-sub) .nav-main {
    padding-left: 290px;
}
.navbar-wrapper:has(.nav-sub) .nav-sub {
    padding-left: 290px;
    min-height: 40px;
}

/* Brand – default (no sub-nav) */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    flex-shrink: 0;
    padding-right: 1.5rem;
}
.nav-brand img {
    height: 28px;
    width: auto;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    gap: 0;
}
.brand-line {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.brand-check   { color: var(--nav-active-border); }
.brand-the     { color: var(--text-white); }
.brand-pockets { color: var(--nav-active-border); }

/* Brand – two-bar mode (fixed column spanning both bars) */
.navbar-wrapper:has(.nav-sub) .nav-brand {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 92px; /* 52px + 40px */
    padding: 0 0.75rem;
    z-index: 101;
    background: var(--nav-bg);
    border-right: 1px solid var(--nav-border);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.navbar-wrapper:has(.nav-sub) .nav-brand img {
    height: 80px;
    flex-shrink: 0;
}
.navbar-wrapper:has(.nav-sub) .brand-text {
    line-height: 1.06;
}
.navbar-wrapper:has(.nav-sub) .brand-line {
    font-size: 1.1rem;
    letter-spacing: 0.07em;
}

/* Primary nav links */
.nav-main-links {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1;
}
.nav-main-links a {
    display: flex;
    align-items: center;
    padding: 0 1.1rem;
    height: 52px;
    color: var(--nav-link-color);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nav-main-links a:hover { color: var(--nav-link-active-color); }
.nav-main-links a.active {
    color: var(--nav-link-active-color);
    border-bottom-color: var(--nav-active-border);
}

/* User section */
.nav-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--nav-active-border);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: 0.03em;
    flex-shrink: 0;
    text-transform: uppercase;
    text-decoration: none;
    transition: opacity 0.15s;
}
.nav-avatar:hover { opacity: 0.85; color: #111; }
.nav-logout-link {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.7rem;
    border: 1px solid var(--nav-border);
    border-radius: var(--ctp-radius-sm);
    color: var(--nav-link-color);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    transition: border-color 0.15s, color 0.15s;
}
.nav-logout-link:hover { color: var(--nav-link-active-color); border-color: var(--nav-link-active-color); }

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--nav-border);
    border-radius: var(--ctp-radius-sm);
    background: transparent;
    color: var(--nav-link-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.theme-toggle:hover {
    color: var(--nav-link-active-color);
    border-color: var(--nav-link-active-color);
}

/* Sub-nav bar */
.nav-sub {
    background: var(--nav-sub-bg);
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 40px;
    border-bottom: 1px solid var(--nav-border);
    padding-left: 1.5rem;
}
.nav-sub a {
    display: flex;
    align-items: center;
    padding: 0 0.9rem;
    height: 40px;
    color: var(--subnav-link-color);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.nav-sub a:hover { color: var(--nav-link-active-color); }
.nav-sub a.active {
    color: var(--subnav-active-color);
    border-bottom-color: var(--subnav-active-border);
    background: var(--subnav-active-bg);
}

/* ===== Auth Pages ===== */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: var(--ctp-radius);
    border: 1px solid var(--border);
    box-shadow: var(--ctp-shadow);
}
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 2rem;
}
.auth-logo img { height: 56px; width: auto; }
.auth-logo .brand-text { display: flex; flex-direction: column; line-height: 1; }
.auth-logo .brand-line { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.08em; }
.auth-logo .brand-check { color: var(--nav-active-border); }
.auth-logo .brand-the   { color: var(--text); }
.auth-logo .brand-pockets { color: var(--nav-active-border); }
.auth-container h1 { margin-bottom: 1.5rem; font-size: 1.5rem; text-align: center; }
.auth-link { margin-top: 1.25rem; text-align: center; font-size: 0.9rem; color: var(--muted); }
.auth-link a { color: var(--sky); text-decoration: none; font-weight: 700; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-heading);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sky);
    box-shadow: 0 0 0 2px rgba(64, 196, 255, 0.18);
}
.form-group input[type="file"] { padding: 0.5rem; }
.form-group select option { background: var(--surface-2); color: var(--text); }

.filter-bar { display: flex; gap: 1rem; align-items: flex-end; }
.filter-bar .form-group { margin-bottom: 0; min-width: 180px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius-sm);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-heading);
    text-decoration: none;
    color: var(--muted);
    background: var(--surface-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--sky); color: var(--sky); }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--orange);
    color: #111;
    border-color: var(--orange-dark);
    font-weight: 800;
}
.btn-primary:hover { background: var(--orange-dark); color: #111; border-color: var(--orange-dark); }

.btn-accent {
    background: var(--orange);
    color: #111;
    border-color: var(--orange-dark);
    font-weight: 800;
}
.btn-accent:hover { background: var(--orange-dark); color: #111; }

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
    font-weight: 700;
}
.btn-danger:hover { background: rgba(248,113,113,0.12); color: var(--red); border-color: var(--red); }

.btn-sm { padding: 0.28rem 0.7rem; font-size: 0.68rem; }

/* ===== Alerts ===== */
.alert { padding: 0.75rem 1rem; border-radius: var(--ctp-radius-sm); margin-bottom: 1rem; font-size: 0.875rem; }
.alert ul { margin-left: 1.2rem; }
.alert-error { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }
.alert-success { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); }

/* ===== Badge / Pill ===== */
.badge {
    display: inline-block;
    background: var(--surface-2);
    color: var(--orange);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    font-family: var(--font-heading);
}
.badge-income { background: var(--green-bg); color: var(--green); border-color: rgba(74, 222, 128, 0.25); }
.badge-expense { background: var(--red-bg); color: var(--red); border-color: rgba(248, 113, 113, 0.25); }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.875rem; }
.checkbox-label input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--orange); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sky-bg);
    color: var(--sky);
    font-weight: 700;
    font-size: 0.7rem;
    border: 1px solid rgba(64, 196, 255, 0.25);
    font-family: var(--font-heading);
}

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--ctp-radius-sm);
    border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-heading);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tfoot td { background: var(--surface-2); border-top: 1px solid var(--border); font-weight: 700; }

.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.desc-cell { min-width: 300px; width: 40%; word-break: break-word; white-space: normal; }
.muted { color: var(--muted); font-size: 0.82rem; }

.amount-positive { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-negative { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }

.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }

.select-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--font-body);
}

.form-stack { display: flex; flex-direction: column; gap: 0.75rem; }

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h2 {
    margin-bottom: 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    font-family: var(--font-heading);
}

/* ===== Page Header ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; }
.page-header h1 { font-size: 2rem; font-weight: 800; color: var(--page-title-color); font-family: var(--font-heading); }

/* ===== Summary Cards ===== */
.import-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    padding: 1.25rem 1rem;
    text-align: center;
}
.summary-card .label {
    font-size: 0.65rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 0.4rem;
    font-family: var(--font-heading);
}
.summary-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-white);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    font-family: var(--font-heading);
}

/* ===== Accounts Grid ===== */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.account-card .account-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.account-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.account-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

/* ===== Format List ===== */
.format-list { list-style: none; padding: 0; }
.format-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.format-list li:last-child { border-bottom: none; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 0.3rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span {
    padding: 0.3rem 0.65rem;
    border-radius: var(--ctp-radius-sm);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-heading);
}
.pagination a { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--sky); color: var(--sky); }
.pagination .current { background: var(--orange); color: #111; border: 1px solid var(--orange-dark); }
.pagination .dots { color: var(--muted); }

/* ===== Category Drag & Drop ===== */
.drag-handle { cursor: grab; color: var(--muted); font-size: 1rem; padding: 0.5rem !important; width: 30px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.draggable-row.dragging { opacity: 0.35; background: var(--orange-bg); }
.draggable-row.drag-over { border-top: 2px solid var(--orange); }

/* ===== Dashboard Category Breakdown ===== */
.cat-parent-row:hover { background: rgba(255, 152, 0, 0.04) !important; }
.cat-parent-row td { border-bottom: 1px solid var(--border); }
.cat-toggle { margin-left: 0.4rem; font-size: 0.7rem; color: var(--muted); }
.cat-child-row td { background: rgba(255, 255, 255, 0.015); border-bottom: 1px solid var(--border); }
.cat-child-row:hover td { background: rgba(255, 152, 0, 0.03) !important; }

/* ===== Savings Planner ===== */
.savings-top-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.savings-grid { min-width: 900px; border-collapse: separate; border-spacing: 0; }
.savings-table-wrap { overflow-x: auto; overflow-y: visible; max-height: none; }

.savings-grid thead th {
    position: sticky;
    top: 92px; /* 52px nav-main + 40px nav-sub */
    z-index: 4;
    background: var(--surface-2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.savings-grid th.sticky-col,
.savings-grid td.sticky-col {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 2;
    min-width: 200px;
    max-width: 280px;
    border-right: 1px solid var(--border);
}
.savings-grid th.sticky-col { background: var(--surface-2); z-index: 5; }
.savings-grid th.month-col { min-width: 72px; }

.savings-cell { cursor: pointer; padding: 0.4rem 0.6rem !important; transition: background 0.1s; position: relative; }
.savings-cell:hover { background: var(--orange-bg) !important; }

.cell-confirmed { background: rgba(74, 222, 128, 0.10); }
.cell-confirmed:hover { background: rgba(74, 222, 128, 0.20) !important; }
.cell-pending { background: var(--sky-bg); }
.cell-pending:hover { background: rgba(64, 196, 255, 0.20) !important; }
.cell-forecast { background: transparent; }

.cell-input {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--sky);
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: var(--font-body);
    text-align: right;
    background: var(--surface-2);
    color: var(--text);
    box-shadow: 0 0 0 2px rgba(64, 196, 255, 0.18);
}
.cell-input:focus { outline: none; }
.cell-display { display: block; padding: 0.15rem 0; font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.line-info-row { display: flex; align-items: center; gap: 0.5rem; }
.line-actions-stack { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.line-actions-stack form { margin: 0; line-height: 0; }
.btn-icon { padding: 0.2rem 0.4rem; font-size: 0.8rem; line-height: 1; min-width: 24px; text-align: center; border-radius: 4px; }
.line-name { font-weight: 700; font-size: 0.875rem; }
.line-category { font-size: 0.7rem; color: var(--sky); font-weight: 700; font-family: var(--font-heading); }
.line-freq { font-size: 0.67rem; color: var(--muted); }

.section-header td {
    background: var(--surface-2);
    padding: 0.45rem 0.75rem;
    font-size: 0.68rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-heading);
}
.edit-row td { background: var(--surface-2); padding: 0.5rem 0.75rem; }

.balance-row td { border-top: 1px solid var(--orange); border-bottom: 1px solid var(--orange); background: var(--orange-bg); font-weight: 700; }
.balance-row td.sticky-col { background: var(--orange-bg); }
.line-total { border-left: 1px solid var(--border); background: rgba(255, 152, 0, 0.04); }

.savings-legend { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-confirmed { background: rgba(74, 222, 128, 0.30); border: 1px solid var(--green); }
.legend-pending { background: rgba(64, 196, 255, 0.25); border: 1px solid var(--sky); }
.legend-forecast { background: var(--surface-2); border: 1px solid var(--border); }

/* ===== Budget ===== */
.budget-input {
    width: 100px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: right;
    font-size: 0.85rem;
    font-family: var(--font-body);
    background: var(--surface-2);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.budget-input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 2px rgba(64, 196, 255, 0.18); }
.budget-input.budget-saved { border-color: var(--green); box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.15); }

.budget-bar { display: inline-block; width: 80px; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 0.4rem; }
.budget-bar-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }
.budget-bar-fill.bar-warn { background: var(--orange); }
.budget-bar-fill.bar-over { background: var(--red); }

/* ===== Preview Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1rem; font-family: var(--font-heading); font-weight: 700; }
.modal-toolbar {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    flex-shrink: 0;
}
.modal-tx-list { overflow-y: auto; flex: 1; }
.modal-tx-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.modal-tx-row:hover { background: var(--surface-2); }
.modal-tx-row input[type="checkbox"] { flex-shrink: 0; accent-color: var(--orange); width: 15px; height: 15px; }
.modal-tx-date { font-size: 0.72rem; color: var(--muted); white-space: nowrap; width: 95px; flex-shrink: 0; }
.modal-tx-name { flex: 1; font-size: 0.875rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-tx-cat { font-size: 0.72rem; width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-tx-amount { font-size: 0.875rem; font-weight: 600; text-align: right; width: 85px; flex-shrink: 0; }
.modal-footer {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== Transaction Toolbar ===== */
.tx-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.period-nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius-sm);
    overflow: hidden;
}
.period-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
}
.period-btn:hover { color: var(--text); background: var(--surface-2); }
.period-label {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text);
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.period-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
}
.tx-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--orange);
    color: #111;
    font-size: 0.62rem;
    font-weight: 800;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    line-height: 1;
}
.tx-more-filters {
    position: relative;
    margin-left: auto;
}
.tx-more-filters > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--muted);
    background: var(--surface-2);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    transition: color 0.12s, border-color 0.12s;
}
.tx-more-filters > summary:hover { color: var(--text); border-color: var(--text); }
.tx-more-filters > summary::-webkit-details-marker { display: none; }
.tx-more-filters[open] > summary { color: var(--text); border-color: var(--sky); }
.tx-more-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    padding: 1rem;
    box-shadow: var(--ctp-shadow);
    z-index: 50;
    min-width: 280px;
}
.tx-more-panel .form-group { margin-bottom: 0.75rem; }

/* ===== Transaction Action Panel (Sprint 9) ===== */
.tx-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
    padding: 0;
    line-height: 1;
}
.tx-action-btn:hover, .tx-action-btn.active {
    color: var(--orange);
    border-color: var(--orange);
    background: var(--orange-bg);
}
.tx-panel-cell { padding: 0 !important; border-bottom: 2px solid var(--orange) !important; }
.tx-panel-inner {
    padding: 0.9rem 1.25rem;
    background: var(--surface-2);
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.tx-panel-info { flex-shrink: 0; min-width: 160px; }
.tx-panel-info strong { display: block; font-size: 0.88rem; color: var(--text); margin-bottom: 0.2rem; }
.tx-panel-actions { display: flex; gap: 0.65rem; flex: 1; flex-wrap: wrap; }
.tx-panel-btn {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    flex: 1;
    min-width: 170px;
    max-width: 260px;
    transition: border-color 0.12s, background 0.12s;
}
.tx-panel-btn:hover { border-color: var(--orange); background: var(--orange-bg); color: var(--text); }
.tx-panel-btn-icon { font-size: 1rem; }
.tx-panel-btn-title {
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tx-panel-btn-desc { font-size: 0.7rem; color: var(--muted); line-height: 1.4; }
.tx-panel-footer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-top: 0.6rem;
    margin-top: 0.6rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.tx-panel-footer-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.tx-panel-footer-btn:hover { color: var(--text); text-decoration: underline; }
.tx-panel-footer-danger:hover { color: var(--red); }
.tx-panel-footer-sep { color: var(--border); font-size: 0.78rem; }

/* ===== Column Picker (Sprint Design 4) ===== */
.col-picker-th { width: 1.8rem; text-align: center; position: relative; }
.col-picker-wrap { position: relative; display: inline-block; }
.col-picker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
    padding: 0;
    line-height: 1;
}
.col-picker-btn:hover { color: var(--text); border-color: var(--text); }
.col-picker-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ctp-radius);
    padding: 0.5rem 0.75rem;
    box-shadow: var(--ctp-shadow);
    z-index: 60;
    min-width: 150px;
    white-space: nowrap;
}
.col-picker-dropdown.open { display: block; }
.col-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.col-picker-item input { accent-color: var(--orange); cursor: pointer; }

/* ===== Rules ===== */
.rules-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: start; }
.rule-section { margin-bottom: 1.25rem; }
.rule-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.rule-section-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-if {
    background: var(--sky-bg);
    color: var(--sky);
    border: 1px solid var(--sky);
}
.badge-then {
    background: var(--orange-bg);
    color: var(--orange);
    border: 1px solid var(--orange);
}
.rule-section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.rule-condition { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.rule-condition .form-group { flex: 1; min-width: 100px; }

.rules-list { display: flex; flex-direction: column; }
.rule-item { padding: 0.875rem 0; border-bottom: 1px solid var(--border); }
.rule-item:last-child { border-bottom: none; }
.rule-inactive { opacity: 0.45; }
.rule-summary { display: flex; flex-direction: column; gap: 0.3rem; }
.rule-header { display: flex; align-items: center; gap: 0.5rem; }
.rule-description { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.rule-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.rule-edit {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.suggestions-list { display: flex; flex-direction: column; gap: 0.4rem; }
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
    border-radius: 6px;
    border: 1px solid var(--border);
}
.suggestion-info { flex: 1; min-width: 200px; font-size: 0.85rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.suggestion-action { display: flex; align-items: center; gap: 0.5rem; }

/* ===== Projected Transactions (Sprint 10) ===== */
.tx-projected {
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 4px,
        rgba(0,0,0,0.02) 4px,
        rgba(0,0,0,0.02) 8px
    );
    opacity: 0.75;
}
[data-theme="light"] .tx-projected { background: repeating-linear-gradient(135deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 8px); }
.tx-projected td { border-bottom: 1px dashed var(--border); }
.tx-projected-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--orange);
    color: #fff;
    border-radius: 3px;
    padding: 0.1rem 0.35rem;
    margin-right: 0.35rem;
    vertical-align: middle;
    opacity: 0.8;
}

/* ===== Month Picker (Sprint 11) ===== */
.month-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}
.month-pill-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.8rem;
    padding: 0.25rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    border: 1.5px solid var(--border);
    color: var(--muted);
    background: var(--bg);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.month-pill-toggle input { display: none; }
.month-pill-toggle.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}
/* Month pills display row (per recurring item) */
.month-pills-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    vertical-align: middle;
}
.month-pill {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 999px;
}
.month-pill-on {
    background: rgba(255, 152, 0, 0.15);
    color: var(--orange);
}
.month-pill-off {
    background: var(--bg);
    color: var(--border);
    opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .nav-main { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; gap: 0.5rem; }
    .navbar-wrapper:has(.nav-sub) .nav-main { padding-left: 1rem; }
    .navbar-wrapper:has(.nav-sub) .nav-brand {
        position: relative; height: auto; left: auto; top: auto;
        width: auto; padding: 0; background: none; border: none;
        flex-direction: row;
    }
    .navbar-wrapper:has(.nav-sub) .nav-brand img { height: 26px; }
    .navbar-wrapper:has(.nav-sub) .nav-sub { padding-left: 1rem; }
    .nav-main-links { flex-wrap: wrap; gap: 0.2rem; order: 3; width: 100%; }
    .nav-user-section { margin-left: auto; }
    .nav-sub { flex-wrap: wrap; height: auto; padding: 0.4rem 1rem; gap: 0.2rem; }
    .page-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-group { min-width: 100%; }
    .search-row { flex-direction: column; }
    .accounts-grid { grid-template-columns: 1fr; }
    .desc-cell { min-width: 150px; }
}
