/*
 * YNAB — Clean Banking Theme
 * Dark sidebar · Light content · White cards · Blue accent
 * Inspired by modern financial app design
 */

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

/* ============================================
   DESIGN TOKENS — LIGHT MODE (DEFAULT)
   ============================================ */

:root {
    /* Page & content */
    --bg-page:          #f0f0f0;
    --bg-card:          #ffffff;
    --bg-elevated:      #f7f7f7;
    --bg-input:         #f4f4f4;
    --bg-hover:         rgba(0, 0, 0, 0.04);
    --bg-hover-neutral: rgba(0, 0, 0, 0.03);

    /* Sidebar (always dark) */
    --sidebar-bg:            #141b2d;
    --sidebar-border:        rgba(255, 255, 255, 0.08);
    --sidebar-text:          rgba(255, 255, 255, 0.5);
    --sidebar-text-hover:    rgba(255, 255, 255, 0.85);
    --sidebar-text-active:   #ffffff;
    --sidebar-hover-bg:      rgba(255, 255, 255, 0.07);
    --sidebar-active-bg:     rgba(102, 126, 234, 0.2);
    --sidebar-active-border: #667eea;

    /* Text */
    --text-primary:   #111111;
    --text-secondary: #666666;
    --text-muted:     #999999;

    /* Accent — blue/purple */
    --accent-primary:      #667eea;
    --accent-primary-rgb:  102, 126, 234;
    --accent-primary-glow: rgba(102, 126, 234, 0.15);
    --accent-light:        #eef2ff;
    --accent-cyan:         #0ea5e9;
    --accent-cyan-glow:    rgba(14, 165, 233, 0.15);

    /* Status */
    --positive:      #059669;
    --positive-bg:   #ecfdf5;
    --positive-glow: rgba(5, 150, 105, 0.15);
    --negative:      #dc2626;
    --negative-bg:   #fef2f2;
    --negative-glow: rgba(220, 38, 38, 0.15);
    --warning:       #d97706;
    --warning-bg:    #fffbeb;
    --warning-glow:  rgba(217, 119, 6, 0.15);

    /* Borders */
    --border-color:        rgba(0, 0, 0, 0.07);
    --border-color-mid:    rgba(0, 0, 0, 0.11);
    --border-color-strong: rgba(0, 0, 0, 0.18);

    /* Radii */
    --border-radius:    12px;
    --border-radius-sm: 7px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Layout */
    --sidebar-width:          240px;
    --sidebar-expanded-width: 240px;
    --header-height: 60px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.09), 0 3px 8px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.14), 0 8px 20px rgba(0,0,0,0.08);

    /* Transitions */
    --transition-fast:   140ms ease;
    --transition-normal: 230ms ease;
    --transition-slow:   370ms ease;

    /* Glass */
    --glass-bg:     rgba(255,255,255,0.85);
    --glass-border: rgba(0,0,0,0.08);
    --glass-shadow: var(--shadow-lg);
}

/* ============================================
   DARK MODE OVERRIDE
   ============================================ */

[data-theme="dark"] {
    --bg-page:          #0e1119;
    --bg-card:          #161c2b;
    --bg-elevated:      #1c2337;
    --bg-input:         #111827;
    --bg-hover:         rgba(99, 126, 235, 0.08);
    --bg-hover-neutral: rgba(255,255,255,0.04);

    --sidebar-bg:          #0d1321;
    --sidebar-border:      rgba(255,255,255,0.06);
    --sidebar-text:        rgba(255,255,255,0.5);
    --sidebar-text-hover:  rgba(255,255,255,0.85);
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg:    rgba(255,255,255,0.06);
    --sidebar-active-bg:   rgba(102, 126, 234, 0.22);

    --text-primary:   #e2e8f0;
    --text-secondary: #8893a8;
    --text-muted:     #4e5a70;

    --accent-light: rgba(102, 126, 234, 0.15);

    --positive:    #34d399;
    --positive-bg: rgba(52, 211, 153, 0.08);
    --negative:    #f87171;
    --negative-bg: rgba(248, 113, 113, 0.08);
    --warning:     #fbbf24;
    --warning-bg:  rgba(251, 191, 36, 0.08);

    --border-color:        rgba(255,255,255,0.06);
    --border-color-mid:    rgba(255,255,255,0.09);
    --border-color-strong: rgba(255,255,255,0.14);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.18);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.35), 0 3px 8px rgba(0,0,0,0.22);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.5), 0 8px 20px rgba(0,0,0,0.3);

    --glass-bg:     rgba(22, 28, 43, 0.9);
    --glass-border: rgba(255,255,255,0.07);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-page);
    position: relative;
}

/* ============================================
   SIDEBAR — narrow icon rail, expands on hover
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 50;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-header {
    padding: 0;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    height: 68px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sidebar-header h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    white-space: nowrap;
    padding: 0 18px;
    width: 100%;
    overflow: hidden;
}

/* Coloured logo mark */
.sidebar-header h1::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    flex-shrink: 0;
    margin-right: 10px;
}


/* Nav */
.sidebar-nav {
    padding: 10px 0 4px;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 11px 20px;
    width: 100%;
    color: var(--sidebar-text);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-left-color var(--transition-fast);
    font-weight: 600;
    font-size: 13px;
    gap: 12px;
    position: relative;
    border-left: 3px solid transparent;
    flex-shrink: 0;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity var(--transition-fast);
}

.nav-item:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-hover-bg);
}

.nav-item:hover svg { opacity: 0.9; }

/* Active state — left border + subtle bg */
.nav-item.active {
    color: #fff;
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
}

.nav-item.active svg { opacity: 1; }


/* Section titles */
.nav-section-title {
    display: block;
    padding: 14px 20px 5px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
}

/* Account list */
.account-list {
    display: block;
    padding: 0 10px;
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 280px;
}

/* Add account button */
.sidebar-add-account {
    display: block;
    padding: 8px 12px;
}

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    color: var(--sidebar-text);
    cursor: pointer;
    border-radius: 7px;
    margin-bottom: 1px;
    transition: all var(--transition-fast);
    font-size: 13px;
    white-space: nowrap;
}

.account-item:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-hover);
}

.account-item.active {
    background: rgba(255,255,255,0.07);
    color: var(--sidebar-text-active);
}

.account-item[draggable="true"] { cursor: grab; }
.account-item[draggable="true"]:active { cursor: grabbing; }
.account-item.dragging { opacity: 0.5; }
.account-item.drag-over { border-top: 2px solid var(--accent-primary); margin-top: -2px; }

.account-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-balance {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    flex-shrink: 0;
    margin-left: 6px;
}

