:root {
    /* Design System - Couleurs */
    --bg-base: #0a0a0b;
    --bg-surface: #141416;
    --bg-surface-elevated: #1e1e20;
    --bg-surface-hover: #262629;

    --text-primary: #f0f0f2;
    --text-secondary: #9ea3a8;
    --text-muted: #6b6f76;

    --border-color: #2a2a2e;
    --border-light: #38383e;

    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;

    /* Couleurs Sémantiques (pour Jauges et Badges) */
    --status-ok: #10b981;
    /* Vert */
    --status-warning: #f59e0b;
    /* Orange */
    --status-critical: #ef4444;
    /* Rouge */
    --status-unknown: #6b7280;
    /* Gris */

    /* Dimensions et Espacements */
    --sidebar-width: 260px;
    --sidebar-mobile-width: 280px;
    --chat-width: 380px;
    --topbar-height: 70px;
    --topbar-mobile-height: 60px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Ombres (Premium Soft Shadows) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);

    /* Typographie */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    overflow: hidden;
    /* Empêche le scroll global, contenu géré en interne */
    display: flex;
}

/* =========================================
   1. UTILITAIRES ET COMPOSANTS DE BASE
   ========================================= */
.hidden {
    display: none !important;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
}

.status-dot.ok {
    background-color: var(--status-ok);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.warning {
    background-color: var(--status-warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.status-dot.critical {
    background-color: var(--status-critical);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-dot.unknown {
    background-color: var(--status-unknown);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-ok);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-critical);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.unknown {
    background: rgba(107, 114, 128, 0.15);
    color: var(--status-unknown);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Buttons */
.btn-primary-large {
    width: 100%;
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary-large:hover {
    background: var(--accent-blue-hover);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.panel-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}


/* =========================================
   2. OVERLAY AUTHENTIFICATION
   ========================================= */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-base);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.auth-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-box {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    text-align: center;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-blue), #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    margin: 0 auto 20px auto;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.auth-box h2 {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 600;
}

.auth-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.auth-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-box input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.error-msg {
    color: var(--status-critical);
    margin-top: 15px;
    font-size: 13px;
    font-weight: 500;
}


/* =========================================
   3. STRUCTURE GLOBALE (APP WRAPPER)
   ========================================= */
.app-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    position: relative;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 11, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1900;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* =========================================
   4. SIDEBAR (Panneau Gauche)
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-right: 12px;
}

.brand-text h1 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-menu {
    padding: 20px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.nav-item:not(.active):not(.disabled):hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-icon {
    margin-right: 12px;
    font-size: 18px;
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.global-status-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}


/* =========================================
   5. CONTENU PRINCIPAL (Centre)
   ========================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Important pour éviter les dépassements flex */
    background-color: var(--bg-base);
}

.topbar {
    height: var(--topbar-height);
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-base);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.btn-sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.server-time {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Dashboard Scroll Area */
.dashboard-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}


/* =========================================
   6. METRICS WIDGETS (Cartes et Jauges SVG)
   ========================================= */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.ai-section {
    margin-bottom: 32px;
}

.ai-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ai-section-title h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.ai-section-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.ai-section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.segmented-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px;
}

.segmented-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segmented-btn.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

.segmented-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.ai-filter select {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    min-width: 180px;
}

.ai-kpi-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-kpi-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    gap: 8px;
}

.ai-kpi-label {
    color: var(--text-muted);
    font-weight: 500;
}

.ai-kpi-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.ai-kpi-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    min-height: 14px;
}

.ai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ai-mini-metric {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-mini-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-mini-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-panels-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.ai-mode-panel .panel-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ai-mode-option {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-mode-option input {
    accent-color: var(--accent-blue);
}

.ai-mode-option.active,
.ai-mode-option:hover {
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
}

.ai-mode-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.ai-mode-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.ai-mode-tip {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.panel-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.ai-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 170px;
    padding: 10px 4px 20px;
    position: relative;
    overflow-x: auto;
}

.ai-bar {
    flex: 1;
    min-width: 12px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.95) 0%, rgba(59, 130, 246, 0.35) 100%);
    border-radius: 10px;
    position: relative;
    transition: transform 0.2s ease;
}

.ai-bar:hover {
    transform: translateY(-3px);
}

.ai-bar-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.ai-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.ai-model-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-model-item {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.ai-model-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ai-model-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.ai-model-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-model-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 600;
}

