/* ==========================================================================
   PERSONAL FINANCE PWA — LUXURY FINTECH DESIGN SYSTEM (DARK MODE)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Obsidian & Luxury Metals */
    --bg-primary: #07090E;
    --bg-secondary: #0D111A;
    --bg-card: #121824;
    --bg-card-hover: #172030;
    --bg-elevated: #1B2436;
    --bg-glass: rgba(18, 24, 36, 0.75);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(16, 185, 129, 0.3);

    /* Metallic Accents */
    --emerald: #10B981;
    --emerald-light: #34D399;
    --emerald-dark: #059669;
    --emerald-glow: rgba(16, 185, 129, 0.18);

    --gold: #F59E0B;
    --gold-light: #FBBF24;
    --gold-dark: #D97706;
    --gold-glow: rgba(245, 158, 11, 0.18);

    --crimson: #EF4444;
    --crimson-light: #F87171;
    --crimson-glow: rgba(239, 68, 68, 0.18);

    --cyan: #06B6D4;
    --indigo: #6366F1;
    --purple: #8B5CF6;

    /* Typography Colors */
    --text-main: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: #34D399;

    /* Shadows & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.8);
    --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.2);
    --shadow-glow-gold: 0 0 25px rgba(245, 158, 11, 0.2);

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Fonts */
    --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-num: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-primary: #F4F6F9;
    --bg-secondary: #E9ECEF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8FAFC;
    --bg-elevated: #E2E8F0;
    --bg-glass: rgba(255, 255, 255, 0.9);

    --border-subtle: #E2E8F0;
    --border-medium: #CBD5E1;
    --border-glow: rgba(16, 185, 129, 0.4);

    --text-main: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-accent: #059669;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 10%, rgba(16, 185, 129, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(245, 158, 11, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
    background-attachment: fixed;
}

/* App Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation (Desktop) */
.app-sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: transform var(--transition-smooth);
}

.brand-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow-emerald);
}

.brand-title {
    font-family: var(--font-num);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-links {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), transparent);
    color: var(--emerald-light);
    border-left: 3px solid var(--emerald);
    font-weight: 600;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-profile-widget {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #3B82F6, #1E40AF);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-meta {
    overflow: hidden;
}

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

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 70px;
}

.app-topbar {
    height: 70px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-title-area h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    padding: 32px;
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* Buttons & UI Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--emerald-light), var(--emerald));
    box-shadow: var(--shadow-glow-emerald);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-card);
    border-color: var(--border-medium);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #121824;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.btn-gold:hover {
    box-shadow: var(--shadow-glow-gold);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--crimson-light);
}

.btn-danger:hover {
    background: var(--crimson);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* Cards & Surfaces */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-smooth);
}

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

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

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Financial Stat Cards (Hero Metrics) */
.hero-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    box-shadow: var(--shadow-md);
}

.stat-card.emerald-border {
    border-left: 3px solid var(--emerald);
}

.stat-card.gold-border {
    border-left: 3px solid var(--gold);
}

.stat-card.crimson-border {
    border-left: 3px solid var(--crimson);
}

.stat-card.cyan-border {
    border-left: 3px solid var(--cyan);
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-value {
    font-family: var(--font-num);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin: 8px 0 4px;
}

.stat-delta {
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stat-delta.positive {
    color: var(--emerald-light);
}

.stat-delta.negative {
    color: var(--crimson-light);
}

/* Grid Layouts */
.grid-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 28px;
}

.grid-equal-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

/* Insight Cards */
.insight-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    transition: all var(--transition-fast);
}

.insight-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-medium);
}

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

.insight-card.success .insight-icon { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); }
.insight-card.warning .insight-icon { background: rgba(245, 158, 11, 0.15); color: var(--gold-light); }
.insight-card.critical .insight-icon { background: rgba(239, 68, 68, 0.15); color: var(--crimson-light); }
.insight-card.info .insight-icon { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }

.insight-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.insight-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.88rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
}

