/* ==================== GLASS MATERIALS ==================== */

/* Standard Glass — 55% white, blur 40px, specular highlight */
.glass {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-top-color: rgba(255, 255, 255, 0.72);
    box-shadow:
        0 0.5px 0 0 rgba(255,255,255,0.45) inset,
        0 1px 3px rgba(0,0,0,0.02),
        0 8px 32px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    border-radius: var(--r-lg);
    corner-shape: squircle;
    transition: transform 0.4s var(--spring-tight),
                box-shadow 0.4s ease;
}
.glass::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(160deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}
.glass > * { position: relative; z-index: 1; }
.glass:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0.5px 0 0 rgba(255,255,255,0.45) inset,
        0 2px 8px rgba(0,0,0,0.04),
        0 20px 52px rgba(0,0,0,0.07);
}

/* Thick Glass — more opaque, stronger blur */
.glass-thick {
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.88);
    box-shadow:
        0 0.5px 0 0 rgba(255,255,255,0.55) inset,
        0 2px 6px rgba(0,0,0,0.03),
        0 16px 56px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
    border-radius: var(--r-lg);
    corner-shape: squircle;
}
.glass-thick::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(160deg, rgba(255,255,255,0.15) 0%, transparent 45%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}
.glass-thick > * { position: relative; z-index: 1; }

/* No hover lift modifier */
.no-lift:hover { transform: none; }

/* Thin Glass — most translucent tier */
.glass-thin {
    background: var(--glass-bg-thin);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.30);
    border-top-color: rgba(255,255,255,0.48);
    box-shadow:
        0 0.5px 0 0 rgba(255,255,255,0.30) inset,
        0 1px 3px rgba(0,0,0,0.02),
        0 4px 16px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
    border-radius: var(--r-lg);
}
.glass-thin::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(160deg, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}
.glass-thin > * { position: relative; z-index: 1; }

/* Section-Tinted Glass Variants */
.glass-tinted-money { background: linear-gradient(135deg, rgba(52,199,89,0.06), var(--glass-bg)); }
.glass-tinted-planning { background: linear-gradient(135deg, rgba(0,122,255,0.06), var(--glass-bg)); }
.glass-tinted-household { background: linear-gradient(135deg, rgba(255,149,0,0.06), var(--glass-bg)); }
.glass-tinted-hustle { background: linear-gradient(135deg, rgba(175,82,222,0.06), var(--glass-bg)); }

/* Material Paper — for Notes (no blur, cool off-white, paper shadow) */
.material-paper {
    background: #FAFAFC;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    position: relative;
}

/* ==================== UNIFIED TITLE SYSTEM (.wtitle) ==================== */

.wtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sf);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.wtitle-icon {
    width: 26px;
    height: 26px;
    border-radius: var(--r-xs);
    corner-shape: squircle;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wtitle-icon .material-symbols-outlined {
    font-size: 14px;
    color: #fff;
}
.wtitle-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-quaternary);
    background: rgba(0,0,0,0.03);
    padding: 2px 8px;
    border-radius: 100px;
    corner-shape: squircle;
}
.wtitle-action {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--apple-blue);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}
.wtitle-action:hover { opacity: 0.7; }

/* ==================== CHART EMPTY STATES ==================== */
.chart-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg-thin);
    border-radius: inherit;
    z-index: 2;
}
.chart-empty-inner {
    text-align: center;
    padding: 24px;
}
.chart-empty-inner i {
    font-size: 32px;
    color: var(--text-quaternary);
    margin-bottom: 12px;
}
.chart-empty-inner p {
    font-size: 15px;
    font-weight: 620;
    color: var(--text-secondary);
    margin: 0 0 4px;
}
.chart-empty-inner span {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ==================== SUMMARY STRIP ==================== */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--glass-bg-thick);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.48);
    border-top-color: rgba(255,255,255,0.72);
    border-radius: var(--radius-2xl);
    padding: 22px var(--space-2xl);
    box-shadow: 
        0 0 0 0.5px rgba(0,0,0,0.04),
        0 1px 2px rgba(0,0,0,0.03),
        0 4px 16px rgba(0,0,0,0.05),
        0 12px 40px -8px rgba(0,0,0,0.06);
    transition: all var(--duration-slow) var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

