/* ============================================================
   SnowManager — Design System
   Refonte UI/UX (TechnoAlpin × Apple editorial)
   Cible : WCAG 2.2 AA, mobile-first, prefers-reduced-motion safe
   ============================================================ */

/* ── 1. RESET & BASE ────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── 2. DESIGN TOKENS ───────────────────────────────────────── */
:root {
    /* ─ Brand : TechnoAlpin (signature) + déclinaisons WCAG safes ─ */
    --ta-navy:        #00233A;
    --ta-blue:        #009FE3;
    --ta-blue-deep:   #0077B6;

    /* ─ Primaire (texte / fonds forts, contraste AA+) ─ */
    --primary-900:    #002A45;   /* sidebar fond */
    --primary-800:    #003D60;
    --primary-700:    #0066B3;   /* CTA principal AA sur blanc */
    --primary-500:    #009FE3;   /* accent décoratif / data viz */
    --primary-100:    #E0F2FB;   /* surfaces froides */

    /* Alias historiques (compat) */
    --primary-blue:   var(--primary-900);
    --secondary-blue: var(--primary-800);
    --accent-blue:    var(--primary-700);
    --light-blue:     var(--primary-100);

    /* ─ Neutrals ─ */
    --neutral-950:    #0A0E1A;
    --neutral-900:    #0F172A;
    --neutral-800:    #1E293B;
    --neutral-700:    #334155;
    --neutral-600:    #475569;
    --neutral-500:    #64748B;
    --neutral-400:    #94A3B8;
    --neutral-300:    #CBD5E0;
    --neutral-200:    #E2E8F0;
    --neutral-100:    #F1F5F9;
    --neutral-50:     #F7FAFC;
    --white:          #FFFFFF;

    /* Alias historiques (compat) */
    --gray-dark:      var(--neutral-800);
    --gray-medium:    var(--neutral-500);
    --gray-light:     var(--neutral-100);
    --border:         var(--neutral-200);

    /* ─ Surfaces ─ */
    --bg:             #F4F6FA;
    --bg-subtle:      #FAFBFD;
    --surface:        #FFFFFF;
    --surface-hover:  #F8FAFC;
    --surface-glass:  rgba(255, 255, 255, 0.78);

    /* ─ Status (WCAG AA pour le texte) ─ */
    --success:        #1F7A4D;
    --success-bg:     #E6F4EC;
    --success-text:   #115C38;
    --warning:        #B45309;
    --warning-bg:     #FEF4E1;
    --warning-text:   #8A4109;
    --danger:         #B42318;
    --danger-bg:      #FCEBE9;
    --danger-text:    #8A1812;
    --info:           #0066B3;
    --info-bg:        #E0F2FB;
    --info-text:      #003D60;

    /* ─ Accents vifs (chrome décoratif uniquement, pas de texte dessus) ─ */
    --accent-info:    #009FE3;   /* TA blue, vibrant */
    --accent-success: #22C55E;   /* émeraude */
    --accent-warning: #F59E0B;   /* ambre */
    --accent-danger:  #EF4444;   /* rouge vif */
    --accent-info-soft:    #E5F5FC;
    --accent-success-soft: #E8F8EE;
    --accent-warning-soft: #FEF3DC;
    --accent-danger-soft:  #FEECEB;

    /* ─ Typographie ─ */
    --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
                      'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:      'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

    /* Échelle fluide — clamp(min, fluid, max) */
    --fs-xs:          0.75rem;        /* 12px */
    --fs-sm:          0.8125rem;      /* 13px */
    --fs-base:        0.9375rem;      /* 15px */
    --fs-md:          1rem;           /* 16px */
    --fs-lg:          1.125rem;       /* 18px */
    --fs-xl:          1.25rem;        /* 20px */
    --fs-2xl:         clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    --fs-3xl:         clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
    --fs-4xl:         clamp(2.25rem, 1.7rem + 2.4vw, 3.5rem);
    --fs-display:     clamp(2.75rem, 2rem + 3.5vw, 4.5rem);

    --lh-tight:       1.15;
    --lh-snug:        1.35;
    --lh-normal:      1.55;
    --lh-relaxed:     1.7;

    --tracking-tight: -0.02em;
    --tracking-snug:  -0.01em;
    --tracking-wide:  0.04em;

    /* ─ Espacements ─ */
    --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;
    --space-16:       4rem;

    /* ─ Rayons ─ */
    --radius-xs:      4px;
    --radius-sm:      8px;
    --radius:         12px;
    --radius-lg:      16px;
    --radius-xl:      20px;
    --radius-2xl:     28px;
    --radius-pill:    999px;

    /* ─ Ombres (Apple-like multi-couches, blue-tinted) ─ */
    --shadow-xs:      0 1px 2px rgba(0, 35, 58, 0.05);
    --shadow-sm:      0 1px 2px rgba(0, 35, 58, 0.05),
                      0 1px 3px rgba(0, 35, 58, 0.06);
    --shadow:         0 2px 6px rgba(0, 35, 58, 0.06),
                      0 1px 3px rgba(0, 35, 58, 0.04);
    --shadow-md:      0 6px 18px rgba(0, 35, 58, 0.08),
                      0 2px 6px rgba(0, 35, 58, 0.05);
    --shadow-lg:      0 18px 40px rgba(0, 35, 58, 0.12),
                      0 6px 14px rgba(0, 35, 58, 0.06);
    --shadow-glow:    0 0 0 4px rgba(0, 102, 179, 0.16);

    /* ─ Motion ─ */
    --ease:           cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out:       cubic-bezier(0.22, 1, 0.36, 1);
    --duration-fast:  120ms;
    --duration:       200ms;
    --duration-slow:  420ms;

    /* ─ Focus ring (accessibilité) ─ */
    --ring:           0 0 0 2px var(--surface),
                      0 0 0 4px var(--primary-700);
    --ring-soft:      0 0 0 3px rgba(0, 102, 179, 0.22);
}

/* ── 3. TYPOGRAPHY (BASE) ───────────────────────────────────── */
body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--neutral-800);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--neutral-900);
    line-height: var(--lh-snug);
    letter-spacing: var(--tracking-snug);
    font-weight: 600;
}

h1 { font-size: var(--fs-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--fs-2xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { line-height: var(--lh-relaxed); max-width: 70ch; }

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

/* Valeurs techniques (débits, pressions, températures, heures) */
.numeric,
.value-tech {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

/* ── 4. ACCESSIBILITY UTILITIES ─────────────────────────────── */

/* Skip link visible au focus clavier uniquement */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 10000;
    padding: 12px 18px;
    background: var(--primary-900);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--fs-sm);
    box-shadow: var(--shadow-md);
    transition: top var(--duration) var(--ease);
}

.skip-link:focus {
    top: 16px;
    outline: none;
    box-shadow: var(--ring), var(--shadow-md);
}

/* Focus visible global — outline 2px solid + offset, only via clavier */
*:focus-visible {
    outline: 2px solid var(--primary-700);
    outline-offset: 2px;
    border-radius: 4px;
}

/* SR-only — caché visuellement, lu par lecteur d'écran */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Réduction de mouvement (préférence système) ────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── 5. LAYOUT — SIDEBAR (mode jour : clair, éditorial) ─────── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-subtle);
    color: var(--neutral-700);
    overflow-y: auto;
    z-index: 1000;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    transition: transform var(--duration-slow) var(--ease);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 22px 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary-500);
    filter: drop-shadow(0 2px 6px rgba(0, 159, 227, 0.25));
}

