/* ========================================
   FlowFi — Smart Budget Planner
   Design System & Global Styles
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a12;
    --bg-secondary: #12121e;
    --bg-card: rgba(20, 20, 35, 0.7);
    --bg-card-hover: rgba(30, 30, 50, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.06);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;

    /* Accent Colors */
    --accent-indigo: #6366f1;
    --accent-indigo-light: #818cf8;
    --accent-violet: #8b5cf6;
    --accent-purple: #a78bfa;
    --accent-emerald: #34d399;
    --accent-emerald-dark: #059669;
    --accent-rose: #f43f5e;
    --accent-rose-light: #fb7185;
    --accent-amber: #f59e0b;
    --accent-amber-light: #fbbf24;
    --accent-sky: #38bdf8;
    --accent-teal: #2dd4bf;
    --accent-pink: #ec4899;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-income: linear-gradient(135deg, #059669, #34d399);
    --gradient-expense: linear-gradient(135deg, #e11d48, #f43f5e);
    --gradient-allocated: linear-gradient(135deg, #6366f1, #a78bfa);
    --gradient-remaining: linear-gradient(135deg, #0284c7, #38bdf8);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow-indigo: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-glow-emerald: 0 0 20px rgba(52, 211, 153, 0.15);
    --shadow-glow-rose: 0 0 20px rgba(244, 63, 94, 0.15);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 72px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* ========================================
   Ambient Background
   ======================================== */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    animation: blobFloat 20s infinite ease-in-out;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-indigo);
    top: -10%;
    left: -5%;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-violet);
    top: 50%;
    right: -10%;
    animation-delay: -7s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: var(--accent-emerald);
    bottom: -10%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ========================================
   App Layout
   ======================================== */
#app {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: rgba(12, 12, 22, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    transition: transform var(--transition-slow);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-indigo-light);
    box-shadow: var(--shadow-glow-indigo);
}

.nav-item.active svg {
    stroke: var(--accent-indigo-light);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.sidebar-footer .nav-item:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 0 32px 32px;
    min-height: 100vh;
}

/* ========================================
   Header
   ======================================== */
.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 18, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin: 0 -32px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 6px 8px;
}