/* Shine line */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: var(--space-2xl);
    right: var(--space-2xl);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 0.5px rgba(0,0,0,0.04),
        0 1px 3px rgba(0,0,0,0.02),
        0 8px 24px rgba(0,0,0,0.06),
        0 20px 48px -8px rgba(0,0,0,0.07);
}
.stat-card:active {
    transform: scale(0.98);
    transition: transform 80ms var(--ease-spring);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    font-size: 16px;
}

.stat-icon.income {
    background: var(--system-green-light);
    color: var(--system-green);
}

.stat-icon.expense {
    background: var(--system-red-light);
    color: var(--system-red);
}

.stat-icon.net {
    background: var(--system-blue-light);
    color: var(--system-blue);
}

.stat-icon.savings {
    background: var(--system-purple-light);
    color: var(--system-purple);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--mono-ls-large);
    line-height: 1.1;
}

.stat-value.positive { color: var(--system-green); }
.stat-value.negative { color: var(--system-red); }
.stat-value.neutral { color: var(--text-primary); }

.stat-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.stat-meta i {
    font-size: 10px;
    opacity: 0.7;
}

/* ==================== CARDS - Liquid Glass ==================== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.48);
    border-top-color: rgba(255,255,255,0.72);
    border-radius: var(--radius-2xl);
    corner-shape: squircle;
    box-shadow: var(--shadow-glass);
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
    contain: layout style paint;
    transition: box-shadow var(--duration-slow) var(--ease-out-expo),
                transform var(--duration-slow) var(--spring-tight),
                background 0.4s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    background: rgba(255,255,255,0.62);
    will-change: transform;
}
.card:active {
    transform: scale(0.99);
    transition: transform 80ms var(--ease-spring);
}

/* Glass specular highlight */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(160deg, rgba(255,255,255,0.10) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}
.card > * { position: relative; z-index: 1; }

/* ─── Card Tier 1: Hero ─── */
.card.card-hero {
    box-shadow: var(--shadow-lg);
}
.card.card-hero:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ─── Card Tier 3: Compact ─── */
.card.card-compact {
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}
.card.card-compact:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
    background: transparent;
}

.card-title {
    font-size: 14.5px;
    font-weight: 660;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    font-size: 12px;
    color: var(--text-quaternary);
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border-radius: 0;
}

.card-total {
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.card-body {
    padding: 0;
    background: transparent;
}

.card-body.padded {
    padding: 20px 24px;
}

/* Card Badge (count indicator) */
.card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--system-blue);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

/* ==================== TIERED CARD HEADERS ==================== */

/* --- TIER 1: Hero Module Header --- */
.card-header-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 32px 22px;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
    background: transparent;
    gap: 0;
}

.card-header-hero .card-hero-icon {
    width: 28px;
    height: 28px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
    flex-shrink: 0;
    transition: transform var(--duration-slow) var(--ease-spring);
    /* Apple Health style: tinted glyph, no background tile */
    background: none !important;
}
.card:hover .card-header-hero .card-hero-icon {
    transform: scale(1.08);
}