.sidebar-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: var(--tracking-snug);
    color: var(--neutral-900);
}

.sidebar-subtitle {
    font-size: 10px;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 3px;
    font-weight: 500;
}

.nav-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.nav-section:last-of-type {
    border-bottom: none;
}

.nav-section-title {
    padding: 0 18px 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--neutral-400);
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 10px 10px 16px;
    margin: 2px 10px;
    color: var(--neutral-700);
    text-decoration: none;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease);
    cursor: pointer;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    min-height: 40px;
}

.nav-item:hover {
    background: rgba(0, 102, 179, 0.06);
    color: var(--neutral-900);
}

.nav-item:focus-visible {
    outline: none;
    background: rgba(0, 102, 179, 0.08);
    color: var(--neutral-900);
    box-shadow: inset 0 0 0 2px var(--primary-700);
}

.nav-item.active {
    background: var(--info-bg);
    color: var(--primary-700);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(0, 102, 179, 0.18);
}

.nav-item.active i { color: var(--primary-700); }

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.85;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    color: var(--white);
}

.user-info {
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--ta-blue-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    color: var(--white);
    box-shadow: 0 2px 6px rgba(0, 119, 182, 0.25);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--neutral-900);
}

.user-role {
    font-size: 11px;
    color: var(--neutral-500);
}

.user-info > i,
.user-info > .fas {
    color: var(--neutral-400);
    cursor: pointer;
    transition: color var(--duration) var(--ease);
}

.user-info > i:hover,
.user-info > .fas:hover {
    color: var(--danger);
}

/* ── 6. LAYOUT — MAIN / TOPBAR ──────────────────────────────── */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
}

.topbar {
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    padding: 13px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-800);
    letter-spacing: var(--tracking-snug);
}

.breadcrumb {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: var(--neutral-500);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--neutral-100);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    min-width: 240px;
    border: 1px solid var(--border);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                background var(--duration) var(--ease);
}

.search-box:focus-within {
    border-color: var(--primary-700);
    box-shadow: var(--ring-soft);
    background: var(--white);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 13px;
    color: var(--neutral-800);
}

.topbar-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--neutral-100);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
    position: relative;
    border: 1px solid var(--border);
    color: var(--neutral-500);
}

.topbar-icon:hover {
    background: var(--white);
    color: var(--primary-700);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-700);
}

.topbar-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    min-width: 18px;
    height: 18px;
    padding: 0 4px;            /* reset le padding hérité de .badge générique */
    border-radius: 9px;        /* cercle pour 1 chiffre, pill propre pour 2+ */
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--surface);
    box-sizing: border-box;
}

.content {
    padding: 28px;
}

/* ── 7. STATS GRID / STAT CARDS ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: box-shadow var(--duration) var(--ease),
                transform var(--duration) var(--ease);
    position: relative;
}

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

.stat-card.blue   { border-left-color: var(--accent-info); }
.stat-card.green  { border-left-color: var(--accent-success); }
.stat-card.orange { border-left-color: var(--accent-warning); }
.stat-card.red    { border-left-color: var(--accent-danger); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card.blue   .stat-icon { background: var(--accent-info-soft);    color: var(--accent-info); }
.stat-card.green  .stat-icon { background: var(--accent-success-soft); color: #16A34A; }
.stat-card.orange .stat-icon { background: var(--accent-warning-soft); color: #D97706; }
.stat-card.red    .stat-icon { background: var(--accent-danger-soft);  color: #DC2626; }

.stat-info { flex: 1; }

.stat-label {
    font-size: 11px;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    color: var(--neutral-900);
    line-height: 1;
    letter-spacing: var(--tracking-tight);
    font-variant-numeric: tabular-nums;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--neutral-500);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.stat-change { font-weight: 600; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ── 8. CARDS ───────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--neutral-900);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: var(--tracking-snug);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    padding: 20px 22px;
}

/* ── 9. BUTTONS ─────────────────────────────────────────────── */
.btn {
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    letter-spacing: var(--tracking-snug);
    min-height: 36px;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-700);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(0, 102, 179, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-800);
    box-shadow: 0 4px 12px rgba(0, 102, 179, 0.32);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-900);
    box-shadow: 0 1px 2px rgba(0, 102, 179, 0.2);
}

.btn-secondary {
    background: var(--neutral-100);
    color: var(--neutral-800);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--white);
    border-color: var(--neutral-400);
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--neutral-700);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--neutral-100);
    color: var(--neutral-900);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(31, 122, 77, 0.25);
}

.btn-success:hover:not(:disabled) {
    background: #19613D;
    box-shadow: 0 4px 12px rgba(31, 122, 77, 0.3);
}

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

.btn-danger:hover:not(:disabled) {
    background: #8A1812;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── 10. TABLES ─────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

thead { background: var(--neutral-100); }

th {
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 13px 14px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
    color: var(--neutral-800);
}

/* Valeurs numériques en mono (utiliser .num sur td) */
td.num,
.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

tbody tr {
    transition: background-color var(--duration-fast) var(--ease);
}

tbody tr:hover {
    background: linear-gradient(90deg,
        rgba(0, 102, 179, 0.06) 0%,
        rgba(0, 102, 179, 0.02) 100%);
}

tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-700);
}

tr.row-selected {
    background: linear-gradient(90deg,
        rgba(0, 102, 179, 0.10) 0%,
        rgba(0, 102, 179, 0.04) 100%) !important;
}

tr.row-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-700);
}

/* Action buttons in tables */
.action-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin: 0 2px;
    transition: background var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    font-weight: 600;
}

.action-btn:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.action-btn i { font-size: 13px; }

/* ── 11. BADGES ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.6;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(31, 122, 77, 0.2);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: rgba(180, 83, 9, 0.2);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(180, 35, 24, 0.2);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: rgba(0, 102, 179, 0.2);
}

/* ── 12. FORMS ──────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--neutral-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    background: var(--surface);
    color: var(--neutral-900);
    min-height: 40px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--neutral-400);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-700);
    box-shadow: var(--ring-soft);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── 13. MODALS ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 15, 30, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 600px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-900);
    letter-spacing: var(--tracking-snug);
}

.modal-close {
    font-size: 20px;
    color: var(--neutral-500);
    cursor: pointer;
    background: var(--neutral-100);
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease);
}

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

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.modal-actions .btn {
    flex: 1;
}

/* ── 14. FILTERS / BULK ACTIONS ─────────────────────────────── */
.snowmaker-filters,
.task-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
}