.account-balance.positive { color: #4ade80; }
.account-balance.negative { color: #f87171; }

/* Footer */
.sidebar-footer {
    padding: 8px 0;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
    flex-shrink: 0;
    overflow: hidden;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-page);
    min-width: 0;
    margin-left: var(--sidebar-width);
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-title {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Month navigation */
.month-nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    overflow: hidden;
}

.month-nav button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-nav button:hover {
    background: var(--bg-hover-neutral);
    color: var(--text-primary);
}

.month-nav .current-month {
    font-weight: 650;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 140px;
    text-align: center;
    padding: 0 8px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ready to Assign */
.ready-to-assign {
    background: var(--bg-card);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.ready-to-assign-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ready-to-assign-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ready-to-assign-amount {
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1;
}

.ready-to-assign-amount.positive { color: var(--positive); }
.ready-to-assign-amount.negative { color: var(--negative); }
.ready-to-assign-amount.zero     { color: var(--text-muted); }

.mobile-edit-btn { display: none !important; }

/* Overspending Alert */
.overspending-alert {
    background: var(--negative-bg);
    border-bottom: 1px solid rgba(220,38,38,0.15);
    border-left: 3px solid var(--negative);
    padding: 13px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    animation: alertPulse 2.5s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.88; }
}

.overspending-alert.hidden { display: none; }

.overspending-content { display: flex; align-items: center; gap: 11px; }
.overspending-content svg { color: var(--negative); flex-shrink: 0; }
.overspending-info  { display: flex; flex-direction: column; gap: 2px; }
.overspending-title { font-weight: 600; color: var(--negative); font-size: 0.875rem; }
.overspending-details { color: var(--text-secondary); font-size: 0.8rem; }

.btn-warning {
    background: var(--negative);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-warning:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--negative-glow);
}

/* Content area */
.content { flex: 1; overflow-y: auto; padding: 0; display: flex; flex-direction: column; min-height: 0; }

/* Views fill the content area */
.view { flex: 1; min-height: 0; }

/* Settings view needs its own scroll management */
.view-settings {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-grid {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
}

/* Metric cards row */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.metric-card:hover { box-shadow: var(--shadow-md); }

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.metric-icon.positive { background: var(--positive); }
.metric-icon.income   { background: var(--accent-primary); }
.metric-icon.expense  { background: var(--negative); }
.metric-icon.ready    { background: var(--warning); }

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.metric-value {
    font-size: 1.3rem;
    font-weight: 750;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.metric-value.positive { color: var(--positive); }
.metric-value.negative { color: var(--negative); }

/* Dashboard rows */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 14px;
}

/* Dashboard cards */
.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}

.dashboard-card.full-width { width: 100%; }

.dashboard-card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Net Worth panel */
.net-worth-card { }

.nw-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.nw-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nw-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
}

.nw-value.positive { color: var(--positive); }
.nw-value.negative { color: var(--negative); }

.nw-bar {
    height: 8px;
    background: var(--negative-bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
}

.nw-bar-assets {
    height: 100%;
    background: var(--positive);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.nw-summary {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.nw-summary .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.dot.assets      { background: var(--positive); }
.dot.liabilities { background: var(--negative); }

.nw-accounts {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.nw-section {
    margin-bottom: 6px;
}

.nw-section small {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.nw-account {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.nw-account:last-child { border-bottom: none; }

.mt-2 { margin-top: 10px; }

/* Bills panel */
.bills-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.bills-total {
    font-weight: 750;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.bills-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bill-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
    gap: 12px;
}

.bill-item:last-child { border-bottom: none; }
.bill-item:hover      { background: var(--bg-hover-neutral); margin: 0 -8px; padding: 10px 8px; border-radius: 7px; }

.bill-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bill-payee {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bill-category {
    font-size: 11.5px;
    color: var(--text-muted);
}

.bill-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.bill-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 13.5px;
    color: var(--text-primary);
}

.bill-date {
    font-size: 11px;
    color: var(--text-muted);
}

.bill-date.due-soon  { color: var(--warning); font-weight: 600; }
.bill-date.overdue   { color: var(--negative); font-weight: 600; }

.no-bills {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Budget Progress */
.budget-progress-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.budget-progress-item { }

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.progress-name {
    font-size: 13px;
    font-weight: 550;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.progress-amounts {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.progress-bar-container {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: var(--positive);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--negative); }
.progress-bar.over    { background: var(--negative); }

.progress-bar-spent {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-bar-spent.over { background: rgba(220, 38, 38, 0.4); }

/* Recent transactions */
.recent-transactions-list {
    display: flex;
    flex-direction: column;
}

.recent-txn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
    gap: 12px;
}

.recent-txn-item:last-child { border-bottom: none; }
.recent-txn-item:hover { background: var(--bg-hover-neutral); margin: 0 -10px; padding: 11px 10px; border-radius: 8px; }

.txn-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.txn-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.txn-payee {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-category {
    font-size: 11.5px;
    color: var(--text-muted);
}

.txn-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 13.5px;
}

.txn-amount.positive { color: var(--positive); }
.txn-amount.negative { color: var(--negative); }

.txn-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   BUDGET TABLE
   ============================================ */

.budget-table { width: 100%; }

.category-group { border-bottom: 1px solid var(--border-color); }

.category-group-header {
    display: grid;
    grid-template-columns: 1fr 120px 100px 60px 120px;
    padding: 11px 28px;
    background: var(--bg-elevated);
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-left: 2px solid transparent;
}

.category-group-header:hover {
    background: var(--bg-hover-neutral);
    border-left-color: var(--accent-primary);
}

.category-group-header .group-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.category-group-header .chevron {
    transition: transform var(--transition-normal);
    color: var(--text-muted);
}

.category-group.collapsed .chevron { transform: rotate(-90deg); }
.category-group.collapsed .category-list { display: none; }

.column-header {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
}

.category-row {
    display: grid;
    grid-template-columns: 1fr 120px 100px 60px 120px;
    padding: 10px 28px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: background var(--transition-fast);
}

.category-row:hover { background: var(--bg-hover); }
.category-row:last-child { border-bottom: none; }

.category-name {
    padding-left: 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13.5px;
}

.category-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 550;
    font-size: 13.5px;
    color: var(--text-primary);
}

.category-cell.positive { color: var(--positive); }
.category-cell.negative { color: var(--negative); }
.category-cell.warning  { color: var(--warning); }

/* Editable cell */
.editable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 5px;
    margin: -4px -8px;
    transition: all var(--transition-fast);
}

.editable:hover {
    background: var(--bg-input);
    box-shadow: inset 0 0 0 1px var(--border-color-mid);
}

.editable input {
    width: 100%;
    background: var(--bg-card);
    border: 1.5px solid var(--accent-primary);
    border-radius: 5px;
    color: var(--text-primary);
    text-align: right;
    padding: 4px 8px;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* ============================================
   UPCOMING TRANSACTIONS
   ============================================ */

.upcoming-transactions {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.upcoming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: background var(--transition-fast);
}

.upcoming-header:hover { background: var(--bg-hover-neutral); }

.upcoming-header h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.upcoming-header h3 svg { color: var(--accent-primary); }

.upcoming-count {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.upcoming-header .chevron {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.upcoming-transactions.collapsed .chevron { transform: rotate(-90deg); }
.upcoming-transactions.collapsed .upcoming-list { display: none; }
.upcoming-list { padding: 0; }

.upcoming-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.upcoming-item:hover { background: var(--bg-hover); }

.upcoming-date { min-width: 80px; font-size: 0.82rem; color: var(--text-secondary); }
.upcoming-date.due-soon { color: var(--warning); font-weight: 600; }
.upcoming-date.overdue  { color: var(--negative); font-weight: 600; }

.upcoming-payee { flex: 1; font-weight: 550; color: var(--text-primary); }

.upcoming-category {
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upcoming-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: right;
    font-size: 13.5px;
}

.upcoming-amount.outflow { color: var(--negative); }
.upcoming-amount.inflow  { color: var(--positive); }

.upcoming-actions { display: flex; gap: 4px; }
.upcoming-actions .btn { padding: 4px 8px; font-size: 0.72rem; }

.upcoming-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* Calendar upcoming override */
.upcoming-actions .btn-ghost { padding: 4px 8px; color: var(--positive); }
.upcoming-actions .btn-ghost:hover { background: var(--positive-bg); color: var(--positive); }

/* ============================================
   TRANSACTION TABLE
   ============================================ */

.transaction-table {
    width: 100%;
    border-collapse: collapse;
}

.date-short, .mobile-amount { display: none; }

.transaction-table th {
    background: var(--bg-elevated);
    padding: 12px 18px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.transaction-table th.text-right { text-align: right; }

.transaction-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 13.5px;
}

.transaction-table tr:hover td { background: var(--bg-hover); }

.transaction-table .amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.transaction-table .outflow { color: var(--negative); }
.transaction-table .inflow  { color: var(--positive); }

.transaction-table tr.selected td { background: var(--accent-light); }

.transaction-table tr.editing-row td { background: var(--bg-card); padding: 7px 10px; }
.transaction-table tr.editing-row .inline-input { width: 100%; min-width: 80px; }

/* Bulk Action Bar */
.bulk-action-bar {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 11px 20px;
    background: var(--accent-light);
    border: 1px solid rgba(196,18,48,0.2);
    border-radius: var(--border-radius);
    margin-bottom: 14px;
}

.bulk-action-bar.active { display: flex; }
.bulk-action-bar strong { color: var(--accent-primary); }

.txn-checkbox {
    accent-color: var(--accent-primary);
    cursor: pointer;
    width: 15px;
    height: 15px;
}

.cleared-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    transition: all var(--transition-fast);
}

.cleared-badge.reconciled { background: var(--positive); color: white; }
.cleared-badge.cleared    { background: var(--accent-primary); color: white; }
.cleared-badge.uncleared  { border: 1.5px solid var(--border-color-mid); color: var(--text-muted); }
.cleared-badge.uncleared:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Reconciled Divider */
.reconciled-divider td { padding: 0 !important; background: transparent !important; }

.divider-line {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}

.divider-line::before,
.divider-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color-mid);
}

.divider-line span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* Reconcile Bar */
.reconcile-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    box-shadow: var(--shadow-xs);
}

.reconcile-bar.hidden { display: none; }

.reconcile-bar-content {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.reconcile-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 650;
    color: var(--text-primary);
    font-size: 14px;
}

.reconcile-bar-title svg { color: var(--positive); }

.reconcile-bar-stats {
    display: flex;
    gap: 24px;
    flex: 1;
    flex-wrap: wrap;
}

.reconcile-bar-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.reconcile-bar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.recon-input {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    width: 120px;
    text-align: right;
    outline: none;
    transition: all var(--transition-fast);
}

.recon-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(196,18,48,0.25);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(196,18,48,0.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-success {
    background: var(--positive);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px var(--positive-glow);
}

.btn-success:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--positive-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}

.btn-ghost:hover {
    background: var(--bg-hover-neutral);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(196,18,48,0.35);
    padding: 8px 16px;
}

.btn-outline:hover {
    background: var(--accent-light);
    border-color: var(--accent-primary);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 7px;
    border-radius: 7px;
    min-width: auto;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-hover-neutral);
    color: var(--text-primary);
}

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

.btn-danger { background: var(--negative); color: white; border: none; }
.btn-danger:hover { filter: brightness(1.1); box-shadow: 0 4px 14px var(--negative-glow); }

.btn-small { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

.undo-redo-btns { display: flex; gap: 3px; margin-right: 10px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-card);
    padding: 11px 22px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 13.5px;
    font-weight: 500;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-success { background: var(--positive); color: white; }
.toast-error   { background: var(--negative); color: white; }

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.view-toggle .btn-icon { padding: 5px 9px; border-radius: 5px; }
.view-toggle .btn-icon.active { background: var(--accent-primary); color: white; }

/* ============================================
   BILLS VIEW
   ============================================ */

.bills-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    padding: 20px 28px 28px;
    align-items: start;
}

.bills-upcoming, .bills-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    gap: 12px;
    flex-wrap: wrap;
}

.section-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin: 0;
}

.bills-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bills-category-filter {
    padding: 6px 10px;
    border: 1px solid var(--border-color-mid);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.bills-view-toggle {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    overflow: hidden;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 550;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.view-btn:hover { background: var(--bg-hover-neutral); color: var(--text-primary); }
.view-btn.active { background: var(--accent-primary); color: white; }

/* Bills calendar */
.bills-calendar { padding: 0; }

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-month {
    font-size: 14px;
    font-weight: 650;
    color: var(--text-primary);
    margin: 0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 8px 4px;
    gap: 4px;
}

.calendar-weekdays > div {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 4px 0;
}

.calendar-day {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-height: 60px;
    padding: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.calendar-day .day-number {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.calendar-day.today { border-color: var(--accent-primary); background: var(--accent-light); }
.calendar-day.today .day-number { color: var(--accent-primary); font-weight: 700; }
.calendar-day.past { opacity: 0.5; }
.calendar-day.empty { background: transparent; border-color: transparent; cursor: default; }
.calendar-day.has-bills { border-color: var(--border-color-mid); }
.calendar-day:hover:not(.empty) { border-color: var(--accent-primary); }

.calendar-bill {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    line-height: 1.2;
    margin-bottom: 2px;
    border-radius: 3px;
    padding: 1px 3px;
}

.calendar-bill.outflow { background: rgba(220,38,38,0.1); color: var(--negative); }
.calendar-bill.inflow  { background: rgba(5,150,105,0.1); color: var(--positive); }
.calendar-bill.skipped { opacity: 0.5; text-decoration: line-through; }

.bill-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
}

.bill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bills list (right panel) */
.bills-list .bills-list { padding: 0 12px 12px; }

/* Upcoming bills grouped by date */
.upcoming-bills-list { display: flex; flex-direction: column; padding: 4px 0; }

.upcoming-date-group {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}

.upcoming-date-group:last-child { border-bottom: none; }

.upcoming-date-group.past { opacity: 0.55; }

.upcoming-date-group.today > .upcoming-date .day { color: var(--accent-primary); }

.upcoming-date-group > .upcoming-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 34px;
    flex-shrink: 0;
    padding-top: 2px;
}

.upcoming-date-group > .upcoming-date .day {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.upcoming-date-group > .upcoming-date .month {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 2px;
}

.upcoming-items { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.upcoming-items .upcoming-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.upcoming-items .upcoming-item:hover { background: var(--bg-hover-neutral); }

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

.upcoming-items .upcoming-payee {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upcoming-items .upcoming-category {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 1px;
}

.upcoming-items .upcoming-amount {
    font-weight: 700;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.upcoming-items .upcoming-amount.positive { color: var(--positive); }
.upcoming-items .upcoming-amount.negative { color: var(--negative); }

/* Recurring bills list */
.recurring-bills-list { display: flex; flex-direction: column; padding: 4px 0; }

.bill-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.bill-item:last-child { border-bottom: none; }
.bill-item:hover { background: var(--bg-hover-neutral); }
.bill-item.inactive { opacity: 0.55; }

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

.bill-payee {
    font-size: 13.5px;
    font-weight: 650;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bill-details {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.bill-next {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.bill-amount {
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.bill-amount.positive { color: var(--positive); }
.bill-amount.negative { color: var(--negative); }

.bill-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ============================================
   FORECAST VIEW
   ============================================ */

.forecast-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.forecast-controls select {
    padding: 7px 12px;
    border: 1px solid var(--border-color-mid);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.forecast-layout {
    padding: 20px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.forecast-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}

.forecast-card.warning {
    border-color: rgba(217,119,6,0.3);
    background: var(--warning-bg);
}

.forecast-card-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.forecast-card-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.forecast-card-value.positive { color: var(--positive); }
.forecast-card-value.negative { color: var(--negative); }

.forecast-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.forecast-range-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
}

.forecast-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-xs);
}

.forecast-chart-card h4 {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.forecast-low-balance-warning {
    background: var(--warning-bg);
    border: 1px solid rgba(217,119,6,0.2);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-upcoming-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.forecast-upcoming-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
}

.forecast-txn-item {
    display: flex;
    align-items: center;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-color);
    gap: 14px;
    transition: background var(--transition-fast);
}

.forecast-txn-item:last-child { border-bottom: none; }
.forecast-txn-item:hover { background: var(--bg-hover-neutral); }

.forecast-txn-date {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 60px;
    font-variant-numeric: tabular-nums;
}

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

.forecast-txn-payee {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forecast-txn-cat {
    font-size: 12px;
    color: var(--text-secondary);
}

.forecast-txn-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}

.forecast-txn-amount.positive { color: var(--positive); }
.forecast-txn-amount.negative { color: var(--negative); }

/* Forecast JS-generated layout classes */
.forecast-warning {
    background: var(--warning-bg);
    border: 1px solid rgba(217,119,6,0.25);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 10px;
}

.forecast-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-xs);
}

.forecast-chart-wrapper { position: relative; height: 280px; }

.forecast-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 700px) { .forecast-details { grid-template-columns: 1fr; } }

.forecast-upcoming,
.forecast-categories {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.forecast-upcoming h4,
.forecast-categories h4 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
}

.forecast-flows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.flow-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}

.flow-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.flow-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.flow-card.inflows .flow-value { color: var(--positive); }
.flow-card.outflows .flow-value { color: var(--negative); }

/* Invoice card in forecast */
.forecast-card.invoice-card { border-color: rgba(196,18,48,0.2); }

/* Upcoming list inside forecast details */
.upcoming-list { display: flex; flex-direction: column; }

.upcoming-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
    font-size: 13px;
}

.upcoming-item:last-child { border-bottom: none; }
.upcoming-item:hover { background: var(--bg-hover-neutral); }

.upcoming-item .upcoming-date {
    min-width: 48px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.upcoming-details { flex: 1; min-width: 0; }

.upcoming-details .upcoming-payee {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.upcoming-details .upcoming-category {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.upcoming-item .upcoming-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    flex-shrink: 0;
}

.upcoming-item .upcoming-amount.positive { color: var(--positive); }
.upcoming-item .upcoming-amount.negative { color: var(--negative); }
.upcoming-item.excluded { opacity: 0.45; }

/* Invoice + excluded badges */
.invoice-badge {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(196,18,48,0.1);
    color: var(--accent-primary);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(196,18,48,0.2);
}

.excluded-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid var(--border-color);
}

/* Skip / exclude toggle buttons */
.skip-toggle,
.exclude-toggle {
    padding: 3px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.skip-toggle:hover,
.exclude-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Forecast category breakdown */
.forecast-categories .category-breakdown { padding: 8px 0; }

.forecast-categories .category-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 10px;
    font-size: 13px;
    border-bottom: none;
}

.forecast-categories .category-name {
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
}

.forecast-categories .category-bar-container {
    flex: 1;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.forecast-categories .category-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.forecast-categories .category-amount {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    color: var(--negative);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   SUBSCRIPTIONS VIEW
   ============================================ */

.subscriptions-layout {
    padding: 20px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.subscription-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-xs);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.stat-content { min-width: 0; }

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 2px;
}

.subscription-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.subscription-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.subscription-filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 550;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.subscription-filter-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.subscription-filter-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

.subscription-list { display: flex; flex-direction: column; gap: 10px; }

.subscription-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition-fast);
}

.subscription-card:hover { border-color: var(--border-color-mid); }

.sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 12px;
}

.sub-name { font-weight: 650; font-size: 14px; color: var(--text-primary); }
.sub-category { font-size: 12px; color: var(--text-secondary); }
.sub-amount { font-weight: 700; font-size: 15px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sub-frequency { font-size: 11px; color: var(--text-muted); }

.sub-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.sub-status { font-size: 12px; font-weight: 600; }
.sub-status.overdue { color: var(--negative); }
.sub-status.due-soon { color: var(--warning); }
.sub-status.upcoming { color: var(--text-secondary); }

.sub-actions { display: flex; gap: 6px; }

/* Filter pills */
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 5px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 550;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.filter-pill:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.filter-pill.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* Subscription grid (card layout) */
.subscription-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    padding: 4px 0;
}

.subscription-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.subscription-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

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

.subscription-name {
    font-weight: 650;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subscription-category {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.subscription-menu {
    position: relative;
    flex-shrink: 0;
}

.subscription-menu .dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

.subscription-menu .dropdown-menu button,
.subscription-menu .dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.subscription-menu .dropdown-menu button:hover,
.subscription-menu .dropdown-menu a:hover { background: var(--bg-hover-neutral); }

.subscription-card-body {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.subscription-amount .amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.subscription-amount .frequency {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 2px;
}

.subscription-next {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.subscription-next.overdue { color: var(--negative); }
.subscription-next.due-soon { color: var(--warning); }

.subscription-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 10px;
}

.subscription-badge.paused {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.subscription-card.paused { opacity: 0.7; }

/* Subscription breakdown section */
.subscription-breakdown {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-xs);
}

.subscription-breakdown h4 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.breakdown-bars { display: flex; flex-direction: column; gap: 12px; }

.breakdown-item { display: flex; flex-direction: column; gap: 5px; }

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.breakdown-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 550;
}

.breakdown-value {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.breakdown-bar-bg {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ============================================
   CALENDAR VIEW
   ============================================ */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.calendar-month-display {
    font-size: 17px;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 8px;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 8px;
    letter-spacing: 0.05em;
}

.calendar-body { display: flex; flex-direction: column; gap: 8px; }

.calendar-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }

.calendar-day {
    min-height: 90px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-day:hover:not(.empty) { border-color: var(--accent-primary); box-shadow: 0 0 0 2px var(--accent-primary-glow); }
.calendar-day.empty { background: transparent; border-color: transparent; cursor: default; }
.calendar-day.today { border-color: var(--accent-primary); background: var(--accent-light); }
.calendar-day.has-transactions { border-left: 3px solid var(--accent-primary); }
.calendar-day.has-upcoming { border-left: 2px solid var(--warning); }

.day-number { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--text-secondary); }
.calendar-day.today .day-number { color: var(--accent-primary); }

.day-transactions { font-size: 11px; }
.day-amount { margin-bottom: 2px; }
.day-amount.inflow             { color: var(--positive); }
.day-amount.outflow            { color: var(--negative); }
.day-amount.upcoming-outflow   { color: var(--negative); opacity: 0.6; font-style: italic; }
.day-amount.upcoming-inflow    { color: var(--positive); opacity: 0.6; font-style: italic; }
.day-count { color: var(--text-muted); margin-top: 4px; }

/* Day Detail */
.day-transactions-list { display: flex; flex-direction: column; gap: 7px; }

.day-transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 13px;
    background: var(--bg-elevated);
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border: 1px solid var(--border-color);
}

.day-transaction-item:hover { background: var(--bg-hover); }

.txn-info { display: flex; flex-direction: column; gap: 2px; }
.txn-payee { font-weight: 600; color: var(--text-primary); }
.txn-category { font-size: 12px; color: var(--text-muted); }
.txn-amount { font-weight: 700; }
.txn-amount.inflow  { color: var(--positive); }
.txn-amount.outflow { color: var(--negative); }

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color-mid);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(16px) scale(0.97);
    transition: all var(--transition-normal);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 750;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 7px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    line-height: 0;
}

.modal-close:hover { background: var(--bg-hover-neutral); color: var(--text-primary); }

.modal-body { padding: 24px 26px; }

.modal-footer {
    padding: 18px 26px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-large { max-width: 640px; width: 90%; }
.modal-large .modal-body { max-height: 60vh; overflow-y: auto; }
.modal-small { max-width: 420px; }

/* ============================================
   FORMS
   ============================================ */

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0;
    padding: 0 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab {
    padding: 13px 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 550;
    font-size: 13px;
    position: relative;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

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

.tab.active {
    color: var(--accent-primary);
    font-weight: 650;
    border-bottom-color: var(--accent-primary);
}

/* ============================================
   SETTINGS
   ============================================ */

/* Settings page container */
.settings-page {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 16px 24px 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 550;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: -1px;
    border-radius: 0;
}

.settings-tab svg { flex-shrink: 0; }
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 650;
    background: transparent;
    box-shadow: none;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-panel { display: none; }
.settings-panel.active { display: block; }

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 700px;
}

/* Settings section = white card */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.settings-section h4 {
    padding: 14px 18px 12px;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    margin: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.settings-row:last-child { border-bottom: none; }
.settings-row label {
    color: var(--text-primary);
    font-weight: 550;
    font-size: 13.5px;
    flex: 1;
}

.settings-row input[type="text"] {
    min-width: 200px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 7px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.settings-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.settings-row select {
    min-width: 200px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 7px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.settings-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.settings-list { display: flex; flex-direction: column; gap: 7px; }

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    transition: border-color var(--transition-fast);
}

.settings-item:hover { border-color: rgba(196,18,48,0.3); }
.settings-item-name { flex: 1; }
.settings-item-name input { width: 100%; background: transparent; border: none; padding: 4px 0; color: var(--text-primary); font-size: inherit; font-family: inherit; }
.settings-item-name input:focus { outline: none; }
.settings-item-actions { display: flex; gap: 7px; margin-left: 12px; }
.settings-item-actions .btn { padding: 7px 12px; }
.settings-empty { text-align: center; padding: 40px; color: var(--text-muted); }
.settings-description { color: var(--text-secondary); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }

/* ============================================
   REPORTS
   ============================================ */

.age-of-money-banner {
    background: var(--bg-card);
    padding: 22px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-xs);
}

.aom-content { display: flex; align-items: center; gap: 16px; }

.aom-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-primary) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 6px 18px var(--accent-cyan-glow);
    flex-shrink: 0;
}

.aom-info { display: flex; flex-direction: column; gap: 4px; }
.aom-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.aom-value { font-size: 1.9rem; font-weight: 800; color: var(--accent-primary); letter-spacing: -0.04em; line-height: 1; }
.aom-description { color: var(--text-muted); font-size: 0.8rem; margin-left: 68px; }

/* ============================================
   VIEW HEADER (shared across Reports, Bills, Forecast, Subscriptions)
   ============================================ */

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
    gap: 16px;
    flex-wrap: wrap;
}

.view-header h1, .view-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.view-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* ============================================
   REPORTS VIEW
   ============================================ */

.ytd-summary-banner {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    flex-wrap: wrap;
}

.ytd-item {
    flex: 1;
    min-width: 130px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}

.ytd-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.ytd-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.ytd-income { color: var(--positive) !important; }
.ytd-expenses { color: var(--negative) !important; }
.ytd-savings { color: var(--positive); }

.averages-row {
    display: flex;
    gap: 12px;
    padding: 0 28px 20px;
    flex-wrap: wrap;
}

.average-card {
    flex: 1;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}

.average-card h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.avg-stats { display: flex; flex-direction: column; gap: 5px; }
.avg-stats > div { display: flex; justify-content: space-between; font-size: 13px; }
.avg-label { color: var(--text-secondary); }
.avg-value { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 18px; padding: 0 28px 28px; }

.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 22px;
    transition: box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.report-card:hover { box-shadow: var(--shadow-md); }

.report-card h3 {
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.report-card-wide { grid-column: 1 / -1; }
.chart-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 16px; }
.chart-container { position: relative; height: 300px; }

/* ============================================
   INLINE TRANSACTION
   ============================================ */

.inline-transaction-row { background: var(--bg-card); }
.inline-transaction-row td { padding: 8px 6px; border-bottom: none; }

.inline-input {
    width: 100%;
    padding: 9px 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.inline-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-glow); }
.inline-input::placeholder { color: var(--text-muted); }
.inline-input.text-right { text-align: right; }
.inline-input[type="number"]::-webkit-outer-spin-button,
.inline-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.inline-input[type="number"] { -moz-appearance: textfield; }

/* ============================================
   QUICK CATEGORIZE
   ============================================ */

.quick-cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-cat-row:last-child { border-bottom: none; }

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

.quick-cat-payee {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-cat-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.quick-cat-select { flex: 0 0 220px; }

.inline-buttons-row td { padding: 9px 18px; background: var(--bg-card); border-bottom: 2px solid var(--accent-primary); }

/* ============================================
   SEARCH
   ============================================ */

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 9px;
    padding: 0 14px;
    transition: all var(--transition-fast);
}

.search-input:focus-within { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-glow); background: var(--bg-card); }
.search-input svg { color: var(--text-muted); flex-shrink: 0; }
.search-input input { flex: 1; background: transparent; border: none; padding: 10px; color: var(--text-primary); outline: none; font-size: 13px; font-family: inherit; }

/* Transaction Filters */
.transaction-filters {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filter-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }

.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.filter-group label { font-size: 0.7rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.filter-group input,
.filter-group select {
    padding: 8px 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-mid);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.filter-group input:focus,
.filter-group select:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-glow); }

#filterToggleBtn.active { background: var(--accent-primary); color: white; }

/* ============================================
   GOALS & SAVINGS
   ============================================ */

.goals-header, .savings-goals-header, .templates-header, .recurring-header, .payee-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }

.goal-item, .template-item { flex-direction: column; align-items: stretch; }
.goal-info, .template-info { flex: 1; }

.goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.goal-category { font-weight: 700; color: var(--text-primary); }
.goal-type { font-size: 11.5px; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border-color); }

.goal-progress-container { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 7px; }
.goal-progress-bar { height: 100%; border-radius: 3px; transition: width var(--transition-slow); }
.goal-progress-bar.low      { background: var(--accent-primary); }
.goal-progress-bar.good     { background: linear-gradient(90deg, var(--accent-cyan), var(--positive)); }
.goal-progress-bar.complete { background: var(--positive); box-shadow: 0 0 6px var(--positive-glow); }
.goal-amounts { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-secondary); }

.savings-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; padding: 14px; background: var(--bg-elevated); border: 1px solid var(--border-color); border-radius: 10px; }
.savings-stat { display: flex; flex-direction: column; align-items: center; text-align: center; }
.savings-stat-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; font-weight: 700; }
.savings-stat-value { font-size: 15px; font-weight: 750; color: var(--text-primary); }

.savings-goal-item { padding: 15px; border-radius: 9px; }
.savings-goal-info { flex: 1; min-width: 0; }
.savings-goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.savings-goal-name { font-weight: 700; font-size: 14.5px; color: var(--text-primary); }
.savings-goal-date { font-size: 11.5px; color: var(--text-muted); }
.savings-goal-desc { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 7px; }
.savings-goal-progress-container { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 7px; }
.savings-goal-progress-bar { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.savings-goal-progress-bar.complete { box-shadow: 0 0 8px var(--positive-glow); }
.savings-goal-amounts { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 7px; }
.savings-goal-monthly { display: flex; justify-content: space-between; font-size: 11.5px; }
.savings-goal-monthly .funded { color: var(--positive); }
.savings-goal-monthly .unfunded { color: var(--warning); }
.savings-goal-monthly .months-remaining { color: var(--text-muted); }
.savings-goal-item .settings-item-actions { flex-shrink: 0; }

/* ============================================
   RECURRING & PAYEES
   ============================================ */

.recurring-item { flex-direction: column; align-items: stretch; gap: 10px; }
.recurring-info { flex: 1; }
.recurring-main { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.recurring-payee { font-weight: 700; color: var(--text-primary); }
.recurring-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.recurring-amount.outflow { color: var(--negative); }
.recurring-amount.inflow  { color: var(--positive); }
.recurring-details { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.78rem; color: var(--text-muted); }

@media (min-width: 600px) { .recurring-item { flex-direction: row; align-items: center; } }

.payee-category { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

.duplicate-result { padding: 18px; text-align: center; color: var(--positive); background: var(--positive-bg); border-radius: 9px; border: 1px solid rgba(5,150,105,0.2); margin-bottom: 14px; }
.duplicate-group { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 9px; padding: 14px; margin-bottom: 10px; }
.duplicate-group h4, #rulesSection h4 { margin: 0 0 10px; color: var(--text-secondary); font-size: 0.875rem; }
.duplicate-option { display: flex; align-items: center; gap: 10px; padding: 9px; cursor: pointer; border-radius: 6px; transition: background var(--transition-fast); }
.duplicate-option:hover { background: var(--bg-hover-neutral); }
.duplicate-option small { color: var(--text-muted); }

.rules-description { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; }
.add-rule-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.add-rule-form input, .add-rule-form select { flex: 1; min-width: 150px; padding: 9px 11px; background: var(--bg-input); border: 1px solid var(--border-color-mid); border-radius: 7px; color: var(--text-primary); font-family: inherit; font-size: 13px; }
.rules-list { display: flex; flex-direction: column; gap: 6px; }
.rule-item { display: flex; align-items: center; gap: 11px; padding: 11px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 7px; }
.rule-pattern { font-weight: 650; color: var(--accent-primary); }
.rule-arrow { color: var(--text-muted); }
.rule-category { flex: 1; color: var(--text-secondary); }
#duplicatesSection, #rulesSection { margin-bottom: 18px; padding: 15px; background: var(--bg-elevated); border-radius: 9px; border: 1px solid var(--border-color); }

/* Template */
.template-name { margin-bottom: 4px; }
.template-name-input { font-weight: 700; color: var(--text-primary); background: transparent; border: 1px solid transparent; padding: 4px 8px; border-radius: 5px; width: 100%; font-family: inherit; }
.template-name-input:focus { outline: none; border-color: var(--accent-primary); background: var(--bg-input); }
.template-details { display: flex; gap: 10px; font-size: 11.5px; color: var(--text-muted); padding-left: 8px; }
.template-item .settings-item-actions { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border-color); }

/* ============================================
   TARGETS
   ============================================ */

.category-target { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); margin-left: auto; padding-left: 12px; }
.target-progress { width: 15rem; height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; position: relative; }
.target-progress-bar { position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px; transition: width var(--transition-slow); }
.target-progress-bar.under { background: var(--accent-primary); }
.target-progress-bar.met   { background: var(--positive); }
.target-progress-bar.on-track { background: var(--accent-cyan); }
.target-spent-bar { position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px; background: rgba(0,0,0,0.2); transition: width var(--transition-slow); }
.target-spent-bar.over { background: rgba(220, 38, 38, 0.6); }
.target-text { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.target-freq { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.target-needed { color: var(--warning); }
.target-met    { color: var(--positive); }
.target-btn { padding: 3px 7px; font-size: 10px; margin-left: 7px; border-radius: 4px; }

.category-avg { font-size: 10px; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; margin-left: 7px; flex-shrink: 0; }

.category-name-wrapper { display: flex; flex-direction: column; gap: 3px; }
.category-name-text { display: flex; align-items: center; }
.category-name-inline { display: flex; align-items: center; gap: 6px; width: 100%; }
.category-label { font-weight: 500; white-space: nowrap; width: 11.25rem; min-width: 11.25rem; overflow: hidden; text-overflow: ellipsis; }
.category-avg { flex-shrink: 0; width: 4.375rem; min-width: 4.375rem; text-align: right; }
.category-name-inline .category-target { margin-left: auto; display: grid; grid-template-columns: 15rem 5.625rem 5rem auto; align-items: center; gap: 0.5rem; min-width: 27.5rem; }
.category-name-inline .target-btn { flex-shrink: 0; }

.snooze-btn { padding: 2px 6px; font-size: 10px; margin-left: 7px; opacity: 0; transition: opacity var(--transition-fast); }
.category-target:hover .snooze-btn { opacity: 1; }
.category-target.snoozed { opacity: 0.75; }
.category-target.snoozed .snooze-btn { opacity: 1; }
.target-snoozed { color: var(--text-muted); font-style: italic; }

/* ============================================
   CATEGORY ICONS
   ============================================ */

.category-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.category-icon svg { width: 100%; height: 100%; }

.category-icon-btn { display: none; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 4px; border: none; background: transparent; color: var(--text-muted); border-radius: 5px; cursor: pointer; margin-right: 6px; transition: all var(--transition-fast); }
.category-icon-btn:hover { background: var(--bg-hover-neutral); color: var(--accent-primary); }
.category-icon-btn .category-icon { width: 16px; height: 16px; }
.budget-edit-mode .category-icon-btn, .category-icon-btn:has(.category-icon svg:not([viewBox="0 0 24 24"])) { display: inline-flex; }
.category-row .category-icon-btn { display: inline-flex; }

.icon-picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; max-height: 300px; overflow-y: auto; padding: 4px; }
.icon-option { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 7px; border: 1.5px solid transparent; border-radius: 7px; background: var(--bg-input); color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast); }
.icon-option:hover { background: var(--bg-hover); color: var(--text-primary); border-color: rgba(196,18,48,0.3); }
.icon-option.selected { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.icon-option svg { width: 18px; height: 18px; }

@media (max-width: 768px) { .icon-picker-grid { grid-template-columns: repeat(6, 1fr); } }

/* ============================================
   HEATMAP
   ============================================ */

.heatmap-wrapper { overflow-x: auto; padding: 10px 0; position: relative; }
.heatmap-container { display: flex; flex-direction: row; gap: 4px; min-width: fit-content; position: relative; }
.heatmap-tooltip { position: absolute; background: var(--text-primary); border-radius: 7px; padding: 6px 10px; font-size: 11.5px; color: var(--bg-card); pointer-events: none; z-index: 100; opacity: 0; visibility: hidden; transition: opacity 0.15s ease; transform: translateX(-50%); box-shadow: var(--shadow-md); white-space: nowrap; text-align: center; }
.heatmap-tooltip strong { display: block; margin-bottom: 2px; }
.heatmap-days { display: flex; flex-direction: column; gap: 2px; padding-top: 20px; flex-shrink: 0; }
.heatmap-day-label { height: 12px; font-size: 10px; color: var(--text-muted); line-height: 12px; width: 30px; text-align: right; padding-right: 6px; }
.heatmap-grid { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.heatmap-months { position: relative; height: 16px; margin-bottom: 4px; }
.heatmap-month { position: absolute; top: 0; font-size: 10px; color: var(--text-muted); }
.heatmap-weeks { display: flex; gap: 2px; }
.heatmap-week { display: flex; flex-direction: column; gap: 2px; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 2px; cursor: pointer; transition: transform var(--transition-fast); }
.heatmap-cell.empty   { background: transparent; }
.heatmap-cell.level-0 { background: var(--border-color); }
.heatmap-cell.level-1 { background: rgba(5, 150, 105, 0.25); }
.heatmap-cell.level-2 { background: rgba(5, 150, 105, 0.5); }
.heatmap-cell.level-3 { background: rgba(5, 150, 105, 0.75); }
.heatmap-cell.level-4 { background: var(--positive); }
.heatmap-cell:hover { transform: scale(1.3); outline: 2px solid var(--accent-primary); outline-offset: 1px; }
.heatmap-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 10.5px; color: var(--text-muted); }
.heatmap-legend .heatmap-cell:hover { transform: none; outline: none; }

/* ============================================
   DIAGNOSTICS & STATS
   ============================================ */

.diagnostics-results { background: var(--bg-elevated); border-radius: 10px; padding: 15px; border: 1px solid var(--border-color); }
.diagnostic-summary { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 8px; font-weight: 600; margin-bottom: 14px; }
.diagnostic-summary.success { background: var(--positive-bg); color: var(--positive); border: 1px solid rgba(5,150,105,0.2); }
.diagnostic-summary.warning { background: var(--negative-bg); color: var(--negative); border: 1px solid rgba(220,38,38,0.2); }
.diagnostic-checks { display: flex; flex-direction: column; gap: 7px; }
.diagnostic-check { display: flex; align-items: center; gap: 10px; padding: 9px 13px; background: var(--bg-card); border-radius: 8px; border-left: 2.5px solid transparent; border: 1px solid var(--border-color); }
.diagnostic-check.success { border-left-color: var(--positive); }
.diagnostic-check.warning { border-left-color: var(--negative); }
.diagnostic-check.info    { border-left-color: var(--accent-primary); }
.check-icon { font-size: 1rem; width: 22px; text-align: center; }
.diagnostic-check.success .check-icon { color: var(--positive); }
.diagnostic-check.warning .check-icon { color: var(--negative); }
.diagnostic-check.info    .check-icon { color: var(--accent-primary); }
.check-name { flex: 1; color: var(--text-primary); font-size: 13.5px; }
.check-count { background: var(--bg-elevated); padding: 2px 9px; border-radius: 10px; font-size: 0.82rem; color: var(--text-secondary); border: 1px solid var(--border-color); }
.check-details { background: var(--bg-elevated); padding: 11px 14px; margin: 7px 0; border-radius: 8px; font-size: 0.875rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.check-details div { color: var(--text-secondary); }
.check-details strong { color: var(--text-primary); }

.db-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-item { background: var(--bg-card); padding: 14px; border-radius: 9px; text-align: center; border: 1px solid var(--border-color); box-shadow: var(--shadow-xs); }
.stat-value { display: block; font-size: 1.5rem; font-weight: 800; color: var(--accent-primary); letter-spacing: -0.03em; }
.stat-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-top: 3px; letter-spacing: 0.05em; font-weight: 700; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stats-details { background: var(--bg-card); padding: 15px; border-radius: 9px; border: 1px solid var(--border-color); }
.stats-placeholder { text-align: center; padding: 22px; color: var(--text-muted); }
.balance-details { padding: 11px 0; }
.balance-details h5 { margin: 14px 0 7px; color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }
.balance-row, .stat-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border-color); }
.balance-row:last-child, .stat-row:last-child { border-bottom: none; }
.orphan-section { margin-top: 10px; padding: 11px; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border-color); }
.orphan-section h5 { margin: 0 0 7px; color: var(--text-primary); }
.warning-text { color: var(--text-muted); font-size: 0.82rem; }
.category-breakdown summary { cursor: pointer; padding: 9px; background: var(--bg-card); border-radius: 8px; color: var(--text-secondary); font-size: 0.875rem; border: 1px solid var(--border-color); }
.category-breakdown summary:hover { background: var(--bg-hover-neutral); }
.breakdown-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 0.82rem; }
.breakdown-table th, .breakdown-table td { padding: 7px 11px; text-align: left; border-bottom: 1px solid var(--border-color); }
.breakdown-table th { background: var(--bg-elevated); color: var(--text-secondary); font-weight: 600; }
.breakdown-table td.positive { color: var(--positive); }
.breakdown-table td.negative { color: var(--negative); }
.maintenance-results, .maintenance-stats { margin-bottom: 14px; }

