/* ==========================================
   Google Ads Optimizer
   Light-first design system with dark mode
   Fonts: Inter (display) + DM Sans (body)
   ========================================== */

/* ==========================================
   1. CSS Custom Properties (Design Tokens)
   ========================================== */
:root {
    /* -- Colors -- */
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-light: #EFF6FF;
    --positive: #10B981;
    --positive-light: #D1FAE5;
    --negative: #EF4444;
    --negative-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --info: #6366F1;
    --info-light: #EEF2FF;

    /* -- Surfaces -- */
    --surface-0: #FFFFFF;
    --surface-1: #F9FAFB;
    --surface-2: #F1F3F9;
    --surface-3: #E5E7EB;

    /* -- Text -- */
    --text-1: #111827;
    --text-2: #6B7280;
    --text-3: #9CA3AF;

    /* -- Border & Shadow -- */
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    /* -- Layout -- */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* -- Spacing -- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* -- Typography -- */
    --font-display: 'Inter', -apple-system, sans-serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* -- Transitions -- */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

[data-theme="dark"] {
    --accent: #3B82F6;
    --accent-hover: #60A5FA;
    --accent-light: rgba(59,130,246,0.15);
    --positive: #34D399;
    --positive-light: rgba(52,211,153,0.15);
    --negative: #F87171;
    --negative-light: rgba(248,113,113,0.15);
    --warning: #FBBF24;
    --warning-light: rgba(251,191,36,0.15);
    --info: #818CF8;
    --info-light: rgba(129,140,248,0.15);

    --surface-0: #0F172A;
    --surface-1: #1E293B;
    --surface-2: #334155;
    --surface-3: #475569;

    --text-1: #F1F5F9;
    --text-2: #94A3B8;
    --text-3: #64748B;

    --border: #334155;
    --border-light: #1E293B;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}


/* ==========================================
   2. Global Reset & Base
   ========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    transition:
        background-color var(--transition-base),
        border-color var(--transition-base),
        color var(--transition-base);
}

body {
    font-family: var(--font-body);
    background: var(--surface-1);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: var(--text-base);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

::selection {
    background: var(--accent);
    color: #FFFFFF;
}


/* ==========================================
   3. Typography
   ========================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-top: 0;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; }

p {
    color: var(--text-2);
    margin-top: 0;
    margin-bottom: var(--space-4);
}

small {
    font-size: var(--text-xs);
    color: var(--text-3);
}

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}


/* ==========================================
   4. Navbar
   ========================================== */
.navbar {
    background: var(--surface-0) !important;
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-6);
    position: relative;
    z-index: 100;
}

[data-theme="dark"] .navbar {
    background: var(--surface-1) !important;
}

.navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-lg);
    letter-spacing: -0.03em;
    color: var(--text-1) !important;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.navbar-brand i {
    color: var(--accent);
    font-size: var(--text-xl);
}

.navbar .nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--text-2) !important;
    padding: var(--space-2) var(--space-4) !important;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}

.navbar .nav-link:hover {
    color: var(--text-1) !important;
    background: var(--surface-2);
}

.navbar .nav-link.active {
    color: var(--accent) !important;
    background: var(--accent-light);
    font-weight: 600;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-0);
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    font-size: var(--text-base);
}

[data-theme="dark"] .btn-icon {
    background: var(--surface-2);
}

.btn-icon:hover {
    background: var(--surface-2);
    color: var(--text-1);
    border-color: var(--border);
}

