/**
 * Super Admin Interface Stylesheet
 * Flight Buddy Command Center
 *
 * Design Direction: Refined Command Center
 * - Dark mode base with purple/violet accents for elevated, secure feeling
 * - Geometric patterns reminiscent of flight paths and radar
 * - Crisp data presentation with glowing status indicators
 *
 * Color System:
 * - Primary: Indigo (#6366f1) to Violet (#7c3aed)
 * - Background: Deep slate grays
 * - Accent: Violet glow effects
 *
 * Typography:
 * - Display: Plus Jakarta Sans (headers)
 * - UI: DM Sans (body text)
 * - Data: JetBrains Mono (tables, metrics)
 *
 * Version: 1.0.0
 */

/* ==========================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================== */

:root {
    /* Primary Colors - Purple/Indigo Theme */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Accent Colors - Violet */
    --accent-400: #a78bfa;
    --accent-500: #8b5cf6;
    --accent-600: #7c3aed;
    --accent-700: #6d28d9;

    /* Background Colors - Deep Slate */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-elevated: #1f1f35;
    --bg-hover: rgba(99, 102, 241, 0.1);

    /* Surface Colors */
    --surface-dark: #0a0a12;
    --surface-muted: #2a2a4a;
    --surface-border: rgba(99, 102, 241, 0.2);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Status Colors */
    --status-success: #22c55e;
    --status-success-bg: rgba(34, 197, 94, 0.15);
    --status-warning: #f59e0b;
    --status-warning-bg: rgba(245, 158, 11, 0.15);
    --status-danger: #ef4444;
    --status-danger-bg: rgba(239, 68, 68, 0.15);
    --status-info: #3b82f6;
    --status-info-bg: rgba(59, 130, 246, 0.15);

    /* Typography */
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-ui: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-glow-accent: 0 0 30px rgba(124, 58, 237, 0.4);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-toast: 300;
    --z-tooltip: 400;

    /* Layout */
    --header-height: 64px;
    --sidebar-width: 240px;
    --content-max-width: 1400px;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */

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

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

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

/* Subtle grid pattern background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

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

a:hover {
    color: var(--primary-300);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

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

/* ==========================================
   LOADING SCREEN
   ========================================== */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

/* Radar-style spinner */
.radar-spinner {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-6);
}

.radar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid var(--primary-500);
    opacity: 0.3;
}

.radar-ring:nth-child(1) {
    width: 30px;
    height: 30px;
}

.radar-ring:nth-child(2) {
    width: 60px;
    height: 60px;
}

.radar-ring:nth-child(3) {
    width: 90px;
    height: 90px;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 45px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-500), transparent);
    transform-origin: left center;
    animation: radar-sweep 2s linear infinite;
}

@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ==========================================
   LOGIN SCREEN
   ========================================== */

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
    z-index: -1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.login-header {
    padding: var(--space-8) var(--space-6) var(--space-4);
    text-align: center;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-600));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-accent);
}

.logo-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-logo h1 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
}

.login-content {
    padding: var(--space-6);
}

.security-notice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.security-notice svg {
    width: 16px;
    height: 16px;
    color: var(--primary-400);
    flex-shrink: 0;
}

.email-auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--status-danger);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-left: 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.form-input:not(.input-wrapper .form-input) {
    padding-left: var(--space-4);
}

.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    resize: vertical;
    min-height: 80px;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--surface-border);
}

.login-footer {
    padding: var(--space-4) var(--space-6);
    text-align: center;
    border-top: 1px solid var(--surface-border);
}

.login-footer p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border: 1px solid transparent;
}

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

.btn-glow {
    box-shadow: var(--shadow-glow);
}

.btn-glow:hover {
    box-shadow: var(--shadow-glow-accent);
}

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

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

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

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary-500);
}

.btn-success {
    background: var(--status-success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-warning {
    background: var(--status-warning);
    color: var(--text-inverse);
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--status-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

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

.btn-sm svg {
    width: 14px;
    height: 14px;
}

/* ==========================================
   NAVIGATION HEADER
   ========================================== */

.nav-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--surface-border);
    z-index: var(--z-dropdown);
}

.nav-accent-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-600), var(--primary-500));
    background-size: 200% 100%;
    animation: accent-shimmer 3s ease infinite;
}