.snowmaker-filters select,
.snowmaker-filters input[type="text"],
.snowmaker-filters input[type="number"],
.task-filters select,
.task-filters input[type="text"] {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--white);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    min-height: 38px;
}

.snowmaker-filters select:focus,
.snowmaker-filters input[type="text"]:focus,
.snowmaker-filters input[type="number"]:focus,
.task-filters select:focus,
.task-filters input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-700);
    box-shadow: var(--ring-soft);
}

.snowmaker-filters input[type="text"],
.task-filters input[type="text"] {
    min-width: 200px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-reset-btn {
    padding: 9px 14px;
    background: var(--neutral-100);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--neutral-500);
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
}

.filter-reset-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.result-count {
    font-size: 13px;
    color: var(--neutral-500);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-count strong {
    color: var(--primary-900);
    font-weight: 600;
}

/* Bulk actions bar */
.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--info-bg);
    border: 1.5px solid rgba(0, 102, 179, 0.3);
    border-radius: var(--radius);
    margin-bottom: 15px;
    animation: slideDown var(--duration) var(--ease-out);
    box-shadow: 0 2px 8px rgba(0, 102, 179, 0.10);
}

.bulk-actions-bar.visible { display: flex; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes taskPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.5), 0 2px 6px rgba(0,0,0,0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(180, 35, 24, 0),  0 2px 6px rgba(0,0,0,0.4); }
}

.bulk-selection-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-700);
    white-space: nowrap;
}

.bulk-actions-bar .bulk-separator {
    width: 1px;
    height: 24px;
    background: var(--primary-700);
    opacity: 0.3;
}

.bulk-actions-bar select {
    padding: 6px 10px;
    border: 1px solid var(--primary-700);
    border-radius: 4px;
    font-size: 12px;
    background: var(--white);
}

.bulk-btn {
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bulk-btn-primary {
    background: var(--primary-700);
    color: var(--white);
}

.bulk-btn-primary:hover {
    background: var(--primary-800);
}

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

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

.bulk-btn-secondary {
    background: var(--white);
    color: var(--neutral-500);
    border-color: var(--border);
}

.bulk-btn-secondary:hover {
    background: var(--neutral-100);
}

/* Checkboxes */
.row-checkbox,
.select-all-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-700);
}

.hours-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hours-range input {
    width: 70px;
    padding: 8px;
    text-align: center;
    font-family: var(--font-mono);
}

.hours-range span {
    font-size: 12px;
    color: var(--neutral-500);
}

/* ── 15. MAP CHIPS / FILTERS ────────────────────────────────── */
.map-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--neutral-800);
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                border-color var(--duration) var(--ease),
                color var(--duration) var(--ease);
    white-space: nowrap;
}

.map-chip:hover {
    border-color: var(--primary-700);
    color: var(--primary-700);
    background: var(--info-bg);
}

.map-chip.active {
    background: var(--primary-700);
    color: var(--white);
    border-color: var(--primary-700);
    box-shadow: 0 2px 8px rgba(0, 102, 179, 0.3);
}

.map-chip.lasso-chip { border-color: var(--border); }

.map-chip.lasso-chip.active {
    background: #7c3aed;
    border-color: #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.32);
}

.map-chip.lasso-chip:hover:not(.active) {
    border-color: #7c3aed;
    color: #7c3aed;
}

.map-filters-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.map-filters-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

#lassoSelectionInfo {
    padding: 6px 12px;
    background: #ede9fe;
    border-bottom: 1px solid #c4b5fd;
    font-size: 12px;
    font-weight: 500;
    color: #5b21b6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-filters-bar-scroll {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── 16. EQUIPMENT SELECTOR / CHECKLIST / PROGRESS ──────────── */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--neutral-100);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-700), var(--primary-500));
    border-radius: var(--radius-pill);
    transition: width var(--duration-slow) var(--ease);
}

.progress-bar.complete {
    background: linear-gradient(90deg, var(--success), #34D399);
}

.checklist-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--neutral-100);
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: box-shadow var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
    border: 1px solid transparent;
}

.checklist-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-700);
}

.checklist-item.completed {
    opacity: 0.55;
    text-decoration: line-through;
}

.equipment-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1.5px solid var(--border);
    padding: 10px;
    border-radius: var(--radius);
    background: var(--neutral-100);
    width: 100%;
    box-sizing: border-box;
}

.equipment-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
    border: 1px solid transparent;
}

.equipment-checkbox:hover {
    background: var(--info-bg);
    border-color: rgba(0, 102, 179, 0.2);
}

.equipment-checkbox input {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary-700);
}

.equipment-checkbox-wrap {
    width: 100%;
    box-sizing: border-box;
}

.piste-group {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 4px;
}

.piste-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--primary-900);
    color: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
}

.piste-group-header input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* ── 17. EMPTY / LOADING / SKELETON ─────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--neutral-500);
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-700);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    animation: spin 0.85s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--neutral-500);
    gap: 12px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--neutral-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    opacity: 0.7;
}

.empty-state-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--neutral-800);
    margin: 0;
}

.empty-state-sub {
    font-size: 13px;
    color: var(--neutral-500);
    margin: 0;
    max-width: 320px;
    line-height: 1.5;
}

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

.skeleton {
    background: linear-gradient(90deg, #F0F2F5 25%, #E4E8ED 50%, #F0F2F5 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-row td {
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--border);
}

.skeleton-row td .skeleton {
    height: 14px;
    border-radius: 6px;
    display: block;
}

.skeleton-card-line {
    height: 16px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-stat {
    height: 48px;
    border-radius: 8px;
}

/* Page fade-in */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-fade-in {
    animation: fadeInUp 280ms var(--ease-out) both;
}

.page-fade-in > * {
    animation: fadeInUp 320ms var(--ease-out) both;
}

.page-fade-in > *:nth-child(1) { animation-delay: 0ms; }
.page-fade-in > *:nth-child(2) { animation-delay: 50ms; }
.page-fade-in > *:nth-child(3) { animation-delay: 100ms; }
.page-fade-in > *:nth-child(4) { animation-delay: 150ms; }
.page-fade-in > *:nth-child(5) { animation-delay: 200ms; }

/* ── 18. SAVE INDICATOR ─────────────────────────────────────── */
@keyframes saveFlash {
    0%   { opacity: 0; transform: scale(0.85); }
    20%  { opacity: 1; transform: scale(1.05); }
    80%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

.save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    pointer-events: none;
    animation: saveFlash 2s ease forwards;
}

.save-indicator.saving {
    background: var(--info-bg);
    color: var(--primary-700);
    border: 1px solid rgba(0, 102, 179, 0.3);
}

.save-indicator.saved {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid rgba(31, 122, 77, 0.3);
}

.save-indicator.error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid rgba(180, 35, 24, 0.3);
}