.ai-pulse {
    position: relative;
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    font-weight: 600;
    font-size: var(--text-xs);
    border: 1px solid var(--accent);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.ai-pulse::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    background: var(--positive);
    border-radius: 50%;
    animation: pulse-glow 2s infinite;
    box-shadow: 0 0 6px var(--positive);
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.nav-user-link {
    color: var(--text-1);
    font-size: var(--text-sm);
    font-weight: 500;
}

.nav-user-link:hover {
    color: var(--accent);
}

.navbar .dropdown-menu {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    margin-top: var(--space-2);
}

[data-theme="dark"] .navbar .dropdown-menu {
    background: var(--surface-1);
}

.navbar .dropdown-item {
    color: var(--text-2);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.navbar .dropdown-item:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.navbar .dropdown-divider {
    border-color: var(--border);
    margin: var(--space-1) 0;
}

.navbar-toggler {
    border: 1px solid var(--border);
    padding: var(--space-2);
    border-radius: var(--radius-md);
}

.navbar-toggler-icon {
    filter: none;
}

[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}


/* ==========================================
   5. Main Layout
   ========================================== */
main.container-fluid {
    flex: 1;
    padding: var(--space-8) var(--space-6);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}


/* ==========================================
   6. Cards
   ========================================== */
.card {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: var(--space-5) var(--space-6);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-1);
}

.card-body {
    padding: var(--space-6);
}


/* ==========================================
   7. Stat Cards
   ========================================== */
.stat-card {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

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

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
}

.stat-card .stat-icon.primary {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-card .stat-icon.success {
    background: var(--positive-light);
    color: var(--positive);
}

.stat-card .stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-card .stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-icon.danger {
    background: var(--negative-light);
    color: var(--negative);
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--text-3);
    font-weight: 500;
    margin-top: var(--space-1);
}

.stat-card .stat-trend {
    font-size: var(--text-xs);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    margin-top: var(--space-3);
}

.stat-card .stat-trend.up {
    color: var(--positive);
    background: var(--positive-light);
}

.stat-card .stat-trend.down {
    color: var(--negative);
    background: var(--negative-light);
}


/* ==========================================
   8. Charts
   ========================================== */
.chart-container {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.chart-container:hover {
    box-shadow: var(--shadow-md);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.chart-header h6 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-1);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.chart-header h6 i {
    color: var(--accent);
}

.chart-legend {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-3);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

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


/* ==========================================
   9. Tables
   ========================================== */
.table {
    margin-bottom: 0;
    font-size: var(--text-sm);
    color: var(--text-2);
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--surface-2);
}

.table th {
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    border-bottom: 1px solid var(--border) !important;
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
    background: var(--surface-1);
}

[data-theme="dark"] .table th {
    background: var(--surface-2);
}

.table td {
    padding: var(--space-4);
    vertical-align: middle;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-2);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table-hover tbody tr:hover {
    --bs-table-hover-bg: var(--surface-2);
}

.table td strong {
    color: var(--text-1);
    font-weight: 600;
}


/* ==========================================
   10. Badges
   ========================================== */
.badge {
    font-weight: 600;
    font-size: var(--text-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    border: none;
}

.badge-success {
    background: var(--positive-light) !important;
    color: var(--positive) !important;
}

.badge-warning {
    background: var(--warning-light) !important;
    color: var(--warning) !important;
}

.badge-danger {
    background: var(--negative-light) !important;
    color: var(--negative) !important;
}

.badge-primary {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
}

.badge-info {
    background: var(--info-light) !important;
    color: var(--info) !important;
}


/* ==========================================
   11. Buttons
   ========================================== */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-5);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

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

.btn-outline-secondary:hover {
    background: var(--surface-2);
    color: var(--text-1);
    border-color: var(--border);
}

.btn-success {
    background: var(--positive);
    color: #FFFFFF;
}

.btn-success:hover {
    background: var(--positive);
    color: #FFFFFF;
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline-light:hover {
    background: var(--surface-2);
    color: var(--text-1);
    border-color: var(--border);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

/* Ripple effect */
.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0);
    animation: ripple-anim 0.5s ease-out;
    pointer-events: none;
}

@keyframes ripple-anim {
    to { transform: scale(4); opacity: 0; }
}


/* ==========================================
   12. Alerts
   ========================================== */
.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--surface-0);
}

.alert-success {
    background: var(--positive-light);
    color: var(--positive);
    border-color: var(--positive);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border-color: var(--warning);
}

[data-theme="dark"] .alert-warning {
    color: var(--text-1);
}

.alert-danger {
    background: var(--negative-light);
    color: var(--negative);
    border-color: var(--negative);
}


/* ==========================================
   13. Forms
   ========================================== */
.form-control,
.form-select {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-1);
    transition: all var(--transition-fast);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--surface-2);
}

.form-control:focus,
.form-select:focus {
    background: var(--surface-0);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    color: var(--text-1);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: var(--surface-2);
}

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