/* Icon color variants — system color glyphs */
.card-hero-icon.green { color: #34C759; }
.card-hero-icon.blue { color: #007AFF; }
.card-hero-icon.red { color: #FF3B30; }
.card-hero-icon.orange { color: #FF9500; }
.card-hero-icon.purple { color: #AF52DE; }
.card-hero-icon.teal { color: #007AFF; }
.card-hero-icon.pink { color: #FF2D55; }

.card-header-hero .card-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
}

.card-header-hero .card-hero-title {
    font-size: 22px;
    font-weight: 760;
    font-family: var(--font-display);
    letter-spacing: -0.028em;
    color: var(--text-primary);
    line-height: 1.12;
}

.card-header-hero .card-hero-subtitle {
    font-size: 13px;
    font-weight: 460;
    color: var(--text-tertiary);
    margin-top: 4px;
    letter-spacing: -0.005em;
}

.card-header-hero .card-hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.card-header-hero .card-hero-stat {
    font-size: 30px;
    font-weight: 600;
    font-family: var(--font-editorial);
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.card-header-hero .card-hero-stat.green { color: var(--system-green); }
.card-header-hero .card-hero-stat.red { color: var(--system-red); }

.card-header-hero .card-actions {
    margin-top: 0;
    flex-shrink: 0;
}

/* --- TIER 2: Standard Header (existing, slightly refined) --- */
/* .card-header — already defined above, no changes needed */

/* --- TIER 3: Compact / Utility Header --- */
.card-header-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.2);
}

.card-header-compact .card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0;
}

.card-header-compact .card-title i {
    width: 20px;
    height: 20px;
    font-size: 10px;
    border-radius: 5px;
}

/* --- Mobile adjustments --- */
@media (max-width: 768px) {
    .card-header-hero {
        padding: 18px 20px 16px;
    }
    .card-header-hero .card-hero-icon {
        width: 24px;
        height: 24px;
        font-size: 18px;
        margin-bottom: 10px;
        border-radius: 0;
    }
    .card-header-hero .card-hero-title {
        font-size: 19px;
    }
    .card-header-hero .card-hero-stat {
        font-size: 24px;
    }
    .card-header-hero .card-hero-top {
        flex-direction: column;
        gap: 10px;
    }
}

/* ==================== UNIFIED SECTION SUB-HEADER ==================== */
/* Shared flex layout for section headers across all pages */
.inc-section-header,
.goals-section-header,
.sc-section-header,
.biz-section-header-v2,
.life-bucket-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 4px;
}

/* ==================== DASHBOARD: UPCOMING BILLS ==================== */
.upcoming-bills-list {
    padding: var(--space-sm) 0;
}

.upcoming-bill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    transition: background var(--duration-fast) var(--ease-default);
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}

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

.upcoming-bill:hover {
    background: rgba(0,0,0,0.02);
}

.upcoming-bill-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
}

.upcoming-bill-day {
    width: 40px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0,0,0,0.04);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.upcoming-bill-day.today {
    background: var(--system-blue);
    color: white;
}

.upcoming-bill-day.urgent {
    background: var(--system-red-light);
    color: var(--system-red);
}

.upcoming-bill-day.soon {
    background: var(--system-orange-light);
    color: var(--system-orange);
}

.upcoming-bill-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.upcoming-bill-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.upcoming-bill-amount {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--system-red);
    flex-shrink: 0;
    margin-left: var(--space-md);
}

/* ==================== DASHBOARD: SPENDING DONUT ==================== */
.donut-wrapper {
    display: flex;
    justify-content: center;
    padding: var(--space-lg) var(--space-xl);
    max-width: 180px;
    margin: 0 auto;
}

.donut-legend {
    padding: 0 var(--space-xl) var(--space-lg);
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 4px 0;
    font-size: 12px;
}