/* ── 19. MOBILE — MENU / NAV / DRAWER ───────────────────────── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--neutral-800);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background var(--duration-fast) ease;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: var(--neutral-100);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    transition: opacity var(--duration) ease;
}

.sidebar-overlay.active { display: block; }

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 998;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.mobile-filter-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: var(--white);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform var(--duration-slow) ease;
    padding: 0 16px 16px;
}

.mobile-filter-drawer.active { transform: translateY(0); }

.mobile-filter-drawer-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 4px;
    margin: 10px auto 16px;
}

.mobile-filter-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-900);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-filter-drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--neutral-500);
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
}

.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 997;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-700);
    color: var(--white);
    border: none;
    box-shadow: 0 4px 16px rgba(0, 102, 179, 0.4);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ── 20. PAGE — LOGIN ───────────────────────────────────────── */
.login-page {
    display: flex;
    min-height: 100vh;
}

.login-sidebar {
    width: 460px;
    background:
        radial-gradient(ellipse at 100% 0%,    rgba(0, 159, 227, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 0% 100%,    rgba(0, 159, 227, 0.10) 0%, transparent 60%),
        linear-gradient(160deg, var(--primary-900) 0%, #001525 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 60px;
    position: relative;
    overflow: hidden;
}

.login-sidebar::before {
    content: '';
    position: absolute;
    inset: auto -200px -200px auto;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 159, 227, 0.08) 0%, transparent 70%);
}

.login-sidebar .brand {
    position: relative;
    z-index: 1;
    max-width: 360px;
}

.login-sidebar .brand-icon {
    font-size: 44px;
    color: var(--primary-500);
    margin-bottom: 32px;
    filter: drop-shadow(0 0 16px rgba(0, 159, 227, 0.4));
}

.login-sidebar h1 {
    font-size: clamp(2rem, 1.6rem + 1vw, 2.5rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: var(--tracking-tight);
    margin-bottom: 12px;
    color: var(--white);
}

.login-sidebar .brand-subtitle {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.55;
    margin-bottom: 32px;
    font-weight: 600;
}

.login-sidebar .brand-description {
    font-size: 16px;
    line-height: 1.7;
    opacity: 0.78;
    max-width: 42ch;
}

.login-sidebar .features {
    margin-top: 48px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-sidebar .feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    opacity: 0.85;
    line-height: 1.4;
}

.login-sidebar .feature-item i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 159, 227, 0.14);
    color: var(--primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-subtle);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
    font-weight: 600;
    color: var(--neutral-900);
    margin-bottom: 8px;
    letter-spacing: var(--tracking-tight);
}

.login-card .login-subtitle {
    font-size: 15px;
    color: var(--neutral-500);
    margin-bottom: 36px;
    line-height: 1.5;
}

/* Login form — scopé pour ne pas conflicter avec les modales du dashboard */
.login-main .form-group {
    margin-bottom: 22px;
}

.login-main .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--neutral-800);
    text-transform: none;
    letter-spacing: 0;
}

.login-main .form-group .input-wrapper {
    position: relative;
}

.login-main .form-group .input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    font-size: 15px;
    pointer-events: none;
    transition: color var(--duration) var(--ease);
}

.login-main .form-group input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    background: var(--white);
    min-height: 48px;
}

.login-main .form-group input:focus {
    outline: none;
    border-color: var(--primary-700);
    box-shadow: var(--ring-soft);
}

.login-main .form-group input:focus ~ i,
.login-main .form-group .input-wrapper:focus-within i {
    color: var(--primary-700);
}

.login-main .btn {
    padding: 14px 24px;
    font-size: 15px;
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
}

.error-msg {
    color: var(--danger-text);
    background: var(--danger-bg);
    border: 1px solid rgba(180, 35, 24, 0.2);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}

.error-msg.visible { display: flex; }
.error-msg i { font-size: 16px; flex-shrink: 0; }

.divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    gap: 12px;
    color: var(--neutral-500);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.demo-info {
    background: var(--info-bg);
    border: 1px solid rgba(0, 102, 179, 0.18);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 13px;
    color: var(--info-text);
    line-height: 1.6;
}

.demo-info strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-700);
}

.btn .spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

.btn.loading .spinner-small { display: block; }
.btn.loading .btn-text { display: none; }

/* ── 21. RESPONSIVE ─────────────────────────────────────────── */

/* Tablette & mobile : < 1024px */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar {
        transform: translateX(-260px);
        transition: transform var(--duration) ease;
    }

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

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

    .topbar { padding: 10px 16px; }
    .search-box { display: none; }
    .content { padding: 16px; }

    .card-header { padding: 14px 16px; flex-wrap: wrap; }
    .card-body { padding: 14px 16px; }
    .card-actions { flex-wrap: wrap; }

    .filters-row { gap: 8px; }
    .filter-group { min-width: 0; flex: 1 1 140px; }
    .snowmaker-filters input[type="text"],
    .task-filters input[type="text"] { min-width: 0; }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table { min-width: 600px; }

    #taskMap, #inspMap {
        height: 360px !important;
    }

    .map-chip {
        font-size: 11px;
        padding: 3px 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Mobile : < 768px */
@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 4px 6px;
        flex: 1;
        text-decoration: none;
        color: var(--neutral-500);
        font-size: 10px;
        font-weight: 600;
        transition: color var(--duration-fast) ease;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        min-height: 56px;
    }

    .mobile-nav-item i { font-size: 18px; }
    .mobile-nav-item.active,
    .mobile-nav-item:active { color: var(--primary-700); }

    .main-content {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        padding: 8px 12px;
        gap: 8px;
    }

    .topbar-left { gap: 10px; min-width: 0; }
    .topbar-right .topbar-icon:not(:first-child) { display: none; }
    /* A11y mobile : cibles tactiles 44×44 minimum */
    .topbar-icon { width: 44px; height: 44px; }

    .page-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .breadcrumb { display: none; }

    .content { padding: 12px; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card { padding: 14px 12px; }
    .stat-header { margin-bottom: 8px; }
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 8px;
    }

    .stat-info h3 { font-size: 11px; }
    .stat-value { font-size: 24px; }
    .stat-card .stat-footer { font-size: 11px; }

    .card { border-radius: var(--radius); margin-bottom: 12px; }
    .card-header { padding: 12px 14px; gap: 8px; }
    .card-body { padding: 12px 14px; }
    .card-title { font-size: 15px; }

    .filters-row {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        flex-wrap: nowrap;
    }

    .filter-group {
        min-width: 130px;
        flex: 0 0 auto;
    }

    .filter-group label { font-size: 10px; }

    .map-filters-bar {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding: 8px 10px !important;
        align-items: stretch !important;
    }

    .map-filters-bar > div {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .map-filters-bar > div::-webkit-scrollbar { display: none; }

    .map-filters-bar-scroll {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
        max-width: 100%;
    }

    .map-filters-bar-scroll::-webkit-scrollbar { display: none; }
    .map-chip { flex-shrink: 0; }

    #taskMap, #inspMap {
        height: 50vh !important;
        min-height: 250px;
        max-height: 350px;
        border-radius: 0 !important;
    }

    .leaflet-popup-content-wrapper { max-width: 260px !important; }

    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 95vh !important;
        height: 95vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: auto 0 0 0 !important;
    }

    .modal { align-items: flex-end !important; }
    .modal-content h3 { font-size: 17px; }

    .btn { padding: 11px 16px; font-size: 13px; min-height: 44px; }
    .btn-icon { min-width: 44px; min-height: 44px; }

    select,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px !important; /* empêche le zoom auto iOS */
        padding: 10px 12px;
        border-radius: 8px;
    }

    #lassoSelectionInfo {
        flex-direction: column;
        gap: 8px;
        align-items: stretch !important;
        text-align: center;
    }

    #lassoSelectionInfo button {
        width: 100%;
        justify-content: center;
    }

    .user-info { padding: 12px 16px; }

    table { min-width: 500px; }
    td, th { padding: 10px 8px; }
}