.form-check-input {
    background-color: var(--surface-0);
    border-color: var(--border);
    cursor: pointer;
}

[data-theme="dark"] .form-check-input {
    background-color: var(--surface-2);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-light);
    border-color: var(--accent);
}

.form-label {
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--text-1);
    margin-bottom: var(--space-2);
}


/* ==========================================
   14. AI Panel
   ========================================== */
.ai-panel {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.ai-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--info), var(--warning));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.ai-panel-header {
    background: var(--surface-1);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.ai-panel-header .ai-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    color: var(--accent);
}

.ai-panel-header h5 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-1);
    letter-spacing: -0.02em;
}

.ai-panel-body {
    padding: var(--space-5);
}

.ai-insight-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    margin-bottom: var(--space-2);
}

.ai-insight-item:hover {
    background: var(--surface-1);
}

[data-theme="dark"] .ai-insight-item:hover {
    background: var(--surface-2);
}

.ai-insight-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.ai-insight-item .insight-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-1);
    margin-bottom: 2px;
}

.ai-insight-item .insight-desc {
    font-size: var(--text-xs);
    color: var(--text-3);
    line-height: 1.5;
}


/* ==========================================
   15. Action Cards
   ========================================== */
.action-card {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: var(--space-5);
    margin-bottom: var(--space-3);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transition: all var(--transition-base);
    cursor: pointer;
}

.action-card:hover {
    background: var(--surface-1);
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .action-card:hover {
    background: var(--surface-2);
}

.action-card.high { border-left-color: var(--negative); }
.action-card.medium { border-left-color: var(--warning); }
.action-card.low { border-left-color: var(--positive); }

.action-card.approved {
    background: var(--positive-light);
    border-left-color: var(--positive);
    opacity: 0.7;
}

.action-type-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    flex-shrink: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface-3);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--surface-0);
    border-radius: 50%;
    transition: all var(--transition-base);
}

[data-theme="dark"] .toggle-switch .slider:before {
    background: var(--text-2);
}

.toggle-switch input:checked + .slider {
    background: var(--positive-light);
    border: 1px solid var(--positive);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
    background: var(--positive);
}

/* Toolbar */
.action-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--surface-0);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.action-toolbar .toolbar-info {
    font-size: var(--text-sm);
    color: var(--text-3);
    margin-right: auto;
}

.action-toolbar .toolbar-info strong {
    color: var(--accent);
}

.list-group-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) 0;
    color: var(--text-2);
}

.list-group-item:last-child { border-bottom: none; }


/* ==========================================
   16. Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-3);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: var(--space-4);
    color: var(--text-3);
}

.empty-state p {
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    color: var(--text-3);
}


/* ==========================================
   17. Page Header
   ========================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    letter-spacing: -0.02em;
}

.page-header h2 i {
    color: var(--accent);
    font-size: var(--text-xl);
}

.page-header .page-meta {
    font-size: var(--text-sm);
    color: var(--text-3);
}


/* ==========================================
   18. Stepper
   ========================================== */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-3);
    border: 2px solid var(--border);
    transition: all var(--transition-base);
}

.stepper-step.active .stepper-circle {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.stepper-step.completed .stepper-circle {
    background: var(--positive);
    color: #FFFFFF;
    border-color: var(--positive);
}

.stepper-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-3);
}

.stepper-step.active .stepper-label { color: var(--accent); }
.stepper-step.completed .stepper-label { color: var(--positive); }

.stepper-line {
    width: 40px;
    height: 2px;
    background: var(--border);
}

.stepper-line.completed { background: var(--positive); }

/* Step classes (for simpler stepper variant) */
.step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-3);
    font-size: var(--text-sm);
    font-weight: 500;
}

.step.active {
    color: var(--accent);
    font-weight: 600;
}

.step.completed {
    color: var(--positive);
}