@keyframes accent-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.nav-content {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    gap: var(--space-6);
}

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

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-600));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo .brand-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.brand-text h1 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.super-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--primary-600), var(--accent-600));
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.super-admin-badge svg {
    width: 10px;
    height: 10px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.nav-item.active {
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.15);
}

.nav-icon {
    width: 18px;
    height: 18px;
}

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

.account-dropdown {
    position: relative;
}

.account-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.account-btn:hover {
    background: var(--bg-hover);
}

.account-avatar {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.account-email {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    z-index: var(--z-dropdown);
}

.account-menu-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: var(--space-2);
}

.account-menu-email {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.account-menu-role {
    display: block;
    font-size: var(--text-xs);
    color: var(--primary-400);
}

.account-menu-divider {
    height: 1px;
    background: var(--surface-border);
    margin: var(--space-2) 0;
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.account-menu-item svg {
    width: 16px;
    height: 16px;
}

.version-badge {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: var(--space-1) var(--space-2);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* Offline Banner */
.offline-banner {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--status-warning-bg);
    border-bottom: 1px solid var(--status-warning);
    padding: var(--space-2) var(--space-4);
}

.offline-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--status-warning);
}

.offline-banner-content svg {
    width: 16px;
    height: 16px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    border-radius: var(--radius-md);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
}

.mobile-nav.active {
    display: block;
}

.mobile-nav-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.mobile-nav-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    animation: slide-in-right 0.2s ease;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--surface-border);
}

.mobile-nav-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

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

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

.mobile-nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--surface-border);
}

.mobile-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-user-avatar svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.mobile-user-info {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    word-break: break-all;
}

.mobile-nav-menu {
    flex: 1;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.mobile-nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-400);
}

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

.mobile-nav-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--surface-border);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main-content {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: var(--space-6);
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}

.content-section {
    display: none;
    animation: fade-in 0.3s ease;
}

.content-section.active {
    display: block;
}

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

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.section-title h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

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

.last-updated {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.last-updated svg {
    width: 14px;
    height: 14px;
}

.section-filters {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-group label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group .form-select {
    min-width: 160px;
}

.search-group {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    padding-left: 38px;
}

/* ==========================================
   STATS GRID
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-600));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-glow);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(124, 58, 237, 0.2));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary-400);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-1);
}

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

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

.stat-trend,
.stat-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
}

.stat-trend svg {
    width: 12px;
    height: 12px;
}

.stat-trend-up {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.stat-trend-down {
    color: var(--status-danger);
    background: var(--status-danger-bg);
}

.stat-trend-neutral {
    color: var(--text-muted);
    background: var(--surface-muted);
}

.stat-indicator-live {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.stat-indicator-live .pulse {
    width: 6px;
    height: 6px;
    background: var(--status-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.stat-indicator-healthy {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.stat-indicator-healthy svg {
    width: 12px;
    height: 12px;
}

/* ==========================================
   DASHBOARD PANELS
   ========================================== */

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-4);
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--surface-border);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.panel-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--primary-400);
}

.panel-link {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--primary-400);
}

.panel-link:hover {
    color: var(--primary-300);
}

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

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.activity-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 16px;
    height: 16px;
    color: var(--primary-400);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.activity-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.activity-empty,
.errors-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--text-muted);
    text-align: center;
}

.activity-empty svg,
.errors-empty svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

/* Companies Summary */
.companies-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.summary-dot-active {
    background: var(--status-success);
    box-shadow: 0 0 8px var(--status-success);
}

.summary-dot-suspended {
    background: var(--status-warning);
    box-shadow: 0 0 8px var(--status-warning);
}

.summary-dot-inactive {
    background: var(--status-danger);
    box-shadow: 0 0 8px var(--status-danger);
}

.summary-label {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.summary-value {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================
   DATA TABLES
   ========================================== */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table {
    width: 100%;
}

.data-table thead {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--surface-border);
}

.data-table th {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--surface-border);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .company-name {
    font-weight: 500;
    color: var(--text-primary);
}

.data-table .user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.data-table .mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.data-table .actions {
    display: flex;
    gap: var(--space-2);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.status-badge-active {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.status-badge-suspended {
    color: var(--status-warning);
    background: var(--status-warning-bg);
}

.status-badge-inactive {
    color: var(--status-danger);
    background: var(--status-danger-bg);
}

.status-badge-pending {
    color: var(--status-info);
    background: var(--status-info-bg);
}

/* Plan Badges */
.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
    background: var(--surface-muted);
    color: var(--text-secondary);
}

.plan-badge-enterprise {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-400);
}

.plan-badge-professional {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-400);
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
    background: var(--surface-muted);
    color: var(--text-secondary);
}