/* Très petit écran : < 480px */
@media (max-width: 480px) {
    .sidebar { width: 85vw; transform: translateX(-85vw); }

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

    .stat-card { padding: 10px 8px; }
    .stat-value { font-size: 20px; }
    .stat-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .card-actions { width: 100%; }
    .card-actions .btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
    }

    .result-count { font-size: 12px; }
    table th, table td { padding: 8px 6px; font-size: 12px; }

    .content { padding: 8px; }
    .card { margin-bottom: 10px; }

    .topbar { padding: 6px 10px; }
    .page-title { font-size: 14px; }
}

/* Login responsive */
@media (max-width: 900px) {
    .login-sidebar { display: none; }
    .login-main { padding: 30px 20px; }
}

@media (max-width: 480px) {
    .login-main { padding: 24px 16px; }
    .login-card h2 { font-size: 22px; }
    .login-main .form-group input {
        padding: 14px 14px 14px 44px;
        font-size: 16px;
    }
}

/* ── 22. LEAFLET — intégration design system ────────────────── */
.leaflet-container {
    font-family: var(--font-sans) !important;
    font-size: 13px;
    background: var(--neutral-100);
    border-radius: var(--radius);
}

/* Conteneurs de carte (cartes situées dans des cards) */
.card .leaflet-container,
#taskMap,
#inspMap,
#snowmakerMap {
    border-radius: var(--radius);
}

/* Contrôles de zoom — boutons cohérents avec .topbar-icon */
.leaflet-bar {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover {
    background: var(--surface) !important;
    color: var(--neutral-700) !important;
    border-bottom: 1px solid var(--border) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 18px !important;
    font-weight: 500;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease);
}

.leaflet-bar a:last-child {
    border-bottom: none !important;
}

.leaflet-bar a:hover {
    background: var(--neutral-100) !important;
    color: var(--primary-700) !important;
}

.leaflet-bar a.leaflet-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Attribution — discret */
.leaflet-control-attribution {
    background: var(--surface-glass) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--neutral-500) !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
    border-radius: var(--radius-sm) 0 0 0 !important;
    border: 1px solid var(--border);
    border-right: none;
    border-bottom: none;
}

.leaflet-control-attribution a {
    color: var(--primary-700) !important;
    font-weight: 500;
}

/* Popup — cohérent avec les cartes du dashboard */
.leaflet-popup-content-wrapper {
    background: var(--surface) !important;
    color: var(--neutral-800) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 4px;
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm) !important;
}

.leaflet-popup-close-button {
    color: var(--neutral-500) !important;
    font-size: 18px !important;
    padding: 6px 8px !important;
}

.leaflet-popup-close-button:hover {
    color: var(--danger) !important;
}

/* Légende de carte (générée par addLegend) */
.leaflet-control .leaflet-control-legend,
.leaflet-bottom .leaflet-control[style*="background:white"] {
    background: var(--surface-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 12px !important;
}

/* Dark mode Leaflet */
body[data-theme="dark"] .leaflet-container {
    background: #0F172A;
}

body[data-theme="dark"] .leaflet-bar a,
body[data-theme="dark"] .leaflet-bar a:hover {
    background: #1E293B !important;
    color: #E2E8F0 !important;
    border-bottom-color: #334155 !important;
}

body[data-theme="dark"] .leaflet-bar a:hover {
    background: #2D3F55 !important;
    color: #33BEFF !important;
}

body[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.78) !important;
    color: #94A3B8 !important;
    border-color: #334155;
}

body[data-theme="dark"] .leaflet-control-attribution a {
    color: #33BEFF !important;
}

body[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: #1E293B !important;
    color: #F1F5F9 !important;
    border: 1px solid #334155;
}

body[data-theme="dark"] .leaflet-popup-tip {
    background: #1E293B !important;
}

body[data-theme="dark"] .leaflet-bottom .leaflet-control[style*="background:white"] {
    background: rgba(30, 41, 59, 0.85) !important;
    color: #E2E8F0 !important;
    border-color: #334155;
}

/* ── 23. ZOOM 200% — pas de scroll horizontal ───────────────── */
@media (max-width: 640px) {
    body { overflow-x: hidden; }
}

/* ════════════════════════════════════════════════════════════
   23. DARK MODE — body[data-theme="dark"]
   ════════════════════════════════════════════════════════════ */
body {
    transition: background-color var(--duration-slow) ease,
                color var(--duration-slow) ease;
}

body[data-theme="dark"] * {
    transition: background-color var(--duration) ease,
                border-color var(--duration) ease,
                color var(--duration-fast) ease;
}

body[data-theme="dark"] {
    --bg:             #0F172A;
    --bg-subtle:      #131E33;
    --surface:        #1E293B;
    --surface-hover:  #263548;
    --surface-glass:  rgba(15, 23, 42, 0.78);
    --border:         #334155;
    --neutral-100:    #263548;
    --neutral-200:    #334155;
    --neutral-500:    #94A3B8;
    --neutral-800:    #E2E8F0;
    --neutral-900:    #F1F5F9;
    --gray-light:     #263548;
    --gray-medium:    #94A3B8;
    --gray-dark:      #CBD5E1;
    --primary-700:    #33BEFF;     /* boost lisibilité accents */
    --info-bg:        #0C2D44;
    --info-text:      #93C5FD;
    --success-bg:     #14532D;
    --success-text:   #86EFAC;
    --warning-bg:     #78350F;
    --warning-text:   #FCD34D;
    --danger-bg:      #7F1D1D;
    --danger-text:    #FCA5A5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow:    0 2px 8px rgba(0, 0, 0, 0.3),  0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6),0 6px 16px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] {
    background-color: #0F172A;
    color: #F1F5F9;
}