/* Danger zone */
.danger-zone { border: 1px solid rgba(220,38,38,0.3); border-radius: 10px; padding: 18px; background: var(--negative-bg); }
.danger-zone h4 { color: var(--negative) !important; }
.data-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.file-input-btn { cursor: pointer; }

/* ============================================
   ABOUT
   ============================================ */

.about-content { text-align: center; padding: 18px 0; }
.about-logo { display: inline-flex; align-items: center; justify-content: center; width: 88px; height: 88px; background: var(--accent-primary); border-radius: 22px; margin-bottom: 18px; box-shadow: 0 10px 40px var(--accent-primary-glow); }
.about-logo svg { stroke: white; }
.about-content h3 { font-size: 22px; margin-bottom: 4px; font-weight: 800; letter-spacing: -0.04em; }
.about-version { color: var(--text-muted); font-size: 13px; margin-bottom: 7px; }
.about-tagline { color: var(--text-secondary); margin-bottom: 22px; }
.about-stats { margin-bottom: 22px; }
.about-section { text-align: left; background: var(--bg-elevated); padding: 18px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border-color); }
.about-section h4 { margin-bottom: 10px; color: var(--text-primary); font-size: 13.5px; font-weight: 700; }
.about-features { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.about-features li { color: var(--text-secondary); font-size: 12.5px; padding-left: 18px; position: relative; }
.about-features li::before { content: '✓'; position: absolute; left: 0; color: var(--positive); font-weight: 700; }
.shortcuts-list { display: flex; flex-direction: column; gap: 7px; }
.shortcut { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12.5px; }
.shortcut kbd { background: var(--bg-input); padding: 3px 7px; border-radius: 5px; font-family: monospace; font-size: 11.5px; border: 1px solid var(--border-color-mid); color: var(--text-primary); }
.shortcut span { margin-left: auto; }
.about-footer { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border-color); font-size: 11.5px; color: var(--text-muted); }
.about-copyright { margin-top: 4px; }

