/* === NexovAria RP — Panel Admin Pro === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #0c0c0e;
    --bg-secondary: #131316;
    --bg-card: #18181b;
    --bg-card-hover: #1e1e22;
    --bg-sidebar: #111114;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.1);
    --text-primary: #f0f0f0;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --red: #e53e3e;
    --red-soft: rgba(229,62,62,0.12);
    --red-border: rgba(229,62,62,0.25);
    --green: #38a169;
    --green-soft: rgba(56,161,105,0.12);
    --orange: #dd6b20;
    --orange-soft: rgba(221,107,32,0.12);
    --cyan: #0891b2;
    --cyan-soft: rgba(8,145,178,0.12);
    --purple: #805ad5;
    --purple-soft: rgba(128,90,213,0.12);
    --blue-discord: #5865F2;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.35);
    --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/bg.png') center/cover no-repeat;
    opacity: 0.06;
    z-index: -2;
    pointer-events: none;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 15% 50%, rgba(229,62,62,0.04) 0%, transparent 55%);
    z-index: -1;
    pointer-events: none;
}

/* ── Sidebar ── */
.sidebar {
    width: 256px;
    background: var(--bg-sidebar);
    height: 100vh;
    border-right: 1px solid var(--border);
    padding: 0;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-brand {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo {
    width: 100%;
    max-width: 130px;
    display: block;
    margin: 0 auto;
    opacity: 0.92;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Section labels */
.nav-section { margin-bottom: 4px; }
.nav-section + .nav-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.nav-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 6px 10px 4px;
    user-select: none;
}

/* Nav links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition), border-left-color var(--transition);
    font-size: 0.845rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    line-height: 1.3;
}
.nav-link:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    border-left-color: var(--border-hover);
}
.nav-link.active {
    background: var(--red-soft);
    color: var(--red);
    border-left-color: var(--red);
    font-weight: 600;
}
.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

/* Colored nav links */
.nav-ems { }
.nav-ems.active, .nav-ems:hover { background: rgba(8,145,178,0.1); color: var(--cyan); border-left-color: var(--cyan); }
.nav-police.active, .nav-police:hover { background: rgba(59,130,246,0.1); color: #3b82f6; border-left-color: #3b82f6; }
.nav-leak.active, .nav-leak:hover { background: rgba(249,115,22,0.1); color: #f97316; border-left-color: #f97316; }
.nav-compta.active, .nav-compta:hover { background: rgba(56,161,105,0.1); color: var(--green); border-left-color: var(--green); }
.nav-danger.active, .nav-danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-left-color: #ef4444; }
.nav-config.active, .nav-config:hover { background: rgba(167,139,250,0.1); color: #a78bfa; border-left-color: #a78bfa; }
.nav-tiktok.active, .nav-tiktok:hover { background: rgba(238,29,82,0.1); color: #ee1d52; border-left-color: #ee1d52; }

/* User profile at bottom */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.sidebar-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    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.72rem;
    text-decoration: none;
    transition: color var(--transition);
}
.sidebar-user-logout:hover { color: var(--red); }

/* ── Content ── */
.content {
    margin-left: 256px;
    padding: 32px 36px;
    width: calc(100% - 256px);
    min-height: 100vh;
    max-width: 1400px;
}

/* ── Typography ── */
h1 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
}
h1 .accent, h1 span.accent { color: var(--red); }
h2 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
    margin: 28px 0 14px;
}
h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 4px;
}

/* ── Cards ── */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    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.75rem;
    font-weight: 700;
    color: var(--red);
    margin: 8px 0 0;
    line-height: 1.2;
}

/* ── Tables ── */
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: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
th {
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ── */
.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red-soft);
    color: var(--red);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    transition: all var(--transition);
    border: 1px solid var(--red-border);
}
.btn-view:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-action {
    padding: 8px 18px;
    border-radius: var(--radius);
    border: none;
    background: var(--red);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-action:hover { background: #c53030; }

/* ── Badges & Tags ── */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
    border: 2px solid var(--border);
}
.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);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.gang-tag {
    display: inline-block;
    background: var(--red-soft);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    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: rgba(255,255,255,0.9);
    color: #18181b;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}
.tag-info {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Ping Colors ── */
.ping-good { color: var(--green); font-weight: 600; }
.ping-medium { color: var(--orange); font-weight: 600; }
.ping-bad { color: var(--red); font-weight: 600; }

/* ── Role Badges ── */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}

/* ── Server Card ── */
.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; }
.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.78rem;
    color: #fca5a5;
    font-weight: 500;
}

/* ── Form Controls ── */
input[type="text"], select {
    padding: 9px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--transition);
    outline: none;
}
input[type="text"]:focus, select:focus {
    border-color: var(--red-border);
}
input[type="text"]::placeholder { color: var(--text-muted); }