/* ── Dark mode SIDEBAR (premium : profondeur + glow + hiérarchie) ── */
body[data-theme="dark"] .sidebar {
    background:
        radial-gradient(ellipse 600px 200px at 50% 0%, rgba(0, 159, 227, 0.06), transparent 70%),
        linear-gradient(180deg, #001E32 0%, #000C18 100%);
    color: rgba(255, 255, 255, 0.72);
    border-right: 1px solid rgba(0, 159, 227, 0.08);
    box-shadow:
        inset -1px 0 0 rgba(255, 255, 255, 0.03),
        4px 0 32px rgba(0, 0, 0, 0.45);
}

body[data-theme="dark"] .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 18px 22px;
    background: linear-gradient(180deg, rgba(0, 159, 227, 0.03), transparent);
}

body[data-theme="dark"] .sidebar-header i {
    color: var(--primary-500);
    filter: drop-shadow(0 0 10px rgba(0, 159, 227, 0.5));
}

body[data-theme="dark"] .sidebar-title {
    color: var(--white);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .sidebar-subtitle {
    color: rgba(255, 255, 255, 0.42);
    letter-spacing: 0.9px;
    font-weight: 500;
}

body[data-theme="dark"] .nav-section {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

body[data-theme="dark"] .nav-section::after {
    /* Hairline supérieure : effet de relief subtil */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

body[data-theme="dark"] .nav-section:last-of-type {
    border-bottom: none;
}

body[data-theme="dark"] .nav-section:last-of-type::after {
    display: none;
}

body[data-theme="dark"] .nav-section-title {
    color: rgba(255, 255, 255, 0.38);
    letter-spacing: 1.4px;
    font-weight: 700;
    font-size: 10px;
    padding-bottom: 10px;
}

body[data-theme="dark"] .nav-item {
    color: rgba(255, 255, 255, 0.70);
    transition:
        background var(--duration) var(--ease),
        color var(--duration) var(--ease),
        box-shadow var(--duration) var(--ease),
        transform var(--duration-fast) var(--ease);
    position: relative;
}

/* Barre verticale animée à gauche de l'item actif */
body[data-theme="dark"] .nav-item::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--primary-500);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(0, 159, 227, 0.6);
    transition: transform var(--duration) var(--ease),
                opacity var(--duration) var(--ease);
    opacity: 0;
}

body[data-theme="dark"] .nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
    opacity: 1;
}

/* Hover : applique uniquement aux items NON actifs (l'actif garde son style) */
body[data-theme="dark"] .nav-item:not(.active):hover {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(0, 159, 227, 0.14) 100%);
    color: var(--white);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 1px 2px rgba(0, 0, 0, 0.25);
}

body[data-theme="dark"] .nav-item:not(.active):hover i {
    color: var(--primary-500);
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(0, 159, 227, 0.3));
}

body[data-theme="dark"] .nav-item:focus-visible {
    outline: none;
    background: rgba(0, 159, 227, 0.14);
    box-shadow:
        inset 0 0 0 1px var(--primary-500),
        0 0 0 2px rgba(0, 159, 227, 0.2);
    color: var(--white);
}

body[data-theme="dark"] .nav-item.active {
    background: linear-gradient(90deg,
        rgba(0, 159, 227, 0.22) 0%,
        rgba(0, 159, 227, 0.08) 100%);
    color: var(--white);
    font-weight: 600;
    box-shadow:
        inset 0 0 0 1px rgba(0, 159, 227, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .nav-item.active i {
    color: var(--primary-500);
    filter: drop-shadow(0 0 6px rgba(0, 159, 227, 0.5));
    opacity: 1;
}

body[data-theme="dark"] .nav-badge {
    background: linear-gradient(135deg, #DC2626, #991B1B);
    box-shadow:
        0 2px 4px rgba(220, 38, 38, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
}

body[data-theme="dark"] .user-info {
    background:
        linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.4));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 18px 14px;
    position: relative;
}

body[data-theme="dark"] .user-info::before {
    /* Hairline éclat haut */
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 159, 227, 0.25) 30%,
        rgba(0, 159, 227, 0.25) 70%,
        transparent);
}

body[data-theme="dark"] .user-avatar {
    background: linear-gradient(135deg, var(--primary-500), var(--ta-blue-deep));
    box-shadow:
        0 4px 12px rgba(0, 119, 182, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body[data-theme="dark"] .user-name {
    color: var(--white);
    font-weight: 600;
}

body[data-theme="dark"] .user-role {
    color: rgba(255, 255, 255, 0.50);
    font-weight: 500;
}

body[data-theme="dark"] .user-info > i,
body[data-theme="dark"] .user-info > .fas {
    color: rgba(255, 255, 255, 0.45);
    transition: color var(--duration) var(--ease),
                transform var(--duration-fast) var(--ease);
}

body[data-theme="dark"] .user-info > i:hover,
body[data-theme="dark"] .user-info > .fas:hover {
    color: #FCA5A5;
    transform: translateX(2px);
}

/* Scrollbar sidebar dark — discrete TA accent */
body[data-theme="dark"] .sidebar::-webkit-scrollbar {
    width: 6px;
}

body[data-theme="dark"] .sidebar::-webkit-scrollbar-track {
    background: transparent;
}

body[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 159, 227, 0.15);
    border-radius: 3px;
}

body[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 159, 227, 0.3);
}

body[data-theme="dark"] .topbar {
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 1px 0 #334155, 0 4px 16px rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .topbar-icon {
    background: rgba(255, 255, 255, 0.06);
    border-color: #334155;
    color: #94A3B8;
}

body[data-theme="dark"] .topbar-icon:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--primary-700);
    color: var(--primary-700);
}

body[data-theme="dark"] .search-box {
    background: #263548;
    border-color: #475569;
    color: #F1F5F9;
}

body[data-theme="dark"] .search-box input {
    color: #F1F5F9;
}

body[data-theme="dark"] .search-box input::placeholder {
    color: #64748B;
}

body[data-theme="dark"] .main-content,
body[data-theme="dark"] .content {
    background: #0F172A;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .stat-card {
    background: #1E293B;
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .card-header {
    border-bottom-color: #334155;
    color: #F1F5F9;
}

body[data-theme="dark"] .card-title,
body[data-theme="dark"] .stat-value,
body[data-theme="dark"] .page-title {
    color: #F1F5F9;
}

body[data-theme="dark"] .stat-label,
body[data-theme="dark"] .breadcrumb,
body[data-theme="dark"] .result-count {
    color: #94A3B8;
}

body[data-theme="dark"] .modal-content {
    background: #1E293B;
    border-color: #334155;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .modal-close {
    background: rgba(255, 255, 255, 0.08);
    color: #94A3B8;
}

body[data-theme="dark"] .modal-close:hover {
    background: rgba(180, 35, 24, 0.25);
    color: #FCA5A5;
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-actions {
    border-color: #334155;
}

body[data-theme="dark"] .modal-title,
body[data-theme="dark"] .modal-header h2,
body[data-theme="dark"] .modal-header h3 {
    color: #F1F5F9;
}

body[data-theme="dark"] table {
    background: #1E293B;
    color: #F1F5F9;
    border-color: #334155;
}

body[data-theme="dark"] thead,
body[data-theme="dark"] thead th {
    background: #263548;
    color: #94A3B8;
    border-bottom-color: #334155;
}

body[data-theme="dark"] tbody tr {
    transition: background-color var(--duration-fast) var(--ease);
}

/* ─── Dark mode HOVER : couleur SOLIDE bleu nuit (pas de transparence)
       — opaque pour éviter tout effet "trop clair" — v20260516170000 ─── */
body[data-theme="dark"] tbody tr:hover td {
    background-color: #11365A !important;
    color: #FFFFFF !important;
}

body[data-theme="dark"] tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-500) !important;
}

