/**
 * LedgerFlow - Dark Glassmorphism Theme
 * Inspired by LedgerFlowAI's modern dark UI
 */

/* ══════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES (DARK PALETTE)
   ══════════════════════════════════════════════ */
:root {
    /* Core Dark Palette */
    --bg-deepest: #0B0F1A;
    --bg-deep: #0F172A;
    --bg-base: #1E293B;
    --bg-elevated: #263548;
    --bg-surface: #334155;

    /* Glass Surfaces */
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    /* Text */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-faint: #475569;

    /* Primary Gradient */
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --primary-gradient: linear-gradient(135deg, #6366F1, #8B5CF6);

    /* Accent Colors */
    --accent-cyan: #22D3EE;
    --accent-emerald: #34D399;
    --accent-amber: #FBBF24;
    --accent-rose: #FB7185;
    --accent-violet: #A78BFA;

    /* Semantic Colors */
    --success: #34D399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --success-fg: #6EE7B7;
    --success-border: rgba(52, 211, 153, 0.25);

    --error: #FB7185;
    --error-bg: rgba(251, 113, 133, 0.12);
    --error-fg: #FDA4AF;
    --error-border: rgba(251, 113, 133, 0.25);

    --warning: #FBBF24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --warning-fg: #FDE68A;
    --warning-border: rgba(251, 191, 36, 0.25);

    --info: #38BDF8;
    --info-bg: rgba(56, 189, 248, 0.12);
    --info-fg: #7DD3FC;
    --info-border: rgba(56, 189, 248, 0.25);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 14px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
    --shadow-glow: 0 0 30px var(--primary-glow);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, #0F172A 0%, #131C31 100%);
}

/* ══════════════════════════════════════════════
   2. RESET & BASE
   ══════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-deepest) !important;
    color: var(--text-primary) !important;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary) !important;
    font-weight: 700;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

::selection {
    background: rgba(99, 102, 241, 0.35);
    color: #fff;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════
   3. LAYOUT
   ══════════════════════════════════════════════ */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-deepest);
}

/* ══════════════════════════════════════════════
   4. SIDEBAR
   ══════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg) !important;
    color: var(--text-primary) !important;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid var(--glass-border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.sidebar * { color: inherit; }

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.4rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-label {
    display: block;
    padding: 0.75rem 1.5rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted) !important;
    letter-spacing: 0.08em;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--text-secondary) !important;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary) !important;
    border-left-color: rgba(99, 102, 241, 0.3);
}

.nav-link:hover i { opacity: 1; }

.nav-link.active {
    background: rgba(99, 102, 241, 0.12);
    color: #fff !important;
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-link.active i {
    opacity: 1;
    color: var(--primary-light) !important;
}

/* Org Selector */
.org-selector {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.org-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.org-toggle:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
}

.org-icon {
    width: 30px;
    height: 30px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.org-name {
    font-size: 0.825rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.org-toggle .fa-chevron-down {
    font-size: 0.65rem;
    opacity: 0.4;
}

/* ══════════════════════════════════════════════
   5. MAIN CONTENT
   ══════════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-deepest) !important;
}

.page-content {
    padding: 1.75rem 2rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    min-height: 0;
    background-color: transparent;
}

/* ══════════════════════════════════════════════
   6. TOP BAR
   ══════════════════════════════════════════════ */
.top-bar {
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumb a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--text-primary); }

/* User Menu */
.user-menu { position: relative; }

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.45rem 0.875rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.825rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.user-menu-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
}

