/* ═══════════════════════════════════════════════════════════════
   NexovAria RP — Design System « Command Center »
   Un seul fichier : tokens, base, layout, composants, responsive.
   Les noms de variables et classes historiques sont conservés.
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

/* ── Tokens ── */
:root {
    /* Surfaces */
    --bg-primary: #09090b;
    --bg-secondary: #0e0e11;
    --bg-card: #121215;
    --bg-card-hover: #17171b;
    --bg-sidebar: #0b0b0e;
    --bg-inset: #0c0c0f;

    /* Bordures */
    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.13);
    --border-strong: rgba(255,255,255,0.18);

    /* Texte */
    --text-primary: #ededef;
    --text-secondary: #a1a1aa;
    --text-muted: #6e6e78;

    /* Accent principal (identité Nexova) */
    --accent: #ef4444;
    --accent-hover: #dc2626;
    --accent-soft: rgba(239,68,68,0.10);
    --accent-border: rgba(239,68,68,0.30);
    --accent-glow: rgba(239,68,68,0.18);

    /* Alias historiques */
    --red: #ef4444;
    --red-soft: rgba(239,68,68,0.10);
    --red-border: rgba(239,68,68,0.30);

    /* Sémantique */
    --green: #22c55e;
    --green-soft: rgba(34,197,94,0.10);
    --green-border: rgba(34,197,94,0.28);
    --orange: #f59e0b;
    --orange-soft: rgba(245,158,11,0.10);
    --orange-border: rgba(245,158,11,0.28);
    --cyan: #06b6d4;
    --cyan-soft: rgba(6,182,212,0.10);
    --cyan-border: rgba(6,182,212,0.28);
    --purple: #a78bfa;
    --purple-soft: rgba(167,139,250,0.10);
    --purple-border: rgba(167,139,250,0.28);
    --blue: #3b82f6;
    --blue-soft: rgba(59,130,246,0.10);
    --blue-border: rgba(59,130,246,0.28);
    --blue-discord: #5865F2;

    /* Métiers */
    --ems: #06b6d4;
    --ems-soft: rgba(6,182,212,0.10);
    --ems-border: rgba(6,182,212,0.28);
    --lspd: #3b82f6;
    --lspd-soft: rgba(59,130,246,0.10);
    --lspd-border: rgba(59,130,246,0.28);

    /* Géométrie */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Ombres & effets */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
    --shadow: 0 4px 12px rgba(0,0,0,0.30);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
    --ring: 0 0 0 3px rgba(239,68,68,0.22);
    --card-highlight: inset 0 1px 0 rgba(255,255,255,0.035);

    /* Typo */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;

    --transition: 0.16s ease;
    --sidebar-w: 256px;
}

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

html { color-scheme: dark; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'cv05', 'cv11';
}
/* Texture de fond très discrète + halo accent (l'âme Nexova) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/bg.png') center/cover no-repeat;
    opacity: 0.035;
    z-index: -2;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 75%);
    mask-image: linear-gradient(to bottom, black 0%, transparent 75%);
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 700px 420px at 8% -5%, rgba(239,68,68,0.05) 0%, transparent 60%),
        radial-gradient(ellipse 900px 500px at 100% 110%, rgba(255,255,255,0.015) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

::selection { background: rgba(239,68,68,0.30); color: #fff; }

/* Scrollbars globales */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
*::-webkit-scrollbar-track { background: transparent; }

/* Focus clavier visible partout */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

a { color: inherit; }
img { max-width: 100%; }

/* ═══════════════════════════ SIDEBAR ═══════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    height: 100vh;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
}
.sidebar-brand::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -1px;
    transform: translateX(-50%);
    width: 64px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
}
.sidebar-logo {
    width: 100%;
    max-width: 118px;
    display: block;
    margin: 0 auto;
    opacity: 0.95;
    filter: drop-shadow(0 0 14px rgba(239,68,68,0.14));
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }

/* Sections */
.nav-section { margin-bottom: 6px; }
.nav-section + .nav-section { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--text-muted);
    padding: 4px 10px 6px;
    user-select: none;
}

