/* ═══════════════════════════════════════════════════
   AI Agent Marketing Team - Design System
   "Warm Sunset" theme with Light/Dark mode
   ═══════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Custom Properties — Dark Mode (default) ── */
:root {
    /* Colors - Warm Sunset palette */
    --color-primary: #f97316;
    --color-primary-light: #fb923c;
    --color-primary-dark: #ea580c;
    --color-secondary: #f59e0b;
    --color-accent: #fbbf24;
    --color-accent-light: #fcd34d;

    /* Status colors */
    --color-success: #22c55e;
    --color-success-light: #4ade80;
    --color-warning: #f59e0b;
    --color-warning-light: #fbbf24;
    --color-error: #ef4444;
    --color-error-light: #f87171;
    --color-info: #38bdf8;

    /* Backgrounds */
    --bg-primary: #121218;
    --bg-secondary: #1c1c24;
    --bg-tertiary: #2a2a35;
    --bg-card: rgba(28, 28, 36, 0.9);
    --bg-card-hover: rgba(42, 42, 53, 0.9);
    --bg-glass: rgba(18, 18, 24, 0.7);
    --bg-input: rgba(28, 28, 36, 0.8);

    /* Text */
    --text-primary: #fef3c7;
    --text-secondary: #d6d3d1;
    --text-tertiary: #78716c;
    --text-inverse: #121218;

    /* Borders */
    --border-color: rgba(251, 191, 36, 0.12);
    --border-color-hover: rgba(251, 191, 36, 0.25);
    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 9999px;

    /* Shadows — warm ember glow */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.25);
    --shadow-glow-accent: 0 0 20px rgba(251, 191, 36, 0.25);

    /* 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-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --content-max-width: 1400px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Light Mode ───────────────────────────────── */