.month-nav {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.month-nav:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.current-month {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

/* ========================================
   Views
   ======================================== */
.view {
    display: none;
    padding-top: 28px;
    animation: fadeSlideIn 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.view-actions {
    display: flex;
    gap: 10px;
}

/* ========================================
   Stats Grid (Dashboard)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-income::before { background: var(--gradient-income); }
.stat-bills::before { background: var(--gradient-expense); }
.stat-allocated::before { background: var(--gradient-allocated); }
.stat-remaining::before { background: var(--gradient-remaining); }

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-income .stat-icon {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-emerald);
}
.stat-bills .stat-icon {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
}
.stat-allocated .stat-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-indigo-light);
}
.stat-remaining .stat-icon {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-sky);
}

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

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Dashboard Grid
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.2);
    box-shadow: var(--shadow-glow-rose);
}

.btn-success {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.btn-success:hover {
    background: rgba(52, 211, 153, 0.2);
    box-shadow: var(--shadow-glow-emerald);
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state.large {
    padding: 80px 20px;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 0.8rem;
}

/* ========================================
   Donut Chart
   ======================================== */
.donut-chart-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.donut-percent {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.donut-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========================================
   Allocation Summary
   ======================================== */
.allocation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.alloc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.alloc-item:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.alloc-color {
    width: 8px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

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

.alloc-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alloc-amount {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.alloc-pct {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-indigo-light);
    white-space: nowrap;
}

/* ========================================
   Upcoming Bills
   ======================================== */
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.upcoming-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.upcoming-item:hover {
    border-color: var(--border-hover);
}

.upcoming-date {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.upcoming-date .day {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-indigo-light);
    line-height: 1;
}

.upcoming-date .month {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

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

.upcoming-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.upcoming-amount {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-rose-light);
    white-space: nowrap;
}

/* ========================================
   Cash Flow
   ======================================== */
.cashflow-bar-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.cashflow-bar {
    height: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.cashflow-income,
.cashflow-expense {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 0;
}

.cashflow-income {
    background: var(--gradient-income);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

.cashflow-expense {
    background: var(--gradient-expense);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
}

.cashflow-labels {
    display: flex;
    justify-content: space-between;
}

.cashflow-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cashflow-label strong {
    color: var(--text-primary);
    font-weight: 700;
}

.cashflow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.income-dot { background: var(--accent-emerald); }
.expense-dot { background: var(--accent-rose); }

/* ========================================
   Items List (Income / Bills)
   ======================================== */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    animation: fadeSlideIn 0.3s ease;
}

.item-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.item-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.3rem;
    flex-shrink: 0;
}

.item-icon.income-icon {
    background: rgba(52, 211, 153, 0.1);
}

.item-icon.bill-icon {
    background: rgba(244, 63, 94, 0.1);
}

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

.item-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
    display: flex;
    gap: 12px;
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-amount {
    font-size: 1.1rem;
    font-weight: 800;
    white-space: nowrap;
}

.item-amount.income-amount {
    color: var(--accent-emerald);
}

.item-amount.bill-amount {
    color: var(--accent-rose-light);
}

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

.item-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.item-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
    color: var(--text-secondary);
}

.item-action-btn.delete:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
}

/* ========================================
   Allocation View
   ======================================== */
.allocation-overview {
    margin-bottom: 24px;
}

.alloc-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.alloc-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.alloc-progress-header span:first-child {
    font-size: 0.9rem;
    font-weight: 600;
}

.alloc-progress-pct {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-indigo-light);
}

.alloc-progress-bar {
    height: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.alloc-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
    width: 0%;
}

.alloc-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.allocation-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.alloc-category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-base);
    animation: fadeSlideIn 0.3s ease;
}

.alloc-category-card:hover {
    border-color: var(--border-hover);
}

.alloc-cat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.alloc-cat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
}

.alloc-cat-title {
    font-size: 0.9rem;
    font-weight: 600;
    flex: 1;
}

.alloc-cat-amount {
    font-size: 1rem;
    font-weight: 800;
}

.alloc-cat-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 10px;
}

.alloc-cat-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.alloc-cat-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.alloc-cat-bills {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alloc-bill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
}

.alloc-bill-row .name {
    color: var(--text-secondary);
}

.alloc-bill-row .amount {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Calendar View
   ======================================== */
.calendar-grid-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

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

.calendar-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
}

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

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 7px 5px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
}

.cal-day-number { align-self: center; }

.cal-day:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.cal-day.other-month {
    color: var(--text-muted);
    opacity: 0.4;
}

.cal-day.today {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-indigo-light);
    font-weight: 700;
}

.cal-day.selected {
    background: var(--accent-indigo);
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow-glow-indigo);
}