/* Liens */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.3;
    position: relative;
}
.nav-link::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px; height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    transition: transform 0.18s ease;
}
.nav-link:hover {
    background: rgba(255,255,255,0.045);
    color: var(--text-primary);
}
.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.nav-link.active::before { transform: translateY(-50%) scaleY(1); }

/* Icônes SVG de navigation */
.nav-ico {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke-width: 1.9;
    opacity: 0.85;
}
.nav-link.active .nav-ico { opacity: 1; }
/* Compat : anciennes icônes emoji */
.nav-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

/* Variantes colorées */
.nav-ems.active, .nav-ems:hover { background: var(--ems-soft); color: var(--ems); }
.nav-ems.active::before { background: var(--ems); }
.nav-police.active, .nav-police:hover { background: var(--lspd-soft); color: var(--lspd); }
.nav-police.active::before { background: var(--lspd); }
.nav-leak.active, .nav-leak:hover { background: rgba(249,115,22,0.10); color: #f97316; }
.nav-leak.active::before { background: #f97316; }
.nav-compta.active, .nav-compta:hover { background: var(--green-soft); color: var(--green); }
.nav-compta.active::before { background: var(--green); }
.nav-danger.active, .nav-danger:hover { background: var(--red-soft); color: var(--red); }
.nav-danger.active::before { background: var(--red); }
.nav-config.active, .nav-config:hover { background: var(--purple-soft); color: var(--purple); }
.nav-config.active::before { background: var(--purple); }
.nav-tiktok.active, .nav-tiktok:hover { background: rgba(238,29,82,0.10); color: #ee1d52; }
.nav-tiktok.active::before { background: #ee1d52; }
.nav-stream.active, .nav-stream:hover { background: rgba(169,112,255,0.10); color: #a970ff; }
.nav-stream.active::before { background: #a970ff; }

/* Profil utilisateur */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.22);
    flex-shrink: 0;
}
.sidebar-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
}
.sidebar-user-info {
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sidebar-user-name {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.sidebar-user-logout {
    color: var(--text-muted);
    font-size: 0.71rem;
    text-decoration: none;
    transition: color var(--transition);
}
.sidebar-user-logout:hover { color: var(--red); }

/* ═══════════════════════════ LAYOUT ═══════════════════════════ */
.content {
    margin-left: var(--sidebar-w);
    padding: 30px 36px 48px;
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    max-width: 1460px;
}

/* ── Typographie ── */
h1 {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 22px;
}
h1 .accent, h1 span.accent { color: var(--accent); }
h2 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 28px 0 14px;
}
h3 {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 4px;
}
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── En-tête de page (standard global) ── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 26px; flex-wrap: wrap;
}
.page-header-left h1 { margin: 0 0 4px; }
.page-header-left p  { margin: 0; color: var(--text-muted); font-size: 0.86rem; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }

/* ═══════════════════════════ CARTES ═══════════════════════════ */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 30px;
}
.card {
    background: var(--bg-card);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--card-highlight);
    transition: border-color var(--transition), background var(--transition);
}
.card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.stat-value {
    font-size: 1.65rem;
    font-weight: 750;
    color: var(--text-primary);
    margin: 8px 0 0;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
/* Accents latéraux (dashboard & co) */
.card-accent-cyan   { border-left: 3px solid var(--cyan); }
.card-accent-red    { border-left: 3px solid var(--red); }
.card-accent-orange { border-left: 3px solid var(--orange); }
.card-accent-green  { border-left: 3px solid var(--green); }
.card-accent-purple { border-left: 3px solid var(--purple); }
.card-accent-blue   { border-left: 3px solid var(--blue); }

/* Stat cards "pro" */
.stat-grid-pro {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 26px;
}
.stat-card-pro {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 18px;
    box-shadow: var(--card-highlight);
    transition: border-color .2s, transform .2s; cursor: default;
}
.stat-card-pro:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.stat-card-pro .scp-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-muted); margin-bottom: 9px; display: flex; align-items: center; gap: 6px;
}
.stat-card-pro .scp-val {
    font-size: 1.8rem; font-weight: 750; line-height: 1;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}

