/* ========================================
   House Expense Management App
   Modern Dark Mode UI with Glassmorphism
   ======================================== */

/* CSS Variables */
:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-strong: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;

    /* Category Colors */
    --color-grocery: #22c55e;
    --color-grocery-bg: rgba(34, 197, 94, 0.15);
    --color-fuel: #f97316;
    --color-fuel-bg: rgba(249, 115, 22, 0.15);
    --color-eating: #a855f7;
    --color-eating-bg: rgba(168, 85, 247, 0.15);
    --color-shopping: #ec4899;
    --color-shopping-bg: rgba(236, 72, 153, 0.15);
    --color-other: #3b82f6;
    --color-other-bg: rgba(59, 130, 246, 0.15);

    /* Accent */
    --accent-primary: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);

    /* Danger */
    --danger: #ef4444;
    --danger-hover: #f87171;

    /* Success */
    --success: #22c55e;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --inner-glow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 20px 5px var(--accent-glow);
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
        transfrom: scale(1);
    }

    50% {
        background-position: 100% 50%;
        transform: scale(1.1);
    }

    100% {
        background-position: 0% 50%;
        transform: scale(1);
    }
}

@keyframes stagger-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Background Gradient Effect - Static for Performance */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* App Container */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-md);
    padding-bottom: var(--space-xl);
}

/* Header */
.header {
    text-align: center;
    padding: var(--space-xl) 0;
    animation: fadeInDown 0.8s var(--transition-normal);
}

.app-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
    filter: drop-shadow(0 2px 10px rgba(99, 102, 241, 0.3));
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* SmartFill Glow */
.smart-filled {
    border-color: var(--accent-primary) !important;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1)) !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3) !important;
    animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
    }

    to {
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
    }
}

/* Insight Card */
.insight-container {
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease 0.1s both;
}