.ai-source-list,
.ai-activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-source-item,
.ai-activity-item {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.ai-source-meta,
.ai-activity-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ai-source-name,
.ai-activity-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-source-stats,
.ai-activity-stats {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-activity-meta .ai-activity-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.ai-activity-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.ai-activity-badge.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-ok);
    border-color: rgba(16, 185, 129, 0.3);
}

.ai-activity-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-critical);
    border-color: rgba(239, 68, 68, 0.3);
}

.ai-empty-state {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 10px;
}

.ai-admin-panel {
    grid-column: 1 / -1;
}

.ai-admin-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-admin-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.ai-admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-admin-btn {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 10px;
}

.ai-admin-btn.subtle {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.ai-admin-btn.subtle:hover {
    color: var(--text-primary);
}

.ai-admin-btn.danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--status-critical);
}

.ai-keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-key-item {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.ai-key-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-key-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-key-sub {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-word;
}

.ai-key-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    height: fit-content;
}

.ai-key-badge.ok {
    background: rgba(16, 185, 129, 0.12);
    color: var(--status-ok);
    border-color: rgba(16, 185, 129, 0.3);
}

.ai-key-badge.off {
    background: rgba(239, 68, 68, 0.12);
    color: var(--status-critical);
    border-color: rgba(239, 68, 68, 0.3);
}

