/* ==========================================================================
   Les Routiers Virtuels — feuille de style
   ========================================================================== */
:root {
  --bg: #0B0F17;
  --bg-2: #080B11;
  --panel: #111827;
  --panel-2: #161F31;
  --line: #222C40;
  --text: #E6EAF2;
  --muted: #9AA4B8;
  --orange: #FF7A1A;
  --orange-2: #FF9A4D;
  --cyan: #22D3EE;
  --violet: #A855F7;
  --green: #4ADE80;
  --red: #F87171;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  --display: 'Barlow Condensed', Inter, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255,122,26,.10), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(34,211,238,.07), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--orange-2); }
a:hover { color: #FFB880; }
h1, h2, h3 { margin: 0; }
.icon { flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--orange); color: #111; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- Coque ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 6px 8px 22px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.brand-mark {
  font-family: var(--display); font-style: italic; font-weight: 800; font-size: 34px; line-height: 1;
  padding: 6px 10px; border-radius: 10px; color: #111;
  background: linear-gradient(135deg, var(--orange-2), var(--orange));
  box-shadow: 0 6px 24px rgba(255,122,26,.35);
}
.brand-name { font-family: var(--display); font-style: italic; font-weight: 800; text-transform: uppercase; font-size: 17px; line-height: 1.05; letter-spacing: .02em; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  color: #C5CCDA; text-decoration: none; font-weight: 500; border: 1px solid transparent;
}
.nav a:hover { background: var(--panel); color: #fff; }
.nav a.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(90deg, rgba(255,122,26,.28), rgba(255,122,26,.08));
  border-color: rgba(255,122,26,.55);
}
.nav a.active .icon { color: var(--orange-2); }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 12px 8px 0; border-top: 1px solid var(--line); }
.sidebar-foot p { margin: 0; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 28px; min-height: 150px;
  border-bottom: 1px solid rgba(255,122,26,.35); position: relative; z-index: 10;
  background:
    linear-gradient(90deg, rgba(8,11,17,.92) 0%, rgba(8,11,17,.55) 38%, rgba(8,11,17,0) 60%),
    linear-gradient(0deg, rgba(8,11,17,.55), rgba(8,11,17,0) 45%),
    url('/assets/img/banniere.jpg') right 30% center / cover no-repeat,
    var(--bg-2);
  box-shadow: 0 10px 40px -20px rgba(255,122,26,.5);
}
.topbar-title h1, .topbar-title p { text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.topbar-actions { align-self: flex-start; }
.topbar .icon-btn, .topbar .user-chip { background: rgba(8,11,17,.7); backdrop-filter: blur(6px); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 44px; line-height: 1.05; text-transform: uppercase; letter-spacing: .01em; }
.topbar-title p { margin: 4px 0 0; color: #E6EAF2; font-size: 15px; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta small { color: var(--orange-2); font-size: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: #3A4660; }
.menu-btn, .nav-toggle, .nav-backdrop { display: none; }

.content { padding: 24px 28px 48px; max-width: 1680px; width: 100%; }

/* ---------- Boutons, tags ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: linear-gradient(135deg, var(--orange-2), var(--orange)); color: #140A02; }
.btn-primary:hover { color: #140A02; filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: #34405A; }
.btn-ghost:hover { color: #fff; border-color: #56627D; }
.btn-block { width: 100%; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.tag.game-ets2 { background: rgba(34,211,238,.14); color: #67E8F9; }
.tag.game-ats { background: rgba(168,85,247,.18); color: #D8B4FE; }
.tag-nouveau { background: var(--orange); color: #140A02; }
.tag-info { background: rgba(34,211,238,.14); color: #67E8F9; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--panel); }
.flash-success { border-color: rgba(74,222,128,.5); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi {
  --c: var(--orange);
  position: relative; display: flex; align-items: center; gap: 16px; padding: 38px 22px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, var(--panel)), var(--panel) 60%);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 10px 40px -18px var(--c);
}
.kpi-orange { --c: var(--orange); } .kpi-cyan { --c: var(--cyan); } .kpi-violet { --c: var(--violet); } .kpi-green { --c: var(--green); }
.kpi-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.kpi > div { min-width: 0; }
.kpi h2 { font-size: 13px; font-weight: 600; color: #C5CCDA; }
.kpi-value { margin: 2px 0 0; white-space: nowrap; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 2.1vw, 38px); line-height: 1; color: #fff; }
.kpi-value small { font-size: 18px; color: var(--muted); font-weight: 600; }
.kpi .trend, .kpi .live { position: absolute; top: 14px; right: 14px; }
.trend { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.trend.up { color: var(--green); background: rgba(74,222,128,.12); }
.trend.up::before { content: '▲ '; font-size: 9px; }
.trend.down { color: var(--red); background: rgba(248,113,113,.12); }
.trend.down::before { content: '▼ '; font-size: 9px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 2s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

/* ---------- Grille & cartes ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; grid-auto-flow: dense; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; }
.row-2 { grid-row: span 2; }
.card { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: .01em; }
.card-head h2 .icon { color: var(--orange-2); }
.more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; text-decoration: none; }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.segmented a { padding: 6px 14px; min-height: 32px; display: inline-flex; align-items: center; border-radius: 8px; font-size: 13px; font-weight: 600; color: #C5CCDA; text-decoration: none; }
.segmented a.on { background: var(--orange); color: #140A02; }
.mb { margin-bottom: 16px; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #1F2940; stroke-width: 1; }
.chart .axis { fill: #8E99AE; font: 500 11px var(--font); }
.chart .tip-text { fill: #fff; font: 700 12px var(--font); }
.chart .bar-value { fill: #A5F3FC; font: 700 12px var(--font); }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut { max-width: 190px; }
.donut-value { fill: #fff; font: 700 38px var(--display); }
.donut-label { fill: var(--muted); font: 500 13px var(--font); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.gauge { width: 64px; height: 64px; flex: none; }
.gauge-text { fill: #fff; font: 700 14px var(--font); }

/* ---------- Convois ---------- */
.convoy-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.convoy { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.convoy-badge { flex: none; width: 54px; height: 54px; border-radius: 10px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 17px; }
.convoy-badge.game-ets2 { background: linear-gradient(135deg, #0E7490, #164E63); color: #CFFAFE; }
.convoy-badge.game-ats { background: linear-gradient(135deg, #7E22CE, #4C1D95); color: #F3E8FF; }
.convoy-body { min-width: 0; }
.convoy h3 { font-size: 15px; }
.route { margin: 2px 0; display: flex; align-items: center; gap: 6px; color: #C5CCDA; font-size: 13px; flex-wrap: wrap; }
.route.big { font-family: var(--display); font-weight: 700; font-size: 24px; color: #fff; }
.meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.mods-on { color: var(--orange-2); }
.empty { color: var(--muted); }

.convoy-grid, .server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; margin-bottom: 32px; }
.convoy-card { display: flex; flex-direction: column; gap: 10px; }
.convoy-card form { margin-top: auto; }
.convoy-top { margin: -20px -20px 4px; padding: 20px; border-radius: var(--radius) var(--radius) 0 0; }
.convoy-top.game-ets2 { background: linear-gradient(135deg, rgba(34,211,238,.18), transparent); }
.convoy-top.game-ats { background: linear-gradient(135deg, rgba(168,85,247,.22), transparent); }
.meta-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; color: #C5CCDA; font-size: 14px; }
.meta-list li { display: flex; align-items: center; gap: 8px; }
.section-title { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 4px 0 14px; text-transform: uppercase; }

/* ---------- Serveurs ---------- */
.server-mini { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.server-mini li { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.server-mini h3 { font-size: 14px; }
.server-mini p { margin: 2px 0 0; font-size: 12px; color: #C5CCDA; }
.mods-line { color: var(--orange-2) !important; display: flex; align-items: center; gap: 4px; }
.server-card { display: flex; flex-direction: column; gap: 10px; }
.server-card .btn { margin-top: auto; }
.server-head { display: flex; justify-content: space-between; gap: 12px; }
.server-head h2 { font-family: var(--display); font-weight: 700; font-size: 24px; margin-top: 6px; }
.server-head p { margin: 2px 0 0; display: flex; align-items: center; gap: 4px; font-size: 13px; }
.server-card > p { margin: 0; }
.server-status { display: flex; align-items: center; gap: 8px; color: #C5CCDA; }
.small-title { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--orange-2); margin-top: 4px; }
.mod-order { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.mod-order li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); font-size: 13px; }
.mod-order .order { width: 22px; height: 22px; border-radius: 6px; background: #1E293B; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.mod-order .mod-name { flex: 1; min-width: 0; }
.lead { max-width: 820px; color: #C5CCDA; margin: 0 0 22px; font-size: 16px; }
.note { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- Classement ---------- */
.ranking { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: end; }
.podium { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.podium li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); text-align: center; font-size: 13px; }
.podium li strong { font-size: 14px; word-break: break-word; }
.podium .p1 { padding-top: 26px; border-color: rgba(250,204,21,.6); background: linear-gradient(180deg, rgba(250,204,21,.16), var(--bg-2)); }
.podium .p1 span:last-child { color: #FDE68A; font-weight: 700; }
.medal { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #111; background: #CBD5E1; }
.p1 .medal { background: #FACC15; } .p3 .medal { background: #FB923C; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); font-size: 14px; }
.rank-list .pos { width: 24px; height: 24px; border-radius: 6px; background: #1E293B; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.rank-list .name { flex: 1; min-width: 0; }
.rank-list .km { color: #C5CCDA; font-variant-numeric: tabular-nums; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; color: #140A02; background: linear-gradient(135deg, var(--orange-2), var(--orange)); flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; vertical-align: middle; margin-right: 6px; }
.avatar.lg { width: 52px; height: 52px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 40px; }

/* ---------- Stats & actus ---------- */
.stats { margin: 0; display: grid; gap: 4px; }
.stats > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stats > div:last-child { border-bottom: 0; }
.stats dt { display: flex; align-items: center; gap: 8px; color: #C5CCDA; }
.stats dt .icon { color: var(--cyan); }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dd.accent { color: var(--orange-2); font-size: 18px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stats-grid > div { flex-direction: column; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.stats-grid dd { font-family: var(--display); font-size: 30px; }
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.news li { padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.news h3 { font-size: 15px; margin: 6px 0 2px; }
.news p { margin: 0; color: #C5CCDA; font-size: 13px; }
.news time { font-size: 12px; color: var(--muted); }
.empty-cta { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty-cta p { margin: 0; color: #C5CCDA; }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.profile-card h2 { font-family: var(--display); font-size: 30px; }
.profile-card p { margin: 0; }

/* ---------- Tableaux ---------- */
.table-card { padding: 0; overflow: hidden; margin-bottom: 24px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-2); }
.table tbody th { font-weight: 600; }
.table tr:last-child th, .table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.me { background: rgba(255,122,26,.10); }
.table code { color: #A5B4CB; font-size: 12px; }
.pos { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #1E293B; font-weight: 700; }
.pos-1 { background: #FACC15; color: #111; } .pos-2 { background: #CBD5E1; color: #111; } .pos-3 { background: #FB923C; color: #111; }

/* ---------- Formulaires ---------- */
.auth { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; padding: 28px; }
.auth-card h2 { font-family: var(--display); font-size: 30px; text-transform: uppercase; margin-bottom: 8px; }
.auth-card label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.auth-card input:not([type=radio]) { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #34405A; background: var(--bg-2); color: var(--text); font: inherit; }
.auth-card input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px rgba(255,122,26,.25); }
.auth-card .btn { margin-top: 14px; }
.auth-card fieldset { border: 0; padding: 0; margin: 6px 0 0; }
.auth-card legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid #34405A; cursor: pointer; margin: 0 !important; font-weight: 500 !important; }
.form-error { margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.5); color: #FECACA; list-style: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .span-3 { grid-column: span 6; } .span-5, .span-4 { grid-column: span 6; } .span-6 { grid-column: span 12; }
  .row-2 { grid-row: auto; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; min-height: 120px;
    background:
      linear-gradient(90deg, rgba(8,11,17,.75), rgba(8,11,17,.2)),
      url('/assets/img/banniere.jpg') 68% center / cover no-repeat, var(--bg-2); }
  .topbar-actions { align-self: center; }
  .topbar-title h1 { font-size: 24px; }
  .topbar-title p, .user-meta { display: none; }
  .content { padding: 16px; }
  .span-3, .span-4, .span-5, .span-6, .span-8 { grid-column: span 12; }
  .server-mini { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .topbar-actions .btn-ghost { display: none; }
}