/* Panneaux de données */
.data-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px;
    box-shadow: var(--card-highlight);
}
.data-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.018); gap: 12px; flex-wrap: wrap;
}
.data-panel-title {
    font-size: 0.86rem; font-weight: 650; display: flex; align-items: center; gap: 8px;
    letter-spacing: -0.005em;
}
.data-panel-body { padding: 20px; }

.panel-box {
    background: var(--bg-card);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--card-highlight);
}
.info-line {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
}
.info-line:last-child { border-bottom: none; }

/* ═══════════════════════════ TABLEAUX ═══════════════════════════ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
th, td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.855rem;
}
td { font-variant-numeric: tabular-nums; }
th {
    background: rgba(255,255,255,0.022);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    white-space: nowrap;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.022); }
tbody tr:last-child td { border-bottom: none; }

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
.table-scroll table { border-radius: 0; }

/* ═══════════════════════════ BOUTONS ═══════════════════════════ */
.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.79rem;
    transition: all var(--transition);
    border: 1px solid var(--accent-border);
}
.btn-view:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-action {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 16px; border-radius: var(--radius); font-size: 0.84rem;
    font-weight: 600; cursor: pointer; border: none; transition: all .15s;
    text-decoration: none; white-space: nowrap; font-family: inherit;
    background: var(--accent); color: #fff;
    line-height: 1.35;
}
.btn-action:hover { background: var(--accent-hover); }
.btn-action:active { transform: scale(.97); }
.btn-action-primary { background: var(--accent); color: #fff; }
.btn-action-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-action-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-action-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.btn-action-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-action-ghost:hover { color: var(--text-primary); border-color: var(--border-hover); background: rgba(255,255,255,0.03); }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    padding: 7px 15px;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
    border: 1px solid var(--border);
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 16px;
}
.btn-back:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: var(--border-hover); }