/* ============================================
   EDIT MODE
   ============================================ */

#editBudgetBtn.active { background: var(--accent-primary); color: white; box-shadow: 0 2px 8px var(--accent-primary-glow); }

.drag-handle, .add-category-row, .category-group-header .btn-ghost, .target-btn { display: none; }
.budget-edit-mode .drag-handle, .budget-edit-mode .add-category-row, .budget-edit-mode .category-group-header .btn-ghost, .budget-edit-mode .target-btn { display: inline-flex; }
.budget-edit-mode .category-name { padding-left: 0; }
.budget-edit-mode .group-name { padding-left: 0; }
.group-name { padding-left: 7px; }

/* ============================================
   DRAG & DROP
   ============================================ */

.drag-handle { cursor: grab; opacity: 0.35; padding: 4px; margin-right: 5px; align-items: center; transition: opacity var(--transition-fast); }
.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.3; background: var(--accent-light) !important; }
.sortable-chosen { background: var(--bg-elevated); box-shadow: var(--shadow-lg); }
.sortable-drag { background: var(--bg-card); box-shadow: var(--shadow-xl); }

/* ============================================
   UTILITIES
   ============================================ */

.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.hidden       { display: none !important; }
.positive     { color: var(--positive); }
.negative     { color: var(--negative); }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state { text-align: center; padding: 72px 20px; color: var(--text-muted); }
.empty-state svg { width: 72px; height: 72px; margin-bottom: 20px; opacity: 0.2; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--text-secondary); font-weight: 700; }
.empty-state p { color: var(--text-muted); }