[data-theme="light"] {
    --color-primary: #ea580c;
    --color-primary-light: #f97316;
    --color-primary-dark: #c2410c;
    --color-secondary: #d97706;
    --color-accent: #f59e0b;
    --color-accent-light: #fbbf24;

    --color-success: #16a34a;
    --color-success-light: #22c55e;
    --color-error: #dc2626;
    --color-error-light: #ef4444;
    --color-info: #2563eb;

    --bg-primary: #fffbf5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fef3e2;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(254, 243, 226, 0.9);
    --bg-glass: rgba(255, 251, 245, 0.8);
    --bg-input: rgba(255, 255, 255, 0.9);

    --text-primary: #292524;
    --text-secondary: #57534e;
    --text-tertiary: #a8a29e;
    --text-inverse: #fef3c7;

    --border-color: rgba(234, 88, 12, 0.12);
    --border-color-hover: rgba(234, 88, 12, 0.25);

    --shadow-sm: 0 1px 3px rgba(234, 88, 12, 0.06);
    --shadow: 0 4px 6px -1px rgba(234, 88, 12, 0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(234, 88, 12, 0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(234, 88, 12, 0.12), 0 8px 10px -6px rgba(0,0,0,0.06);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.15);
    --shadow-glow-accent: 0 0 20px rgba(251, 191, 36, 0.15);
}

/* Smooth transition on theme switch */
body, .sidebar, .main-content, .card, .agent-hub-card, .agent-hub-panel,
.top-header, .stat-card, .nav-item, .form-input, .btn, .modal, .toast {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

button {
    cursor: pointer;
    font-family: var(--font-family);
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
}

/* Force dark theme on native select/option across all browsers */
select {
    background-color: var(--bg-input, var(--surface, #1e1e2e));
    color: var(--text-primary, #e2e8f0);
    border: 1px solid var(--border-color, #3a3a4a);
    border-radius: var(--border-radius, 8px);
    padding: 6px 10px;
}
select option {
    background-color: var(--bg-input, var(--surface, #1e1e2e));
    color: var(--text-primary, #e2e8f0);
    padding: 8px 10px;
}
select option:checked,
select option:hover {
    background-color: var(--primary, #f97316);
    color: #fff;
}

/* ─── Date / Time inputs — dark theme fix ────────────────────────────────── */
input[type="date"],
input[type="time"] {
    color-scheme: dark;
    color: var(--text-primary, #e2e8f0);
    background-color: var(--bg-input, #1c1c24);
    border: 1px solid var(--border-color, #3a3a4a);
    border-radius: var(--border-radius, 8px);
}

/* Editable parts of the date/time picker (placeholder segments) */
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="time"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-hours-field,
input[type="time"]::-webkit-datetime-edit-minutes-field {
    color: var(--text-primary, #e2e8f0);
}

/* Calendar / clock icon — invert so it's visible on dark backgrounds */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8) brightness(1.1);
    cursor: pointer;
    opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Light theme overrides */
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"] {
    color-scheme: light;
}
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-text,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-month-field,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-day-field,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-year-field,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-text,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-hours-field,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-minutes-field {
    color: var(--text-primary, #1a1a2e);
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

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

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

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

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

/* ─── Layout ───────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(251, 191, 36, 0.08));
    color: var(--color-primary-light);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--border-radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, #f97316, #fbbf24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-role {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ─── Main Content ─────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-header {
    height: var(--header-height);
    padding: 0 var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.header-breadcrumb {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.page-content {
    flex: 1;
    padding: var(--space-8);
    max-width: 100%;
    width: 100%;
}

/* ─── Cards ────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition);
}

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

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

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

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* ─── Stat Cards ───────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5) var(--space-6);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color, #f97316), transparent);
}

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

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: var(--space-3);
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
}

.stat-card-value {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-card-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

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

.stat-card-change.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success-light);
}

.stat-card-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error-light);
}

/* ─── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: all var(--transition);
    white-space: nowrap;
    height: 38px;
}

.btn-primary {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-error), #dc2626);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon {
    width: 38px;
    padding: 0;
}

.btn-sm {
    height: 30px;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    height: 46px;
    padding: var(--space-3) var(--space-8);
    font-size: var(--font-size-base);
}

/* ─── Forms ────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: all var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

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

.form-textarea {
    min-height: 100px;
    padding: var(--space-3) var(--space-4);
    resize: vertical;
    height: auto;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ─── Badges ───────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-primary {
    background: rgba(249, 115, 22, 0.2);
    color: var(--color-primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success-light);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-warning-light);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error-light);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

/* ─── Tables ───────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--border-color);
}

tr:hover td {
    background: rgba(99, 102, 241, 0.03);
}

/* ─── Agent Cards ──────────────────────────────── */
.agent-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    background: var(--bg-card);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--color-primary);
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.agent-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.agent-icon.cmo {
    background: linear-gradient(135deg, #f97316, #fbbf24);
}

.agent-icon.copywriter {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
}

.agent-icon.seo {
    background: linear-gradient(135deg, #10b981, #059669);
}

.agent-icon.analytics {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.agent-name {
    font-weight: 700;
    font-size: var(--font-size-base);
}

.agent-role {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.agent-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    margin-top: var(--space-3);
}

.agent-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse 2s infinite;
}

.agent-status-dot.idle {
    background: var(--text-tertiary);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ─── Activity Feed ────────────────────────────── */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.activity-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius);
    transition: background var(--transition);
}

.activity-item:hover {
    background: var(--bg-tertiary);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.activity-text strong {
    color: var(--color-primary-light);
}

.activity-time {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ─── Content Cards ────────────────────────────── */
.content-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    background: var(--bg-card);
    transition: all var(--transition);
}

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

.content-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.content-type-icon {
    font-size: 16px;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    background: rgba(99, 102, 241, 0.15);
}

.seo-score {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.seo-score-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.seo-score-fill {
    height: 100%;
    border-radius: 2px;
    transition: width var(--transition-slow);
}

/* ─── Modal ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-spring);
}

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

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

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
}

/* ─── Language Switcher ────────────────────────── */
.lang-switch {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
    padding: 2px;
    height: 32px;
}

.lang-switch-btn {
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: all var(--transition);
}

.lang-switch-btn.active {
    background: var(--color-primary);
    color: white;
}

/* ─── Notification Bell & Dropdown ──────────────── */
.notification-wrapper {
    position: relative;
    display: inline-block;
}

.notification-bell {
    position: relative;
    font-size: 1.25rem;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background: var(--color-danger, #ef4444);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--bg-primary);
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: var(--shadow-xl);
    z-index: 1500;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.notif-dropdown-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.notif-mark-all:hover {
    background: var(--color-primary-alpha, rgba(99,102,241,0.1));
}

.notif-dropdown-list {
    overflow-y: auto;
    max-height: 340px;
    flex: 1;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.notif-item:hover {
    background: var(--bg-hover, rgba(255,255,255,0.05));
}
.notif-item.notif-unread {
    background: var(--color-primary-alpha, rgba(99,102,241,0.06));
}

.notif-item-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

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

.notif-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted, #999);
    margin-top: 3px;
}

.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-empty, .notif-loading {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.notif-dropdown-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-3) var(--space-4);
    text-align: center;
}

.notif-view-all {
    font-size: 0.85rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}
.notif-view-all:hover {
    text-decoration: underline;
}

/* ─── Notifications Page ───────────────────────── */
.notifications-page {
    max-width: 700px;
    margin: 0 auto;
}

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

.notifications-page-list .notif-item {
    border-radius: var(--border-radius);
    margin-bottom: var(--space-2);
    border: 1px solid var(--border-color);
}

/* ─── @Mention Dropdown ────────────────────────── */
.td-mention-item:hover, .td-mention-item.active {
    background: var(--bg-hover, rgba(255,255,255,0.08)) !important;
}

/* ─── Toast Notifications ──────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-3) var(--space-5);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
    animation: slideIn var(--transition-spring) forwards;
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-error);
}

.toast.warning {
    border-left: 3px solid var(--color-warning);
}

.toast.info {
    border-left: 3px solid var(--color-info);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ─── Charts Container ────────────────────────── */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ─── Grid Utilities ───────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
}

/* ─── Flex Utilities ───────────────────────────── */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

/* ─── Text Utilities ───────────────────────────── */
.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

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

.text-3xl {
    font-size: var(--font-size-3xl);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ─── Spacing Utilities ────────────────────────── */
.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

/* ─── Login Page ───────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.15), transparent 70%);
    top: -200px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.1), transparent 70%);
    bottom: -100px;
    left: -100px;
}

.login-card {
    width: 420px;
    padding: var(--space-10);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
}

.login-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    margin: 0 auto var(--space-6);
}

.login-title {
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-8);
}

.login-btn {
    width: 100%;
    height: 46px;
    font-size: var(--font-size-base);
    margin-top: var(--space-2);
}

.login-demo-accounts {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
}

.login-demo-title {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
    text-align: center;
}

.demo-account-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    transition: all var(--transition);
    margin-bottom: var(--space-2);
}

.demo-account-btn:hover {
    background: rgba(249, 115, 22, 0.1);
    border-color: var(--color-primary);
    color: var(--text-primary);
}

/* ─── Loading ──────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* ─── Empty State ──────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* ─── Progress Bar ─────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width var(--transition-slow);
}

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

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

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

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-content {
        padding: var(--space-4);
    }
}

/* ─── Animations ───────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

/* ─── Loading Screen ───────────────────────────── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: var(--space-4);
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Agent Workflow Steps ─────────────────────── */
.agent-step-block {
    animation: fadeIn 0.3s ease-out;
    background: rgba(99, 102, 241, 0.03);
}

.agent-workflow-progress {
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: var(--space-2);
}

.agent-workflow-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width 0.3s ease;
    border-radius: 2px;
}

.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

pre {
    font-family: 'SF Mono', Monaco, 'Cascadia Mono', monospace;
}

/* ─── Agent Hub ────────────────────────────────── */
.agent-hub-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: var(--space-6);
    min-height: 70vh;
}

.agent-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

.agent-hub-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.agent-hub-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--agent-color, var(--color-primary));
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.agent-hub-card:hover {
    border-color: var(--agent-color, var(--color-primary));
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.agent-hub-card:hover::before,
.agent-hub-card.selected::before {
    opacity: 1;
}

.agent-hub-card.selected {
    border-color: var(--agent-color, var(--color-primary));
    box-shadow: 0 0 0 1px var(--agent-color, var(--color-primary)), 0 8px 24px rgba(0,0,0,0.2);
}

.agent-hub-card.coming-soon {
    opacity: 0.5;
    cursor: default;
}

.agent-hub-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
}

.agent-hub-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.agent-hub-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.agent-hub-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.agent-hub-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
    line-height: 1.4;
}

.agent-hub-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.agent-hub-status {
    display: flex;
    align-items: center;
}

.agent-hub-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse 2s infinite;
}

/* Panel */
.agent-hub-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
    max-height: calc(100vh - var(--header-height) - var(--space-8) * 2);
    overflow-y: auto;
}

.agent-hub-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    text-align: center;
}

.agent-hub-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99,102,241,0.05), rgba(6,182,212,0.05));
}

.agent-hub-panel-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

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

.agent-hub-panel-body .form-group {
    margin-bottom: var(--space-4);
}

.agent-hub-panel-body textarea.form-input {
    height: auto;
    min-height: 70px;
    padding: var(--space-3) var(--space-4);
    resize: vertical;
}

/* Result */
.agent-hub-result {
    border-top: 1px solid var(--border-color);
    padding: var(--space-5);
}

.agent-hub-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.agent-hub-result-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.agent-hub-section {
    margin-bottom: var(--space-3);
}

.agent-hub-section-label {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-primary-light);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.agent-hub-field {
    display: flex;
    gap: var(--space-2);
    padding: 3px 0;
    font-size: 0.85rem;
}

.agent-hub-field-label {
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.agent-hub-field-value {
    color: var(--text-primary);
}

.agent-hub-list-item {
    padding: 3px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.agent-hub-text-block {
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--border-radius);
}

.agent-hub-error {
    text-align: center;
    padding: var(--space-6);
}

/* Loading */
.agent-hub-loading {
    text-align: center;
    padding: var(--space-8);
}

.agent-hub-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.agent-hub-spinner-lg {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-3);
}

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

/* Responsive */
@media (max-width: 900px) {
    .agent-hub-layout {
        grid-template-columns: 1fr;
    }
    .agent-hub-panel {
        position: static;
        max-height: none;
    }
}

/* ═══════════════════════════════════════
   Agent Chat UI
   ═══════════════════════════════════════ */
.chat-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100%;
    overflow: hidden;
}
.chat-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-sidebar-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}
.chat-sidebar-header h4 { margin: 0; font-size: 1rem; }
.chat-sidebar-search {
    padding: var(--space-2) var(--space-3);
}
.chat-sidebar-search .form-input {
    font-size: 0.8rem;
    padding: var(--space-2);
}
.chat-agent-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}
.chat-agent-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}
.chat-agent-item:hover { background: var(--bg-tertiary); }
.chat-agent-item.active {
    background: var(--color-primary);
    color: #fff;
}
.chat-agent-item.active .chat-agent-desc { color: rgba(255,255,255,0.7); }
.chat-agent-icon {
    width: 32px; height: 32px;
    border-radius: var(--border-radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    color: #fff;
}
.chat-agent-info { min-width: 0; }
.chat-agent-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-agent-desc { font-size: 0.65rem; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chat main area */
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
}
.chat-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}
.chat-header-agent { display: flex; align-items: center; gap: var(--space-3); }
.chat-header-icon {
    width: 36px; height: 36px;
    border-radius: var(--border-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff;
}
.chat-header-name { font-weight: 600; font-size: 0.95rem; }
.chat-header-status { font-size: 0.7rem; color: var(--color-success); }

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    scroll-behavior: smooth;
}
.chat-message { display: flex; gap: var(--space-2); max-width: 80%; }
.chat-message-user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message-agent { align-self: flex-start; }
.chat-avatar {
    width: 32px; height: 32px;
    border-radius: var(--border-radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; flex-shrink: 0; color: #fff;
}
.chat-bubble {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.chat-bubble-user {
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-agent {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}
.chat-text { word-break: break-word; }
.chat-text pre {
    background: var(--bg-tertiary);
    padding: var(--space-2);
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    font-size: 0.8rem;
    margin: var(--space-2) 0;
}
.chat-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    font-size: 0.65rem;
    color: var(--text-tertiary);
}
.chat-bubble-user .chat-meta { color: rgba(255,255,255,0.6); justify-content: flex-end; }
.chat-model { background: var(--bg-tertiary); padding: 1px 6px; border-radius: var(--border-radius-sm); }
.chat-copy-btn {
    background: none; border: none; cursor: pointer;
    font-size: 0.7rem; padding: 2px;
}
.chat-result-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: var(--space-2);
    color: var(--color-primary);
}
.chat-rich-content { line-height: 1.6; }
.chat-rich-content h2, .chat-rich-content h3 { margin-top: var(--space-3); }
.chat-details {
    margin-top: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
}
.chat-details summary {
    padding: var(--space-2);
    cursor: pointer;
    font-weight: 500;
}
.chat-detail-item {
    padding: var(--space-1) var(--space-2);
    border-top: 1px solid var(--border-color);
    font-size: 0.78rem;
}

/* Typing indicator */
.chat-typing {
    display: flex; gap: 4px; padding: 4px 0;
}
.chat-typing span {
    width: 8px; height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: chatTyping 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.chat-input-area {
    padding: var(--space-3) var(--space-6);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-2) var(--space-3);
    transition: border-color 0.2s;
}
.chat-input-wrapper:focus-within { border-color: var(--color-primary); }
.chat-input {
    flex: 1;
    background: none; border: none; outline: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    padding: var(--space-1) 0;
}
.chat-send-btn {
    width: 36px; height: 36px;
    border-radius: var(--border-radius-full);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.1s, opacity 0.2s;
}
.chat-send-btn:hover { transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Empty / Welcome states */
.chat-empty, .chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: var(--space-8);
}
.chat-empty-icon { font-size: 3rem; margin-bottom: var(--space-3); }
.chat-welcome-icon {
    width: 64px; height: 64px;
    border-radius: var(--border-radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: #fff;
    margin-bottom: var(--space-4);
}
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    margin-top: var(--space-4);
    max-width: 600px;
}
.chat-suggestion-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}
.chat-suggestion-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-sidebar { display: none; }
    .chat-messages { padding: var(--space-3); }
    .chat-message { max-width: 90%; }
    .chat-input-area { padding: var(--space-2) var(--space-3); }
}

/* ═══════════════════════════════════════
   Super Admin & Utility
   ═══════════════════════════════════════ */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}
.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}
.health-item:last-child { border-bottom: none; }
.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-tertiary);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-3); }