.user-menu-toggle .fa-chevron-down {
    font-size: 0.6rem;
    opacity: 0.4;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.user-dropdown.active { display: block; }

.user-dropdown-header {
    padding: 1rem 1.125rem;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-dropdown-role { display: inline-block; font-size: 0.7rem; font-weight: 600; }

.user-dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.125rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.825rem;
    transition: all 0.15s;
}

.user-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.user-dropdown-item.text-danger { color: var(--error, #FB7185) !important; }
.user-dropdown-item.text-danger:hover { background: var(--error-bg); }

/* ══════════════════════════════════════════════
   7. GLASS CARD
   ══════════════════════════════════════════════ */
.card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.15);
}

.card-header {
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent !important;
}

.card-body {
    padding: 1.5rem;
    background-color: transparent !important;
}

/* ══════════════════════════════════════════════
   8. STAT CARDS
   ══════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow), 0 0 20px var(--primary-glow);
    border-color: rgba(99, 102, 241, 0.2);
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon-blue { background: var(--info-bg); color: var(--info); }
.stat-icon-green { background: var(--success-bg); color: var(--success); }
.stat-icon-yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon-purple { background: rgba(139, 92, 246, 0.12); color: var(--accent-violet); }
.stat-icon-rose { background: rgba(251, 113, 133, 0.12); color: var(--accent-rose); }
.stat-icon-cyan { background: rgba(34, 211, 238, 0.12); color: var(--accent-cyan); }

/* ══════════════════════════════════════════════
   9. BUTTONS
   ══════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

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

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

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.18) !important;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.btn-danger { background: rgba(251,113,133,0.15) !important; color: var(--accent-rose) !important; border: 1px solid rgba(251,113,133,0.25) !important; }
.btn-danger:hover { background: rgba(251,113,133,0.25) !important; }

.btn-warning { background: rgba(251,191,36,0.15) !important; color: var(--accent-amber) !important; border: 1px solid rgba(251,191,36,0.25) !important; }
.btn-warning:hover { background: rgba(251,191,36,0.25) !important; }

.btn-info { background: rgba(56,189,248,0.15) !important; color: var(--info) !important; border: 1px solid rgba(56,189,248,0.25) !important; }
.btn-info:hover { background: rgba(56,189,248,0.25) !important; }

.btn-success { background: rgba(52,211,153,0.15) !important; color: var(--success) !important; border: 1px solid var(--success-border) !important; }
.btn-success:hover { background: rgba(52,211,153,0.25) !important; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 0.375rem; }

/* ══════════════════════════════════════════════
   10. DATA TABLES
   ══════════════════════════════════════════════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    background-color: rgba(255,255,255,0.03) !important;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--glass-border);
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    font-size: 0.825rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.data-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

.data-table td code {
    background: rgba(255,255,255,0.06);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.825rem;
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════
   11. STATUS BADGES
   ══════════════════════════════════════════════ */
.status-badge {
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    white-space: nowrap;
}

.status-paid, .status-active, .status-completed {
    background-color: var(--success-bg) !important;
    color: var(--success) !important;
    border: 1px solid var(--success-border);
}

.status-pending, .status-draft {
    background-color: var(--warning-bg) !important;
    color: var(--warning) !important;
    border: 1px solid var(--warning-border);
}

.status-overdue, .status-failed {
    background-color: var(--error-bg) !important;
    color: var(--error) !important;
    border: 1px solid var(--error-border);
}

.status-sent {
    background-color: var(--info-bg) !important;
    color: var(--info) !important;
    border: 1px solid var(--info-border);
}

.status-admin { background: rgba(251,113,133,0.12) !important; color: var(--accent-rose) !important; border: 1px solid rgba(251,113,133,0.25); }
.status-accountant { background: var(--info-bg) !important; color: var(--info) !important; border: 1px solid var(--info-border); }
.status-approver { background: var(--success-bg) !important; color: var(--success) !important; border: 1px solid var(--success-border); }
.status-viewer { background: rgba(255,255,255,0.05) !important; color: var(--text-muted) !important; border: 1px solid rgba(255,255,255,0.08); }
.status-partial { background-color: var(--warning-bg) !important; color: var(--warning) !important; border: 1px solid var(--warning-border); }
.status-inactive { background: rgba(255,255,255,0.05) !important; color: var(--text-muted) !important; border: 1px solid rgba(255,255,255,0.08); }

/* ══════════════════════════════════════════════
   12. FORM CONTROLS
   ══════════════════════════════════════════════ */
.form-control, .search-input, .filter-select {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    font-size: 0.825rem;
    font-family: inherit;
    background-color: rgba(255,255,255,0.04);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

.form-control:focus, .search-input:focus, .filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: rgba(255,255,255,0.06);
}

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

select.form-control, select.form-input { cursor: pointer; }
textarea.form-control { resize: vertical; }

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.form-row .form-group { flex: 1; }

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.775rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
}