/* ============================================
   LOADING
   ============================================ */

.loading { display: flex; align-items: center; justify-content: center; padding: 56px; }
.spinner { width: 32px; height: 32px; border: 2.5px solid var(--border-color-mid); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   IMPORT VIEW
   ============================================ */

.import-page {
    padding: 28px;
    max-width: 900px;
}

.import-page-header {
    margin-bottom: 28px;
}

.import-page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.import-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Upload card */
.import-upload-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.import-account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.import-account-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 130px;
}

.import-account-select-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border-color-mid);
    border-radius: var(--border-radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.import-account-select-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Dropzone */
.import-dropzone {
    border: 2px dashed var(--border-color-mid);
    border-radius: var(--border-radius);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-elevated);
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.import-dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.import-dropzone:hover .import-dropzone-icon,
.import-dropzone.dragover .import-dropzone-icon {
    color: var(--accent-primary);
}

.import-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.import-dropzone-text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.import-dropzone-text span {
    font-size: 13px;
    color: var(--text-secondary);
}

.import-dropzone-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Format info */
.import-format-info {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.import-format-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.import-format-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.import-format-tag {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.import-format-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Pending card */
.import-pending-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.import-pending-card .pending-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    gap: 12px;
}

.import-pending-card .pending-header h3 {
    font-size: 14px;
    font-weight: 650;
    color: var(--text-primary);
}

.import-pending-card .pending-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.import-pending-card .pending-list {
    min-height: 120px;
}

/* Empty state */
.import-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    gap: 12px;
}

.import-empty-state svg {
    opacity: 0.3;
}

.import-empty-state p {
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-color-strong); }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .dashboard-metrics { grid-template-columns: repeat(2, 1fr); }
    .dashboard-row { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .category-group-header, .category-row { grid-template-columns: 1fr 100px 90px 50px 100px; }
}