/* ───────── Calendar Grid — Editorial Warm ───────── */
.cal-nav { display: flex; align-items: center; gap: var(--space-3); }
.cal-month-label { font-size: 1.1rem; font-weight: 600; min-width: 140px; text-align: center; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--border-color);
}

.cal-header-cell {
    padding: 10px 12px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.cal-header-cell:last-child { border-right: none; }

.cal-cell {
    min-height: 128px;
    padding: 10px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-width: 0;
    transition: background 0.18s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--bg-tertiary); }
.cal-cell.empty { background: var(--bg-primary); opacity: 0.45; pointer-events: none; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--color-primary); }

/* Day number */
.cal-day {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.cal-day-num {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}
.cal-cell.today .cal-day-num {
    background: var(--color-primary);
    color: #fff;
}

/* Event pill */
.cal-event {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    padding: 4px 7px 4px 6px;
    border-radius: 7px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.12s;
    overflow: hidden;
    min-width: 0;
    user-select: none;
}
.cal-event:hover { filter: brightness(1.13); transform: translateY(-1px); }
.cal-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}
.cal-event-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-event-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-event-sub {
    font-size: 9.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Light theme overrides */
[data-theme="light"] .cal-cell { background: #ffffff; }
[data-theme="light"] .cal-cell:hover { background: #fef9f5; }
[data-theme="light"] .cal-cell.empty { background: #f5f0ea; }
[data-theme="light"] .cal-header-cell { background: #fef3e2; color: #a8a29e; }
[data-theme="light"] .cal-event-label { color: #292524; }
[data-theme="light"] .cal-event-sub { color: #78716c; }

/* Legacy compat */
.cal-event-brand { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-event-channel { opacity: 0.8; flex-shrink: 0; }

/* ───────── Kanban Board ───────── */
.kanban-board { display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-4); min-height: 400px; }
.kanban-column { flex: 1; min-width: 240px; max-width: 300px; background: var(--surface-body);
    border-radius: var(--radius-md); display: flex; flex-direction: column; }
.kanban-column-header { padding: var(--space-3); font-weight: 700; font-size: 0.9rem;
    display: flex; justify-content: space-between; align-items: center;
    border-top: 3px solid currentColor; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.kanban-count { background: var(--surface-card); padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; }
.kanban-cards { padding: var(--space-2); flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: var(--space-2); }
.kanban-cards.drag-over { background: var(--primary-light, rgba(232,99,43,0.08)); border-radius: var(--radius-sm); }
.kanban-card { background: var(--surface-card); border-radius: var(--radius-sm); padding: var(--space-3);
    cursor: grab; position: relative; transition: box-shadow 0.2s, transform 0.15s; border: 1px solid var(--border-color); }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-priority { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.kanban-card-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.kanban-card-desc { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; }
.kanban-tag { font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-due { color: var(--text-secondary); }

/* ───────── Workload Matrix ───────── */
.workload-legend { display: flex; gap: var(--space-4); margin-bottom: var(--space-4); padding: var(--space-2) 0; }
.wl-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.wl-dot.manual { background: var(--error, #E53E3E); }
.wl-dot.ai { background: var(--success, #38A169); }
.workload-row { display: grid; grid-template-columns: 200px 1fr 60px; gap: var(--space-3);
    align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-color); }
.workload-row:last-child { border-bottom: none; }
.workload-label { font-size: 0.82rem; font-weight: 500; }
.workload-bars { display: flex; flex-direction: column; gap: 3px; }
.wl-bar { height: 20px; border-radius: 4px; font-size: 0.7rem; display: flex; align-items: center;
    padding: 0 8px; color: #fff; font-weight: 600; min-width: 30px; transition: width 0.5s ease; }
.wl-bar.manual { background: var(--error, #E53E3E); }
.wl-bar.ai { background: var(--success, #38A169); }
.workload-save { font-weight: 700; font-size: 0.85rem; color: var(--success, #38A169); text-align: right; }

/* ───────── Roadmap Timeline ───────── */
.roadmap-container { position: relative; padding-left: 30px; }
.roadmap-container::before { content: ''; position: absolute; left: 12px; top: 0; bottom: 0;
    width: 3px; background: var(--border-color); }
.roadmap-phase { position: relative; margin-bottom: var(--space-6); }
.roadmap-dot { position: absolute; left: -24px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--border-color); border: 3px solid var(--surface-body); z-index: 1; }
.roadmap-phase.done .roadmap-dot { background: var(--success, #38A169); }
.roadmap-phase.current .roadmap-dot { background: var(--primary, #E8632B); box-shadow: 0 0 0 4px rgba(232,99,43,0.2); }
.roadmap-content { background: var(--surface-card); border-radius: var(--radius-md); padding: var(--space-4);
    border: 1px solid var(--border-color); }
.roadmap-title { margin: 0 0 var(--space-2); font-size: 1rem; }
.roadmap-meta { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: var(--space-3); }
.roadmap-items { list-style: none; padding: 0; margin: 0; }
.roadmap-items li { padding: 4px 0; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.roadmap-items li.done { color: var(--text-secondary); }
.roadmap-check { font-size: 0.7rem; }
.roadmap-items li.done .roadmap-check { color: var(--success, #38A169); }

/* ───────── Brand Tier Badges ───────── */
.tier-badge { display: inline-flex; align-items: center; justify-content: center; padding: 6px 14px;
    border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; min-width: 70px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.tier-badge.tier-1 { background: linear-gradient(135deg, #FBBF24, #F59E0B); color: #7C2D12; }
.tier-badge.tier-2 { background: linear-gradient(135deg, #60A5FA, #3B82F6); color: #fff; }
.tier-badge.tier-3 { background: linear-gradient(135deg, #34D399, #10B981); color: #fff; }
.tier-badge.tier-4 { background: linear-gradient(135deg, #9CA3AF, #6B7280); color: #fff; }

/* ───────── Form Rows ───────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-input { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); background: var(--surface-body); color: var(--text-primary);
    font-size: 0.9rem; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,99,43,0.15); }

/* ───────── Modal Overlay ───────── */
/* NOTE: Primary modal styles are defined above (~line 933) using visibility/opacity.
   Do NOT add display:none here — it breaks the modal toggle. */
.empty-state-title { font-size: 1rem; font-weight: 600; }

/* ───────── Health Check Panel ───────── */
.health-list { display: flex; flex-direction: column; gap: 8px; }
.health-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; }
.health-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.health-info { flex: 1; }
.health-info strong { font-size: 0.85rem; display: block; }
.health-info small { font-size: 0.75rem; color: var(--text-secondary); }
.health-ok .health-dot { background: var(--success, #38A169); }
.health-warn .health-dot { background: var(--warning, #DD6B20); }
.health-danger .health-dot { background: var(--error, #E53E3E); }

/* ───────── Stats Grid (Chairman Dashboard) ───────── */
.stats-grid { display: grid; gap: var(--space-4); }
.stats-grid.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat-card { background: var(--surface-card); border-radius: var(--radius-md); padding: var(--space-5);
    border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--primary); opacity: 0.5; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 18px; margin-bottom: 12px; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.stat-delta { font-size: 0.75rem; margin-top: 4px; }
.stat-delta.positive { color: var(--success, #38A169); }
.stat-delta.negative { color: var(--error, #E53E3E); }

/* ───────── Modal Body ───────── */
.modal-body { display: flex; flex-direction: column; gap: var(--space-3); }
.modal-body .form-group { margin-bottom: 0; }
.modal-body .form-group label { font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; display: block; color: var(--text-secondary); }
.modal-body select.form-input { appearance: auto; }

/* ═══════════════════════════════════════════════════
   Profile Panel — Slide-in from right
   ═══════════════════════════════════════════════════ */

.profile-panel-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    pointer-events: none;
}
.profile-panel-overlay.active { pointer-events: auto; }

.profile-panel-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity var(--transition-slow);
}
.profile-panel-overlay.active .profile-panel-backdrop { opacity: 1; }

.profile-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    z-index: 1001;
    overflow: hidden;
}
.profile-panel-overlay.active .profile-panel { transform: translateX(0); }

.profile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    min-height: var(--header-height);
}
.profile-panel-title { font-size: var(--font-size-lg); font-weight: 700; }

.profile-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Avatar Section */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}
.profile-avatar-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
}
.profile-avatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: white;
    overflow: hidden;
    border: 3px solid var(--border-color);
    transition: border-color var(--transition);
}
.profile-avatar-wrapper:hover .profile-avatar { border-color: var(--color-primary); }

.profile-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-avatar-initial {
    font-size: 48px;
    font-weight: 700;
    color: white;
}
.profile-avatar-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    color: white;
    font-size: 24px;
}
.profile-avatar-overlay-text { font-size: 12px; margin-top: 4px; }
.profile-avatar-wrapper:hover .profile-avatar-overlay { opacity: 1; }

.profile-avatar-hint {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* Profile Sections */
.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
}
.profile-section-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}
.profile-message {
    font-size: var(--font-size-xs);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-3);
}
.profile-error { background: rgba(239,68,68,0.1); color: var(--color-error-light); }
.profile-success { background: rgba(34,197,94,0.1); color: var(--color-success-light); }

/* ═══════════════════════════════════════════════════
   Avatar Crop Modal
   ═══════════════════════════════════════════════════ */

.avatar-crop-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.avatar-crop-modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.avatar-crop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}
.avatar-crop-title { font-size: var(--font-size-base); font-weight: 700; }

.avatar-crop-body { padding: var(--space-4); }
.avatar-crop-container {
    width: 100%;
    height: 350px;
    max-height: 50vh;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.avatar-crop-container img { max-width: 100%; display: block; }

.avatar-crop-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    gap: var(--space-4);
}
.avatar-crop-zoom {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}
.avatar-crop-label { font-size: var(--font-size-xs); color: var(--text-secondary); white-space: nowrap; }
.avatar-crop-zoom input[type="range"] { flex: 1; accent-color: var(--color-primary); }
.avatar-crop-rotate { display: flex; gap: var(--space-2); }

.avatar-crop-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
}

/* Circular crop mask for Cropper.js */
.cropper-crop-circle .cropper-view-box,
.cropper-crop-circle .cropper-face {
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════
   Header User Menu
   ═══════════════════════════════════════════════════ */

.header-user-menu { position: relative; }
.header-user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-primary);
}
.header-user-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}
.header-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}
.header-user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-user-chevron {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform var(--transition);
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}
.header-user-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background var(--transition);
    border: none;
    text-align: left;
}
.header-user-dropdown-item:hover { background: var(--bg-tertiary); }
.header-user-dropdown-logout:hover { color: var(--color-error-light); }
.header-user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}