/* Badges & Pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-gold { background: rgba(245, 158, 11, 0.15); color: var(--gold-light); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-crimson { background: rgba(239, 68, 68, 0.15); color: var(--crimson-light); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #C4B5FD; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-muted { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }

/* Progress Bars */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.emerald { background: linear-gradient(90deg, var(--emerald-dark), var(--emerald-light)); }
.progress-bar.gold { background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); }
.progress-bar.crimson { background: linear-gradient(90deg, var(--crimson), var(--crimson-light)); }

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

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

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

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

/* Modals & Dialogs */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition-smooth);
}

.modal-backdrop.show .modal-dialog {
    transform: translateY(0) scale(1);
}

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

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

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

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    animation: toastSlideIn 0.3s ease-out;
}

.toast.success { border-left: 4px solid var(--emerald); }
.toast.error { border-left: 4px solid var(--crimson); }
.toast.info { border-left: 4px solid var(--cyan); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(13, 17, 26, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    z-index: 50;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    flex: 1;
    padding: 6px 0;
}

.mobile-nav-item.active {
    color: var(--emerald-light);
}

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
}

.mobile-quick-add {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-emerald);
    border: none;
    margin-top: -20px;
    cursor: pointer;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    .grid-2col, .grid-3col {
        grid-template-columns: 1fr;
    }
}

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

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

    .app-main {
        margin-left: 0;
        padding-bottom: 84px;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .page-content {
        padding: 16px;
    }

    .app-topbar {
        padding: 0 16px;
    }

    .grid-equal-2col, .form-row {
        grid-template-columns: 1fr;
    }

    .hero-stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
    color: var(--gold-light);
    border-color: var(--gold-dark);
    background: var(--bg-card-hover);
}

/* Type Segment Switcher (Expense / Income) */
.type-segment-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}

.type-segment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.type-segment-btn:hover {
    color: var(--text-main);
}

.type-segment-btn.active-expense {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.type-segment-btn.active-income {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

/* Category Box Grid & Interactive Tiles */
.category-box-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 2px;
    margin-top: 6px;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 6px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    position: relative;
    user-select: none;
}

.category-tile:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.category-tile.selected {
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid var(--emerald);
    box-shadow: var(--shadow-glow-emerald);
    transform: translateY(-2px);
}

.category-tile.selected-expense {
    background: rgba(239, 68, 68, 0.12);
    border: 2px solid #EF4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

.category-tile-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    transition: transform var(--transition-fast);
}

.category-tile:hover .category-tile-icon {
    transform: scale(1.08);
}

.category-tile-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* AI Advisor Chat UI */
.ai-advisor-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.ai-advisor-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.ai-chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.25s ease-out;
}

.ai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-msg-assistant {
    align-self: flex-start;
}

.ai-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-msg-user .ai-msg-avatar {
    background: var(--emerald-dark);
    color: #fff;
}

.ai-msg-assistant .ai-msg-avatar {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.ai-msg-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.6;
}

.ai-msg-user .ai-msg-bubble {
    background: var(--emerald-dark);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg-assistant .ai-msg-bubble {
    background: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
}

.ai-msg-bubble p {
    margin-bottom: 8px;
}

.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.ai-msg-bubble strong {
    color: #fff;
}

[data-theme="light"] .ai-msg-bubble strong {
    color: #0F172A;
}

.ai-prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.ai-chip {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-chip:hover {
    color: var(--emerald-light);
    border-color: var(--emerald);
    background: rgba(16, 185, 129, 0.08);
}

.ai-input-bar {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    background: var(--bg-card);
}

.ai-input-bar input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    color: var(--text-main);
    font-size: 0.92rem;
    font-family: var(--font-ui);
    outline: none;
}

.ai-input-bar input:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

/* Floating AI Action Trigger */
.floating-ai-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    border: none;
    cursor: pointer;
    z-index: 900;
    transition: all var(--transition-smooth);
}

.floating-ai-trigger:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.6);
}

@media (max-width: 768px) {
    .floating-ai-trigger {
        bottom: 84px;
        right: 16px;
        width: 46px;
        height: 46px;
    }
}