.ai-admin-form {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-form-row.inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ai-form-row label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-form-row input,
.ai-form-row textarea {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
}

.ai-form-row textarea {
    resize: vertical;
}

.ai-admin-response {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
}

.ai-admin-response-title {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.ai-json {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-icon {
    font-size: 18px;
    opacity: 0.8;
}

/* Special Uptime text layout */
.card-uptime .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.uptime-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.uptime-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Gauges (SVG Circular) */
.gauge-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.gauge-container {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 12px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 4;
}

.circle-value {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    /* Default stroke color, overriden by JS data-status attr */
    stroke: var(--status-unknown);
    transition: stroke-dasharray 1s ease-out, stroke 0.4s ease;
}

/* Colors based on generic data-status attribute handled by JS */
.gauge-container[data-status="ok"] .circle-value {
    stroke: var(--status-ok);
}

.gauge-container[data-status="warning"] .circle-value {
    stroke: var(--status-warning);
}

.gauge-container[data-status="critical"] .circle-value {
    stroke: var(--status-critical);
}

.gauge-container[data-status="unknown"] .circle-value {
    stroke: var(--status-unknown);
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.gauge-unit {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.gauge-state {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}


/* =========================================
   7. PANNEAUX (Listes, Logs, Extensions futures)
   ========================================= */
.panels-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.panel-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Fix panel height for logs */
.logs-panel {
    height: 450px;
}

.services-panel {
    max-height: 450px;
}

.panel-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Services List */
.services-list {
    list-style: none;
}

.services-list li {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
}

/* Skeleton pour chargement */
.skeleton-item {
    height: 44px;
    background: var(--bg-surface-elevated) !important;
    animation: pulse 1.5s infinite;
    border-color: transparent !important;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.6;
    }
}

/* Empty state / Future proxmox */
.empty-state-panel {
    min-height: 150px;
    border: 1px dashed var(--border-light);
    background: transparent;
}

.panel-body.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    filter: grayscale(1) opacity(0.5);
}

.empty-state-panel h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.empty-state-panel p {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 250px;
}

/* Logs Panel */
.logs-body {
    padding: 0 !important;
    background: #000;
}

.logs-container {
    padding: 16px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #a1a1aa;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-placeholder {
    color: var(--text-muted);
    font-style: italic;
}


/* =========================================
   8. CHAT DRAWER (Assistant Eve)
   ========================================= */
.chat-drawer {
    width: var(--chat-width);
    background: var(--bg-surface-elevated);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
}

.chat-profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-container {
    position: relative;
    width: 50px;
    height: 50px;
}

.eve-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.status-dot-pulsating {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: var(--status-ok);
    border: 2px solid var(--bg-surface);
    border-radius: 50%;
}

.status-dot-pulsating::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid var(--status-ok);
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.eve-meta h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-status-text {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

/* Actions & Dropdown */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.btn-menu-trigger {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-menu-trigger:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    min-width: 200px;
    background: rgba(30, 30, 32, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    overflow: hidden;
    padding: 6px;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    width: 100%;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.dropdown-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item#btn-clear-chat-v2:hover {
    color: var(--status-critical);
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-close-chat {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-close-chat:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Card Presence Eve V2 */
.card-eve-presence {
    background: linear-gradient(135deg, var(--bg-surface), #1a1a1c) !important;
    border: 1px solid var(--border-light) !important;
    padding: 24px !important;
    min-width: 320px;
}

.eve-presence-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

.eve-presence-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.eve-presence-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.eve-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.eve-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.eve-status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--status-ok);
    border: 1px solid rgba(16, 185, 129, 0.2);
    letter-spacing: 0.5px;
}

.eve-activity-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-label {
    color: var(--text-muted);
}

.activity-value {
    color: var(--text-primary);
    font-weight: 500;
}

.text-truncate {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 180px;
    text-align: right;
}

.eve-google-access {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.access-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.access-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.access-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.access-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.access-dot.ok {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.access-dot.error {
    background: #ef4444;
}

.access-text .state {
    font-weight: 400;
    opacity: 0.6;
    font-size: 12px;
    margin-left: 4px;
}

.connector-badge.critical {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-critical);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.eve-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin-right: 16px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    color: white;
}

.eve-meta h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-history {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    max-width: 88%;
}

.message.eve {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.msg-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.message.eve .msg-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.message.user .msg-content {
    background-color: var(--accent-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-wrapper {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-wrapper textarea {
    flex: 1;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    line-height: 1.4;
    max-height: 100px;
    transition: border-color 0.2s;
}

.chat-input-wrapper textarea:focus {
    border-color: var(--accent-blue);
}

.btn-send-msg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.btn-send-msg:hover {
    background: var(--accent-blue-hover);
}

.btn-send-msg:active {
    transform: scale(0.95);
}


/* =========================================
   9. GESTION DU RESPONSIVE ET MOBILE
   ========================================= */
.btn-chat-toggle {
    display: none;
}

.btn-close-chat {
    display: none;
}

.chat-overlay {
    display: none;
}

@media (max-width: 1200px) {
    .panels-layout {
        grid-template-columns: 1fr;
    }

    /* Services au dessus des logs */
    .logs-panel {
        height: 400px;
    }

    .ai-panels-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    body {
        overflow-x: hidden;
    }

    .app-wrapper {
        position: relative;
    }

    .btn-sidebar-toggle {
        display: inline-flex;
    }

    /* Sidebar Mobile - Entièrement masquée par défaut */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-mobile-width);
        transform: translateX(-100%);
        visibility: hidden;
        z-index: 2000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        background: var(--bg-surface);
        box-shadow: none;
    }

    .app-wrapper.sidebar-active .sidebar {
        transform: translateX(0);
        visibility: visible;
        box-shadow: var(--shadow-xl);
    }

    .brand-text {
        display: block;
    }

    .nav-label {
        display: block;
    }

    .nav-item {
        justify-content: flex-start;
        padding: 12px 20px;
    }

    .nav-icon {
        margin-right: 12px;
        font-size: 18px;
    }

    .global-status-box {
        align-items: flex-start;
    }

    .status-label {
        display: block;
    }

    .sidebar-footer {
        padding: 20px;
    }

    .badge {
        padding: 4px;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        text-indent: -9999px;
        overflow: hidden;
    }

    /* Fix Chat to Drawer behavior on Mobile/Tablet */
    .chat-drawer {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 320px;
        transform: translateX(100%);
        /* Masqué par défaut sur mobile */
        box-shadow: var(--shadow-xl);
    }

    .chat-drawer.open {
        transform: translateX(0);
    }

    /* Boutons de toggle chat visible */
    .btn-chat-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
        background: var(--bg-surface-elevated);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 8px 12px;
        border-radius: 20px;
        font-size: 14px;
        cursor: pointer;
        position: relative;
    }

    .chat-notif-dot {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 10px;
        height: 10px;
        background: var(--status-critical);
        border-radius: 50%;
        border: 2px solid var(--bg-base);
    }

    .btn-close-chat {
        display: block;
        background: transparent;
        color: var(--text-secondary);
        border: none;
        font-size: 20px;
        cursor: pointer;
        padding: 5px;
    }

    /* Overlay sombre quand le chat est ouvert */
    .chat-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 90;
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .chat-overlay.active {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .dashboard-scroll-area {
        padding: 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .ai-section-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ai-filter select {
        min-width: 160px;
    }

    .ai-chart {
        height: 150px;
    }
}

@media (max-width: 600px) {
    .metrics-section {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: min(84vw, var(--sidebar-mobile-width));
    }

    .chat-drawer {
        width: 100%;
    }

    /* Chat prend tout l'écran en largeur sur mobile */

    .ai-kpi-grid {
        grid-template-columns: 1fr;
    }

    .segmented-control {
        width: 100%;
        justify-content: space-between;
    }

    .segmented-btn {
        flex: 1;
        text-align: center;
    }

    .ai-source-item,
    .ai-activity-item,
    .ai-model-item {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .ai-key-item {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   10. HISTORIQUE D'ACTIVITÉ (Eve)
   ========================================= */
.activity-history-panel {
    max-height: 450px;
}

.activity-history-body {
    padding: 8px 12px !important;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item-row {
    display: grid;
    grid-template-columns: 56px 1fr 24px;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
}

.activity-item-row:hover {
    background: rgba(255, 255, 255, 0.02);
    transform: translateX(4px);
}

.activity-item-row:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    min-width: 56px;
}

.activity-info {
    flex: 1;
    min-width: 0;
}

.activity-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.2;
}

.activity-summary {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.activity-status {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
}

.history-count-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* =========================================
   11. SMS PROGRAMMÉS
   ========================================= */
.sms-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sms-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

.sms-item:last-child {
    border-bottom: none;
}

.sms-meta {
    flex: 1;
    min-width: 0;
}

.sms-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.sms-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sms-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.sms-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-ok);
    border-color: rgba(16, 185, 129, 0.3);
}

.sms-status.paused {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.sms-sub {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.sms-actions {
    display: flex;
    gap: 6px;
}

.sms-btn {
    font-size: 12px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sms-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.55);
    transform: translateY(-1px);
}

.sms-btn.danger {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--status-critical);
    background: rgba(239, 68, 68, 0.12);
}

.sms-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.55);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 10, 0.65);
    z-index: 2000;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
}

.modal-card {
    position: relative;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: min(520px, 92vw);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    margin: 0;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-body textarea,
.modal-body input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 13px;
}

.modal-row {
    display: flex;
    gap: 12px;
}

.modal-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.sms-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 12px 0;
}

/* =========================================
   12. LIGHTBOX AVATAR EVE
   ========================================= */
.eve-avatar-clickable {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
}

.eve-avatar-clickable:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.eve-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.eve-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.eve-lightbox.active .lightbox-content img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: var(--text-primary);
    font-size: 50px;
    font-weight: 200;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10000;
    line-height: 1;
}

.lightbox-close:hover {
    color: var(--accent-blue);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 20px;
        right: 20px;
        font-size: 40px;
    }

    .lightbox-content {
        max-width: 95%;
    }
}

/* =========================================
   13. DASHBOARD REFONTE PRINCIPALE
   ========================================= */
:root {
    --bg-base: #080f18;
    --bg-surface: #111b29;
    --bg-surface-elevated: #152235;
    --bg-surface-hover: #1d2e46;
    --text-primary: #eef4ff;
    --text-secondary: #a9b7cc;
    --text-muted: #7f8ea6;
    --border-color: #22354e;
    --border-light: #2d4768;
    --accent-blue: #34a8ff;
    --accent-blue-hover: #1e92ec;
    --font-family: 'Manrope', 'Segoe UI', sans-serif;
}

body {
    background:
        radial-gradient(circle at 14% 2%, rgba(52, 168, 255, 0.14), transparent 38%),
        radial-gradient(circle at 88% 12%, rgba(16, 185, 129, 0.14), transparent 30%),
        var(--bg-base);
}

.btn-secondary {
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(52, 168, 255, 0.45);
}

.dashboard-shell .topbar {
    background: rgba(8, 15, 24, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.dashboard-shell .dashboard-scroll-area {
    padding: 24px;
}

.dashboard-shell .metric-card,
.dashboard-shell .panel-card {
    background: linear-gradient(160deg, rgba(24, 36, 54, 0.92), rgba(17, 27, 41, 0.98));
    border: 1px solid rgba(95, 129, 170, 0.24);
    box-shadow: 0 14px 32px rgba(5, 9, 16, 0.45);
}

.dashboard-shell .dashboard-scroll-area>section,
.dashboard-shell .dashboard-scroll-area>.panels-layout {
    animation: dashboard-fade-in 0.35s ease both;
}

@keyframes dashboard-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-kicker {
    color: #66c7ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.dashboard-intro-copy h3 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.dashboard-intro-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.quick-refresh-btn {
    padding: 10px 16px;
    min-width: 220px;
    font-size: 13px;
    font-weight: 700;
}

.quick-refresh-btn:disabled {
    opacity: 0.7;
    cursor: progress;
}

.overview-metrics {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.overview-metrics>.card-eve-presence {
    grid-column: span 6;
}

.overview-metrics>.card-uptime {
    grid-column: span 3;
}

.overview-metrics>.quick-actions-card {
    grid-column: span 3;
}

.overview-metrics>.metric-card:not(.card-eve-presence):not(.card-uptime):not(.quick-actions-card) {
    grid-column: span 4;
}

.card-uptime .card-header {
    align-items: center;
}

.uptime-meta {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.uptime-meta strong {
    color: var(--text-primary);
    font-weight: 700;
}

.quick-actions-body {
    gap: 10px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-action-btn {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(95, 129, 170, 0.4);
    background: rgba(9, 17, 30, 0.72);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.quick-action-btn:hover {
    border-color: rgba(52, 168, 255, 0.6);
    transform: translateY(-1px);
    background: rgba(52, 168, 255, 0.15);
}

.quick-actions-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.dashboard-ops-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.alerts-list,
.files-recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.alert-item {
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: rgba(7, 12, 20, 0.66);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.35;
}

.alert-item.ok {
    border-color: rgba(16, 185, 129, 0.4);
    color: #9be7ca;
}

.alert-item.warning {
    border-color: rgba(245, 158, 11, 0.45);
    color: #f9d99d;
}

.alert-item.critical {
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffc2c2;
}

.file-item {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: rgba(7, 12, 20, 0.66);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item-path {
    color: #c6deff;
    font-size: 13px;
    text-decoration: none;
    font-weight: 700;
    word-break: break-word;
}

.file-item-path:hover {
    color: #84c8ff;
}

.file-item-meta {
    color: var(--text-secondary);
    font-size: 11px;
}

.files-empty {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 18px 10px;
}

.dashboard-shell .ai-section {
    margin-bottom: 24px;
    padding: 22px;
    border: 1px solid rgba(95, 129, 170, 0.24);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(15, 24, 38, 0.96), rgba(12, 20, 33, 0.94));
}

.dashboard-shell .ai-metrics-section {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-shell .ai-panels-grid {
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-shell .ai-chart {
    height: 220px;
    padding: 48px 10px 36px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
}

.dashboard-shell .ai-bar {
    min-width: 56px;
    border-radius: 12px 12px 8px 8px;
    box-shadow: 0 10px 18px rgba(4, 8, 14, 0.35);
}

.dashboard-shell .ai-bar-value {
    top: auto;
    bottom: calc(100% + 8px);
    background: rgba(5, 10, 18, 0.84);
    border: 1px solid rgba(95, 129, 170, 0.35);
    border-radius: 8px;
    padding: 2px 7px;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 11px;
}

.dashboard-shell .ai-bar-label {
    bottom: -26px;
    font-size: 11px;
    color: var(--text-secondary);
}

.dashboard-shell .dashboard-secondary-layout {
    gap: 18px;
}

.dashboard-shell .logs-panel {
    height: 500px;
}

.dashboard-shell .services-panel,
.dashboard-shell .activity-history-panel {
    min-height: 250px;
}

.logs-container,
.ai-json {
    font-family: 'JetBrains Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

@media (max-width: 1400px) {
    .overview-metrics>.card-eve-presence {
        grid-column: span 12;
    }

    .overview-metrics>.card-uptime,
    .overview-metrics>.quick-actions-card {
        grid-column: span 6;
    }
}

@media (max-width: 1200px) {
    .dashboard-ops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-shell .ai-metrics-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-shell .dashboard-secondary-layout {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 900px) {
    .dashboard-shell .badge {
        padding: 4px 10px;
        border-radius: 20px;
        width: auto;
        height: auto;
        text-indent: 0;
        overflow: visible;
    }

    .dashboard-shell .dashboard-scroll-area {
        padding: 16px;
    }

    .dashboard-intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-refresh-btn {
        width: 100%;
        min-width: 0;
    }

    .overview-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-metrics>.metric-card {
        grid-column: span 1 !important;
    }

    .overview-metrics>.card-eve-presence {
        grid-column: 1 / -1 !important;
    }

    .dashboard-ops-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-shell .ai-metrics-section,
    .dashboard-shell .ai-panels-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-shell .ai-chart {
        height: 205px;
    }
}

@media (max-width: 600px) {
    .overview-metrics {
        grid-template-columns: 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-shell .gauge-container {
        width: 98px;
        height: 98px;
    }

    .dashboard-shell .gauge-value {
        font-size: 22px;
    }

    .dashboard-shell .ai-bar {
        min-width: 62px;
    }
}