body[data-theme="dark"] tbody tr:hover td small,
body[data-theme="dark"] tbody tr:hover td .text-muted {
    color: #CBD5E1 !important;
}

body[data-theme="dark"] tbody tr:hover td .badge,
body[data-theme="dark"] tbody tr:hover td .badge * {
    color: inherit !important;
}

body[data-theme="dark"] td,
body[data-theme="dark"] th {
    border-color: #334155;
}

body[data-theme="dark"] tbody td {
    color: #E2E8F0;
}

body[data-theme="dark"] tr.row-selected td,
body[data-theme="dark"] tr.row-selected:hover td {
    background-color: #1A4B7A !important;
    color: #FFFFFF !important;
}

body[data-theme="dark"] tr.row-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--primary-500) !important;
}

/* ─── Dark mode : chips de filtres carte (.map-chip)
       Problème connu : --white reste #FFF en dark → chip blanche + texte clair illisible ─── */
body[data-theme="dark"] .map-chip {
    background: #1E293B !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

body[data-theme="dark"] .map-chip:hover:not(.active) {
    background: #2D3F55 !important;
    color: #FFFFFF !important;
    border-color: var(--primary-500) !important;
}

body[data-theme="dark"] .map-chip.active {
    background: var(--primary-500) !important;
    color: #FFFFFF !important;
    border-color: var(--primary-500) !important;
}

body[data-theme="dark"] .map-chip.lasso-chip:not(.active) {
    border-color: #334155 !important;
}

body[data-theme="dark"] .map-chip.lasso-chip.active {
    background: #7C3AED !important;
    border-color: #7C3AED !important;
}

/* Barre de filtres carte en dark — fond légèrement transparent dark, pas blanc */
body[data-theme="dark"] .map-filters-bar {
    background: rgba(15, 23, 42, 0.85) !important;
    border-bottom-color: #334155 !important;
}

body[data-theme="dark"] .map-filters-divider {
    background: #334155 !important;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    background: #263548;
    border-color: #475569;
    color: #F1F5F9;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
    color: #64748B;
}

body[data-theme="dark"] input:focus,
body[data-theme="dark"] select:focus,
body[data-theme="dark"] textarea:focus {
    background: #2D3F55;
    border-color: var(--primary-700);
    box-shadow: 0 0 0 3px rgba(51, 190, 255, 0.18);
}

body[data-theme="dark"] .btn-secondary {
    background: #263548;
    border-color: #475569;
    color: #F1F5F9;
}

body[data-theme="dark"] .btn-secondary:hover {
    background: #2D3F55;
    border-color: #94A3B8;
}

/* A11y dark : btn-primary utilise --primary-700 = #33BEFF (clair) en dark.
   Texte blanc dessus = contraste 2.11 (FAIL). On bascule en texte sombre. */
body[data-theme="dark"] .btn-primary,
body[data-theme="dark"] .bulk-btn-primary {
    color: #001525 !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(51, 190, 255, 0.35);
}

body[data-theme="dark"] .btn-primary:hover:not(:disabled),
body[data-theme="dark"] .bulk-btn-primary:hover:not(:disabled) {
    background: #5BCBFF;
    color: #001525 !important;
    box-shadow: 0 4px 14px rgba(51, 190, 255, 0.45);
}

body[data-theme="dark"] .form-group label,
body[data-theme="dark"] label {
    color: #94A3B8;
}

body[data-theme="dark"] .filters-row,
body[data-theme="dark"] .snowmaker-filters {
    background: #1E293B;
    border-color: #334155;
}

body[data-theme="dark"] .filter-group select,
body[data-theme="dark"] .filter-group input {
    background: #263548;
    border-color: #475569;
    color: #F1F5F9;
}

body[data-theme="dark"] .pagination-btn,
body[data-theme="dark"] .pagination button,
body[data-theme="dark"] .page-btn {
    background: #263548;
    border-color: #475569;
    color: #F1F5F9;
}

body[data-theme="dark"] .pagination-btn:hover,
body[data-theme="dark"] .pagination button:hover,
body[data-theme="dark"] .page-btn:hover {
    background: #2D3F55;
}

body[data-theme="dark"] .pagination-btn.active,
body[data-theme="dark"] .page-btn.active {
    background: var(--primary-700);
    border-color: var(--primary-700);
    color: #001525;
}

body[data-theme="dark"] .empty-state-icon {
    background: #263548;
}

body[data-theme="dark"] .empty-state-title {
    color: #CBD5E1;
}

body[data-theme="dark"] .empty-state-sub {
    color: #94A3B8;
}

body[data-theme="dark"] .badge-info    { background: #1E3A5F; color: #7DD3FC; border-color: rgba(125, 211, 252, 0.2); }
body[data-theme="dark"] .badge-success { background: #14532D; color: #86EFAC; border-color: rgba(134, 239, 172, 0.2); }
body[data-theme="dark"] .badge-warning { background: #78350F; color: #FCD34D; border-color: rgba(252, 211, 77, 0.2); }
body[data-theme="dark"] .badge-danger  { background: #7F1D1D; color: #FCA5A5; border-color: rgba(252, 165, 165, 0.2); }

body[data-theme="dark"] .dropdown,
body[data-theme="dark"] .dropdown-menu {
    background: #1E293B;
    border-color: #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .dropdown-item,
body[data-theme="dark"] .dropdown-menu a,
body[data-theme="dark"] .dropdown-menu li {
    color: #E2E8F0;
}

body[data-theme="dark"] .dropdown-item:hover,
body[data-theme="dark"] .dropdown-menu a:hover,
body[data-theme="dark"] .dropdown-menu li:hover {
    background: rgba(255, 255, 255, 0.07);
}

body[data-theme="dark"] .dropdown-divider {
    border-color: #334155;
}

body[data-theme="dark"] .alert-item {
    background: #263548;
    border-color: #334155;
}

body[data-theme="dark"] .alert-item:hover {
    background: #2D3F55;
}

body[data-theme="dark"] .save-indicator.saving {
    background: #1E3A5F;
    color: #7DD3FC;
    border-color: #2563EB;
}

body[data-theme="dark"] .save-indicator.saved {
    background: #14532D;
    color: #86EFAC;
    border-color: #16A34A;
}

body[data-theme="dark"] .save-indicator.error {
    background: #7F1D1D;
    color: #FCA5A5;
    border-color: #DC2626;
}

body[data-theme="dark"] {
    scrollbar-color: #475569 #1E293B;
}

body[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1E293B;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748B;
}

body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6 {
    color: #F1F5F9;
}

body[data-theme="dark"] hr,
body[data-theme="dark"] .divider {
    border-color: #334155;
}

body[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #263548 25%, #2D3F55 50%, #263548 75%);
    background-size: 600px 100%;
}

/* Inline style overrides — necessary because some legacy markup uses inline color attributes */
body[data-theme="dark"] .modal-content h3,
body[data-theme="dark"] .modal-content h4,
body[data-theme="dark"] .content h3,
body[data-theme="dark"] .content h4,
body[data-theme="dark"] #contentArea h3,
body[data-theme="dark"] #contentArea h4 {
    color: #93C5FD !important;
}

body[data-theme="dark"] [style*="border-top: 2px solid var(--gray-light)"],
body[data-theme="dark"] [style*="border-top:2px solid var(--gray-light)"] {
    border-top-color: #334155 !important;
}

body[data-theme="dark"] [style*="background:var(--gray-light)"],
body[data-theme="dark"] [style*="background: var(--gray-light)"] {
    background: #263548 !important;
}

body[data-theme="dark"] #snowmakerQrCode {
    background: white !important;
    border-color: #475569 !important;
}

body[data-theme="dark"] [style*="background:#fef3c7"],
body[data-theme="dark"] [style*="background: #fef3c7"] {
    background: #78350F !important;
    color: #FDE68A !important;
}

body[data-theme="dark"] [style*="background:#fee2e2"],
body[data-theme="dark"] [style*="background: #fee2e2"] {
    background: #7F1D1D !important;
    color: #FCA5A5 !important;
}

body[data-theme="dark"] [style*="background:#dcfce7"],
body[data-theme="dark"] [style*="background: #dcfce7"] {
    background: #14532D !important;
    color: #86EFAC !important;
}

body[data-theme="dark"] [style*="background:#dbeafe"],
body[data-theme="dark"] [style*="background: #dbeafe"] {
    background: #1E3A5F !important;
    color: #93C5FD !important;
}

body[data-theme="dark"] #darkModeToggle .fa-sun {
    color: #FBBF24;
}

body[data-theme="dark"] #cmdPaletteBtn {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: #334155 !important;
    color: #94A3B8 !important;
}

body[data-theme="dark"] #cmdPaletteBtn:hover {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: var(--primary-700) !important;
    color: var(--primary-700) !important;
}

body[data-theme="dark"] #cmdPaletteBtn span:last-child {
    background: #334155 !important;
    color: #94A3B8 !important;
}