/* Shared form-input */
.form-input {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    font-size: 0.825rem;
    font-family: inherit;
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

textarea.form-input { resize: vertical; }

/* ══════════════════════════════════════════════
   13. MODALS
   ══════════════════════════════════════════════ */
.modal-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-container.active { display: flex; }

.modal {
    background-color: var(--bg-elevated) !important;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
}

.modal-lg { max-width: 800px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* Fade modals */
.modal.fade { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); z-index: 1000; align-items: center; justify-content: center; }
.modal.fade.active { display: flex; }
.modal-dialog { width: 100%; max-width: 500px; margin: 1rem; }
.modal-dialog.modal-lg { max-width: 800px; }
.modal-content { background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--glass-border); width: 100%; max-height: 90vh; overflow-y: auto; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-overlay .modal { background: var(--bg-elevated); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--glass-border); }

/* ══════════════════════════════════════════════
   14. TOAST NOTIFICATIONS
   ══════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--text-muted);
    backdrop-filter: blur(12px);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 0.825rem; color: var(--text-primary); margin-bottom: 2px; }
.toast-message { font-size: 0.775rem; color: var(--text-muted); line-height: 1.4; }

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-close:hover { opacity: 1; }

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

/* ══════════════════════════════════════════════
   15. FOOTER
   ══════════════════════════════════════════════ */
.app-footer {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--glass-border);
    padding: 1.25rem 2rem;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.footer-links { display: flex; gap: 1.5rem; }

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.775rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--text-primary); }

.copyright { font-size: 0.775rem; color: var(--text-muted); margin: 0; }
.footer-version { font-size: 0.725rem; color: var(--text-faint); font-weight: 600; }

/* ══════════════════════════════════════════════
   16. AUTH / LOGIN
   ══════════════════════════════════════════════ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at 30% 20%, rgba(99,102,241,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.06) 0%, transparent 60%),
                var(--bg-deepest);
}

.auth-box {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg), 0 0 80px rgba(99,102,241,0.08);
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-tabs {
    display: flex;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.06);
}

.auth-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius) - 2px);
    font-weight: 600;
    font-size: 0.825rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.auth-tab.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form .form-group { margin-bottom: 0; }
.auth-form .form-group label { display: block; font-size: 0.775rem; font-weight: 600; margin-bottom: 0.375rem; color: var(--text-secondary); }
.auth-form .form-input, .auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"] {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    outline: none;
}

.auth-form .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox-group label { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }

.auth-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.825rem;
    font-weight: 500;
    display: none;
}

.auth-message.error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); display: block; }
.auth-message.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); display: block; }

/* ══════════════════════════════════════════════
   17. TOOLBAR
   ══════════════════════════════════════════════ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.toolbar-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.toolbar-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   18. TABS
   ══════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--glass-border);
}

.tab {
    padding: 0.6rem 1.25rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

.card-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--glass-border); }
.card-tab { padding: 0.5rem 1rem; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.2s; }
.card-tab:hover { color: var(--text-primary); }
.card-tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.card-search { display: flex; align-items: center; }
.card-search .form-input { width: 220px; }

/* ══════════════════════════════════════════════
   19. BADGES
   ══════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.08); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }

/* ══════════════════════════════════════════════
   20. CHART CONTAINERS
   ══════════════════════════════════════════════ */
.chart-container { position: relative; height: 300px; width: 100%; }

.chart-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chart-controls select { width: auto; min-width: 160px; }
.chart-section { margin-bottom: 1.5rem; }
.chart-section .card-body { padding-bottom: 0.5rem; }

.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