/* ═══════════════════════════ BADGES ═══════════════════════════ */
.badge-pro {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 700;
    line-height: 1.6;
}
.badge-success { background: var(--green-soft);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-danger  { background: var(--red-soft);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-warn    { background: var(--orange-soft); color: var(--orange); border: 1px solid var(--orange-border); }
.badge-info    { background: var(--cyan-soft);   color: var(--cyan);   border: 1px solid var(--cyan-border); }
.badge-neutral { background: rgba(113,113,122,.1); color: var(--text-muted); border: 1px solid var(--border); }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid var(--border-strong);
}
.status-open   { color: var(--green); font-weight: 600; }
.status-closed { color: var(--red);   font-weight: 600; }
.job-tag {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.gang-tag {
    display: inline-block;
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #f87171;
}
.state-out     { color: #f87171;       font-weight: 600; }
.state-in      { color: var(--green);  font-weight: 600; }
.state-impound { color: var(--orange); font-weight: 600; }
.plate-box {
    background: #e4e4e7;
    color: #18181b;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}
.tag-info {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.ping-good   { color: var(--green);  font-weight: 600; font-variant-numeric: tabular-nums; }
.ping-medium { color: var(--orange); font-weight: 600; font-variant-numeric: tabular-nums; }
.ping-bad    { color: var(--red);    font-weight: 600; font-variant-numeric: tabular-nums; }

.role-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
}
.tag-badge {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 4px 2px 0;
    border-radius: 20px;
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    font-size: 0.76rem;
    color: #fca5a5;
    font-weight: 500;
}
.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.type-car      { background: var(--blue-soft);   color: #60a5fa; }
.type-boat     { background: rgba(20,184,166,0.12); color: #2dd4bf; }
.type-aircraft { background: var(--purple-soft); color: var(--purple); }
.type-bike     { background: var(--orange-soft); color: #fbbf24; }
.type-other    { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.payment-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
}
.status-complete { background: var(--green-soft);  color: var(--green); }
.status-pending  { background: var(--orange-soft); color: var(--orange); }
.status-refunded { background: var(--red-soft);    color: var(--red); }
.status-other    { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.badge-inroom  { display:inline-block; padding:2px 10px; border-radius:20px; font-size:.72rem; font-weight:700; background:var(--red-soft);   color:var(--red);   border:1px solid var(--red-border); }
.badge-outroom { display:inline-block; padding:2px 10px; border-radius:20px; font-size:.72rem; font-weight:700; background:var(--green-soft); color:var(--green); border:1px solid var(--green-border); }

/* ═══════════════════════════ FORMULAIRES ═══════════════════════════ */
input[type="text"], input[type="search"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="time"], input[type="url"],
select, textarea {
    padding: 8px 13px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.865rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent-border);
    box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select { cursor: pointer; }
select option { background: var(--bg-secondary); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.search-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px;
}
.search-bar input { flex: 1; min-width: 200px; }

.vehicles-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.vehicles-toolbar input[type="text"] { flex: 1; min-width: 200px; }
.vehicles-count {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════ ÉTATS & FEEDBACK ═══════════════════════════ */
.empty-state-pro {
    text-align: center; padding: 56px 20px; color: var(--text-muted);
}
.empty-state-pro .empty-icon { font-size: 2.6rem; margin-bottom: 12px; opacity: .45; }
.empty-state-pro p { font-size: 0.9rem; }

.error-box {
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    color: #fca5a5;
    padding: 13px 18px;
    border-radius: var(--radius);
    font-size: 0.88rem;
}

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: skeleton-slide 1.4s infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
}
@keyframes skeleton-slide { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ═══════════════════════════ CHAT / TRANSCRIPT ═══════════════════════════ */
.chat-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 16px;
    border: 1px solid var(--border);
    max-width: 960px;
    box-shadow: var(--card-highlight);
}
.message { display: flex; margin-bottom: 18px; align-items: flex-start; }
.message.system .msg-content { color: var(--text-muted); font-style: italic; }
.avatar-container { margin-right: 12px; flex-shrink: 0; }
.avatar-container img { width: 38px; height: 38px; border-radius: 50%; background: var(--bg-secondary); }
.msg-body {
    flex: 1;
    background: rgba(255,255,255,0.02);
    padding: 11px 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.msg-header { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.84rem; }
.author-name { font-weight: 600; color: var(--accent); }
.timestamp { color: var(--text-muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.msg-content { white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; font-size: 0.89rem; }
.no-messages { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; }

/* ═══════════════════════════ BOUTIQUE / TEBEX ═══════════════════════════ */
.store-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--orange);
    box-shadow: var(--card-highlight);
}
.store-header .store-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 24px;
    flex: 1;
}
.store-header .store-info-grid p { margin: 2px 0; font-size: 0.85rem; color: var(--text-secondary); }
.store-header .store-info-grid strong { color: var(--text-primary); }
.store-header h2 { margin: 0 0 8px; color: var(--orange); font-size: 1.1rem; }

.revenue-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.revenue-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--card-highlight);
}
.revenue-card .rev-label { color: var(--text-muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.revenue-card .rev-value { font-size: 1.45rem; font-weight: 750; color: var(--green); font-variant-numeric: tabular-nums; }

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.pkg-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}
.pkg-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.pkg-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.pkg-card .pkg-noimg {
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, var(--orange-soft), var(--red-soft));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
}
.pkg-card .pkg-body { padding: 14px 16px; }
.pkg-card .pkg-name { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; margin-bottom: 2px; }
.pkg-card .pkg-cat { font-size: 0.74rem; color: var(--orange); font-weight: 500; margin-bottom: 6px; }
.pkg-card .pkg-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
.pkg-card .pkg-price { font-size: 1.05rem; font-weight: 750; color: var(--green); font-variant-numeric: tabular-nums; }
.pkg-card .pkg-sale {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--red-soft);
    color: #f87171;
    font-size: 0.74rem;
    font-weight: 600;
}

.goals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.goal-card {
    background: var(--bg-card);
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--card-highlight);
}
.goal-card h4 { color: var(--orange); margin: 0 0 4px; font-size: 0.93rem; }
.goal-card .goal-desc { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 10px; }
.goal-bar-bg {
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    height: 18px;
    overflow: hidden;
    position: relative;
}
.goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange), var(--red));
    border-radius: 20px;
    transition: width 0.6s ease;
}
.goal-bar-text {
    position: absolute;
    inset: 0;
    text-align: center;
    line-height: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
}

.section-title {
    color: var(--orange);
    margin: 24px 0 12px;
    font-size: 1.05rem;
    font-weight: 650;
}

.top-sales {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.top-sale-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition);
}
.top-sale-card:hover { border-color: var(--border-hover); }
.top-sale-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
}
.top-sale-card.rank-1::before { background: #fbbf24; }
.top-sale-card.rank-2::before { background: #9ca3af; }
.top-sale-card.rank-3::before { background: #b45309; }
.top-sale-card .rank-badge {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.rank-1 .rank-badge { background: rgba(251,191,36,0.12); color: #fbbf24; border: 2px solid rgba(251,191,36,0.3); }
.rank-2 .rank-badge { background: rgba(156,163,175,0.12); color: #9ca3af; border: 2px solid rgba(156,163,175,0.3); }
.rank-3 .rank-badge { background: rgba(180,83,9,0.12); color: #d97706; border: 2px solid rgba(180,83,9,0.3); }
.rank-other .rank-badge { background: rgba(255,255,255,0.04); color: var(--text-muted); border: 2px solid var(--border); }
.top-sale-card .sale-info { flex: 1; min-width: 0; }
.top-sale-card .sale-name { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sale-card .sale-stats { display: flex; gap: 12px; font-size: 0.78rem; }
.top-sale-card .sale-count { color: var(--cyan); font-weight: 600; }
.top-sale-card .sale-revenue { color: var(--green); font-weight: 600; }

/* ═══════════════════════════ GRAPHIQUES ═══════════════════════════ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    box-shadow: var(--card-highlight);
}
.chart-card h3 {
    margin: 0 0 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chart-card canvas { max-height: 280px; }
.chart-card-wide { grid-column: span 2; }
@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-card-wide { grid-column: span 1; }
}

/* ═══════════════════════════ ESPACES MÉTIERS (EMS / LSPD) ═══════════════════════════ */
.ems-hero, .lspd-hero {
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 4px solid var(--ems); border-radius: var(--radius-lg);
    padding: 20px 26px; margin-bottom: 22px;
    display: flex; align-items: center; gap: 18px;
    box-shadow: var(--card-highlight);
}
.lspd-hero { border-left-color: var(--lspd); }
.ems-hero-icon, .lspd-hero-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.ems-hero h1, .lspd-hero h1 { margin: 0 0 3px; font-size: 1.3rem; }
.ems-hero p, .lspd-hero p { margin: 0; color: var(--text-muted); font-size: 0.84rem; }
.ems-hero .ems-grade, .lspd-hero .lspd-grade {
    display: inline-block; margin-left: 10px; padding: 2px 10px;
    border-radius: 20px; font-size: 0.71rem; font-weight: 700;
    background: var(--ems-soft); color: var(--ems); border: 1px solid var(--ems-border);
    vertical-align: middle;
}
.lspd-hero .lspd-grade { background: var(--lspd-soft); color: var(--lspd); border-color: var(--lspd-border); }
.ems-hero .ems-grade.chief, .lspd-hero .lspd-grade.chief { background: rgba(251,191,36,.1); color: #fbbf24; border-color: rgba(251,191,36,.25); }

.ems-nav, .lspd-nav {
    display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 22px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 6px;
}
.ems-nav a, .lspd-nav a {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 14px; background: transparent; border: none;
    border-radius: var(--radius); color: var(--text-muted);
    text-decoration: none; font-size: 0.83rem; font-weight: 600;
    transition: all .15s; white-space: nowrap;
}
.ems-nav a:hover { background: var(--ems-soft); color: var(--ems); }
.ems-nav a.active { background: var(--ems); color: #fff; }
.lspd-nav a:hover { background: var(--lspd-soft); color: var(--lspd); }
.lspd-nav a.active { background: var(--lspd); color: #fff; }

.ems-panel, .lspd-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px;
    box-shadow: var(--card-highlight);
}
.ems-panel-title, .lspd-panel-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-muted); margin: 0 0 16px; padding-bottom: 11px;
    border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
}

.ems-stat-grid, .lspd-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; margin-bottom: 22px; }
.ems-stat, .lspd-stat {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 15px; text-align: center;
    transition: border-color .2s;
    box-shadow: var(--card-highlight);
}
.ems-stat:hover { border-color: var(--ems-border); }
.lspd-stat:hover { border-color: var(--lspd-border); }
.ems-stat-val, .lspd-stat-val { font-size: 1.7rem; font-weight: 750; color: var(--ems); line-height: 1; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.lspd-stat-val { color: var(--lspd); }
.ems-stat-lbl, .lspd-stat-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ═══════════════════════════ DIVERS ═══════════════════════════ */
.server-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
    margin-top: 12px;
}
.server-detail-grid p {
    margin: 3px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.server-detail-grid strong { color: var(--text-primary); font-weight: 600; }

/* Indicateur LIVE */
.live-indicator {
    position: fixed;
    top: 14px;
    right: 20px;
    background: var(--bg-card);
    color: var(--red);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    z-index: 9999;
    border: 1px solid var(--border);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow);
}
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Ancien en-tête plein écran (compat) */
.header {
    background: var(--bg-card);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}
.header h1 { margin: 0; }
#network-container { flex: 1; width: 100%; height: 100%; background: var(--bg-primary); }
.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 10;
}
.legend h4 { margin: 0 0 8px; color: var(--text-primary); font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; margin-bottom: 6px; font-size: 0.82rem; color: var(--text-secondary); }
.legend-color { width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; border: 2px solid transparent; }
.l-parrain { border-color: #fbbf24; }
.l-filleul { border-color: var(--green); }

/* ═══════════════════════════ ORGANIGRAMME (nouveau) ═══════════════════════════ */
.org-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
}
.org-toolbar input[type="search"] { flex: 1; min-width: 220px; }
.org-seg {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}
.org-seg button {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
}
.org-seg button.active { background: var(--accent); color: #fff; }
.org-seg button:not(.active):hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.org-canvas {
    position: relative;
    background: var(--bg-secondary);
    background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 22px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: calc(100vh - 300px);
    min-height: 460px;
}
.org-canvas svg { display: block; }

/* Carte de nœud (rendue en foreignObject) */
.org-node {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 9px 12px;
    height: 100%;
    font-family: var(--font-sans);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    cursor: pointer;
    transition: border-color .15s;
    overflow: hidden;
}
.org-node:hover { border-color: var(--accent-border); }
.org-node.is-parrain { border-left: 3px solid #fbbf24; }
.org-node.is-root { border-left: 3px solid var(--accent); }
.org-node img {
    width: 34px; height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--border-strong);
    background: var(--bg-secondary);
}
.org-node .on-info { min-width: 0; flex: 1; }
.org-node .on-name {
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.org-node .on-meta {
    display: flex;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.org-node .on-meta .pts { color: #fbbf24; font-weight: 700; }
.org-node .on-meta .kids { color: var(--cyan); font-weight: 600; }

/* Vue liste de l'organigramme */
.org-list { display: none; }
.org-list.active { display: block; }
.org-tree-row td:first-child { white-space: nowrap; }
.org-indent { display: inline-block; }
.org-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    cursor: pointer;
    margin-right: 8px;
    vertical-align: middle;
    transition: all .12s;
    font-size: 0.62rem;
    user-select: none;
}
.org-caret:hover { color: var(--text-primary); border-color: var(--border-hover); }
.org-caret.leaf { visibility: hidden; }
.org-caret svg { transition: transform .15s; }
.org-caret.open svg { transform: rotate(90deg); }

/* ═══════════════════════════ MODALES & TOASTS ═══════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast-stack {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-left: 3px solid var(--accent);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 11px 16px;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: toast-in .22s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══════════════════════════ UTILITAIRES ═══════════════════════════ */
.text-muted-u { color: var(--text-muted); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ═══════════════════════════ MOBILE ═══════════════════════════ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2em;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 50;
}
.overlay.open { display: block; }

/* ─── 1024px ─── */
@media (max-width: 1024px) {
    .card-container { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .chart-card-wide { grid-column: span 1; }
    .store-header .store-info-grid { grid-template-columns: 1fr 1fr; }
    .charts-row { grid-template-columns: 1fr !important; }
    .chart-full { grid-column: span 1 !important; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ─── 768px ─── */
@media (max-width: 768px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-w) - 14px);
        transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
        z-index: 150;
        box-shadow: none;
    }
    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .menu-toggle { display: flex !important; }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 16px 16px 24px;
        padding-top: 62px;
    }

    h1 { font-size: 1.2rem; margin-bottom: 16px; }
    h2 { font-size: 1rem; margin: 20px 0 10px; }

    .card-container { grid-template-columns: 1fr; }

    table {
        font-size: 0.8rem;
        min-width: 540px;
    }
    th, td { padding: 9px 10px; }
    .content > table,
    .content > div > table,
    .content > section > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

    .page-header { flex-direction: column; }
    .stat-grid-pro { grid-template-columns: 1fr 1fr; }
    .data-panel-header { flex-direction: column; align-items: flex-start; }

    .store-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .store-header .store-info-grid { grid-template-columns: 1fr; width: 100%; }
    .packages-grid { grid-template-columns: 1fr; }
    .revenue-row { grid-template-columns: 1fr 1fr; }
    .goals-container { grid-template-columns: 1fr; }
    .top-sales { grid-template-columns: 1fr; }

    .server-detail-grid { grid-template-columns: 1fr; }
    .vehicles-toolbar { flex-direction: column; align-items: stretch; }
    .vehicles-toolbar input[type="text"],
    .vehicles-toolbar select { min-width: unset; width: 100%; }

    .charts-grid { grid-template-columns: 1fr; }
    .chart-card-wide { grid-column: span 1; }
    .charts-row { grid-template-columns: 1fr !important; }
    .chart-full { grid-column: span 1 !important; }

    .eco-grid { grid-template-columns: 1fr 1fr !important; }
    .sankey-container { padding: 14px; }
    .flow-tabs { gap: 4px; }
    .flow-tab { padding: 5px 10px; font-size: 0.75rem; }
    #flowTreeChart { height: 420px !important; }
    #timelineChart { height: 260px !important; }

    .lspd-nav, .ems-nav { gap: 4px; }
    .lspd-nav a, .ems-nav a { padding: 7px 10px; font-size: 0.78rem; }
    .ems-hero, .lspd-hero { flex-direction: column; text-align: center; padding: 18px; gap: 10px; }
    .ems-stat-grid, .lspd-stat-grid { grid-template-columns: 1fr 1fr; }

    .dispatch-grid { grid-template-columns: 1fr !important; }
    .dispatch-topbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .btn-create { margin-left: 0; justify-content: center; }
    .legend { flex-wrap: wrap; bottom: 10px; right: 10px; font-size: 0.78rem; padding: 10px; }

    .modal { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr !important; }

    .info-line { flex-direction: column; align-items: flex-start; gap: 4px; }

    .chat-container { padding: 14px; }
    .message { gap: 8px; }
    .avatar-container img { width: 32px; height: 32px; }

    .live-indicator { top: auto; bottom: 14px; right: 14px; }

    .eco-grid { gap: 10px; }
    .card-grid-2, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }

    .org-canvas { height: calc(100vh - 250px); min-height: 380px; }
    .org-toolbar { padding: 10px; }
}

/* ─── 480px ─── */
@media (max-width: 480px) {
    .content { padding: 12px; padding-top: 60px; }
    h1 { font-size: 1.1rem; }

    .eco-grid { grid-template-columns: 1fr !important; }
    .revenue-row { grid-template-columns: 1fr !important; }
    .stat-grid-pro { grid-template-columns: 1fr; }

    .lspd-nav a span, .ems-nav a span { display: none; }
    .ems-nav a span:first-child { display: none; }

    .btn-create { font-size: 0.8rem; padding: 8px 14px; }

    table th:nth-child(n+5),
    table td:nth-child(n+5) { display: none; }

    .modal { max-width: 100%; border-radius: 12px; }
}