.insight-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.insight-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.insight-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.insight-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Quick Add */
.quick-add-container {
    position: relative;
    margin-bottom: var(--space-md);
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    padding: 0 var(--space-sm);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.quick-add-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.quick-add-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: var(--space-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.quick-add-input:focus {
    outline: none;
}

.quick-add-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.quick-add-btn {
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.quick-add-btn:hover {
    transform: scale(1.1);
}

/* Dashboard Controls (Month Nav) */
.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* More subtle border */
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm), var(--inner-glow);
    animation: fadeInUp 0.5s ease both;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 3;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.month-display {
    position: relative;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#currentMonthLabel {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

#currentMonthLabel:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hidden-month-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    /* Sits on top of label */
}

/* Summary Section */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.summary-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* More subtle border */
    box-shadow: var(--shadow-sm), var(--inner-glow);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), 0 0 15px rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.summary-card:hover::before {
    opacity: 1;
}

.summary-card.total {
    border-color: rgba(99, 102, 241, 0.2);
}

.summary-card.total:hover {
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

.summary-card.month {
    border-color: rgba(236, 72, 153, 0.2);
}

.summary-card.month:hover {
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.5);
}

.summary-card.week {
    border-color: rgba(34, 197, 94, 0.2);
}

.summary-card.week:hover {
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.summary-card.today {
    border-color: rgba(249, 115, 22, 0.2);
}

.summary-card.today:hover {
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.2);
    border-color: rgba(249, 115, 22, 0.5);
}


.summary-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-date-input {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    width: 100%;
    margin-top: 2px;
    transition: color var(--transition-fast);
}

.summary-date-input:focus,
.summary-date-input:hover {
    outline: none;
    color: var(--text-primary);
}

/* Backup Section */
.backup-section {
    margin-bottom: var(--space-lg);
}

.backup-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.backup-btn {
    flex: 1;
    max-width: 180px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.backup-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.backup-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Add Expense Section */
.add-expense-section {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle border */
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    overflow: hidden;
    /* animation removed here, handling via JS for smoother toggle */
    box-shadow: var(--shadow-sm), var(--inner-glow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.backup-btn.export:hover {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.backup-btn.import:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.backup-icon {
    font-size: 1.1rem;
}

/* Add Expense & Filters Headers */
.section-header h2,
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.toggle-icon {
    color: var(--text-secondary);
    transition: transform var(--transition-normal);
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Expense Form */
.expense-form {
    padding: 0 var(--space-lg) var(--space-lg);
    display: grid;
    gap: var(--space-md);
    max-height: 2000px;
    /* Increased max-height significantly */
    overflow: hidden;
    transition: max-height var(--transition-slow), padding var(--transition-slow), opacity var(--transition-normal);
}

.expense-form.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

.form-group input,
.form-group select {
    background: rgba(0, 0, 0, 0.2);
    /* Darker input bg */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    /* Soft glow focus */
    background: rgba(0, 0, 0, 0.4);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Buttons */
.btn-add {
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    margin-top: var(--space-sm);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    filter: brightness(1.1);
}

.btn-add:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Ripple effect container handled via JS or CSS ::after trick (existing was ok, refined here) */
.btn-add::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn-add:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
    transition: 0s;
}

/* Filter Section */
.filter-section {
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease 0.3s both;
}

.filter-buttons {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-md);
    /* Increased padding for shadow clipping */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle border */
    border-radius: var(--radius-xl);
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Specific Active Colors - Overriding gradient for specific categories if active */
.filter-btn[data-filter="grocery"].active {
    background: var(--color-grocery);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.filter-btn[data-filter="fuel"].active {
    background: var(--color-fuel);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.filter-btn[data-filter="eating"].active {
    background: var(--color-eating);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.filter-btn[data-filter="shopping"].active {
    background: var(--color-shopping);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.filter-btn[data-filter="other"].active {
    background: var(--color-other);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Breakdown Section & Chart */
.breakdown-section {
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease 0.35s both;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.chart-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
    position: relative;
    padding: var(--space-md);
}

/* Dynamic Conic Gradient Chart */
.donut-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(var(--chart-gradient, #333 0% 100%));
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    animation: fadeScale 0.8s ease-out;
}

.donut-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    background: var(--bg-primary);
    /* Matches body background */
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.chart-total-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-total-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--space-sm);
}

.breakdown-item {
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.breakdown-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.08);
}

.breakdown-item.grocery {
    border-left: 3px solid var(--color-grocery);
}

.breakdown-item.fuel {
    border-left: 3px solid var(--color-fuel);
}

.breakdown-item.eating {
    border-left: 3px solid var(--color-eating);
}

.breakdown-item.shopping {
    border-left: 3px solid var(--color-shopping);
}

.breakdown-item.other {
    border-left: 3px solid var(--color-other);
}

/* Remove old left borders */
.breakdown-item.grocery,
.breakdown-item.fuel,
.breakdown-item.eating,
.breakdown-item.shopping,
.breakdown-item.other {
    border-left: none;
}

.breakdown-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}

.breakdown-value {
    font-size: 1rem;
    font-weight: 600;
    display: block;
}

.breakdown-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Expenses Section */
.expenses-section {
    animation: fadeInUp 0.6s ease 0.4s both;
}

.expenses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.sort-select {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Expenses List */
.expenses-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: none;
    overflow: visible;
    transition: max-height var(--transition-slow), opacity var(--transition-normal);
}

.expenses-list.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Expense Card */
.expense-card {
    background: var(--bg-secondary);
    /* Opaque background to hide delete button */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    opacity: 1;
    /* No animation - ensures immediate visibility */
}

.expense-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.expense-card.removing {
    opacity: 0;
    transform: translateX(-100%);
}

/* Category Badge */
.expense-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.expense-badge.grocery {
    background: var(--color-grocery-bg);
}

.expense-badge.fuel {
    background: var(--color-fuel-bg);
}

.expense-badge.eating {
    background: var(--color-eating-bg);
}

.expense-badge.shopping {
    background: var(--color-shopping-bg);
}

.expense-badge.other {
    background: var(--color-other-bg);
}

/* Expense Info */
.expense-info {
    flex: 1;
    min-width: 0;
}

.expense-description {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expense-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.expense-category {
    text-transform: capitalize;
}

/* Expense Amount & Actions */
.expense-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
}

.expense-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-actions {
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.expense-card:hover .expense-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.edit:hover {
    background: var(--accent-primary);
}

.action-btn.delete:hover {
    background: var(--danger);
}

.action-btn.view-receipt:hover {
    background: var(--color-other);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    display: none;
}

.empty-state.visible {
    display: block;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal.modal-small {
    max-width: 320px;
}

/* Camera Modal - Full Screen override */
.modal.modal-camera {
    max-width: 100% !important;
    width: 100%;
    height: 100%;
    max-height: 100vh !important;
    margin: 0;
    border-radius: 0;
    background: #000;
    border: none;
    overflow: hidden;
}

.camera-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Key for full screen feeling */
    display: block;
    transform: none;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 10;
}

.btn-capture {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    border: 4px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-capture:active {
    transform: scale(0.95);
}

.btn-camera-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
}

/* Receipt Upload Styles */
.receipt-section {
    margin-top: var(--space-xs);
}

.receipt-controls {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.btn-upload-file,
.btn-take-photo {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.btn-upload-file:hover,
.btn-take-photo:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.btn-take-photo {
    border-style: solid;
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.receipt-preview {
    position: relative;
    width: 100%;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    display: none;
}

.receipt-preview.has-image {
    display: block;
}

.receipt-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btn-remove-receipt {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--danger);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Receipt Link in List */
.btn-view-receipt {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-view-receipt:hover {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal .expense-form {
    padding: var(--space-lg);
    max-height: none;
}

.modal-message {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
}

/* Category Manager */
.category-manager {
    padding: var(--space-lg);
}

.add-cat-form {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-row {
    display: flex;
    gap: var(--space-sm);
}

.form-row input[type="text"] {
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-primary);
}

.form-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#newCatName {
    flex: 1;
}

#newCatIcon {
    width: 50px;
    text-align: center;
}

#newCatColor {
    width: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
}

.btn-small-add {
    flex: 1;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-small-add:hover {
    background: var(--accent-hover);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 300px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.cat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.cat-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cat-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
}

.badge-default {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-icon-delete {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-icon-delete:hover {
    opacity: 1;
}



.modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    padding: var(--space-md);
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    z-index: 5;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin: 0 calc(var(--space-lg) * -1) calc(var(--space-lg) * -1);
    /* Negative margin to span full width */
}

.btn-cancel,
.btn-save,
.btn-delete {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-save {
    background: var(--accent-primary);
    border: none;
    color: var(--text-primary);
}

.btn-save:hover {
    background: var(--accent-hover);
}

.btn-delete {
    background: var(--danger);
    border: none;
    color: var(--text-primary);
}

.btn-delete:hover {
    background: var(--danger-hover);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .app-container {
        padding: var(--space-sm);
    }

    .summary-section {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    .summary-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-sm);
    }

    .summary-icon {
        font-size: 1.2rem;
    }

    .summary-value {
        font-size: 0.95rem;
    }

    .breakdown-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .expense-card {
        padding: var(--space-sm);
    }

    .expense-badge {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .expense-actions {
        opacity: 1;
    }
}

@media (max-width: 360px) {
    .summary-section {
        grid-template-columns: 1fr;
    }

    .summary-card {
        flex-direction: row;
    }

    .breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .expense-actions {
        opacity: 1;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }
}

/* Dark Mode Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.expense-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-right: var(--space-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform var(--transition-fast);
}


/* OCR Scanning Overlay */
.scan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.scan-overlay.active {
    opacity: 1;
    visibility: visible;
}

.scan-content {
    background: var(--bg-secondary);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.2);
}

.scan-content h3 {
    margin: var(--space-md) 0 var(--space-xs);
    color: var(--text-primary);
}

.scan-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.scan-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.expense-thumbnail:hover {
    transform: scale(1.1);
    border-color: var(--accent-primary);
}

/* Expense Details Modal */
.expense-details-content {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.detail-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.detail-value.text-large {
    font-size: 1.1rem;
    font-weight: 500;
}

.detail-value.highlight {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.details-row {
    display: flex;
    gap: var(--space-lg);
}

.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    font-weight: 500;
}

.receipt-display {
    margin-top: var(--space-xs);
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 300px;
    text-align: center;
}

.receipt-display img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

/* Make rows clickable */
.expense-card {
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.expense-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================
   Mobile Optimization
   ========================================== */
@media (max-width: 480px) {

    /* 1. Horizontal Scroll Snap for Summaries */
    .summary-section {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: var(--space-md);
        gap: var(--space-md);
        margin-right: calc(var(--space-md) * -1);
        /* Bleed out */
        padding-right: var(--space-md);
        /* Peak next card */
        /* Hide scrollbar but allow functionality */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .summary-section::-webkit-scrollbar {
        display: none;
    }

    .summary-card {
        min-width: 85%;
        /* SHow most of cur card + bit of next */
        scroll-snap-align: center;
        flex-direction: row;
        /* Keep row layout inside card */
        justify-content: flex-start;
        text-align: left;
        margin: 0;
    }

    /* 1.5 Breakdown List View on Mobile */
    .breakdown-grid {
        grid-template-columns: 1fr;
        /* Single column list */
        gap: var(--space-sm);
    }

    .breakdown-item {
        flex-direction: column;
        /* Keep column but use width */
        align-items: flex-start;
        /* Align left */
        text-align: left;
        padding: var(--space-sm) var(--space-md);
        position: relative;
        min-height: 60px;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .breakdown-content-top {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        width: 100%;
        margin-bottom: 2px;
    }

    .breakdown-content-middle {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .breakdown-value {
        font-size: 1.1rem;
        /* Larger value */
        position: absolute;
        right: var(--space-md);
        top: 50%;
        transform: translateY(-50%);
    }

    .breakdown-dot {
        display: none;
        /* Icon is enough */
    }

    .breakdown-label {
        font-weight: 500;
        font-size: 0.9rem;
        color: var(--text-primary);
    }

    /* Progress Bar */
    .breakdown-progress-container {
        width: 100%;
        height: 4px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
        margin-top: 6px;
        overflow: hidden;
    }

    .breakdown-progress-bar {
        height: 100%;
        border-radius: 2px;
    }

    /* 2. Bottom Sheet Modals */
    .modal-overlay {
        align-items: flex-end;
        /* Align to bottom */
        padding: 0;
    }

    .modal {
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        /* Round top corners only */
        transform: translateY(100%);
        transition: transform var(--transition-normal);
        max-height: 85vh;
        /* Less than full height */
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }

    .modal-header {
        padding-top: var(--space-lg);
    }

    /* 3. Touch Friendly Targets */
    .btn-add,
    .filter-btn,
    .modal-close,
    .action-btn {
        min-height: 44px;
        /* Standard touch target */
        min-width: 44px;
    }

    .form-group input,
    .form-group select {
        padding: 12px 16px;
        /* Larger hit area */
        font-size: 16px;
        /* Prevent IOS zoom */
    }

    /* Adjust expense list opacity for touch (no hover needed) */
    .expense-actions {
        opacity: 1;
        /* Always visible on mobile */
    }

    .expense-card {
        padding: var(--space-md) var(--space-sm);
    }
}

/* ==========================================
   PWA Install Styles
   ========================================== */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    width: 90%;
    max-width: 400px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none;
    /* JS will toggle flex */
}

.install-banner.show {
    display: block;
    transform: translateX(-50%) translateY(0);
}

.install-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    position: relative;
}

.install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.install-text h3 {
    font-size: 1rem;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.install-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-install {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: auto;
}

.close-install {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* iOS Modal */
.ios-modal {
    text-align: center;
    max-width: 320px;
}

.ios-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.ios-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ios-content ol {
    text-align: left;
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.ios-content li {
    margin-bottom: 8px;
}

.ios-share-icon,
.ios-plus-icon {
    font-size: 1.2rem;
    vertical-align: middle;
}

/* ==========================================
   Collapsible Sections
   ========================================== */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toggle-icon {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.collapsible-header.open .toggle-icon {
    transform: rotate(180deg);
}

.expenses-list {
    max-height: none;
    overflow: visible;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.expenses-list.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* Transaction Count Badge */
.txn-count-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    opacity: 0.8;
}

/* Load More */
.load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    margin-top: 4px;
}

.load-more-btn {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 10px 28px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.load-more-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.load-more-count {
    font-weight: 400;
    opacity: 0.8;
    font-size: 0.8rem;
}

.show-all-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 12px;
    transition: color var(--transition-fast);
    font-family: inherit;
}

.show-all-btn:hover {
    color: var(--accent-primary);
}

/* ==========================================
   Search Bar
   ========================================== */
.search-container {
    margin-bottom: var(--space-md);
}

.search-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

/* ==========================================
   Floating Action Button (FAB)
   ========================================== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .fab {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

/* ==========================================
   Theme Toggle
   ========================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: rotate(20deg);
    background: var(--bg-tertiary);
}

/* Light Theme */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: rgba(30, 41, 59, 0.15);
}

body.light-theme .app-container {
    background: linear-gradient(135deg, #e0e7ff 0%, #f0abfc 50%, #fef3c7 100%);
    background-size: 400% 400%;
}

body.light-theme .glass-card,
body.light-theme .summary-card,
body.light-theme .modal,
body.light-theme .expense-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(30, 41, 59, 0.1);
}

body.light-theme .search-input,
body.light-theme .form-input,
body.light-theme select,
body.light-theme input {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ==========================================
   Budget Limits
   ========================================== */
.budget-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.budget-bar-container {
    margin-top: 4px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.budget-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.budget-warning {
    color: #f97316;
    font-size: 0.75rem;
    margin-top: 2px;
}

.budget-exceeded {
    color: #ef4444;
}

/* ==========================================
   Recurring Expenses
   ========================================== */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.recurring-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 5px;
}

/* ==========================================
   Split Expenses
   ========================================== */
.split-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.split-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.split-input.hidden {
    display: none;
}

.split-badge {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* ==========================================
   Spending Trends Chart
   ========================================== */
.trends-section {
    margin-bottom: var(--space-xl);
}

.trends-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 15px;
}

.trend-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
    overflow: visible;
}

.trend-bar-wrapper {
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    position: relative;
    overflow: visible;
}

.trend-bar {
    width: 100%;
    max-width: 40px;
    background: var(--accent-gradient);
    border-radius: 0 0 0 0;
    transition: height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 -4px 15px rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.trend-bar-projected+.trend-bar {
    border-radius: 0;
}

.trend-bar:hover {
    filter: brightness(1.2);
}

.trend-bar-current {
    box-shadow: 0 -4px 20px rgba(99, 102, 241, 0.35);
}

.trend-bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.trend-bar-projected {
    width: 100%;
    max-width: 40px;
    background: rgba(99, 102, 241, 0.12);
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
}

.trend-proj-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-primary);
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.trend-bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

.trend-today-dot {
    font-size: 0.5rem;
    color: var(--accent-primary);
    line-height: 1;
    margin-top: -2px;
}

/* ==========================================
   Swipe to Delete
   ========================================== */
.expense-item-wrapper {
    position: relative;
    margin-bottom: var(--space-md);
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.swipe-delete-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 100%;
    background: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    cursor: pointer;
}

.expense-card {
    position: relative;
    z-index: 2;
    margin-bottom: 0 !important;
    /* Managed by wrapper */
    transition: transform 0.3s ease;
    touch-action: pan-y;
    background: var(--bg-secondary) !important;
    /* Ensure opaque background */
}

.expense-card.swiped {
    transform: translateX(-80px);
}

/* Missing Keyframes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes stagger-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Income Feature Styles
   ======================================== */

/* Summary Cards */
.summary-card.income {
    border-color: rgba(34, 197, 94, 0.2);
}

.summary-card.income:hover {
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.summary-card.balance {
    border-color: rgba(59, 130, 246, 0.2);
}

.summary-card.balance:hover {
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Transaction List Items */
.transaction-item.income {
    border-left: 4px solid var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.transaction-item.income .amount {
    color: var(--success);
}

.transaction-item.expense {
    border-left: 4px solid var(--accent-primary);
    /* Default accent or category color usually handles this, but explicit is good */
}

/* Transaction Type Toggle */
.form-type-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    gap: 4px;
}

.type-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}

.type-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.type-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#btnTypeExpense.active {
    background: rgba(239, 68, 68, 0.15);
    /* Red tint */
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

#btnTypeIncome.active {
    background: rgba(34, 197, 94, 0.15);
    /* Green tint */
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Hide/Show logic specific classes if needed, 
   but we use standard .hidden usually */

/* ==========================================
   Sync Indicator
   ========================================== */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sync-indicator:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.sync-indicator.syncing .sync-dot {
    animation: pulse 1s infinite;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.sync-dot.error {
    background: var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.sync-text {
    white-space: nowrap;
}

/* ==========================================
   Monthly Comparison
   ========================================== */
.comparison-section {
    margin-bottom: var(--space-xl);
    animation: fadeInUp 0.6s ease 0.32s both;
}

.comparison-container {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.comparison-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-cat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.comparison-values {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.comparison-val {
    text-align: right;
    min-width: 70px;
    font-weight: 500;
    font-size: 0.9rem;
}

.comparison-change {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.comparison-change.up {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.comparison-change.down {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.comparison-change.same {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================
   Savings Goals
   ========================================== */
.goals-section {
    margin-bottom: var(--space-xl);
    animation: fadeInUp 0.6s ease 0.38s both;
}

.goals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.goals-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.goal-card {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: transform var(--transition-fast);
}

.goal-card:hover {
    transform: translateY(-2px);
}

.goal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.goal-name {
    font-weight: 600;
    font-size: 1rem;
}

.goal-amount {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.goal-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent-gradient);
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.goal-progress-fill.complete {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.goal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.goal-actions {
    display: flex;
    gap: var(--space-xs);
}

.goal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.goal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.goal-btn.add-funds {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

/* ==========================================
   Recurring Management
   ========================================== */
.recurring-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

.recurring-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recurring-item.inactive {
    opacity: 0.5;
}

.recurring-info {
    flex: 1;
}

.recurring-desc {
    font-weight: 500;
    margin-bottom: 4px;
}

.recurring-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.recurring-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.recurring-toggle {
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 11px;
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast);
}

.recurring-toggle.active {
    background: var(--success);
}

.recurring-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.recurring-toggle.active::after {
    transform: translateX(18px);
}

/* ==========================================
   Settings
   ========================================== */
.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.member-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
}

.member-remove:hover {
    color: var(--danger);
}

/* ==========================================
   Receipt Gallery
   ========================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform var(--transition-fast);
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--accent-primary);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 4px 6px;
    font-size: 0.65rem;
    color: white;
}

/* ==========================================
   Print Report
   ========================================== */
.report-section {
    margin-bottom: var(--space-lg);
}

.report-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    text-align: center;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.report-stat {
    text-align: center;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.report-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    display: block;
}

.report-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.report-table th,
.report-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.report-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

/* ==========================================
   Tags
   ========================================== */
.tag-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    margin-left: 4px;
}

/* ==========================================
   Undo Toast
   ========================================== */
.toast.undo {
    border-color: var(--accent-primary);
}

.toast .undo-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: var(--space-sm);
    transition: background var(--transition-fast);
}

/* --- Backup Buttons: horizontal scroll on mobile --- */
@media (max-width: 600px) {
    .backup-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    .backup-buttons::-webkit-scrollbar {
        display: none;
    }

    .backup-btn {
        flex: 0 0 auto;
        min-width: 90px;
        max-width: none;
        padding: var(--space-sm) var(--space-sm);
        font-size: 0.78rem;
        gap: 4px;
    }

    .backup-btn span:last-child {
        white-space: nowrap;
    }
}

/* --- Header Sync Indicator: compact on mobile --- */
@media (max-width: 480px) {
    .sync-indicator {
        padding: 4px 6px;
        gap: 4px;
    }

    .sync-text {
        display: none;
    }

    .header-right {
        gap: 6px;
    }
}

/* --- Monthly Comparison: responsive layout --- */
@media (max-width: 480px) {
    .comparison-values {
        gap: var(--space-sm);
    }

    .comparison-val {
        min-width: 50px;
        font-size: 0.78rem;
    }

    .comparison-change {
        font-size: 0.65rem;
        min-width: 45px;
        padding: 2px 5px;
    }

    .comparison-cat {
        max-width: 90px;
        overflow: hidden;
    }

    .comparison-cat span:last-child {
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .comparison-header {
        font-size: 0.7rem;
    }
}

/* --- New Modals: bottom-sheet on mobile --- */
@media (max-width: 600px) {

    #settingsModal .modal,
    #recurringModal .modal,
    #addGoalModal .modal,
    #receiptGalleryModal .modal,
    #reportModal .modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        max-height: 85vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        width: 100%;
        max-width: 100%;
        overflow-y: auto;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .settings-content,
    .recurring-content {
        padding: var(--space-md) !important;
    }

    .recurring-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .recurring-actions {
        align-self: flex-end;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-xs);
    }
}

/* --- Report Summary: responsive --- */
@media (max-width: 380px) {
    .report-summary {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }

    .report-stat {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    .report-stat-value {
        font-size: 1rem;
        display: inline;
    }

    .report-stat-label {
        font-size: 0.75rem;
    }

    .report-table {
        font-size: 0.78rem;
    }

    .report-table th,
    .report-table td {
        padding: 6px 4px;
    }
}

/* --- Toast with Undo: constrain on mobile --- */
@media (max-width: 480px) {
    .toast {
        max-width: calc(100vw - 32px);
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
    }

    .toast .undo-btn {
        padding: 3px 10px;
        font-size: 0.78rem;
    }
}

/* --- Expense Card Meta: tags overflow --- */
@media (max-width: 480px) {
    .tag-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* --- Goals Section: tighter on mobile --- */
@media (max-width: 480px) {
    .goal-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .goal-amount {
        font-size: 0.8rem;
    }

    .goal-meta {
        font-size: 0.75rem;
    }
}

/* --- Savings Goal Modal: compact form --- */
@media (max-width: 600px) {
    #addGoalModal .modal {
        max-height: 80vh;
    }

    #goalForm {
        padding: var(--space-md) !important;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    #reportContent,
    #reportContent * {
        visibility: visible;
    }

    #reportContent {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* ==========================================
   AI Smart Budget Suggestions
   ========================================== */
.smart-budget-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.smart-budget-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.smart-budget-cat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    font-size: 1rem;
}

.smart-budget-values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.smart-budget-stat {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    min-width: 70px;
}

.smart-budget-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.smart-budget-stat .stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.smart-budget-stat.suggested {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--accent-primary);
}

.smart-budget-stat.suggested .stat-value {
    color: var(--accent-primary);
}

.smart-budget-stat.current {
    background: rgba(34, 197, 94, 0.15);
}

.smart-budget-stat.current .stat-value {
    color: var(--success);
}

.btn-apply-budget {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-apply-budget:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* AI Budget button style */
.backup-btn.ai-budget {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.backup-btn.ai-budget:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
    border-color: var(--accent-primary);
}

/* Smart-filled animation for NLP */
.smart-filled {
    animation: smartFillPulse 0.5s ease-out;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

@keyframes smartFillPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Mobile responsive for smart budget */
@media (max-width: 480px) {
    .smart-budget-values {
        gap: 6px;
    }

    .smart-budget-stat {
        min-width: 60px;
        padding: 4px 8px;
    }

    .smart-budget-stat .stat-value {
        font-size: 0.8rem;
    }
}

/* ==========================================
   SmartFill Confidence Indicator
   ========================================== */
.smart-fill-indicator {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    animation: indicatorFadeIn 0.3s ease-out;
    z-index: 10;
    white-space: nowrap;
}

@keyframes indicatorFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* High confidence indicator */
.smart-fill-indicator.high-confidence {
    background: linear-gradient(135deg, var(--success), #059669);
}

/* Medium confidence indicator */
.smart-fill-indicator.medium-confidence {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ==========================================
   AI Features Styles
   ========================================== */

/* AI Scan Button */
.btn-ai-scan {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-ai-scan::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: aiShimmer 3s ease-in-out infinite;
}

@keyframes aiShimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.btn-ai-scan:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
}

.btn-ai-scan:active {
    transform: scale(0.95);
}

/* AI Scan Toggle Checkbox */
.ai-scan-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    cursor: pointer;
    user-select: none;
}

.ai-scan-toggle input[type="checkbox"] {
    display: none;
}

.ai-scan-toggle-slider {
    position: relative;
    width: 42px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ai-scan-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-scan-toggle input:checked+.ai-scan-toggle-slider {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.ai-scan-toggle input:checked+.ai-scan-toggle-slider::before {
    transform: translateX(18px);
    background: white;
}

.ai-scan-toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s;
}

.ai-scan-toggle input:checked~.ai-scan-toggle-label {
    color: #a78bfa;
}

.btn-ai-scan.scanning {
    pointer-events: none;
    opacity: 0.8;
}

.btn-ai-scan.scanning::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* AI Scan Results */
.ai-scan-results {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.ai-scan-results h4 {
    color: #a78bfa;
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
}

.ai-scan-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: var(--text-secondary);
}

.ai-scan-item .item-price {
    color: var(--text-primary);
    font-weight: 600;
}

/* Anomaly Alerts */
.anomaly-alerts-container {
    margin-bottom: var(--space-lg);
}

.anomaly-alert {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    animation: alertSlideIn 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.anomaly-alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #f59e0b, #ef4444);
    border-radius: 4px 0 0 4px;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.anomaly-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.anomaly-content {
    flex: 1;
}

.anomaly-title {
    font-weight: 600;
    color: #f59e0b;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.anomaly-message {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.anomaly-ratio {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.anomaly-dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.anomaly-dismiss:hover {
    opacity: 1;
}

/* Auto-Categorize Suggestion */
.ai-category-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 20px;
    font-size: 0.8rem;
    color: #a78bfa;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-category-suggestion:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.2));
    transform: translateY(-1px);
}

.ai-category-suggestion .ai-badge {
    background: rgba(139, 92, 246, 0.3);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #c4b5fd;
}

/* Description Cleanup Indicator */
.ai-cleanup-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
    color: #4ade80;
    cursor: pointer;
    transition: all 0.2s;
    animation: fadeInUp 0.3s ease-out;
}

.ai-cleanup-pill:hover {
    background: rgba(34, 197, 94, 0.2);
}

/* AI Report Section */
.ai-report-btn {
    background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.ai-report-btn:hover {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
}

.ai-report-content {
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(99, 102, 241, 0.03));
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-md);
    margin: var(--space-md);
    line-height: 1.7;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    animation: fadeInUp 0.5s ease-out;
}

.ai-report-loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.ai-report-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* AI Loading Overlay */
.ai-loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-md);
    color: #a78bfa;
    font-size: 0.85rem;
}

.ai-loading-dots {
    display: inline-flex;
    gap: 3px;
}

.ai-loading-dots span {
    width: 5px;
    height: 5px;
    background: #a78bfa;
    border-radius: 50%;
    animation: dotBounce 1.2s ease-in-out infinite;
}

.ai-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Auth Styles Overlay
   ======================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.auth-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.2);
    animation: stagger-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-form input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    border-color: var(--accent-primary);
}

/* ==========================================
   Shopping List Feature
   ========================================== */

/* Shopping button accent color */
.backup-btn.shopping {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.backup-btn.shopping:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.3));
    border-color: var(--success);
}

/* Add item form */
.shopping-add-form {
    margin-bottom: 0;
}

.shopping-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.shopping-input-name {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.shopping-input-name:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.shopping-input-qty {
    width: 65px;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: center;
}

.shopping-input-qty:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.shopping-add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.shopping-add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.shopping-add-btn:active {
    transform: scale(0.95);
}

/* Shopping list container */
.shopping-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Individual item */
.shopping-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    animation: fadeInUp 0.25s ease-out;
}

.shopping-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.shopping-item.checked {
    opacity: 0.5;
}

.shopping-item.checked .shopping-item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Custom checkbox */
.shopping-checkbox-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.shopping-checkbox {
    display: none;
}

.shopping-checkmark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: all var(--transition-fast);
    position: relative;
}

.shopping-checkbox:checked+.shopping-checkmark {
    background: var(--success);
    border-color: var(--success);
}

.shopping-checkbox:checked+.shopping-checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

.shopping-checkmark:hover {
    border-color: var(--accent-primary);
}

/* Item name */
.shopping-item-name {
    flex: 1;
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Quantity badge */
.shopping-qty-badge {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Delete button */
.shopping-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.shopping-item:hover .shopping-delete-btn {
    opacity: 0.6;
}

.shopping-delete-btn:hover {
    opacity: 1 !important;
    color: #f87171;
}

/* Checked items divider */
.shopping-checked-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shopping-checked-divider::before,
.shopping-checked-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* Clear checked button */
.shopping-clear-btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.shopping-clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Mobile: bottom-sheet modal for shopping */
@media (max-width: 600px) {
    #shoppingListModal .modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        max-height: 90vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        width: 100%;
        max-width: 100%;
        overflow-y: auto;
        animation: slideUp 0.3s ease;
    }

    .shopping-delete-btn {
        opacity: 0.5;
    }
}

/* ==========================================
   AI Shopping List Scanner
   ========================================== */

/* Scan buttons row */
.shopping-scan-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: var(--space-md);
}

.shopping-scan-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.shopping-scan-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
    animation: aiShimmer 3s ease-in-out infinite;
}

.shopping-scan-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.2));
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.shopping-scan-btn:active {
    transform: scale(0.97);
}

/* Review section */
.scan-review-section {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(99, 102, 241, 0.04));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    animation: fadeInUp 0.3s ease-out;
}

.scan-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: #c4b5fd;
}

.scan-review-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color var(--transition-fast);
}

.scan-review-close:hover {
    color: var(--text-primary);
}

.scan-review-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 35vh;
    overflow-y: auto;
    margin-bottom: var(--space-md);
}

.scan-review-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.scan-review-name {
    flex: 1;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

.scan-review-name:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.scan-review-qty {
    width: 60px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    text-align: center;
}

.scan-review-qty:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.scan-review-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.scan-review-actions .btn-save {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scan-review-actions .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.scan-review-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scan-review-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ==========================================
   Onboarding Tour
   ========================================== */

/* Dim overlay */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.tour-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Highlighted element */
.tour-highlight {
    position: relative;
    z-index: 9991 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.5), 0 0 30px rgba(99, 102, 241, 0.3) !important;
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-normal);
}

/* Tooltip card */
.tour-tooltip {
    position: absolute;
    z-index: 9992;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: rgba(30, 30, 55, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.tour-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.tour-step-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tour-skip-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.tour-skip-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.tour-tooltip-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.tour-tooltip-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
}

/* Step dots */
.tour-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: var(--space-md);
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tour-dot.active {
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    transform: scale(1.3);
}

.tour-dot:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navigation buttons */
.tour-tooltip-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-btn-back {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.tour-btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.tour-btn-next {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.tour-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.tour-btn-finish {
    background: linear-gradient(135deg, #22c55e, #10b981);
}

.tour-btn-finish:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Mobile tooltip */
@media (max-width: 600px) {
    .tour-tooltip {
        position: fixed !important;
        bottom: 20px !important;
        top: auto !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
    }
}

/* ==========================================
   Notification Center
   ========================================== */

/* Bell badge */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Dropdown panel */
.notif-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 340px;
    max-height: 420px;
    background: rgba(30, 30, 55, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 9999;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-panel-actions {
    display: flex;
    gap: 4px;
}

.notif-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.notif-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Notification list */
.notif-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 16px;
    font-size: 0.85rem;
}

/* Notification items */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background var(--transition-fast);
    border-left: 3px solid transparent;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item.unread {
    background: rgba(99, 102, 241, 0.06);
}

/* Type-based border colors */
.notif-item[data-type="expense_added"] {
    border-left-color: #22c55e;
}

.notif-item[data-type="expense_deleted"] {
    border-left-color: #ef4444;
}

.notif-item[data-type="budget_alert"] {
    border-left-color: #f59e0b;
}

.notif-item[data-type="recurring"] {
    border-left-color: #3b82f6;
}

.notif-item[data-type="ai_scan"] {
    border-left-color: #a855f7;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-item-msg {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
    word-break: break-word;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.notif-item.read .notif-item-title {
    color: var(--text-secondary);
}

.notif-item.read .notif-item-msg {
    color: var(--text-muted);
}

.notif-dismiss-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.notif-item:hover .notif-dismiss-btn {
    opacity: 1;
}

.notif-dismiss-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Mobile notification panel */
@media (max-width: 600px) {
    .notif-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-top: 0;
    }

    .notif-dismiss-btn {
        opacity: 0.5;
    }
}

/* ==========================================
   Cheapest Buy Feature
   ========================================== */
.cb-store-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.cb-store-card:hover {
    border-color: var(--accent-primary);
}

.cb-store-card:has(input:checked) {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

.cb-store-card input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.cb-store-icon {
    font-size: 1.1rem;
}

.cb-progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.cb-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), #a78bfa);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.cb-results-summary {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.cb-summary-chip {
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.cb-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cb-results-table th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-transform: capitalize;
    font-size: 0.75rem;
}

.cb-results-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.cb-results-table tr:last-child td {
    border-bottom: none;
}

.cb-item-name {
    text-transform: capitalize;
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-cheapest {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-weight: 700;
    border-radius: 4px;
}

.cb-multi-store {
    border-left: 3px solid var(--accent-primary);
}

.cb-single-store {
    opacity: 0.6;
}

.cb-no-results {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-secondary);
}

.cb-no-results .cb-no-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    display: block;
}

/* ==========================================
   Halal Scanner Feature
   ========================================== */

/* Button in sidebar */
.backup-btn.halal-check {
    border-color: rgba(16, 185, 129, 0.25);
}

.backup-btn.halal-check:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
    color: #10b981;
}

/* Modal body */
.halal-modal-body {
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

/* Tab toggle */
.halal-tabs {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: var(--space-lg);
}

.halal-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.halal-tab.active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.halal-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.halal-tab-icon {
    font-size: 1.1rem;
}

/* Barcode reader area */
.halal-reader-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    min-height: 250px;
}

.halal-reader-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    animation: halalScanline 2s ease-in-out infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes halalScanline {
    0% {
        top: 0;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.halal-reader-hint {
    text-align: center;
    margin-top: var(--space-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Custom Camera Controls */
.halal-camera-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.halal-camera-switch-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.halal-camera-switch-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

.halal-camera-switch-btn:active {
    transform: scale(0.9);
}

.halal-switch-icon {
    display: inline-block;
    transition: transform 0.6s ease;
}

.halal-switch-icon.spinning {
    transform: rotate(360deg);
}

.halal-camera-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Hide any residual library UI if it appears */
#halalReader__dashboard_section_csr {
    display: none !important;
}

/* Ingredients upload area */
.halal-upload-zone {
    border: 2px dashed rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    transition: all var(--transition-fast);
    background: rgba(16, 185, 129, 0.03);
    cursor: pointer;
}

.halal-upload-zone:hover {
    border-color: rgba(16, 185, 129, 0.6);
    background: rgba(16, 185, 129, 0.08);
}

.halal-upload-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    display: block;
}

.halal-upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.halal-upload-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.halal-preview-img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
    border: 1px solid var(--border-color);
}

/* Loading spinner */
.halal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
}

.halal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: halalSpin 0.8s linear infinite;
}

@keyframes halalSpin {
    to {
        transform: rotate(360deg);
    }
}

.halal-loading-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #10b981;
}

/* Overlay UI */
.halal-result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    /* JS will set to flex */
    flex-direction: column;
    justify-content: center;
    padding: var(--space-lg);
    box-sizing: border-box;
    overflow-y: auto;
}

.dark-mode .halal-result-overlay {
    background: rgba(15, 23, 42, 0.95);
}

/* Result card */
.halal-result-card {
    margin-top: var(--space-md);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: fadeInUp 0.4s ease-out;
}

.halal-result-header {
    padding: var(--space-lg);
    text-align: center;
    position: relative;
}

.halal-result-header.halal {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.halal-result-header.haram {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.08));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.halal-result-header.mushbooh {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.halal-status-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-xs);
}

.halal-status-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.halal-status-text.halal {
    color: #10b981;
}

.halal-status-text.haram {
    color: #ef4444;
}

.halal-status-text.mushbooh {
    color: #f59e0b;
}

/* Product info */
.halal-product-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-glass);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.halal-product-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.halal-product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.halal-product-brand {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Flagged ingredients */
.halal-flags {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.halal-flag-section {
    padding: var(--space-sm) 0;
}

.halal-flag-section+.halal-flag-section {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: var(--space-xs);
    padding-top: var(--space-sm);
}

.halal-flag-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.halal-flag-label.haram {
    color: #ef4444;
}

.halal-flag-label.mushbooh {
    color: #f59e0b;
}

.halal-flag-label.info {
    color: #10b981;
}

.halal-flag-label.neutral {
    color: var(--text-secondary);
}

.halal-flag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.halal-flag-chip {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

.halal-flag-chip.haram {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.halal-flag-chip.mushbooh {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Extracted ingredients text */
.halal-extracted {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    padding-top: var(--space-sm);
}

/* Scan again button */
.halal-scan-again {
    display: block;
    width: 100%;
    margin-top: var(--space-md);
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.halal-scan-again:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(16, 185, 129, 0.3);
}

/* Halal label badge */
.halal-cert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: var(--space-sm);
}