:root {
  color-scheme: dark;
  --bg: #04111d;
  --panel: #0b2942;
  --panel-2: #0d314e;
  --line: rgba(189, 213, 231, .16);
  --text: #f4f8fb;
  --muted: #a5b8c8;
  --amber: #f4b223;
  --amber-soft: #ffd166;
  --mint: #72e0bb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 86% -8%, rgba(45, 121, 174, .25), transparent 32rem),
    linear-gradient(155deg, #081d30, var(--bg) 70%);
}

.screen { height: 100svh; min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: clamp(12px, 1.55vw, 26px); }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 58px; height: 58px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; color: #071727; background: var(--amber); font-size: 19px; font-weight: 950; letter-spacing: -.07em; box-shadow: 0 10px 28px rgba(244,178,35,.18); }
.brand p { margin: 0 0 4px; color: var(--amber-soft); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 850; }
h1 { margin: 0; font-size: clamp(26px, 3.35vw, 42px); line-height: .95; letter-spacing: -.045em; }
.live { display: flex; align-items: center; gap: 18px; }
.sync { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(114,224,187,.1); }
.sync.busy i { animation: pulse 1s infinite; }
.sync.error i { background: #ff8f81; box-shadow: 0 0 0 5px rgba(255,143,129,.1); }
.clock { min-width: 100px; text-align: right; }
.clock strong { display: block; font-size: 27px; line-height: 1; letter-spacing: -.04em; }
.clock span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: capitalize; }

.board { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(310px, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, .64fr); gap: 12px; padding: 14px 0 10px; }
.sector { min-height: 0; display: grid; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(16,52,81,.94), rgba(7,28,46,.9)); box-shadow: 0 16px 42px rgba(0,0,0,.22); }
.sector.val-d-or { grid-row: 1 / span 2; }
.sector-head { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.035); }
.sector-name { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.sector-name h2 { margin: 0; font-size: clamp(20px, 2.2vw, 28px); letter-spacing: -.03em; }
.sector-name span { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.sector-stripe { width: 48px; height: 5px; flex: 0 0 auto; border-radius: 999px; background: var(--amber); }
.rows { min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); align-content: stretch; gap: 5px; padding: 7px; }
.sector.val-d-or .rows { grid-template-columns: repeat(2, minmax(0,1fr)); }
.rows-column { min-height: 0; display: flex; flex-direction: column; gap: 5px; }
.rows-column .row { flex: 1 1 0; }
.row { min-width: 0; min-height: 0; display: grid; grid-template-columns: 51px minmax(0,1fr) 64px; align-items: center; gap: 8px; padding: 3px 7px; border: 1px solid rgba(255,255,255,.045); border-radius: 10px; background: rgba(255,255,255,.035); }
.route { min-width: 0; padding: 5px 3px; overflow: hidden; border-radius: 7px; color: var(--amber-soft); background: rgba(244,178,35,.11); text-align: center; text-overflow: ellipsis; font-size: clamp(11px, 1.35vw, 16px); font-weight: 950; }
.driver { min-width: 0; }
.driver strong { display: block; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; font-size: clamp(11px, 1.43vw, 16px); line-height: 1.08; }
.driver small { display: block; margin-top: 2px; overflow: hidden; color: var(--amber-soft); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.vehicle { min-width: 0; padding: 5px 4px; overflow: hidden; border-radius: 7px; color: #9af0d3; background: rgba(80,218,171,.12); text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(10px, 1.15vw, 13px); font-weight: 900; }
.row.unassigned .driver strong { color: var(--muted); font-style: italic; font-weight: 600; }
.row.unassigned .vehicle { color: #ffb5ab; background: rgba(255,127,111,.12); }
.message-card { grid-column: 1 / -1; display: grid; place-content: center; gap: 8px; min-height: 40vh; text-align: center; color: var(--muted); }
.message-card strong { color: var(--text); font-size: 24px; }
footer { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.78); } }

/* Format cible : écran mural 1080 × 1920 en mode portrait. */
@media (orientation: portrait) and (min-height: 1300px) {
  .board { grid-template-columns: minmax(0, 1.78fr) minmax(300px, .92fr); }
  .row { grid-template-columns: 47px minmax(0,1fr) 61px; gap: 6px; }
}

@media (max-width: 760px) {
  .sync { display: none; }
  .board { grid-template-columns: minmax(0, 1.75fr) minmax(230px, .9fr); gap: 8px; }
  .row { grid-template-columns: 43px minmax(0,1fr) 53px; gap: 5px; padding-inline: 5px; }
  .sector-head { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; } }