.cal-day .cal-dots {
    display: flex;
    justify-content: center;
    gap: 3px;
    height: 6px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.cal-dot.income { background: var(--accent-emerald); }
.cal-dot.bill { background: var(--accent-rose); }
.cal-note-previews { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; min-width: 0; }
.cal-note-preview,
.cal-note-more { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.cal-note-preview { color: var(--accent-indigo-light); font-size: 0.62rem; font-weight: 650; }
.cal-note-more { color: var(--text-muted); font-size: 0.56rem; }
.cal-day.selected .cal-note-preview,
.cal-day.selected .cal-note-more { color: rgba(255, 255, 255, 0.9); }

.calendar-events {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.calendar-events h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.event-type-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.event-type-dot.income { background: var(--accent-emerald); }
.event-type-dot.bill { background: var(--accent-rose); }

.event-info {
    flex: 1;
}

.event-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.event-type-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.event-amount {
    font-weight: 700;
    font-size: 0.9rem;
}

.event-amount.income { color: var(--accent-emerald); }
.event-amount.bill { color: var(--accent-rose-light); }

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

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

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

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

/* Form Styles */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-indigo) 14%, transparent);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%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: 40px;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ========================================
   Toast
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s ease;
    min-width: 280px;
    max-width: 400px;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast.success { border-left: 3px solid var(--accent-emerald); }
.toast.error { border-left: 3px solid var(--accent-rose); }
.toast.info { border-left: 3px solid var(--accent-indigo); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .allocation-categories {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 0 16px 16px;
    }

    .top-header {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .month-selector {
        padding: 4px 6px;
    }

    .current-month {
        font-size: 0.8rem;
        min-width: 110px;
    }

    .page-subtitle {
        display: none;
    }
}

/* ========================================
   Utilities
   ======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Category colors mapping */
.cat-color-housing { background: #6366f1; }
.cat-color-utilities { background: #38bdf8; }
.cat-color-food { background: #f59e0b; }
.cat-color-transport { background: #a78bfa; }
.cat-color-insurance { background: #ec4899; }
.cat-color-entertainment { background: #f43f5e; }
.cat-color-health { background: #34d399; }
.cat-color-education { background: #2dd4bf; }
.cat-color-savings { background: #059669; }
.cat-color-subscriptions { background: #818cf8; }
.cat-color-personal { background: #fbbf24; }
.cat-color-other { background: #8888a0; }

/* Bill paid status */
.item-card.paid {
    opacity: 0.6;
}

.item-card.paid .item-name {
    text-decoration: line-through;
}

.paid-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.overdue-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ========================================
   Light Theme
   ======================================== */
[data-theme="light"] {
    --bg-primary: #f5f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(240, 240, 248, 0.9);
    --bg-glass: rgba(0, 0, 0, 0.02);
    --bg-input: rgba(0, 0, 0, 0.04);

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #1a1a2e;
    --text-secondary: #6b6b80;
    --text-muted: #9999aa;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .top-header {
    background: rgba(245, 245, 249, 0.85);
}

[data-theme="light"] .blob {
    opacity: 0.06;
}

[data-theme="light"] .nav-item.active {
    background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .form-select option {
    background: #ffffff;
    color: #1a1a2e;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Accent Color Themes
   ======================================== */
[data-accent="rose"] {
    --accent-indigo: #f43f5e;
    --accent-indigo-light: #fb7185;
    --gradient-primary: linear-gradient(135deg, #e11d48, #f43f5e);
    --gradient-allocated: linear-gradient(135deg, #f43f5e, #fda4af);
    --shadow-glow-indigo: 0 0 20px rgba(244, 63, 94, 0.15);
    --border-focus: rgba(244, 63, 94, 0.5);
}

[data-accent="emerald"] {
    --accent-indigo: #059669;
    --accent-indigo-light: #34d399;
    --gradient-primary: linear-gradient(135deg, #059669, #34d399);
    --gradient-allocated: linear-gradient(135deg, #059669, #6ee7b7);
    --shadow-glow-indigo: 0 0 20px rgba(52, 211, 153, 0.15);
    --border-focus: rgba(52, 211, 153, 0.5);
}

[data-accent="sky"] {
    --accent-indigo: #0284c7;
    --accent-indigo-light: #38bdf8;
    --gradient-primary: linear-gradient(135deg, #0284c7, #38bdf8);
    --gradient-allocated: linear-gradient(135deg, #0284c7, #7dd3fc);
    --shadow-glow-indigo: 0 0 20px rgba(56, 189, 248, 0.15);
    --border-focus: rgba(56, 189, 248, 0.5);
}

[data-accent="pink"] {
    --accent-indigo: #db2777;
    --accent-indigo-light: #ec4899;
    --gradient-primary: linear-gradient(135deg, #db2777, #f472b6);
    --gradient-allocated: linear-gradient(135deg, #ec4899, #f9a8d4);
    --shadow-glow-indigo: 0 0 20px rgba(236, 72, 153, 0.15);
    --border-focus: rgba(236, 72, 153, 0.5);
}

/* ========================================
   Settings View
   ======================================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.settings-section:hover {
    border-color: var(--border-hover);
    box-shadow: none;
}

.settings-section-header svg { color: var(--accent-indigo-light); }

.feedback-form {
    display: grid;
    gap: 12px;
}

.feedback-form .form-group { margin: 0; }
.feedback-form textarea.form-input { height: 100px; min-height: 88px; max-height: 160px; overflow-y: auto; resize: none; line-height: 1.5; }
.feedback-form .btn { justify-self: start; }
.feedback-form .btn:disabled { opacity: 0.65; cursor: wait; }
.feedback-help { color: var(--text-secondary); font-size: 0.76rem; line-height: 1.5; }
.feedback-status { min-height: 1.2em; color: var(--accent-indigo-light); font-size: 0.8rem; }
.cloud-section { grid-column: 1 / -1; }
.cloud-config-alert { margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-md); color: var(--text-secondary); background: var(--bg-glass); border: 1px solid var(--border); font-size: 0.8rem; line-height: 1.5; }
.cloud-status { min-height: 1.2em; margin: 12px 0; color: var(--accent-indigo-light); font-size: 0.82rem; }
.cloud-last-synced { margin: -6px 0 12px; color: var(--text-secondary); font-size: 0.75rem; }
.cloud-user-label { margin: 10px 0 14px; color: var(--text-primary); font-size: 0.9rem; }
.cloud-consent { display: flex; align-items: flex-start; gap: 9px; color: var(--text-secondary); font-size: 0.76rem; line-height: 1.45; }
.cloud-consent input { margin-top: 2px; accent-color: var(--accent-indigo); }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.text-button { margin-top: 10px; padding: 4px 0; border: 0; color: var(--accent-indigo-light); background: transparent; font: inherit; font-size: 0.78rem; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.cloud-section [hidden] { display: none !important; }

/* Money amounts are entered directly; keep stepper arrows only for dates and day numbers. */
input.money-input { -moz-appearance: textfield; appearance: textfield; }
input.money-input::-webkit-inner-spin-button,
input.money-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.income-icon {
    color: #b2c09d;
    font-size: 0.95rem;
    font-weight: 700;
}

.income-icon span {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid rgba(165, 179, 143, 0.3);
    border-radius: 8px;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.settings-section-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-item:first-of-type {
    padding-top: 0;
}

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

.setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
    flex-shrink: 0;
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-secondary);
}

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

.theme-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* Accent Color Picker */
.accent-picker {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.accent-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--swatch);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    padding: 0;
}

.accent-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px color-mix(in srgb, var(--swatch) 40%, transparent);
}

.accent-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--bg-primary), 0 0 0 5px var(--swatch);
}

.accent-swatch.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all var(--transition-base);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient-primary);
    border-color: transparent;
}

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

/* Settings select */
.setting-select {
    max-width: 280px;
    flex-shrink: 0;
}

/* Theme transition animation */
body {
    transition: background-color 0.4s ease, color 0.3s ease;
}

.sidebar,
.top-header,
.card,
.stat-card,
.settings-section,
.alloc-progress-card,
.calendar-grid-wrapper,
.calendar-events,
.modal {
    transition: background-color 0.4s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Monthly plan, goals, and allocation preview */
.monthly-plan-summary {
    margin-bottom: 24px;
    padding: 18px 22px;
}

.plan-ok,
.plan-warning {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.plan-ok strong { color: var(--accent-emerald); font-size: 1rem; }
.plan-warning strong { color: var(--accent-rose); font-size: 1rem; }
.plan-empty strong { color: var(--text-primary); font-size: 0.95rem; }
.plan-empty span { color: var(--text-secondary); font-size: 0.82rem; }
.plan-ok span,
.plan-warning span { color: var(--text-secondary); font-size: 0.82rem; }
.plan-empty { display: flex; flex-direction: column; gap: 5px; }

.allocation-results { margin-bottom: 24px; }
.allocation-results .card-header > span { color: var(--text-secondary); font-size: 0.75rem; }
.allocation-result-list { display: flex; flex-direction: column; gap: 8px; }
.allocation-result-row,
.allocation-result-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    font-size: 0.82rem;
}
.allocation-result-row small { display: block; color: var(--text-secondary); text-transform: capitalize; }
.allocation-result-row strong,
.allocation-result-total strong { white-space: nowrap; }
.allocation-result-row.savings { border-color: rgba(52, 211, 153, 0.2); }
.allocation-result-total { margin-top: 12px; border-color: var(--border-hover); font-weight: 700; }
.allocation-results .plan-warning { margin-bottom: 12px; padding: 12px; border-radius: var(--radius-sm); background: rgba(244, 63, 94, 0.08); }

.savings-goals-list { display: flex; flex-direction: column; gap: 16px; }
.goal-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px 14px; align-items: center; }
.goal-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.goal-info strong { overflow: hidden; text-overflow: ellipsis; }
.goal-info span { color: var(--text-secondary); font-size: 0.75rem; }
.goal-progress { grid-column: 1; height: 7px; border-radius: 99px; overflow: hidden; background: var(--bg-input); }
.goal-progress span { display: block; height: 100%; background: var(--gradient-income); border-radius: inherit; }
.goal-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.goal-actions > strong { margin-right: 2px; font-size: 0.75rem; }
.goal-actions .item-action-btn { width: 30px; height: 30px; font-size: 1rem; }
.goal-actions .item-action-btn.delete { font-size: 1.25rem; }
.savings-goals-card { min-width: 0; }
.modal-copy { color: var(--text-secondary); margin-bottom: 14px; line-height: 1.55; }

/* Calendar notes and actual monthly savings */
.cal-dot.note,
.event-type-dot.note { background: var(--accent-amber, #fbbf24); }
#btn-add-calendar-note:disabled { opacity: 0.5; cursor: not-allowed; }
.calendar-events h3 { margin-bottom: 16px; }
.note-event { align-items: flex-start; }
.note-event .event-info { flex: 1; min-width: 0; }
.event-note-text { margin-top: 4px; color: var(--text-secondary); font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-event .event-type-label { margin-top: 6px; }
.event-actions { display: flex; gap: 4px; margin-left: auto; }
.form-hint { display: block; margin-top: 6px; color: var(--text-secondary); font-size: 0.72rem; line-height: 1.45; }
.goal-row { grid-template-columns: minmax(0, 1fr) auto; }
.goal-monthly-line { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.goal-month-status { font-size: 0.75rem; font-weight: 650; }
.goal-month-status.pending { color: var(--accent-rose, #fb7185); }
.goal-month-status.done { color: var(--accent-emerald, #34d399); }
.goal-month-status.neutral { color: var(--text-secondary); font-weight: 500; }
.goal-monthly-line .btn { flex: 0 0 auto; }

@media (max-width: 600px) {
    .goal-monthly-line { align-items: flex-start; }
    .goal-monthly-line .goal-month-status { flex: 1 1 100%; }
    #btn-add-calendar-note { padding-inline: 11px; font-size: 0.76rem; }
}

/* Friendly first-use setup */
.welcome-card[hidden],
.sample-month-note[hidden],
.continue-setup[hidden] { display: none !important; }
.welcome-card { padding: 22px 24px; margin-bottom: 24px; }
.welcome-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.welcome-heading h2 { margin: 2px 0 6px; font-size: 1.2rem; }
.welcome-heading p:not(.eyebrow) { color: var(--text-secondary); font-size: 0.84rem; }
.eyebrow { color: var(--accent-indigo-light); font-size: 0.67rem; font-weight: 800; letter-spacing: 1px; }
.text-button { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.8rem; cursor: pointer; padding: 7px 9px; border-radius: var(--radius-sm); }
.text-button:hover { color: var(--text-primary); background: var(--bg-glass); }
.setup-progress { height: 7px; margin-top: 18px; border-radius: 99px; background: var(--bg-input); overflow: hidden; }
.setup-progress span { display: block; height: 100%; width: 0; background: var(--gradient-primary); border-radius: inherit; transition: width 250ms ease; }
.setup-progress-label { margin-top: 7px; color: var(--text-secondary); font-size: 0.72rem; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.setup-step { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; text-align: left; color: var(--text-primary); background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; font: inherit; transition: border-color var(--transition-fast), background var(--transition-fast); }
.setup-step:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.setup-step > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.setup-step strong { font-size: 0.78rem; }
.setup-step small { color: var(--text-secondary); font-size: 0.68rem; line-height: 1.35; }
.setup-step > b { color: var(--text-muted); font-size: 1.2rem; }
.setup-step-check { display: grid; width: 27px; height: 27px; place-items: center; flex: 0 0 27px; border-radius: 50%; color: var(--accent-indigo-light); background: rgba(99, 102, 241, 0.12); font-size: 0.75rem; font-weight: 800; }
.setup-step.complete .setup-step-check { color: var(--accent-emerald); background: rgba(52, 211, 153, 0.12); }
.welcome-actions { display: flex; align-items: center; gap: 10px; margin-top: 15px; }
.welcome-actions > span { color: var(--text-secondary); font-size: 0.72rem; }
.sample-month-note { margin: -10px 0 20px; padding: 10px 14px; color: var(--text-secondary); background: rgba(99, 102, 241, 0.08); border: 1px solid var(--border-focus); border-radius: var(--radius-md); font-size: 0.78rem; }
.continue-setup { margin: -12px 0 16px; }

/* Quick bill choices and undo actions */
.quick-bills { margin-bottom: 18px; }
.quick-bills > span { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; }
.quick-bills > div { display: flex; flex-wrap: wrap; gap: 7px; }
.quick-bills button { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-primary); background: var(--bg-glass); font: inherit; font-size: 0.75rem; cursor: pointer; }
.quick-bills button:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.form-hint { display: block; margin: 6px 0 0 24px; color: var(--text-secondary); font-size: 0.72rem; }
.check-label { display: flex; align-items: center; gap: 8px; }
.toast-action { flex: 0 0 auto; border: 0; background: transparent; color: var(--accent-indigo-light); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.toast-action:hover { text-decoration: underline; }
.toast { gap: 12px; }
.toast-message { flex: 1; }
.mobile-quick-add { display: none; }
.quick-add-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-add-options .btn { justify-content: center; min-height: 46px; }

@media (max-width: 600px) {
    .mobile-quick-add {
        position: fixed;
        right: 16px;
        bottom: max(18px, env(safe-area-inset-bottom));
        z-index: 80;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 12px 17px;
        border: 1px solid var(--border-hover);
        border-radius: var(--radius-full);
        color: #fff;
        background: var(--gradient-primary);
        box-shadow: var(--shadow-lg);
        font: inherit;
        font-size: 0.88rem;
        font-weight: 700;
        cursor: pointer;
    }
    .mobile-quick-add:hover { filter: brightness(1.06); }
    .calendar-grid-wrapper { padding: 12px 8px; }
    .calendar-grid { gap: 2px; }
    .calendar-weekdays { gap: 2px; }
    .calendar-weekdays span { font-size: 0.63rem; }
    .cal-day { min-height: 60px; padding: 6px 2px; gap: 3px; font-size: 0.76rem; }
    .cal-note-preview { font-size: 0.48rem; }
    .cal-note-more { display: none; }
    .quick-add-options { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .allocation-results .card-header { align-items: flex-start; flex-direction: column; gap: 6px; }
    .allocation-result-row { align-items: flex-start; flex-direction: column; gap: 4px; }
    .setup-steps { grid-template-columns: 1fr; }
    .welcome-card { padding: 18px; }
    .welcome-heading h2 { font-size: 1.05rem; }
    .welcome-actions { align-items: flex-start; flex-direction: column; }
}

/* Settings responsive */
@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .theme-switcher {
        width: 100%;
    }

    .theme-btn {
        flex: 1;
        justify-content: center;
    }

    .setting-select {
        max-width: 100%;
        width: 100%;
    }
}