.chart-legend-list { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.5rem 0; }
.chart-legend-item { display: flex; align-items: center; gap: 0.625rem; font-size: 0.825rem; color: var(--text-secondary); }
.chart-legend-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-value { margin-left: auto; font-weight: 600; }

/* ══════════════════════════════════════════════
   21. PAGE HEADER
   ══════════════════════════════════════════════ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════════════════════
   22. INVOICE / LINE ITEMS
   ══════════════════════════════════════════════ */
.line-item { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.line-item .item-description { flex: 1; }
.line-item .item-quantity { width: 80px; }
.line-item .item-price { width: 120px; }

.invoice-totals { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--glass-border); }
.total-row { display: flex; justify-content: space-between; margin-bottom: 0.25rem; color: var(--text-secondary); font-size: 0.875rem; }
.total-row-bold { display: flex; justify-content: space-between; font-weight: 700; font-size: 1rem; padding-top: 0.5rem; border-top: 1px solid var(--glass-border); color: var(--text-primary); }

/* ══════════════════════════════════════════════
   23. AI CHAT WIDGET
   ══════════════════════════════════════════════ */
.lf-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(99,102,241,0.4);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

.lf-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(99,102,241,0.55);
}

.lf-chat-bubble i { font-size: 1.35rem; transition: all 0.3s; }

.lf-chat-bubble.hidden {
    width: 0; height: 0; opacity: 0; transform: scale(0);
}

.lf-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 100px);
    background: var(--bg-elevated);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.lf-chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