/* ── Vehicles Toolbar ── */
.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.85rem;
    margin-bottom: 8px;
}

/* ── Type Badges ── */
.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.type-car { background: rgba(59,130,246,0.15); color: #60a5fa; }
.type-boat { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.type-aircraft { background: var(--purple-soft); color: #a78bfa; }
.type-bike { background: var(--orange-soft); color: #fb923c; }
.type-other { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ── 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;
}
.message { display: flex; margin-bottom: 20px; align-items: flex-start; }
.message.system .msg-content { color: var(--text-muted); font-style: italic; }
.avatar-container { margin-right: 14px; flex-shrink: 0; }
.avatar-container img { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-secondary); }
.msg-body {
    flex: 1;
    background: rgba(255,255,255,0.02);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.msg-header { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.85rem; }
.author-name { font-weight: 600; color: var(--red); }
.timestamp { color: var(--text-muted); font-size: 0.78rem; }
.msg-content { white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; font-size: 0.9rem; }
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
}
.btn-back:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.no-messages { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; }

/* ── Player Detail ── */
.panel-box {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.info-line {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}
.info-line:last-child { border-bottom: none; }

/* ── 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);
}
.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.15rem; }

.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: 18px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
}
.revenue-card .rev-label { color: var(--text-muted); font-size: 0.78rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.revenue-card .rev-value { font-size: 1.5rem; font-weight: 700; color: var(--green); }

.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);
}
.pkg-card:hover { border-color: var(--border-hover); }
.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.75rem; 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.1rem; font-weight: 700; color: var(--green); }
.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.75rem;
    font-weight: 600;
}

.payment-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    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); }

.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);
}
.goal-card h4 { color: var(--orange); margin: 0 0 4px; font-size: 0.95rem; }
.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: 20px;
    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: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
}

.section-title {
    color: var(--orange);
    margin: 24px 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.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: 16px 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: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    font-weight: 700;
    flex-shrink: 0;
}
.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; }

.error-box {
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    color: #fca5a5;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

/* ── Charts ── */
.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;
}
.chart-card h3 {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.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; }
}

/* ── Parrainages ── */
.header {
    background: var(--bg-card);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}
.header h1 { margin: 0; color: var(--orange); }
#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); }

/* ── LIVE Indicator ── */
.live-indicator {
    position: fixed;
    top: 14px;
    right: 20px;
    background: var(--bg-card);
    color: var(--red);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 9999;
    border: 1px solid var(--border);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.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; }
}

/* ── 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;
}
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 50;
}
.overlay.open { display: block; }

/* ─── Responsive Tables wrapper ─── */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
.table-scroll table { border-radius: 0; }

/* ─── 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; }
}

/* ─── 768px (tablette / mobile) ─── */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        left: -270px;
        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 */
    .content {
        margin-left: 0;
        width: 100%;
        padding: 16px 16px 24px;
        padding-top: 62px;
    }

    /* Typography */
    h1 { font-size: 1.25rem; margin-bottom: 16px; }
    h2 { font-size: 1rem; margin: 20px 0 10px; }

    /* Cards */
    .card-container { grid-template-columns: 1fr; }

    /* Tables - envelopper dans .table-scroll via JS ou manuellement */
    table {
        font-size: 0.8rem;
        min-width: 540px;
    }
    th, td { padding: 9px 10px; }
    /* Wrapper auto pour toutes les tables dans .content */
    .content > table,
    .content > div > table,
    .content > section > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

    /* Store */
    .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; }

    /* Layout grids */
    .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 */
    .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; }

    /* Économie */
    .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 / EMS navs */
    .lspd-nav, .ems-nav { gap: 6px; }
    .lspd-nav a, .ems-nav a { padding: 7px 10px; font-size: 0.78rem; }

    /* Dispatch */
    .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; }

    /* Modals */
    .modal { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr !important; }

    /* Panel box info-lines */
    .info-line { flex-direction: column; align-items: flex-start; gap: 4px; }

    /* Chat */
    .chat-container { padding: 14px; }
    .message { gap: 8px; }
    .avatar-container img { width: 32px; height: 32px; }

    /* Live indicator */
    .live-indicator { top: auto; bottom: 14px; right: 14px; }

    /* Tableaux d'économie */
    .eco-grid { gap: 10px; }

    /* Players grid / gang grid */
    .card-grid-2 { grid-template-columns: 1fr !important; }
}

/* ─── 480px (petit mobile) ─── */
@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; }

    .lspd-nav a span, .ems-nav a span { display: none; }

    .btn-create { font-size: 0.8rem; padding: 8px 14px; }

    /* Cacher colonnes moins importantes sur mobile */
    table th:nth-child(n+5),
    table td:nth-child(n+5) { display: none; }

    .modal { max-width: 100%; border-radius: 12px; }
}