/* ==========================================
   HEALTH GRID
   ========================================== */

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.health-card {
    background: var(--bg-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.health-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.health-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary-400);
}

.health-info {
    flex: 1;
}

.health-info h4 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.health-status {
    font-size: var(--text-sm);
    font-weight: 500;
}

.health-status-operational {
    color: var(--status-success);
}

.health-status-degraded {
    color: var(--status-warning);
}

.health-status-down {
    color: var(--status-danger);
}

.health-status-checking {
    color: var(--text-muted);
}

.health-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.health-metric {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.metric-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.metric-value {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* Errors Panel */
.panel-errors {
    margin-top: var(--space-4);
}

.errors-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.error-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--status-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
}

.error-icon {
    width: 24px;
    height: 24px;
    color: var(--status-danger);
    flex-shrink: 0;
}

.error-content {
    flex: 1;
}

.error-message {
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.error-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================
   MODALS
   ========================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    animation: modal-in 0.2s ease;
}

.modal-sm .modal-container {
    max-width: 400px;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    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(--surface-border);
}

/* Form Panels */
.form-panel {
    margin-bottom: var(--space-6);
}

.form-panel:last-child {
    margin-bottom: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-title svg {
    width: 16px;
    height: 16px;
    color: var(--primary-400);
}

/* Status Modal */
.status-info {
    margin-bottom: var(--space-5);
}

.status-info p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.status-info strong {
    color: var(--text-primary);
}

.status-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: var(--z-toast);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    animation: toast-in 0.3s ease;
}

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

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-close {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.toast-success .toast-icon {
    color: var(--status-success);
}

.toast-error .toast-icon {
    color: var(--status-danger);
}

.toast-warning .toast-icon {
    color: var(--status-warning);
}

.toast-info .toast-icon {
    color: var(--status-info);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

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

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

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-group {
        max-width: none;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }

    .health-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        max-height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 56px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .brand-text h1 {
        display: none;
    }

    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
    }

    .toast {
        min-width: auto;
    }
}

/* ==========================================
   SIMPLE DATATABLES OVERRIDES
   ========================================== */

.dataTable-wrapper .dataTable-top,
.dataTable-wrapper .dataTable-bottom {
    padding: var(--space-3) var(--space-4);
}

.dataTable-wrapper .dataTable-search input {
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
}

.dataTable-wrapper .dataTable-search input:focus {
    outline: none;
    border-color: var(--primary-500);
}

.dataTable-wrapper .dataTable-selector {
    background: var(--bg-tertiary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: var(--space-2);
}

.dataTable-wrapper .dataTable-pagination li a {
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
}

.dataTable-wrapper .dataTable-pagination li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dataTable-wrapper .dataTable-pagination li.active a {
    background: var(--primary-500);
    color: white;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-mono {
    font-family: var(--font-mono);
}

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

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

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

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

/* ==========================================
   TOTP MODAL
   Two-factor authentication modal styles
   ========================================== */

.totp-modal {
    max-width: 420px;
    text-align: center;
}

.totp-modal .modal-header {
    justify-content: center;
    position: relative;
    border-bottom: none;
    padding-bottom: var(--space-2);
}

.totp-modal .modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.totp-modal .modal-header h2 svg {
    width: 28px;
    height: 28px;
    color: var(--primary-400);
}

.totp-modal .modal-close {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
}

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

.totp-instruction {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

.totp-input-group {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.totp-input {
    width: 180px;
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.3em;
    background: var(--bg-tertiary);
    border: 2px solid var(--surface-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.totp-input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.totp-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.15em;
}

.totp-error {
    font-size: var(--text-sm);
    color: var(--status-danger);
    background: var(--status-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-top: var(--space-3);
}

.totp-modal .modal-footer {
    justify-content: center;
    gap: var(--space-4);
    border-top: none;
    padding-top: 0;
}