.mobile-menu-btn { display: none; background: transparent; border: none; color: var(--text-primary); padding: 7px; border-radius: 7px; cursor: pointer; transition: all var(--transition-fast); }
.mobile-menu-btn:hover { background: var(--bg-hover-neutral); }

.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 99; opacity: 0; transition: opacity var(--transition-normal); }
.mobile-overlay.active { opacity: 1; }

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    .mobile-overlay { display: block; pointer-events: none; }
    .mobile-overlay.active { pointer-events: auto; }

    .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 100; transition: left var(--transition-normal); box-shadow: 4px 0 30px rgba(0,0,0,0.3); }
    .sidebar.open { left: 0; }

    .dashboard-metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dashboard-row     { grid-template-columns: 1fr; }
    .dashboard-grid    { padding: 14px 16px; gap: 14px; }

    .category-group-header, .category-row { grid-template-columns: 1fr 80px 70px 80px; padding: 10px 16px; }
    .sparkline-cell, .sparkline-header { display: none !important; }

    .header { padding: 8px 14px; overflow: visible; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; height: auto; gap: 8px; }
    .header-right { grid-column: 2; grid-row: 1; }
    .header-left { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 8px; }
    .header-left .header-title { flex: 1; }
    .month-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; width: 100%; }

    .ready-to-assign { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
    .ready-to-assign-info { flex-direction: row !important; align-items: center !important; flex-wrap: wrap; gap: 8px !important; }
    .ready-to-assign-amount { font-size: 1.5rem; }
    .ready-to-assign .btn:not(.mobile-edit-btn) { flex: 1; justify-content: center; min-width: 0; }

    .overspending-alert { flex-direction: column; padding: 12px 16px; gap: 10px; }
    .overspending-content { width: 100%; }
    .btn-warning { width: 100%; justify-content: center; }

    .mobile-edit-btn { display: inline-flex !important; flex: 0 0 auto !important; padding: 8px 12px !important; }
    #editBudgetBtn { display: none !important; }
    .undo-redo-btns { display: flex; gap: 2px; margin-right: 0; }

    .category-target { flex-wrap: wrap; gap: 6px; width: 100%; }
    .category-target .target-progress { width: 100%; order: 1; }
    .category-target .target-text { order: 2; flex: 1; }
    .category-target .target-freq { display: none; }
    .snooze-btn { padding: 6px 10px !important; font-size: 0.72rem; opacity: 1 !important; margin-left: auto; flex-shrink: 0; order: 3; }
    .snooze-btn svg { width: 12px; height: 12px; }

    .reports-grid { grid-template-columns: 1fr; padding: 12px; }
    .report-card { padding: 16px; max-width: 100%; overflow: hidden; }
    .chart-container { max-width: 100%; overflow: hidden; }
    .age-of-money-banner { padding: 14px; }
    .aom-description { margin-left: 0; margin-top: 8px; }
    .aom-value { font-size: 1.5rem; }

    .modal { margin: 12px; max-height: calc(100vh - 24px); max-width: calc(100vw - 24px); width: 100%; }
    .modal-header { padding: 16px 20px; }
    .modal-header h2 { font-size: 1rem; }
    .modal-body { padding: 18px 20px; }
    .modal-footer { padding: 14px 20px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 0.72rem; }
    .form-group input, .form-group select { padding: 12px 13px; font-size: 16px; }
    .modal-footer .btn { padding: 12px 18px; flex: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   TRANSACTIONS TABLE REFRESH (2026-08) — single amount column + calmer rows
   ═══════════════════════════════════════════════════════════════════ */

/* Single signed Amount column on desktop: hide Outflow/Inflow, show Amount.
   saveEditTransaction picks the field by visibility, so no JS change needed. */
.transaction-table .desktop-only   { display: none !important; }
.transaction-table .mobile-amount  { display: table-cell !important; }
.transaction-table th.mobile-amount { text-align: right; width: 130px; }
.transaction-table td.mobile-amount {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.transaction-table td.mobile-amount.inflow  { color: #22c55e; }
.transaction-table td.mobile-amount.outflow { color: #ef4444; }

/* Calmer rows: even padding, vertical centering, subtle zebra + hover */
.transaction-table tbody td { padding-top: 9px; padding-bottom: 9px; vertical-align: middle; }
.transaction-table tbody tr { transition: background-color .12s ease; }
.transaction-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.018); }
.transaction-table tbody tr:hover { background: rgba(124,106,239,0.08); }

/* Account shown as a quiet chip rather than repeated bold text */
.acct-chip {
    display: inline-block;
    font-size: .78rem;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    color: var(--text-secondary, #b0adc8);
    white-space: nowrap;
}

/* Quieter Redbark source mark (smaller white pill) */
.rb-badge {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    padding: 1px 4px;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.rb-badge img { height: 8px; width: auto; display: block; }

/* Sticky column headers so labels stay visible down the long list */
.transaction-table thead th { position: sticky; top: 0; z-index: 6; }

/* Row action icons stay quiet until you hover the row (declutter),
   but never on the edit/add/divider rows where the buttons are the point. */
@media (hover: hover) {
    .transaction-table tbody tr:not(.editing-row):not(.inline-transaction-row):not(.inline-buttons-row):not(.reconciled-divider) td:last-child {
        opacity: .3;
        transition: opacity .12s ease;
    }
    .transaction-table tbody tr:not(.editing-row):not(.inline-transaction-row):not(.inline-buttons-row):not(.reconciled-divider):hover td:last-child {
        opacity: 1;
    }
}

/* Pending (unsettled) transaction tag */
.pending-tag {
    display: inline-block;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 1px 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: rgba(245,158,11,0.16);
    color: #f5b942;
    border: 1px solid rgba(245,158,11,0.4);
    vertical-align: middle;
}