.donut-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.donut-legend-label {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.donut-legend-value {
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

/* ==================== DASHBOARD: MONTH TREND ==================== */
.trend-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.trend-metric {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    transition: background var(--duration-fast) var(--ease-default);
}

.trend-metric:hover {
    background: rgba(0,0,0,0.02);
}

.trend-metric.compact {
    padding: var(--space-sm) var(--space-md);
}

.trend-metric-icon {
    font-size: 16px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.trend-metric-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.trend-metric-value {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.trend-metric.compact .trend-metric-value {
    font-size: 12px;
}

.trend-metric-sub {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* ==================== BUTTONS ==================== */
.btn {
    font-family: var(--font-system);
    font-size: 14px;
    font-weight: 550;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    corner-shape: squircle;
    border: none;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn i {
    font-size: 12px;
}

.btn-primary {
    background: var(--system-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0,122,255,0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,122,255,0.25);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.045);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.07);
    transform: translateY(-0.5px);
}

.btn:active {
    transform: scale(0.97);
    transition: transform 80ms var(--ease-spring);
}

.btn-ghost {
    background: transparent;
    color: var(--system-blue);
}

.btn-ghost:hover {
    background: rgba(0,122,255,0.06);
    transform: translateY(-0.5px);
}

.btn-danger {
    background: var(--system-red-light);
    color: var(--system-red);
}

.btn-danger:hover {
    background: rgba(229, 56, 59, 0.15);
    transform: translateY(-0.5px);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ==================== COMPONENT POLISH ==================== */
/* Universal progress bar squircle */
[class*="progress"], [class*="bar-fill"], [class*="gauge-fill"],
[class*="sbar-fill"], [class*="mbar"], .funding-bar, .funding-bar-fill {
    border-radius: 999px;
}

/* Input focus rings — glass-tinted glow */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(0,122,255,0.10), 0 0 0 6px rgba(0,122,255,0.04);
}

/* ==================== TABLES ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 14px 24px;
    font-weight: 550;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: transparent;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}

.data-table td {
    padding: 14px 24px;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--duration-normal) var(--ease-out-expo);
}

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

.data-table tbody tr:hover td {
    background: rgba(0,0,0,0.018);
}

.data-table .category-row {
    background: rgba(0, 0, 0, 0.015);
}

.data-table .category-row td {
    font-weight: 620;
    font-size: 13px;
    padding: 14px var(--space-2xl);
}

.data-table .total-row {
    background: rgba(0, 0, 0, 0.015);
}

.data-table .total-row td {
    font-weight: 620;
    padding: 16px var(--space-2xl);
}

.data-table .editable {
    cursor: text;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-default);
    min-width: 60px;
    display: inline-block;
}

.data-table .editable:hover {
    background: var(--system-blue-light);
}

.data-table .editable:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 3px var(--system-blue-light);
}

.data-table input[type="text"],
.data-table input[type="number"] {
    font-family: var(--font-system);
    font-size: 14px;
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    width: 100%;
    transition: all var(--duration-fast) var(--ease-default);
    background: var(--bg-elevated);
}

.data-table input:focus {
    outline: none;
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3.5px rgba(0,122,255,0.12);
    background: rgba(0,0,0,0.015);
}

/* Pay Schedule Preview */
.pay-schedule {
    font-size: 11px;
    color: var(--system-blue);
    opacity: 0.8;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pay-schedule i {
    font-size: 9px;
}

.pay-date-cell {
    min-width: 160px;
}

.pay-date-picker-group {
    display: flex;
    gap: 8px;
}

/* Mini Calendar Day Picker */
.pay-mini-cal {
    display: inline-block;
}

.mini-cal-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    text-align: center;
}

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: rgba(0,0,0,0.04);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 154px;
}

.mini-cal-day {
    width: 22px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-secondary);
    transition: all 0.1s;
    user-select: none;
}

.mini-cal-day:hover {
    background: var(--system-blue-light);
    color: var(--system-blue);
}

.mini-cal-day.selected {
    background: var(--system-blue);
    color: white;
    font-weight: 700;
}

.mini-cal-day.auto {
    background: rgba(0,122,255,0.12);
    color: var(--system-blue);
    font-weight: 600;
}

/* HUD Editable Fields */
.hud-editable {
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    margin: -2px -6px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.hud-editable:hover {
    background: rgba(0,122,255,0.08);
    transform: scale(1.02);
}

.hud-inline-edit {
    border: 2px solid var(--system-blue);
    border-radius: var(--radius-sm);
    font-size: inherit;
    font-weight: inherit;
    font-family: var(--font-display);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    text-align: center;
    width: 110px;
    padding: 2px 6px;
    outline: none;
    box-shadow: 0 0 0 4px var(--system-blue-light);
}

.hud-inline-edit.balance-edit {
    width: 130px;
    color: var(--system-blue);
}

.data-table select {
    font-family: var(--font-system);
    font-size: 13px;
    padding: var(--space-sm) var(--space-md);
    border: 0.5px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    cursor: pointer;
}

.data-table select:focus {
    outline: none;
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3px var(--system-blue-light);
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--system-blue);
}

/* Row Actions */
.row-actions {
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
}

tr:hover .row-actions {
    opacity: 1;
}

.row-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    font-size: 12px;
}

.row-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.row-action-btn.delete:hover {
    background: var(--system-red-light);
    color: var(--system-red);
}

/* Category Toggle */
.category-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}

.category-toggle i.chevron {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform var(--duration-fast) var(--ease-default);
    width: 16px;
}

.category-toggle.collapsed i.chevron {
    transform: rotate(-90deg);
}

.category-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.category-name i {
    font-size: 13px;
    color: var(--system-blue);
    opacity: 0.7;
}

/* ==================== CHARTS ==================== */
.chart-container {
    position: relative;
    height: 300px;
    padding: var(--space-xl);
}

/* ==================== WARNINGS ==================== */
.warnings-container {
    margin-bottom: var(--space-xl);
}

.warning-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--system-orange-light);
    border: 1px solid rgba(200, 138, 62, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    font-size: 13px;
    color: #8a6914;
}

.warning-item i {
    font-size: 14px;
}

.warning-item.error {
    background: var(--system-red-light);
    border-color: rgba(229, 56, 59, 0.2);
    color: #a33029;
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    padding: 24px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #F5F5F7;
    border: 0.5px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    corner-shape: squircle;
    box-shadow: 0 24px 80px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.04);
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - 48px);
    overflow: auto;
    transform: scale(0.94) translateY(8px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.18s ease-out;
}

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

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="date"],
.modal select,
.modal textarea {
    border-radius: 10px;
    corner-shape: squircle;
}

.modal-header {
    padding: 22px var(--space-2xl) 16px;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}