.lf-chat-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1E1B4B, #312E81);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.lf-chat-header-info { display: flex; align-items: center; gap: 0.75rem; }
.lf-chat-header-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.lf-chat-header-title { font-weight: 700; font-size: 0.9rem; }
.lf-chat-header-status { font-size: 0.7rem; opacity: 0.7; }
.lf-chat-close { background: rgba(255,255,255,0.1); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.lf-chat-close:hover { background: rgba(255,255,255,0.2); }

.lf-chat-header-actions { display: flex; align-items: center; gap: 0.375rem; }
.lf-chat-icon-btn { background: rgba(255,255,255,0.1); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; font-size: 0.9rem; }
.lf-chat-icon-btn:hover { background: rgba(255,255,255,0.2); transform: rotate(30deg); }

/* Chat settings */
.lf-settings-overlay { position: absolute; inset: 0; background: var(--bg-elevated); z-index: 10; display: flex; flex-direction: column; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.lf-settings-overlay.open { opacity: 1; pointer-events: all; }
.lf-settings-header { padding: 1rem 1.25rem; background: linear-gradient(135deg, #1E1B4B, #312E81); color: #fff; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.lf-settings-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.lf-settings-label { display: block; font-size: 0.775rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.375rem; margin-top: 1rem; }
.lf-settings-label:first-child { margin-top: 0; }
.lf-settings-select, .lf-settings-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.825rem;
    font-family: inherit;
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
}

.lf-settings-select:focus, .lf-settings-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.lf-settings-hint { display: block; font-size: 0.725rem; color: var(--text-muted); margin-top: 0.375rem; }
.lf-settings-save { width: 100%; margin-top: 1.5rem; padding: 0.6rem; border: none; border-radius: 8px; background: var(--primary-gradient); color: #fff; font-weight: 600; font-size: 0.825rem; cursor: pointer; transition: filter 0.2s; }
.lf-settings-save:hover { filter: brightness(1.1); }

.lf-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-deep);
}

.lf-chat-msg { display: flex; gap: 0.625rem; max-width: 100%; }
.lf-chat-msg-user { flex-direction: row-reverse; }

.lf-chat-msg-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.lf-chat-msg-user .lf-chat-msg-avatar { background: var(--primary-gradient); color: #fff; }
.lf-chat-msg-assistant .lf-chat-msg-avatar { background: var(--bg-surface); color: var(--text-secondary); }

.lf-chat-msg-content { max-width: 85%; }
.lf-chat-msg-text { padding: 0.6rem 0.875rem; border-radius: 12px; font-size: 0.825rem; line-height: 1.55; color: var(--text-primary); }
.lf-chat-msg-user .lf-chat-msg-text { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.lf-chat-msg-assistant .lf-chat-msg-text { background: var(--bg-surface); border: 1px solid var(--glass-border); border-bottom-left-radius: 4px; }
.lf-chat-msg-text strong { font-weight: 700; }

.lf-typing-dots span { display: inline-block; animation: lf-bounce 1.4s infinite; font-size: 1.5rem; line-height: 0; vertical-align: middle; color: var(--text-muted); }
.lf-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.lf-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lf-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

.lf-chat-suggestions { padding: 0.5rem 1rem; display: flex; flex-wrap: wrap; gap: 0.375rem; flex-shrink: 0; background: var(--bg-deep); border-top: 1px solid var(--glass-border); }
.lf-chat-suggestion { padding: 0.3rem 0.625rem; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); font-size: 0.725rem; cursor: pointer; color: var(--text-muted); transition: all 0.2s; white-space: nowrap; }
.lf-chat-suggestion:hover { border-color: var(--primary); color: var(--primary-light); background: rgba(99,102,241,0.1); }

.lf-chat-input-area { padding: 0.75rem 1rem; display: flex; gap: 0.5rem; border-top: 1px solid var(--glass-border); background: var(--bg-deep); flex-shrink: 0; }
.lf-chat-input { flex: 1; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 0.6rem 0.875rem; font-size: 0.825rem; font-family: inherit; resize: none; outline: none; max-height: 120px; line-height: 1.4; background: rgba(255,255,255,0.04); color: var(--text-primary); }
.lf-chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.lf-chat-send { width: 40px; height: 40px; border-radius: 10px; border: none; background: var(--primary-gradient); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: filter 0.2s; }
.lf-chat-send:hover { filter: brightness(1.15); }
.lf-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════════
   24. SETTINGS / INFO
   ══════════════════════════════════════════════ */
.settings-container { display: flex; flex-direction: column; gap: 1.5rem; }
.info-list { display: flex; flex-direction: column; gap: 0.5rem; }
.info-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--glass-border); font-size: 0.825rem; }
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { font-weight: 600; color: var(--text-primary); }
.logo-upload-container { display: flex; flex-direction: column; gap: 0.5rem; }
.logo-preview { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; background: rgba(255,255,255,0.04); border-radius: var(--radius); border: 1px solid var(--glass-border); }

/* ══════════════════════════════════════════════
   25. REMINDERS
   ══════════════════════════════════════════════ */
.reminders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.reminder-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); overflow: hidden; transition: all 0.3s; backdrop-filter: blur(8px); }
.reminder-card:hover { box-shadow: var(--shadow), 0 0 15px var(--primary-glow); border-color: rgba(99,102,241,0.15); }
.reminder-card .reminder-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; background: rgba(255,255,255,0.03); font-size: 0.8rem; color: var(--text-muted); }
.reminder-card .reminder-body { padding: 1rem; }
.reminder-card .reminder-body h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--text-primary); }
.reminder-card .reminder-body p { font-size: 0.8rem; color: var(--text-muted); }
.reminder-card .reminder-footer { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-top: 1px solid var(--glass-border); }
.reminder-card .priority-indicator { display: flex; align-items: center; gap: 4px; font-size: 0.725rem; color: var(--text-muted); }
.reminder-card .priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.reminder-card .priority-dot.priority-high { background: var(--error); }
.reminder-card .priority-dot.priority-medium { background: var(--warning); }
.reminder-card .priority-dot.priority-low { background: var(--success); }
.reminder-card .reminder-actions { display: flex; gap: 4px; }
.reminder-card .reminder-type-icon { font-size: 1.25rem; }

/* ══════════════════════════════════════════════
   26. LOCATIONS
   ══════════════════════════════════════════════ */