/* ==========================================
   19. Chat
   ========================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface-0);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chat-message {
    display: flex;
    gap: var(--space-3);
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.ai {
    align-self: flex-start;
}

.chat-bubble,
.chat-bubble-user,
.chat-bubble-ai {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: 1.6;
    word-break: break-word;
}

.chat-bubble-user,
.chat-message.user .chat-bubble {
    background: var(--accent);
    color: #FFFFFF;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-bubble-ai,
.chat-message.ai .chat-bubble {
    background: var(--surface-1);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-bottom-left-radius: var(--radius-sm);
}

[data-theme="dark"] .chat-bubble-ai,
[data-theme="dark"] .chat-message.ai .chat-bubble {
    background: var(--surface-2);
}

.chat-input-area {
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--surface-0);
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

[data-theme="dark"] .chat-input-area {
    background: var(--surface-1);
}

.chat-input-area .form-control {
    flex: 1;
}

/* Chat typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: var(--space-2) 0;
    align-items: center;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--text-3);
    border-radius: 50%;
    animation: chat-typing-dot 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-typing-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}


/* ==========================================
   20. Animations
   ========================================== */
.animate-in {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity var(--transition-slow),
        transform var(--transition-slow);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-in:nth-child(1) { transition-delay: 0ms; }
.animate-in:nth-child(2) { transition-delay: 60ms; }
.animate-in:nth-child(3) { transition-delay: 120ms; }
.animate-in:nth-child(4) { transition-delay: 180ms; }
.animate-in:nth-child(5) { transition-delay: 240ms; }
.animate-in:nth-child(6) { transition-delay: 300ms; }
.animate-in:nth-child(7) { transition-delay: 360ms; }
.animate-in:nth-child(8) { transition-delay: 420ms; }

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

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.spinner { animation: spin 1s linear infinite; }

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

.slide-in-right { animation: slideInRight var(--transition-base); }

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

.fade-in-up { animation: fadeInUp var(--transition-base); }

.count-up {
    display: inline-block;
}


/* ==========================================
   21. Footer
   ========================================== */
.footer {
    margin-top: auto;
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border);
    background: var(--surface-0);
}

[data-theme="dark"] .footer {
    background: var(--surface-1);
}

.footer small {
    color: var(--text-3);
    font-size: var(--text-xs);
}


/* ==========================================
   22. Scrollbar
   ========================================== */
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-1);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) var(--surface-1);
}


/* ==========================================
   23. Responsive
   ========================================== */
@media (max-width: 992px) {
    main.container-fluid {
        padding: var(--space-6) var(--space-4);
    }
}

@media (max-width: 768px) {
    main.container-fluid {
        padding: var(--space-4) var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stat-card .stat-value {
        font-size: var(--text-2xl);
    }

    .card-body {
        padding: var(--space-4);
    }

    .page-header {
        flex-direction: column;
        gap: var(--space-4);
        align-items: flex-start;
    }

    .stepper {
        flex-wrap: wrap;
    }

    .action-toolbar {
        flex-wrap: wrap;
    }

    .chart-container {
        padding: var(--space-4);
    }

    .chat-message {
        max-width: 95%;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: var(--text-base);
    }

    .navbar {
        padding: var(--space-2) var(--space-3);
    }

    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }

    .ai-panel-header {
        padding: var(--space-4);
    }

    .ai-panel-body {
        padding: var(--space-3);
    }
}


/* ==========================================
   24. Utility Classes
   ========================================== */
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--positive) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--negative) !important; }
.text-info { color: var(--info) !important; }
.text-muted,
.text-secondary { color: var(--text-2) !important; }
.text-light { color: var(--text-1) !important; }

.bg-primary-light { background-color: var(--accent-light) !important; }
.bg-success-light { background-color: var(--positive-light) !important; }
.bg-warning-light { background-color: var(--warning-light) !important; }
.bg-danger-light { background-color: var(--negative-light) !important; }
.bg-info-light { background-color: var(--info-light) !important; }

/* Progress */
.progress {
    border-radius: var(--radius-full);
    background: var(--surface-2);
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--accent), var(--info));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.breadcrumb-item a { color: var(--accent); font-weight: 500; }
.breadcrumb-item a:hover { color: var(--accent-hover); }
.breadcrumb-item.active { color: var(--text-3); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-3); }

/* Toast */
#toast-container .toast {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight var(--transition-base);
}

[data-theme="dark"] #toast-container .toast {
    background: var(--surface-1);
}