.modal-title {
    font-size: 18px;
    font-weight: 680;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-title i {
    color: var(--text-tertiary);
}

.modal-body {
    padding: var(--space-2xl);
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-footer {
    padding: var(--space-lg) var(--space-2xl) var(--space-xl);
    border-top: 1px solid var(--separator);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ==================== MODAL FORM ELEMENTS ==================== */
/* Shared form primitives used by hustle CRUD modals, business edit, etc. */

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin-bottom: -6px;
}

.modal-input,
.modal-form input[type="text"],
.modal-form input[type="url"],
.modal-form input[type="number"],
.modal-form input[type="date"],
.modal-form input[type="time"],
.modal-form select {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-system);
    font-size: 14.5px;
    font-weight: 450;
    color: var(--text-primary);
    background: rgba(0,0,0,0.025);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    corner-shape: squircle;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.modal-input:focus,
.modal-form input:focus,
.modal-form select:focus {
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3.5px rgba(0,122,255,0.12);
    background: rgba(0,0,0,0.015);
}

.modal-input::placeholder,
.modal-form input::placeholder {
    color: var(--text-quaternary);
    font-weight: 400;
}

.modal-textarea,
.modal-form textarea {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-system);
    font-size: 14.5px;
    font-weight: 450;
    color: var(--text-primary);
    background: rgba(0,0,0,0.025);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    corner-shape: squircle;
    outline: none;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    line-height: 1.5;
}

.modal-textarea:focus,
.modal-form textarea:focus {
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
    background: rgba(0,122,255,0.02);
}

.modal-textarea::placeholder,
.modal-form textarea::placeholder {
    color: var(--text-quaternary);
    font-weight: 400;
}

/* Select arrow */
.modal-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

/* Inline grid layout for compact fields */
.modal-form > div[style*="grid"] .modal-label {
    margin-bottom: -2px;
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-input {
    width: 100%;
    font-family: var(--font-system);
    font-size: 15px;
    padding: var(--space-md) var(--space-lg);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    transition: all var(--duration-fast) var(--ease-default);
    background: var(--bg-elevated);
}

.form-input:focus {
    outline: none;
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3.5px rgba(0,122,255,0.12);
    background: rgba(0,0,0,0.015);
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-sm);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}

.toggle-wrapper:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toggle-label i {
    font-size: 14px;
    color: var(--text-tertiary);
    width: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 26px;
    transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--system-green, #34C759);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* ==================== NAV TABS ==================== */
.nav-tabs {
    display: inline-flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.04);
    padding: 3px;
    border-radius: 12px;
}

.nav-tab {
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-tab i {
    font-size: 12px;
    opacity: 0.7;
}

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

.nav-tab.active {
    background: var(--glass-bg-thick);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.nav-tab.active i {
    opacity: 1;
    color: var(--system-blue);
}

/* ==================== RECENT DOCS LIST (Tier 4) ==================== */
.home-recent-docs-list {
    display: flex;
    flex-direction: column;
}

.home-recent-doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease;
}
.home-recent-doc-row:last-child { border-bottom: none; }
.home-recent-doc-row:hover { background: rgba(0,0,0,0.025); }

.home-recent-doc-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 14px;
}
.home-recent-doc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-recent-doc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.home-recent-doc-name {
    font-size: 13px;
    font-weight: 580;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-recent-doc-meta {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Summary inner layout (inside attention card) */
.home-summary-inner {
    padding: 12px 22px 16px;
}
.home-summary-month-row {
    display: none; /* month shown in card header now */
}
.home-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
}
.home-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}
.home-summary-row-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 520;
    color: var(--text-secondary);
}
.home-summary-row-icon {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    flex-shrink: 0;
}
.home-summary-row-value {
    font-size: 14px;
    font-weight: 640;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--mono-ls-medium);
}
/* .home-summary-row-value.fun removed in v33 */
.home-summary-divider {
    grid-column: 1 / -1;
    height: 0.5px;
    background: var(--separator);
    margin: 2px 0;
}
.home-summary-details-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px;
    border: none;
    background: rgba(0,0,0,0.025);
    border-radius: 0 0 24px 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
    transition: background 0.2s ease;
}
.home-summary-details-btn:hover { background: var(--system-blue-light); }
.home-summary-details-btn i { font-size: 11px; }

/* Upcoming bills in attention card */
.home-bill-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
    transition: background 0.15s ease;
}
.home-bill-item:last-child { border-bottom: none; }
.home-bill-item:hover { background: rgba(0,0,0,0.02); }