.locations-tree { display: flex; flex-direction: column; gap: 4px; }
.location-node { position: relative; }
.location-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: var(--radius); transition: all 0.2s; }
.location-item:hover { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.location-item .location-type-icon { font-size: 1.25rem; }
.location-item .location-name { font-weight: 600; font-size: 0.825rem; flex: 1; color: var(--text-primary); }
.location-item .location-code { font-size: 0.725rem; color: var(--text-muted); }
.location-item .location-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.location-item:hover .location-actions { opacity: 1; }
.location-item.inactive { opacity: 0.4; }

/* ══════════════════════════════════════════════
   27. BUDGETS
   ══════════════════════════════════════════════ */
.budgets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.budget-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 1.25rem; transition: all 0.3s; backdrop-filter: blur(8px); }
.budget-card:hover { box-shadow: var(--shadow), 0 0 15px var(--primary-glow); border-color: rgba(99,102,241,0.15); }
.budget-card.placeholder { display: flex; align-items: center; justify-content: center; min-height: 160px; }
.budget-card .budget-placeholder { text-align: center; color: var(--text-muted); font-size: 0.825rem; }
.budget-card .budget-placeholder .placeholder-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.budget-card .budget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.budget-card .budget-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.budget-card .budget-header .budget-year { font-size: 0.725rem; padding: 2px 8px; background: rgba(255,255,255,0.06); border-radius: 99px; color: var(--text-muted); }
.budget-card .budget-summary { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 0.75rem; }
.budget-card .budget-summary .summary-item { display: flex; justify-content: space-between; font-size: 0.8rem; }
.budget-card .budget-summary .summary-item .label { color: var(--text-muted); }
.budget-card .budget-summary .summary-item .value { font-weight: 600; color: var(--text-primary); }
.budget-card .budget-items-summary { font-size: 0.725rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.budget-card .budget-actions { display: flex; gap: 6px; }
.budget-item-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.budget-item-row .item-account { flex: 1; }
.budget-item-row .item-amount { width: 140px; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: 0.825rem; }

/* ══════════════════════════════════════════════
   28. INSIGHTS & HEALTH
   ══════════════════════════════════════════════ */
.insight-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.insight-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.health-score-card svg circle {
    transition: stroke-dashoffset 1.5s ease;
}

/* ══════════════════════════════════════════════
   29. UTILITY CLASSES
   ══════════════════════════════════════════════ */
/* Text */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.text-danger { color: var(--error) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary-light) !important; }
.text-white { color: #fff !important; }

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Flex */
.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }
.flex-column { flex-direction: column !important; }
.flex-1 { flex: 1; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* Width */
.w-100 { width: 100%; }
.w-auto { width: auto; }

/* Row / Col */
.row { display: flex; gap: 1rem; }
.col-6 { flex: 0 0 calc(50% - 0.5rem); }
.col-4 { flex: 0 0 calc(33.333% - 0.667rem); }
.col-8 { flex: 0 0 calc(66.667% - 0.333rem); }

/* ══════════════════════════════════════════════
   30. LOADING SPINNER
   ══════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.loading-spinner {
    text-align: center;
    color: var(--text-primary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════
   31. RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.mobile-active { transform: translateX(0); }
    .chart-grid { grid-template-columns: 1fr; }
    .chart-controls { flex-direction: column; align-items: stretch; }
    .chart-controls select { width: 100%; }
}

@media (max-width: 860px) {
    .dashboard-charts-row { grid-template-columns: 1fr !important; }
    .dashboard-insights-row { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .lf-chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); max-height: calc(100vh - 16px); border-radius: 12px; }
    .lf-chat-bubble { bottom: 16px; right: 16px; }
}

/* ══════════════════════════════════════════════
   32. GLASSMORPHISM UTILITIES
   ══════════════════════════════════════════════ */
.glass { background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-border); }
.glass-strong { background: rgba(30, 41, 59, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(148, 163, 184, 0.15); }

/* Gradient text */
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow on hover */
.glow-hover { transition: box-shadow 0.3s; }
.glow-hover:hover { box-shadow: 0 0 20px var(--primary-glow); }

/* Pulse animation for AI indicators */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.animate-pulse { animation: pulse-glow 2s infinite; }

/* Shimmer for loading states */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
