/* ===== MISSION CONTROL CSS v17 — FANCY EDITION ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #07070f;
    --bg-secondary: #0f0f1c;
    --bg-card: #131320;
    --bg-card-hover: #181830;
    --border: #1e1e35;
    --border-glow: rgba(139, 92, 246, 0.25);
    --text-primary: #e8e8f0;
    --text-secondary: #7070a0;
    --text-muted: #404060;
    --accent-purple: #8b5cf6;
    --accent-purple-dim: #6d3fd4;
    --accent-purple-glow: rgba(139, 92, 246, 0.15);
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.12);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.12);
    --accent-amber: #f59e0b;
    --accent-amber-dim: rgba(245, 158, 11, 0.12);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.12);
    --accent-pink: #ec4899;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-purple: 0 0 40px rgba(139, 92, 246, 0.12);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dot grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(139,92,246,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

/* Ambient glow top */
body::after {
    content: '';
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(139,92,246,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* NAV BAR */
.mc-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: rgba(7,7,15,0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.mc-nav-brand {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(139,92,246,0.6);
    text-decoration: none;
    transition: color 0.2s;
}
.mc-nav-brand:hover { color: var(--accent-purple); }

.mc-nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.mc-nav-links a {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.mc-nav-links a:hover { color: var(--accent-purple); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

.app {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 20px;
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0 24px; flex-wrap: wrap; gap: 15px;
}

.header h1 {
    font-size: 2rem; font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #c084fc 50%, var(--accent-pink) 100%);
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.subtitle { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 15px; }
.date-display {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* ===== ALERT BANNER ===== */
.alert-banner {
    background: linear-gradient(135deg, rgba(139,85,247,0.08), rgba(236,72,153,0.08));
    border: 1px solid rgba(139,85,247,0.2);
    border-radius: var(--radius);
    padding: 16px 24px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    position: relative;
    overflow: hidden;
}

.alert-banner::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.06), transparent);
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* ===== PAY CYCLE BANNER ===== */
.cycle-banner {
    display: flex; align-items: center; gap: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 32px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cycle-banner:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-purple);
}

.cycle-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.4), transparent);
}

.cycle-ring-container {
    position: relative; width: 100px; height: 100px; flex-shrink: 0;
    filter: drop-shadow(0 0 12px rgba(139,92,246,0.4));
}
.cycle-ring { width: 100px; height: 100px; transform: rotate(-90deg); }
.cycle-ring-bg {
    fill: none; stroke: var(--bg-secondary); stroke-width: 8;
}
.cycle-ring-fill {
    fill: none; stroke: url(#ringGrad); stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.cycle-ring-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; display: flex; flex-direction: column;
}
.cycle-day {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.7rem; font-weight: 700;
    color: var(--accent-purple);
    text-shadow: 0 0 20px rgba(139,92,246,0.5);
}
.cycle-label { font-size: 0.7rem; color: var(--text-muted); }

.cycle-info { flex: 1; }
.cycle-title { font-weight: 600; font-size: 1rem; margin-bottom: 6px; }
.cycle-dates { font-size: 0.85rem; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.cycle-countdown { font-size: 0.85rem; color: var(--accent-purple); margin-top: 6px; font-weight: 500; }

.cycle-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 12px 28px;
    min-width: 450px;
}
.cqs-item { display: flex; flex-direction: column; gap: 4px; }
.cqs-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.cqs-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem; font-weight: 600;
    transition: text-shadow 0.3s;
}
.cqs-value.green { color: var(--accent-green); }
.cqs-value.green:hover { text-shadow: 0 0 16px rgba(34,197,94,0.5); }
.cqs-value.red { color: var(--accent-red); }
.cqs-value.blue { color: var(--accent-blue); }
.cqs-value.purple { color: var(--accent-purple); }
.cqs-value.gold { color: #facc15; }

/* ===== INSIGHTS ROW ===== */
.insights-row {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px;
}
.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    font-size: 0.85rem; line-height: 1.5;
    color: var(--text-secondary);
    min-height: 70px; display: flex; align-items: center;
    transition: border-color 0.3s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.insight-card:hover {
    border-color: rgba(139,92,246,0.2);
    transform: translateY(-2px);
}

.insight-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.insight-card:hover::after { opacity: 1; }

.insight-card .insight-emoji { font-size: 1.4rem; margin-right: 12px; flex-shrink: 0; }
.insight-card .insight-text strong { color: var(--text-primary); }
.insight-card .insight-text .highlight-green { color: var(--accent-green); font-weight: 600; }
.insight-card .insight-text .highlight-red { color: var(--accent-red); font-weight: 600; }
.insight-card .insight-text .highlight-amber { color: var(--accent-amber); font-weight: 600; }
.insight-card .insight-text .highlight-purple { color: var(--accent-purple); font-weight: 600; }

/* ===== BUDGET PROGRESS BAR ===== */
.budget-progress-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 22px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}
.budget-progress-section:hover { border-color: var(--border-glow); }
.budget-progress-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; font-size: 0.85rem;
}
.budget-progress-header span { color: var(--text-secondary); }
.budget-progress-pct { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.budget-progress-bar {
    height: 14px; background: var(--bg-secondary); border-radius: 7px;
    position: relative; overflow: visible;
}
.budget-progress-fill {
    height: 100%; border-radius: 7px;
    background: linear-gradient(90deg, var(--accent-purple), #c084fc, var(--accent-pink));
    background-size: 200% 100%;
    animation: gradient-flow 3s linear infinite;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative; z-index: 2;
    box-shadow: 0 0 12px rgba(139,92,246,0.4);
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.budget-progress-marker {
    position: absolute; top: -3px; width: 3px; height: 20px;
    background: var(--accent-amber);
    border-radius: 2px;
    z-index: 1; transition: left 0.5s ease;
    box-shadow: 0 0 8px rgba(245,158,11,0.6);
}
.budget-progress-labels {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; font-size: 0.75rem; color: var(--text-muted);
}
#budgetProgressNote { color: var(--accent-amber); font-size: 0.75rem; font-weight: 500; }

/* ===== HIDDEN SUMMARY ===== */
.hidden-summary {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-secondary); border: 1px dashed rgba(255,255,255,0.07);
    border-radius: var(--radius-sm); padding: 12px 18px;
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px;
}
.btn-link {
    background: none; border: none; color: var(--accent-purple);
    cursor: pointer; font-size: 0.85rem; font-family: 'Inter', sans-serif; text-decoration: underline;
}
.btn-link:hover { color: #c084fc; }

/* ===== MAIN GRID ===== */
.main-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.panel:hover {
    border-color: rgba(139,92,246,0.18);
}

/* Top glow line on hover */
.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.5), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}
.panel:hover::before { opacity: 1; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.panel-header h2 { font-size: 1rem; font-weight: 600; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chart-period-label { font-size: 0.72rem; color: var(--text-muted); font-style: italic; }

/* ===== SURVIVAL PANEL ===== */
.survival-stats { display: flex; flex-direction: column; gap: 16px; }
.survival-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.survival-row.main { margin-bottom: 6px; }
.survival-row.total { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; font-weight: 600; font-size: 1rem; }
.survival-val { font-family: 'JetBrains Mono', monospace; }
.survival-val.green { color: var(--accent-green); }
.survival-val.red { color: var(--accent-red); }
.survival-val.blue { color: var(--accent-blue); }
.survival-bar-bg { height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; width: 100%; margin-top: 6px; }
.survival-bar-fill { height: 100%; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); border-radius: 4px; }
.survival-bar-fill.essential { background: linear-gradient(90deg, var(--accent-blue), #60a5fa); box-shadow: 0 0 8px rgba(59,130,246,0.3); }
.survival-bar-fill.discretionary { background: linear-gradient(90deg, var(--accent-pink), #f9a8d4); box-shadow: 0 0 8px rgba(236,72,153,0.3); }

.survival-cat-list {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--border);
}
.survival-cat-item {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.8rem; padding: 8px 12px;
    background: var(--bg-secondary); border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-blue);
    transition: background 0.2s;
}
.survival-cat-item:hover { background: var(--bg-card-hover); }
.survival-cat-item .cat-name { color: var(--text-primary); }
.survival-cat-item .cat-amount {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-blue); font-size: 0.8rem;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 9px 18px; border: none; border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; letter-spacing: 0.01em;
}
.btn-primary {
    background: var(--accent-purple);
    color: white;
    box-shadow: 0 0 0 rgba(139,92,246,0);
}
.btn-primary:hover {
    background: #9d6ffa;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(139,92,246,0.35);
}
.btn-secondary {
    background: var(--bg-secondary); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent-purple); color: var(--text-primary); }
.btn-outline {
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent-purple); color: var(--text-primary); }
.btn-danger {
    background: var(--accent-red-dim); color: var(--accent-red);
    border: 1px solid transparent;
}
.btn-danger:hover { border-color: var(--accent-red); }
.btn-small {
    padding: 7px 14px; font-size: 0.78rem;
    background: var(--accent-purple); color: white;
    border: none; border-radius: var(--radius-sm); cursor: pointer;
    transition: all 0.2s;
}
.btn-small:hover {
    background: #9d6ffa;
    box-shadow: 0 0 16px rgba(139,92,246,0.3);
}
.btn-full { width: 100%; padding: 13px; font-size: 0.95rem; margin-top: 12px; }

/* ===== FILTERS ===== */
.filters-row { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-select, .filter-input {
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif; font-size: 0.82rem; flex: 1;
    transition: border-color 0.2s;
}
.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}

/* ===== TRANSACTION LIST ===== */
.transaction-list { max-height: 550px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

.tx-item {
    display: flex; align-items: center; padding: 12px 15px;
    background: var(--bg-secondary); border-radius: var(--radius-sm);
    gap: 14px; transition: background 0.15s, transform 0.15s;
    cursor: default; border: 1px solid transparent;
}
.tx-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(139,92,246,0.1);
    transform: translateX(2px);
}
.tx-item.tx-hidden { opacity: 0.35; border-left: 3px solid var(--text-muted); }
.tx-item.is-essential { border-left: 3px solid var(--accent-blue); }

.tx-cat-badge {
    font-size: 0.68rem; padding: 4px 10px; border-radius: 12px;
    background: var(--bg-card); color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    border: 1px solid transparent;
}
.tx-cat-badge:hover { border-color: var(--accent-purple); color: var(--text-primary); }

.tx-details { flex: 1; min-width: 0; }
.tx-desc { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.tx-date { font-size: 0.72rem; color: var(--text-muted); }
.tx-amount { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 0.92rem; flex-shrink: 0; }
.tx-amount.income { color: var(--accent-green); }
.tx-amount.expense { color: var(--accent-red); }

.tx-actions { display: flex; gap: 8px; }
.tx-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1rem; padding: 4px;
    opacity: 0; transition: opacity 0.15s, transform 0.15s;
}
.tx-item:hover .tx-btn { opacity: 1; }
.tx-btn:hover { color: var(--accent-red); transform: scale(1.15); }
.tx-btn.tx-essential { opacity: 0.3; transition: all 0.15s; }
.tx-btn.tx-essential.active { opacity: 1; color: var(--accent-blue); text-shadow: 0 0 10px rgba(59,130,246,0.5); }
.tx-btn.tx-essential:hover { opacity: 1; transform: scale(1.2); }
.tx-essential-badge {
    font-size: 0.62rem; padding: 3px 8px; border-radius: 10px;
    background: var(--accent-blue-dim); color: var(--accent-blue);
    font-weight: 600; letter-spacing: 0.3px; white-space: nowrap;
}
.tx-delete { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 4px; }
.tx-delete:hover { color: var(--accent-red); }

/* ===== BILL DELETE BUTTONS ===== */
.bill-item { position: relative; }
.bill-delete-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1rem; padding: 6px;
    opacity: 0; transition: opacity 0.2s, color 0.2s; margin-left: 8px;
}
.bill-item:hover .bill-delete-btn { opacity: 1; }
.bill-delete-btn:hover { color: var(--accent-red); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty-icon { font-size: 3.5rem; display: block; margin-bottom: 14px; }
.empty-sub { font-size: 0.85rem; margin-top: 8px; }
.empty-state-small { text-align: center; padding: 35px; color: var(--text-muted); font-size: 0.88rem; }

/* ===== CATEGORY BARS ===== */
.category-bars { display: flex; flex-direction: column; gap: 14px; max-height: 450px; overflow-y: auto; }
.cat-bar-item { display: flex; flex-direction: column; gap: 7px; }
.cat-bar-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.83rem; }
.cat-bar-name { color: var(--text-primary); font-weight: 500; }
.cat-bar-amount { font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); font-size: 0.78rem; }
.cat-bar-track { height: 9px; background: var(--bg-secondary); border-radius: 5px; overflow: hidden; }
.cat-bar-fill {
    height: 100%; border-radius: 5px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
}
.cat-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: bar-shimmer 3s ease-in-out infinite;
}
@keyframes bar-shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* ===== AFFORD CALCULATOR ===== */
.afford-calculator { display: flex; flex-direction: column; gap: 14px; }
.afford-context {
    font-size: 0.78rem; color: var(--text-muted); padding: 10px 14px;
    background: var(--bg-secondary); border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    border-left: 2px solid var(--accent-purple);
}
.afford-input-row { display: flex; gap: 10px; }
.afford-input {
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif; font-size: 0.9rem; flex: 1;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.afford-input.amount { max-width: 130px; }
.afford-input:focus {
    outline: none; border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}
.afford-result {
    padding: 16px; border-radius: var(--radius-sm); font-size: 0.9rem;
    display: none; font-weight: 500; text-align: center; line-height: 1.6;
    animation: result-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes result-pop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.afford-result.yes { background: var(--accent-green-dim); color: var(--accent-green); display: block; border: 1px solid rgba(34,197,94,0.2); }
.afford-result.no { background: var(--accent-red-dim); color: var(--accent-red); display: block; border: 1px solid rgba(239,68,68,0.2); }
.afford-result.maybe { background: var(--accent-amber-dim); color: var(--accent-amber); display: block; border: 1px solid rgba(245,158,11,0.2); }

/* ===== SETTINGS ===== */
.settings-grid { display: flex; flex-direction: column; gap: 16px; }
.setting-item label { display: block; font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.setting-input-row { display: flex; align-items: center; gap: 10px; }
.currency-prefix { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.setting-input {
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; flex: 1; width: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.setting-input:focus {
    outline: none; border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center;
    z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 500px;
    box-shadow: var(--shadow), 0 0 60px rgba(139,92,246,0.1);
    max-height: 90vh; overflow-y: auto;
    animation: modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-wide { max-width: 750px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 0; }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.6rem; cursor: pointer; padding: 0; line-height: 1; transition: color 0.2s; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-hint { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 18px; }

.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat-option {
    padding: 12px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.83rem; transition: all 0.15s; text-align: center;
}
.cat-option:hover { border-color: var(--accent-purple); background: var(--bg-card-hover); }
.cat-option.active { border-color: var(--accent-purple); background: rgba(139,92,246,0.12); }

.form-group { margin-bottom: 16px; flex: 1; }
.form-group label { display: block; font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.form-input {
    width: 100%; background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif; font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none; border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}
.form-row { display: flex; gap: 14px; }
.checkbox-group { display: flex; align-items: center; gap: 10px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent-purple); }
.checkbox-group label { margin-bottom: 0; cursor: pointer; text-transform: none; font-size: 0.9rem; }

.csv-preview {
    background: var(--bg-secondary); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 18px; max-height: 220px; overflow: auto;
    font-family: 'JetBrains Mono', monospace; font-size: 0.73rem;
    color: var(--text-secondary); white-space: pre; line-height: 1.7;
    border: 1px solid var(--border);
}
.csv-mapping { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.csv-mapping .form-group { margin-bottom: 0; }

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

/* SVG gradient definition for ring */
.svg-defs { position: absolute; width: 0; height: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .cycle-banner { flex-direction: column; text-align: center; }
    .cycle-quick-stats { min-width: 0; width: 100%; grid-template-columns: repeat(2, 1fr); }
    .cqs-item:last-child { grid-column: span 2; }
    .insights-row { grid-template-columns: 1fr; }
    .main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .app { padding: 14px; }
    .header h1 { font-size: 1.5rem; }
    .filters-row { flex-direction: column; }
    .afford-input-row { flex-direction: column; }
    .afford-input.amount { max-width: none; }
    .form-row { flex-direction: column; }
    .csv-mapping { grid-template-columns: 1fr; }
    .panel-actions { flex-wrap: wrap; }
    .category-grid { grid-template-columns: 1fr; }
    .cycle-quick-stats { grid-template-columns: 1fr 1fr; }
    .cqs-item:last-child { grid-column: span 2; }
}