.home-bill-dot {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    flex-shrink: 0;
}

.home-bill-info {
    flex: 1;
    min-width: 0;
}
.home-bill-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.home-bill-due {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
}
.home-bill-amount {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.home-bill-amount.urgent { color: var(--system-red); }

.home-bills-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 0.5px solid rgba(0,0,0,0.06);
    background: rgba(0,0,0,0.02);
    border-radius: 0 0 24px 24px;
}
.home-bills-total-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.home-bills-total-amount {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.home-bills-total-due {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}
.home-bills-show-all {
    font-size: 12px;
    font-weight: 600;
    color: var(--system-blue);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.home-bills-show-all:hover { text-decoration: underline; }

/* Keep old HUD/stat elements hidden for backward compat */
.hud-divider, .hud-section, .hud-savings-gauge, .hud-adjust-btn,
.hud-pill, .hud-pill-label, .hud-pill-row, .hud-pill-icon, .hud-pill-value, .hud-pill-dim,
.hud-health-badge, .hud-meta-strip, .hud-date-pill, .hud-user-avatar,
.stat-cards, .stat-card, .stat-card-header, .stat-icon, .stat-label, .stat-value-row, .stat-value,
.stat-change, .stat-dim, .stat-sparkline, .stat-progress, .stat-progress-fill,
.stat-fun-avatars, .stat-fun-avatar, .stat-fun-avatar-icon, .stat-health-icon, .stat-footer,
.home-banner, .banner-photo, .banner-text, .banner-greeting, .banner-subtitle, .banner-date-pill {
    /* These old classes are no longer used but may be referenced in JS — safe to ignore */
}

/* HUD Icon/Color Picker (used from stat cards + settings) */
.hud-picker-section { margin-bottom: 16px; }
.hud-picker-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.hud-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}
.hud-picker-grid.colors {
    grid-template-columns: repeat(6, 1fr);
}
.hud-pick-btn {
    width: 38px; height: 38px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.hud-pick-btn:hover { background: rgba(0,122,255,0.08); color: var(--system-blue); }
.hud-pick-btn.active { border-color: var(--system-blue); background: rgba(0,122,255,0.1); color: var(--system-blue); }

.hud-pick-color {
    width: 38px; height: 38px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}
.hud-pick-color:hover { transform: scale(1.1); }
.hud-pick-color.active { border-color: white; box-shadow: 0 0 0 2px var(--system-blue), inset 0 -2px 4px rgba(0,0,0,0.1); }

/* ==================== WIDGET GRID SYSTEM (v35) ==================== */
/* Two-column responsive grid for dashboard-style widget layouts */
.widget-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.widget-grid .full-width { grid-column: 1 / -1; }
.widget-pad { padding: 20px; }

@media (max-width: 768px) {
    .widget-grid { grid-template-columns: 1fr; }
}

/* ==================== FINANCIAL NUMBER TYPOGRAPHY (v45) ==================== */
/* SF Mono for all monetary amounts — data clarity, tabular alignment */
.stat-value,
.card-total,
.card-hero-stat,
.home-bill-amount,
.home-bills-total-amount,
.home-summary-row-value,
.funding-amount,
.total-value,
.runway-item-amount,
.monthly-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--mono-ls-medium);
}

/* ==================== UNIVERSAL SQUIRCLE CORNERS (v36) ==================== */
/* Progressive enhancement — non-WebKit browsers get standard rounded corners */
button,
input,
select,
textarea,
.badge,
.status-pill,
.wtitle-badge,
.progress-bar,
[class*="progress"],
.btn,
[class*="-btn"],
[class*="-pill"],
.card-compact,
.card-hero {
    corner-shape: squircle;
}

/* ==================== COMPONENT POLISH (v36) ==================== */
/* Softer inputs, glass-appropriate form fields */
input, select, textarea {
    background: rgba(0, 0, 0, 0.03);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    corner-shape: squircle;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-system);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
    outline: none;
}

/* Progress bars — capsule-rounded */
.progress-bar, [class*="progress-fill"] {
    border-radius: 100px;
}

/* Badge pills — refined */
.badge, .status-pill, .wtitle-badge {
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 3px 10px;
}

/* ─── Profile Avatar ─── */
.hb-avatar {
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hb-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}
.hb-avatar-letter {
    font-family: var(--font-sf);
    font-weight: 700; color: white;
    line-height: 1;
}