body[data-theme="dark"] .modal-content [style*="color:#1e293b"],
body[data-theme="dark"] .modal-content [style*="color: #1e293b"],
body[data-theme="dark"] .modal-content [style*="color:#2c3e50"],
body[data-theme="dark"] .modal-content [style*="color: #2c3e50"],
body[data-theme="dark"] .modal-content [style*="color:#374151"],
body[data-theme="dark"] .modal-content [style*="color: #374151"],
body[data-theme="dark"] #contentArea [style*="color:#1e293b"],
body[data-theme="dark"] #contentArea [style*="color: #1e293b"],
body[data-theme="dark"] #contentArea [style*="color:#2c3e50"],
body[data-theme="dark"] #contentArea [style*="color: #2c3e50"],
body[data-theme="dark"] #contentArea [style*="color:#374151"],
body[data-theme="dark"] #contentArea [style*="color: #374151"],
body[data-theme="dark"] #contentArea [style*="color:#1e3a5f"],
body[data-theme="dark"] #contentArea [style*="color: #1e3a5f"] {
    color: #E2E8F0 !important;
}

body[data-theme="dark"] .modal-content [style*="color:var(--primary-blue)"],
body[data-theme="dark"] .modal-content [style*="color: var(--primary-blue)"],
body[data-theme="dark"] #contentArea [style*="color:var(--primary-blue)"],
body[data-theme="dark"] #contentArea [style*="color: var(--primary-blue)"] {
    color: #93C5FD !important;
}

/* (Leaflet popup dark : règles consolidées dans la section LEAFLET plus haut) */

body[data-theme="dark"] .modal-footer,
body[data-theme="dark"] [style*="position:sticky"][style*="bottom:0"],
body[data-theme="dark"] [style*="position: sticky"][style*="bottom: 0"] {
    background: #1E293B !important;
    border-top-color: #334155 !important;
}

body[data-theme="dark"] select option {
    background: #1E293B;
    color: #F1F5F9;
}

body[data-theme="dark"] [style*="background:rgba(0,0,0,0.1)"],
body[data-theme="dark"] [style*="background: rgba(0,0,0,0.1)"] {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* ─── Pills "equipment selector" historique avec inline background:white ───
       (history.js injecte des styles inline qu'on ne peut overrider qu'ici) */
body[data-theme="dark"] [style*="background:white"],
body[data-theme="dark"] [style*="background: white"],
body[data-theme="dark"] [style*="background:#fff"],
body[data-theme="dark"] [style*="background: #fff"],
body[data-theme="dark"] [style*="background:#FFFFFF"],
body[data-theme="dark"] [style*="background: #FFFFFF"] {
    background: #1E293B !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

/* Sous-titres/codes dans ces pills — garder hiérarchie lisible */
body[data-theme="dark"] [style*="background:white"] *:not(.badge):not([class*="badge-"]),
body[data-theme="dark"] [style*="background: white"] *:not(.badge):not([class*="badge-"]) {
    color: inherit;
}

/* ─── Backgrounds pastels inline souvent utilisés en JS (warnings/overdue/alerts)
       — on les fonce pour le dark mode ─── */
body[data-theme="dark"] [style*="background:#fff3f3"],
body[data-theme="dark"] [style*="background: #fff3f3"] {
    background: rgba(180, 35, 24, 0.18) !important;
}

body[data-theme="dark"] [style*="background:#fff7ed"],
body[data-theme="dark"] [style*="background: #fff7ed"],
body[data-theme="dark"] [style*="background:#fff3e0"],
body[data-theme="dark"] [style*="background: #fff3e0"],
body[data-theme="dark"] [style*="background:#fff5f5"],
body[data-theme="dark"] [style*="background: #fff5f5"] {
    background: rgba(180, 83, 9, 0.18) !important;
    color: #FCD34D !important;
}

body[data-theme="dark"] [style*="background:#ffebee"],
body[data-theme="dark"] [style*="background: #ffebee"] {
    background: rgba(180, 35, 24, 0.20) !important;
    color: #FCA5A5 !important;
}

body[data-theme="dark"] [style*="background:#eff6ff"],
body[data-theme="dark"] [style*="background: #eff6ff"] {
    background: rgba(0, 102, 179, 0.18) !important;
    color: #93C5FD !important;
}
