/* Leitstelle - mise en page et composants (toutes les couleurs viennent de tokens.css) */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/var(--lh) var(--font);
  font-feature-settings: "tnum", "cv11";
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- gabarit ---------- */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
  grid-template-areas: "nav top" "nav main" "nav status";
  height: 100vh;
}
.app.nav-collapsed { grid-template-columns: var(--nav-w-collapsed) 1fr; }

/* ---------- navigation latérale ---------- */
.sidenav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: var(--bw) solid var(--border);
  min-width: 0;
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-2);
  height: var(--topbar-h);
  padding: 0 var(--sp-3);
  border-bottom: var(--bw) solid var(--border);
  white-space: nowrap;
}
.brand-mark { flex: none; width: 24px; height: 24px; display: block; }
.brand-name { font-weight: 600; font-size: var(--fs-md); letter-spacing: .01em; }
.brand-sub { color: var(--text-3); font-size: var(--fs-xs); }
.nav { flex: 1; overflow-y: auto; padding: var(--sp-2) 0; }
.nav-group { margin-bottom: var(--sp-2); }
.nav-title {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); white-space: nowrap;
}
.nav a {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 30px; padding: 0 var(--sp-3);
  color: var(--text-2); text-decoration: none; white-space: nowrap;
  border-left: 2px solid transparent;
  transition: background var(--dur), color var(--dur);
}
/* compteur en direct d'une rubrique (véhicules en service, joueurs connectés) */
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); border: var(--bw) solid var(--border); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; line-height: 16px; text-align: center; }
.nav a[aria-current="page"] .nav-count { background: var(--surface); }
.app.nav-collapsed .nav-count { display: none; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-selected); color: var(--text); border-left-color: var(--accent); font-weight: 500; }
.nav a[aria-disabled="true"] { color: var(--text-3); }
.nav svg, .icon { flex: none; width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-foot { border-top: var(--bw) solid var(--border); }
.nav-foot button {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; height: 32px;
  padding: 0 var(--sp-3); border: 0; background: none; color: var(--text-3); cursor: pointer; white-space: nowrap;
}
.nav-foot button:hover { color: var(--text); background: var(--surface-hover); }
.app.nav-collapsed .nav-title,
.app.nav-collapsed .nav-label,
.app.nav-collapsed .brand-text { display: none; }
.app.nav-collapsed .nav a, .app.nav-collapsed .nav-foot button { justify-content: center; padding: 0; }
.app.nav-collapsed .brand { justify-content: center; padding: 0; }
.app.nav-collapsed .nav-group + .nav-group { border-top: var(--bw) solid var(--border); padding-top: var(--sp-2); }
.app.nav-collapsed .collapse-icon { transform: rotate(180deg); }

/* ---------- barre supérieure ---------- */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4);
  background: var(--surface);
  border-bottom: var(--bw) solid var(--border);
  min-width: 0;
}
.crumbs { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs .path { color: var(--text-3); font-size: var(--fs-sm); }
.crumbs h1 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.topbar .spacer { flex: 1; }
.clock { display: flex; align-items: baseline; gap: var(--sp-2); white-space: nowrap; }
.clock b { font-size: var(--fs-lg); font-weight: 600; }
.clock span { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; }
.tb-sep { width: 1px; height: 20px; background: var(--border); }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--ctl-h); height: var(--ctl-h);
  border: var(--bw) solid var(--border); border-radius: var(--r-2);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.user { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-2); white-space: nowrap; font-size: var(--fs-sm); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: var(--bw) solid var(--border); display: grid; place-items: center; color: var(--text-3); }

/* ---------- barre d'état ---------- */
.statusbar {
  grid-area: status;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-3);
  background: var(--surface-2);
  border-top: var(--bw) solid var(--border);
  font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; overflow: hidden;
}
.statusbar .item { display: flex; align-items: center; gap: var(--sp-1); }
.statusbar .spacer { flex: 1; }

/* ---------- états métier ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-off); flex: none; }
.dot.online { background: var(--st-online); }
.dot.incident { background: var(--st-incident); }
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 18px; padding: 0 6px; border-radius: var(--r-1);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
}
.badge.online { color: var(--st-online); background: var(--st-online-bg); }
.badge.late { color: var(--st-late); background: var(--st-late-bg); }
.badge.early { color: var(--st-early); background: var(--st-early-bg); }
.badge.incident { color: var(--st-incident); background: var(--st-incident-bg); }
.badge.off { color: var(--st-off); background: var(--st-off-bg); }
.badge.foot, .badge.aboard { color: var(--st-off); background: var(--st-off-bg); }
.line-chip {
  display: inline-block; min-width: 32px; padding: 0 5px; height: 18px; line-height: 18px;
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-1);
  text-align: center; font-weight: 600; font-size: var(--fs-sm); background: var(--surface);
}

/* ---------- zone principale ---------- */
.main { grid-area: main; min-width: 0; min-height: 0; overflow: hidden; display: flex; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; }

/* panneau latéral de détail */
.panel {
  width: var(--panel-w); flex: none;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface);
  border-left: var(--bw) solid var(--border);
}
.panel-head {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-3);
  border-bottom: var(--bw) solid var(--border);
  font-weight: 600;
}
.panel-head .count { color: var(--text-3); font-weight: 400; }
.panel-body { flex: 1; min-height: 0; overflow: auto; }
.panel-section { border-top: var(--bw) solid var(--border); }
.panel-section h2 { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); border-bottom: var(--bw) solid var(--border); }

/* barre d'outils (étroite, avec un panneau ouvert : elle passe à la ligne plutôt que d'écraser les champs) */
.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); row-gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: var(--bw) solid var(--border);
  background: var(--surface);
}
.input {
  height: var(--ctl-h); padding: 0 var(--sp-2); min-width: 0;
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  background: var(--surface);
  transition: border-color var(--dur), box-shadow var(--dur);
}
textarea.input { height: auto; padding: var(--sp-2); line-height: 1.45; resize: vertical; }
.input:disabled { color: var(--text-3); background: var(--surface-2); cursor: not-allowed; }
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; cursor: pointer; }
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:disabled) { cursor: not-allowed; opacity: .7; }

/* tableaux denses */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  position: sticky; top: 0; z-index: 1;
  height: var(--row-h); padding: 0 var(--sp-2);
  background: var(--surface-2); color: var(--text-2);
  border-bottom: var(--bw) solid var(--border-strong);
  font-weight: 600; text-align: left; white-space: nowrap; user-select: none;
}
.table th.num { text-align: right; }
.table th[data-sort] { cursor: pointer; }
.table th[data-sort]:hover { color: var(--text); }
.table th .sort { display: inline-block; width: 8px; margin-left: 2px; color: var(--text-3); }
.table th[aria-sort="ascending"] .sort::after { content: "▲"; font-size: 8px; }
.table th[aria-sort="descending"] .sort::after { content: "▼"; font-size: 8px; }
.table td {
  height: var(--row-h); padding: 0 var(--sp-2);
  border-bottom: var(--bw) solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr[aria-selected="true"] td { background: var(--surface-selected); }
.table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.table .empty td { height: auto; padding: var(--sp-4) var(--sp-3); color: var(--text-3); white-space: normal; cursor: default; }
.table .empty:hover td { background: none; }

/* fiche de détail (paires clé / valeur) */
.kv { display: grid; grid-template-columns: 112px 1fr; margin: 0; font-size: var(--fs-sm); }
.kv dt, .kv dd { margin: 0; padding: 5px var(--sp-3); border-bottom: var(--bw) solid var(--border); }
.kv dt { color: var(--text-3); }
.kv dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* carte */
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--map-bg); }
.leaflet-container { font: inherit; background: var(--map-bg); }
.map-legend {
  position: absolute; left: var(--sp-3); bottom: var(--sp-3); z-index: 500;
  background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-2);
  padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-2);
  display: grid; gap: 3px;
}
.map-legend .sw { display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; }
.map-legend .sw.stop { width: 7px; height: 7px; border-radius: 50%; background: var(--map-stop); }
.map-legend .sw.road { background: var(--map-road); box-shadow: 0 0 0 1px var(--map-road-casing); }
.map-legend .sw.rail { background: var(--map-rail); }
.map-legend .sw.veh { width: 9px; height: 9px; border-radius: 50%; background: var(--st-online); }
.map-legend label { margin-top: 3px; }
.leaflet-bar { border: var(--bw) solid var(--border) !important; border-radius: var(--r-2) !important; box-shadow: none !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text-2) !important; border-bottom-color: var(--border) !important; width: 26px !important; height: 26px !important; line-height: 26px !important; }
.leaflet-bar a:hover { background: var(--surface-hover) !important; color: var(--text) !important; }
.leaflet-control-attribution { background: var(--surface) !important; color: var(--text-3) !important; font-size: 10px; border-top-left-radius: var(--r-1); }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-tooltip.tip {
  background: var(--surface); color: var(--text); border: var(--bw) solid var(--border-strong);
  border-radius: var(--r-2); box-shadow: none; font: var(--fs-sm)/1.35 var(--font); padding: 4px 8px;
}
.leaflet-tooltip.tip::before { display: none; }
.veh-marker {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--st-online); border: 2px solid var(--surface);
  display: grid; place-items: center;
}
.veh-marker.off { background: var(--st-off); }
.veh-marker.foot, .veh-marker.aboard { width: 12px; height: 12px; margin: 3px; background: var(--st-off); border-width: 2px; }
.veh-marker.foot::after, .veh-marker.aboard::after { display: none; }
.veh-marker.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.veh-marker::after {
  content: ""; width: 0; height: 0;
  border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 6px solid var(--surface);
  transform: rotate(var(--h, 0deg));
}

/* ligne et n° de train à côté des bus en service (Vue réseau) */
.veh-tag {
  position: absolute; left: 21px; top: 0; display: flex; height: 18px; white-space: nowrap; pointer-events: none;
  font: 600 11px/18px Inter, system-ui, sans-serif; border-radius: 4px; overflow: hidden;
  box-shadow: 0 0 0 1.5px var(--surface), 0 1px 3px rgba(0, 0, 0, .25);
}
.veh-tag .vt-line { padding: 0 5px; background: var(--st-online); color: #fff; }
.veh-tag.ai .vt-line { background: var(--st-off); }
.veh-tag .vt-train { padding: 0 5px; background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }

/* message de vue */
.notice { margin: var(--sp-5); color: var(--text-2); max-width: 560px; }
.notice h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); font-weight: 600; color: var(--text); }

/* ---------- pages tableau ---------- */
.page { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.page-body { flex: 1; min-height: 0; overflow: auto; }
.page-scroll { overflow: auto; background: var(--bg); }
.toolbar .spacer, .panel-head .spacer { flex: 1; }
.count { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; }
select.input { padding-right: var(--sp-5); }
.link { color: var(--accent); text-decoration: none; font-weight: 500; font-size: var(--fs-sm); }
.link:hover { text-decoration: underline; }
.panel-section .table th { top: 0; }
.panel-section .table td { max-width: 140px; }
.panel .table td { max-width: 120px; }
.panel .panel-body { overflow-x: hidden; }

/* ---------- fiches (vue serveur) ---------- */
.sheets {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--sp-3); padding: var(--sp-3); align-items: start;
}
.sheet { background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-2); overflow: hidden; }
.sheet h2 {
  margin: 0; padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); background: var(--surface-2); border-bottom: var(--bw) solid var(--border);
}
.sheet .kv { grid-template-columns: 140px 1fr; }
.sheet .kv dt:last-of-type, .sheet .kv dd:last-of-type { border-bottom: 0; }
.sheet .table tbody tr:last-child td { border-bottom: 0; }

/* ---------- santé du serveur : courbes ---------- */
.sheet.wide { grid-column: 1 / -1; }
.seg { display: inline-flex; border: var(--bw) solid var(--border-strong); border-radius: var(--r-2); overflow: hidden; }
.seg button { height: calc(var(--ctl-h) - 2px); padding: 0 var(--sp-2); border: 0; background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; }
.seg button + button { border-left: var(--bw) solid var(--border-strong); }
.seg button:hover { background: var(--surface-hover); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-selected); color: var(--text); font-weight: 600; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.chart { padding: var(--sp-2) var(--sp-3) var(--sp-1); border-right: var(--bw) solid var(--border); border-bottom: var(--bw) solid var(--border); min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.chart-title { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-value { white-space: nowrap; color: var(--text-3); font-size: var(--fs-xs); }
.chart-value b { color: var(--text); font-size: var(--fs-lg); font-weight: 600; }
.chart-sub { font-size: var(--fs-xs); margin: 1px 0 2px; }
.chart-plot { position: relative; }
.chart-plot svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); font-feature-settings: "tnum"; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 2; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; top: -2px; pointer-events: none; white-space: nowrap;
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  padding: 2px 6px; font-size: var(--fs-xs); color: var(--text);
}
.h-table { max-height: 320px; overflow: auto; }

/* ---------- boutons, connexion, confirmation ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); padding: 0 var(--sp-3);
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.btn .icon { width: 14px; height: 14px; }
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:disabled { color: var(--text-3); background: var(--surface-2); border-color: var(--border); cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.danger { color: var(--st-incident); border-color: var(--st-incident); }
.btn.danger:hover:not(:disabled) { background: var(--st-incident-bg); }
.btn.danger:disabled { color: var(--text-3); border-color: var(--border); }
.confirm .btn.danger { background: var(--st-incident); color: var(--danger-text); }
.user { position: relative; }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000; width: 260px;
  display: grid; gap: var(--sp-2); padding: var(--sp-3);
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
}
.pop label, .cfg label { display: grid; gap: 3px; font-size: var(--fs-sm); color: var(--text-2); }
.form-error { color: var(--st-incident); font-size: var(--fs-sm); min-height: 0; }
.form-error:empty { display: none; }
dialog.confirm {
  width: min(440px, calc(100vw - 32px)); padding: 0;
  background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-3);
}
dialog.confirm::backdrop { background: var(--backdrop); }
dialog.confirm h2 { margin: 0; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-lg); font-weight: 600; border-bottom: var(--bw) solid var(--border); }
.confirm-body { padding: var(--sp-2) var(--sp-4); color: var(--text-2); }
.confirm-body p, .confirm-body ul { margin: var(--sp-2) 0; }
.confirm-body b { color: var(--text); }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-top: var(--bw) solid var(--border); }

/* ---------- pilotage ---------- */
.ctl-msg { padding: 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.ctl-msg:not(:empty) { padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw) solid var(--border); }
.cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); padding: var(--sp-3); align-items: start; }
.cfg .input { width: 100%; }
.cfg small { font-size: var(--fs-xs); }
.cfg-note, .cfg .form-error, .cfg-actions { grid-column: 1 / -1; }
.cfg-note { font-size: var(--fs-sm); }
.cfg-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }

/* ---------- carte sans plan ---------- */
.no-plan {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 600;
  width: min(420px, calc(100% - 32px)); padding: var(--sp-4);
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  color: var(--text-2);
}
.no-plan h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.no-plan p { margin: 0 0 var(--sp-3); }
.cfg-plan { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }

.cfg-live { grid-column: 1 / -1; font-size: var(--fs-sm); }
.cfg-live:empty { display: none; }
.cfg-actions .spacer { flex: 1; }

/* ---------- écran d'accès (connexion, mot de passe) ---------- */
.gate { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: var(--sp-4); background: var(--bg); overflow: auto; }
.gate.over { background: var(--backdrop); }
.gate-card {
  display: grid; grid-template-columns: 300px 380px; width: min(680px, 100%);
  background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-3); overflow: hidden;
}
.gate-side {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-5); background: var(--surface-2); border-right: var(--bw) solid var(--border);
}
.gate-logo { width: 40px; height: 40px; margin-bottom: var(--sp-3); }
.gate-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.gate-sub { color: var(--text-2); font-size: var(--fs-sm); }
.gate-points { list-style: none; margin: var(--sp-5) 0 0; padding: 0; display: grid; gap: var(--sp-3); }
.gate-points li { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); }
.gate-points .icon { color: var(--accent); }
.gate-server { margin-top: auto; padding-top: var(--sp-5); color: var(--text-3); font-size: var(--fs-xs); font-feature-settings: "tnum"; }
.gate-main { padding: var(--sp-5); }
.gate-form { display: grid; gap: var(--sp-3); }
.gate-form h1 { margin: 0; font-size: 18px; font-weight: 600; }
.gate-lead { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.gate-note { margin: 0; padding: var(--sp-2) var(--sp-3); background: var(--st-late-bg); color: var(--text); border-left: 2px solid var(--st-late); font-size: var(--fs-sm); }
.gate-field { display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.gate-input { position: relative; display: block; }
.gate-input > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.gate-input .input { width: 100%; height: 36px; padding-left: 34px; font-size: var(--fs-md); }
.gate-input .input[type="password"], .gate-input .input[name="current"], .gate-input .input[name="new"], .gate-input .input[name="again"], .gate-input .input[name="password"] { padding-right: 36px; }
.gate-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: var(--r-2); background: none; color: var(--text-3); cursor: pointer; }
.gate-eye:hover { color: var(--text); background: var(--surface-hover); }
.gate-caps { margin: -4px 0 0; color: var(--st-late); font-size: var(--fs-xs); }
.gate-remember { font-size: var(--fs-sm); }
.gate-submit { height: 36px; font-size: var(--fs-md); }
.gate-foot { margin: 0; font-size: var(--fs-xs); line-height: 1.5; }
.gate-rules { margin: 0; padding-left: 18px; font-size: var(--fs-xs); }
.gate-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.gate-theme { position: fixed; top: var(--sp-3); right: var(--sp-3); }
.gate.over .gate-theme { display: none; }
@media (max-width: 720px) {
  .gate-card { grid-template-columns: 1fr; width: min(420px, 100%); }
  .gate-side { border-right: 0; border-bottom: var(--bw) solid var(--border); padding: var(--sp-4); }
  .gate-points, .gate-server { display: none; }
  .gate-main { padding: var(--sp-4); }
}
.field-err { color: var(--st-incident); font-size: var(--fs-xs); min-height: 0; }
.field-err:empty { display: none; }
.app[hidden] { display: none !important; }

/* ---------- menu utilisateur ---------- */
.user-btn { display: flex; align-items: center; gap: var(--sp-2); height: 30px; padding: 0 var(--sp-2); border: var(--bw) solid transparent; border-radius: var(--r-2); background: none; color: var(--text); cursor: pointer; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-hover); border-color: var(--border); }
.user-btn .avatar { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.role-chip { font-size: var(--fs-xs); color: var(--text-2); border: var(--bw) solid var(--border-strong); border-radius: var(--r-1); padding: 0 5px; line-height: 16px; }
.pop.menu { width: 240px; padding: var(--sp-1) 0; gap: 0; }
.menu-head { display: grid; padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw) solid var(--border); font-size: var(--fs-sm); }
.menu-item { text-align: left; height: 30px; padding: 0 var(--sp-3); border: 0; background: none; color: var(--text); cursor: pointer; font-size: var(--fs-sm); }
.menu-item:hover { background: var(--surface-hover); }
.toast { position: fixed; right: var(--sp-4); bottom: calc(var(--statusbar-h) + var(--sp-3)); z-index: 3000; max-width: 360px; padding: var(--sp-2) var(--sp-3); background: var(--text); color: var(--surface); border-radius: var(--r-2); font-size: var(--fs-sm); }

/* ---------- comptes ---------- */
.side-form { display: grid; gap: var(--sp-3); padding: var(--sp-3); }
.side-form label, .pop label, .cfg label {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 4px;
  font-size: var(--fs-sm); color: var(--text-2);
}
.side-form label > :is(.input, select, textarea, small, div, .field-err),
.pop label > :is(.input, select, textarea, small, div, .field-err),
.cfg label > :is(.input, select, textarea, small, div, .field-err) { flex: 1 0 100%; }
.side-form label.check, .pop label.check, .cfg label.check { display: inline-flex; flex-wrap: nowrap; align-items: center; color: var(--text); align-self: center; }
.side-note { margin: 0; font-size: var(--fs-xs); }
.side-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0; }
.side-actions.wrap { flex-wrap: wrap; justify-content: flex-start; }
.reveal { margin: var(--sp-3); padding: var(--sp-3); border: var(--bw) solid var(--st-late); background: var(--st-late-bg); border-radius: var(--r-2); font-size: var(--fs-sm); color: var(--text); }
.reveal p { margin: var(--sp-1) 0; }
.reveal-pw { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0; }
.reveal-pw code { flex: 1; font: 600 var(--fs-lg)/1.3 var(--font-mono); letter-spacing: .04em; padding: 4px 6px; background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-1); user-select: all; }

.table tr.static { cursor: default; }
.side-actions .spacer { flex: 1; }

/* ---------- services : courses ---------- */
.panel.panel-wide { width: var(--panel-w-wide); }
/* panneau à largeur réglable : une poignée sur son bord gauche */
.panel.panel-sized { position: relative; }
.panel-resizer { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.panel-resizer:hover, .panel-resizer:focus-visible, body.panel-resizing .panel-resizer { background: var(--accent); opacity: .5; outline: none; }
body.panel-resizing { cursor: col-resize; user-select: none; }
body.panel-resizing #map { pointer-events: none; }
.trips-wrap { max-height: 300px; overflow: auto; }
.table.trips td { max-width: 230px; }
.table.trips .trip-from { color: var(--text-2); }
.table.trips td.tight { color: var(--st-late); font-weight: 600; }
.panel-section h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---------- fenêtre modale ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-3);
}
dialog.modal:not([open]) { display: none; }
dialog.modal.wide { width: min(720px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--backdrop); }
.modal-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: var(--bw) solid var(--border); }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.modal-sub { display: flex; align-items: center; gap: var(--sp-2); margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.modal-body { flex: 1; min-height: 0; overflow: auto; padding: var(--sp-3) var(--sp-4); }
.modal-foot { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-top: var(--bw) solid var(--border); }
.modal-foot .spacer { flex: 1; }
.modal-note { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); }
.modal-table { margin-top: var(--sp-3); border: var(--bw) solid var(--border); border-radius: var(--r-2); }

/* progression d'un arrêt ou d'un démarrage du serveur */
.prog-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.prog-head .spacer { flex: 1; }
.prog-pct { font-size: var(--fs-lg); }
.prog-bar { height: 8px; margin: var(--sp-2) 0; border-radius: var(--r-3); background: var(--surface-2); border: var(--bw) solid var(--border); overflow: hidden; }
.prog-bar > span { display: block; height: 100%; background: var(--st-late); transition: width 900ms linear; }
.prog-bar.online > span { background: var(--st-online); }
.prog-bar.off > span { background: var(--st-off); }
.prog-bar.incident > span { background: var(--st-incident); }
.prog-meta { font-size: var(--fs-sm); }
.prog-ready { margin: var(--sp-3) 0 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-2); color: var(--st-online); background: var(--st-online-bg); font-weight: 600; }
.prog-steps { list-style: none; margin: var(--sp-3) 0 0; padding: 0; border-top: var(--bw) solid var(--border); }
.prog-steps li { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--row-h); border-bottom: var(--bw) solid var(--border); font-size: var(--fs-md); }
.prog-label { flex: 1; min-width: 0; }
.prog-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-strong); }
.prog-steps li.done .prog-dot { background: var(--st-online); border-color: var(--st-online); }
.prog-steps li.current .prog-dot { border-color: var(--st-late); animation: prog-pulse 1.2s ease-in-out infinite; }
.prog-steps li.current .prog-label { font-weight: 600; }
.prog-steps li.failed .prog-dot { background: var(--st-incident); border-color: var(--st-incident); }
.prog-steps li.todo { color: var(--text-3); }
@keyframes prog-pulse { 50% { background: var(--st-late); } }
@media (prefers-reduced-motion: reduce) { .prog-bar > span { transition: none; } .prog-steps li.current .prog-dot { animation: none; background: var(--st-late); } }
.kv.kv-inline { grid-template-columns: repeat(3, auto 1fr); border: var(--bw) solid var(--border); border-radius: var(--r-2); }
.kv.kv-inline dt, .kv.kv-inline dd { border-bottom: 0; }
.table.mission td:nth-child(2) { white-space: normal; }
.table.mission tr.end td { font-weight: 600; }
.est { color: var(--text-2); font-style: italic; }
.trips .table tbody tr, .table.trips tbody tr { cursor: pointer; }
.trips-hint { padding: var(--sp-2) var(--sp-3) 0; font-size: var(--fs-xs); }

/* ---------- journal et joueurs ---------- */
.cat-chip { display: inline-block; padding: 1px 6px; border-radius: var(--r-1); font-size: var(--fs-xs); font-weight: 500; background: var(--surface-2); color: var(--text-2); border: var(--bw) solid var(--border); white-space: nowrap; }
.cat-chip.cat-joueur { color: var(--st-online); border-color: var(--st-online); }
.cat-chip.cat-serveur { color: var(--text); }
.cat-chip.cat-leitstelle, .cat-chip.cat-connexion { color: var(--accent); border-color: var(--accent); }
.cat-chip.cat-admin { color: var(--st-late); border-color: var(--st-late); }
.fresh { color: var(--accent); font-weight: 600; }
.table.journal { table-layout: fixed; }
.table.journal th:nth-child(1) { width: 150px; }
.table.journal th:nth-child(2) { width: 130px; }
.table.journal th:nth-child(3) { width: 160px; }
.table.journal td { max-width: none; }
.table.act { table-layout: fixed; }
.table.act td:first-child { width: 112px; }
.panel-section .table.act td { max-width: none; }
.kv.kv-wrap dd { white-space: normal; overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.cc { display: inline-block; min-width: 22px; padding: 0 3px; border: var(--bw) solid var(--border); border-radius: var(--r-1); font-size: 10px; font-weight: 600; text-align: center; color: var(--text-2); }
.page-foot { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); border-top: var(--bw) solid var(--border); }
.table td .dot { display: inline-block; vertical-align: middle; }
.toolbar .input[type="search"] { min-width: 220px; flex: 0 1 auto; }
.toolbar select.input { min-width: 120px; }
/* ---------- menu contextuel ---------- */
.ctx-menu {
  position: fixed; z-index: 1000; min-width: 200px; max-width: 320px; padding: var(--sp-1) 0;
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.ctx-menu button {
  display: block; width: 100%; padding: 6px var(--sp-3); border: 0; background: none; color: var(--text);
  font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctx-menu button:hover:not([disabled]), .ctx-menu button:focus-visible { background: var(--surface-hover); outline: none; }
.ctx-menu button[disabled] { color: var(--text-3); cursor: default; }
.ctx-menu button.danger { color: var(--st-incident); }
.ctx-sep { height: 0; margin: var(--sp-1) 0; border-top: var(--bw) solid var(--border); }
.table.has-menu tbody tr:focus { outline: none; }
.period-in { display: inline-flex; align-items: center; gap: var(--sp-1); }
.period-in[hidden] { display: none; }

/* ---------- modération ---------- */
.cat-chip.cat-moderation { color: var(--st-incident); border-color: var(--st-incident); }
.mod-form { padding: 0; }
.mod-form label.check { display: flex; align-items: center; gap: 6px; color: var(--text); }
.mod-form .modal-note { margin-top: var(--sp-1); }
.mod-banned { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.panel-section .side-actions { padding: var(--sp-2) var(--sp-3); }

/* ---------- tracé du joueur choisi ---------- */
.map-legend .sw.route { width: 18px; height: 4px; border-radius: 2px; background: var(--accent); }
.map-legend .sw.trail { width: 18px; height: 0; border-top: 3px dashed var(--st-online); background: none; }
.map-legend .sw.dev { width: 18px; height: 5px; border-radius: 3px; background: var(--map-deviation); }
/* déviations : le vert du tracé, la barre du tracé en cours, ses points */
:root { --map-deviation: #1f9d4c; }
:root[data-theme="dark"] { --map-deviation: #4fd17f; }
.dev-bar {
  position: absolute; top: var(--sp-3); left: 50%; transform: translateX(-50%); z-index: 600;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); max-width: calc(100% - 120px);
  background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-2);
  padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.dev-bar-h { font-size: var(--fs-xs); flex-basis: 100%; order: 2; }
.dev-drawing, .dev-drawing .leaflet-interactive { cursor: crosshair !important; }
.dev-vertex { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--map-deviation); box-sizing: border-box; cursor: grab; }
.dev-vertex.first { background: #c9f0d7; }
.dev-vertex.last { background: var(--map-deviation); border-color: var(--surface); box-shadow: 0 0 0 2px var(--map-deviation); }
.dev-acts { white-space: nowrap; }
.dev-acts .link + .link { margin-left: var(--sp-2); }
.map-legend .leg-route[hidden] { display: none; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* ---------- monde partagé ---------- */
.world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) 0; }
.sheet > .side-note { padding: var(--sp-2) var(--sp-3) 0; }
.world-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border: var(--bw) solid var(--border); border-radius: var(--r-2); }
.world-tile b { font-size: var(--fs-lg); font-weight: 600; text-align: left; }
.world-tile span { color: var(--text-3); font-size: var(--fs-xs); }
form.world-ctl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }
form.world-ctl > label:not(.check) { min-width: 180px; width: auto; }
form.world-ctl > label.check { min-height: var(--ctl-h); }
form.world-ctl .side-actions { padding: 0; }
form.world-ctl .form-error { flex-basis: 100%; }

/* ---------- mode discret (partage d'écran) ---------- */
html[data-privacy="on"] .sensitive {
  color: transparent !important; user-select: none; border-radius: 2px;
  background: repeating-linear-gradient(135deg, var(--border-strong) 0 3px, var(--surface-2) 3px 6px);
}
html[data-privacy="on"] .sensitive * { visibility: hidden; }
html[data-privacy="on"] .sensitive-input { -webkit-text-security: disc; }
.privacy-pill { padding: 2px 8px; border-radius: var(--r-2); font-size: var(--fs-xs); font-weight: 600; color: var(--accent-text); background: var(--accent); white-space: nowrap; }
.privacy-pill[hidden] { display: none; }
#privacy-toggle[aria-pressed="true"] { color: var(--accent); }

/* ---------- avertissement avant une zone sensible ---------- */
/* (la zone principale range ses enfants en ligne : l'avertissement en prend toute la largeur) */
.zone-gate { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; height: 100%; padding: var(--sp-5); overflow: auto; }
.zone-card {
  width: min(640px, 100%); padding: var(--sp-5); display: grid; gap: var(--sp-3);
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-top: 4px solid var(--st-late); border-radius: var(--r-3);
}
.zone-icon .icon { width: 40px; height: 40px; color: var(--st-late); stroke-width: 1.6; }
.zone-card h2 { margin: 0; font-size: 22px; font-weight: 700; }
.zone-sub { margin: -6px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.zone-card ul { margin: 0; padding-left: 20px; display: grid; gap: var(--sp-2); color: var(--text-2); line-height: 1.5; }
.zone-card ul b { color: var(--text); }
.zone-ok { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-2); background: var(--st-online-bg); color: var(--st-online); font-size: var(--fs-sm); }
.zone-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); }
.zone-actions .spacer { flex: 1; }

/* ---------- communication (Discord) ---------- */
.dc-area { height: auto; min-height: 120px; padding: var(--sp-2); resize: vertical; font: inherit; line-height: 1.45; }
.dc-rules { font-family: var(--font-mono); font-size: var(--fs-sm); min-height: 420px; }
.dc-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); align-items: start; }
.dc-label { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 4px; }
.dc-preview { padding: var(--sp-3); background: #313338; border-radius: var(--r-2); color: #dbdee1; max-height: 520px; overflow: auto; }
.dc-embed { border-left: 4px solid var(--c); background: #2b2d31; border-radius: 4px; padding: 10px 14px; font-size: 14px; line-height: 1.4; }
.dc-title { font-weight: 700; color: #f2f3f5; margin-bottom: 6px; }
.dc-text code, .dc-text pre { background: #1e1f22; border-radius: 3px; padding: 0 3px; font-family: var(--font-mono); font-size: 12px; }
.dc-text pre { padding: 6px; white-space: pre-wrap; }
.dc-text a { color: #00a8fc; }
.dc-text .dq { display: inline-block; border-left: 3px solid #4e5058; padding-left: 8px; }
.dc-foot { margin-top: 8px; font-size: 12px; color: #b5bac1; }
.dc-mention { margin-bottom: 6px; color: #c9cdfb; background: rgba(88,101,242,.3); display: inline-block; padding: 0 3px; border-radius: 3px; }
.dc-status { padding: 0; font-size: var(--fs-sm); }
.dc-steps { margin: 0; padding: 0 var(--sp-3) var(--sp-3) calc(var(--sp-3) + 16px); display: grid; gap: var(--sp-2); line-height: 1.5; color: var(--text-2); }
.dc-steps b { color: var(--text); }
@media (max-width: 900px) { .dc-split { grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  .kv.kv-inline { grid-template-columns: auto 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: var(--nav-w-collapsed) 1fr; }
  .app .nav-title, .app .nav-label, .app .brand-text { display: none; }
  .app .nav a { justify-content: center; padding: 0; }
  .view { flex-direction: column; }
  .panel, .panel.panel-wide, .panel.panel-sized { width: auto !important; height: 45%; border-left: 0; border-top: var(--bw) solid var(--border); }
  .panel-resizer { display: none; }
  .sheets { grid-template-columns: 1fr; }
  .clock span, .user .name { display: none; }
}

/* ---------- avance / retard ---------- */
.delay { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.delay.ok { color: var(--st-online); }
.delay.early { color: var(--st-early); }
.delay.late { color: var(--st-late); }
.delay.late2 { color: var(--st-incident); }

/* ---------- bus sans conducteur (vue réseau) ---------- */
.veh-marker.ai, .veh-marker.parked { width: 13px; height: 13px; margin: 2.5px; border-radius: 3px; border-width: 1.5px; }
.veh-marker.ai { background: var(--st-off); opacity: .9; }
.veh-marker.parked { background: var(--surface); border-color: var(--st-late); }
.veh-marker.ai::after { border-left-width: 2.5px; border-right-width: 2.5px; border-bottom-width: 5px; }
.veh-marker.parked::after { border-left-width: 2.5px; border-right-width: 2.5px; border-bottom: 5px solid var(--st-late); }
.map-legend .sw.ai, .map-legend .sw.parked { width: 9px; height: 9px; border-radius: 2px; }
.map-legend .sw.ai { background: var(--st-off); }
.map-legend .sw.parked { background: var(--surface); box-shadow: inset 0 0 0 2px var(--st-late); }

/* ---------- messages aux conducteurs ---------- */
.msg-pick { display: grid; gap: 4px; max-height: 180px; overflow: auto; padding: var(--sp-2); border: var(--bw) solid var(--border); border-radius: var(--r-2); }
.side-form .msg-area { height: auto; min-height: 64px; }

/* ---------- véhicules autorisés : arbre ---------- */
.parc-opts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw) solid var(--border); font-size: var(--fs-sm); }
.parc-opts .spacer { flex: 1; }
.parc-title { font-weight: 600; color: var(--text); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { padding: var(--sp-1) 0; }
.tree ul { padding-left: 22px; }
.tree-row { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 var(--sp-3); cursor: pointer; }
.tree-row:hover { background: var(--surface-hover); }
.tree-row.current { background: var(--surface-selected); box-shadow: inset 2px 0 0 var(--accent); }
.tree-row .tw { width: 12px; flex: none; color: var(--text-3); }
.tree-row .tw::before { content: "▸"; display: inline-block; transition: transform .1s; }
[aria-expanded=true] > .tree-row .tw::before { transform: rotate(90deg); }
.tree-row .tw.none::before { content: ""; }
.tree-box { accent-color: var(--accent); margin: 0; flex: none; }
.t-brand > .tree-row .t-name { font-weight: 600; }
.t-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tree-row .count { margin-left: auto; }
.tree-row .count + .badge, .t-sub + .badge { margin-left: var(--sp-2); }
.t-leaf .tree-row .t-sub { flex: 1; }
.tree-empty { padding: var(--sp-4); }

/* ---------- actions d'une ligne : bouton « ⋯ » (le même menu que le clic droit) ---------- */
.table th.col-act, .table td.col-act { width: 36px; max-width: 36px; padding: 0 4px; text-align: center; }
.row-act {
  width: 24px; height: 22px; padding: 0; border: var(--bw) solid transparent; border-radius: var(--r-2);
  background: none; color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer; opacity: .55;
}
.table tbody tr:hover .row-act, .table tbody tr[aria-selected="true"] .row-act, .row-act:focus-visible, .row-act[aria-expanded="true"] { opacity: 1; color: var(--text); }
.row-act:hover { background: var(--surface); border-color: var(--border-strong); }

/* ---------- état « hors ligne » au même format que « en ligne » ---------- */
.badge.offline { color: var(--st-off); background: var(--st-off-bg); }

/* ---------- largeur des colonnes ---------- */
.col-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resize::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 3px; width: 2px; border-radius: 1px; background: var(--border-strong); opacity: 0; transition: opacity var(--dur); }
.table th:hover .col-resize::after { opacity: 1; }
.col-resize:hover::after, .table.resizing .col-resize:hover::after { background: var(--accent); opacity: 1; }
.table.sized { table-layout: fixed; }
.table.sized td { max-width: none; }
.table.resizing, .table.resizing * { cursor: col-resize !important; user-select: none; }

/* ---------- fiche du bus choisi (carte) ---------- */
.leaflet-popup.bus-card-pop { margin-bottom: 14px; }
.leaflet-popup.bus-card-pop .leaflet-popup-content-wrapper {
  padding: 0; background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-3); box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.leaflet-popup.bus-card-pop .leaflet-popup-content { margin: 0; font: var(--fs-sm)/1.4 var(--font); }
.leaflet-popup.bus-card-pop .leaflet-popup-tip { background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.leaflet-popup.bus-card-pop a.leaflet-popup-close-button { top: 6px; right: 6px; width: 20px; height: 20px; color: var(--text-3); font: 18px/20px var(--font); }
.leaflet-popup.bus-card-pop a.leaflet-popup-close-button:hover { color: var(--text); }
.bus-card { padding: var(--sp-2) var(--sp-3) var(--sp-2); }
.bc-head { display: flex; align-items: center; gap: var(--sp-2); padding-right: 22px; }
.bc-name { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-dest { margin-top: 2px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px var(--sp-3); margin: var(--sp-2) 0 0; padding-top: var(--sp-2); border-top: var(--bw) solid var(--border); }
.bc-kv dt { color: var(--text-3); }
.bc-kv dd { margin: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: var(--bw) solid var(--border); }
/* (des icônes : fiche, service, appel, message ; les actions à droite) */
.bc-actions { align-items: center; gap: var(--sp-2); }
.bc-actions .spacer { flex: 1; }
.bc-actions .icon-btn { width: 30px; height: 30px; color: var(--accent); text-decoration: none; }
.bc-actions .icon-btn .icon { width: 17px; height: 17px; }

/* ---------- statut du serveur (Discord) ---------- */
.st-dots { display: inline-flex; gap: 2px; }
.st-dots i { width: 8px; height: 8px; border-radius: 50%; background: #2b2d31; box-shadow: inset 0 0 0 1px var(--border-strong); }
.st-dots i.online { background: #2e9e5b; box-shadow: none; }
.st-dots i.late { background: #e0a030; box-shadow: none; }
.st-dots i.incident { background: #d64545; box-shadow: none; }
.st-now { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3); font-size: var(--fs-sm); }
.st-hold { margin: 0; padding: var(--sp-2) var(--sp-3); border-top: var(--bw) solid var(--border); background: var(--st-late-bg); font-size: var(--fs-sm); }
.st-kind { display: flex; }
.st-kind button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.st-until { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.st-until label { flex: 1; min-width: 130px; }
.st-until .field-err { flex-basis: 100%; }
.st-auto-on { grid-column: 1 / -1; font-weight: 500; }
.dc-msg { color: #dbdee1; font-size: 15px; line-height: 1.375; }
.dc-msg .dc-h1 { font-size: 24px; font-weight: 700; line-height: 1.3; color: #f2f3f5; margin: 4px 0; }
.dc-msg .dc-small { font-size: 12px; color: #949ba4; }
.dc-msg .dc-gap { height: 8px; }
.dc-msg b { color: #f2f3f5; }

/* ---------- Phonie SAE ---------- */
.phonie .ph-body { padding: 0; background: var(--bg); }
.ph-section { background: var(--surface); border-bottom: var(--bw) solid var(--border); }
.ph-section h2 { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); border-bottom: var(--bw) solid var(--border); }
.ph-section h2 .count { margin-left: var(--sp-1); text-transform: none; letter-spacing: 0; }
.ph-hint { margin: 0; padding: var(--sp-2) var(--sp-3) 0; font-size: var(--fs-sm); }
.ph-empty { margin: 0; padding: var(--sp-4) var(--sp-3); font-size: var(--fs-sm); }
.ph-list { list-style: none; margin: 0; padding: 0; }
.ph-list li { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; padding: var(--sp-1) var(--sp-3); border-bottom: var(--bw) solid var(--border); }
.ph-list li:last-child { border-bottom: 0; }
.ph-list .check { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.ph-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ph-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-who small { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-req.pending { background: var(--st-late-bg); box-shadow: inset 3px 0 0 var(--st-late); }
.ph-req .ph-icon { display: inline-flex; color: var(--st-late); }
.ph-req.taken .ph-icon { color: var(--text-3); }
.ph-req.pending .ph-icon .icon { animation: ph-ring 1.2s ease-in-out infinite; }
@keyframes ph-ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
.ph-since { color: var(--text-2); font-size: var(--fs-sm); min-width: 64px; text-align: right; }
.ph-actions { display: flex; gap: var(--sp-1); }
.ph-bus.picked { background: var(--surface-selected); }
.ph-settings { padding: 0 0 var(--sp-3); }
.ph-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.ph-row > span { flex: 1; }
.ph-row input[type="range"] { width: 160px; accent-color: var(--accent); }
.ph-call { padding: var(--sp-3); display: grid; gap: var(--sp-2); }
.ph-call-type { font-size: var(--fs-lg); font-weight: 700; padding-left: var(--sp-2); border-left: 4px solid currentColor; }
.ph-call-who { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.ph-call-who span { padding: 2px var(--sp-2); background: var(--surface-2); border: var(--bw) solid var(--border); border-radius: var(--r-2); font-size: var(--fs-sm); }
.radio-state { display: inline-flex; align-items: center; }
.rd-individual { color: #3b82f6; }
.rd-selective { color: var(--st-late); }
.rd-general { color: var(--st-incident); }
.rd-talk { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.rd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); flex: none; }
.rd-talk.on .rd-dot { background: var(--st-online); box-shadow: 0 0 0 3px var(--st-online-bg); animation: rd-pulse 1s ease-in-out infinite; }
@keyframes rd-pulse { 50% { opacity: .45; } }

/* la barre radio, sur toutes les pages */
.radio-dock {
  position: fixed; right: var(--sp-4); bottom: calc(var(--statusbar-h) + var(--sp-3)); z-index: 2500;
  width: 300px; display: grid; gap: var(--sp-2); padding: var(--sp-3);
  background: var(--surface); border: var(--bw) solid var(--border-strong); border-radius: var(--r-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); font-size: var(--fs-sm);
}
.radio-dock[hidden] { display: none; }
.radio-dock.alert { border-color: var(--st-late); padding: 0; }
.rd-head { display: flex; align-items: center; gap: var(--sp-2); }
.rd-type { font-weight: 700; font-size: var(--fs-md); padding-left: var(--sp-2); border-left: 4px solid currentColor; }
.rd-time { margin-left: auto; color: var(--text-3); }
.rd-who { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-err { color: var(--st-incident); font-size: var(--fs-xs); }
.rd-actions { display: flex; gap: var(--sp-2); }
.rd-ptt { flex: 1; justify-content: center; height: 36px; font-weight: 600; user-select: none; touch-action: none; }
.rd-ptt kbd { margin-left: var(--sp-1); padding: 0 4px; border: var(--bw) solid var(--border-strong); border-radius: var(--r-1); font: inherit; font-size: var(--fs-xs); color: var(--text-3); }
.rd-ptt.on { background: var(--st-incident); border-color: var(--st-incident); color: var(--danger-text); }
.rd-ptt.on kbd { color: inherit; border-color: currentColor; }
.rd-actions .btn.danger { height: 36px; }
.rd-req { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); color: var(--st-late); text-decoration: none; background: var(--st-late-bg); border-radius: var(--r-3); }
.rd-req span { color: var(--text); }
.rd-req .icon { animation: ph-ring 1.2s ease-in-out infinite; }
body:has(.radio-dock:not([hidden])) .toast { bottom: calc(var(--statusbar-h) + var(--sp-3) + 170px); }
@media (prefers-reduced-motion: reduce) { .ph-req .icon, .rd-req .icon, .rd-talk.on .rd-dot { animation: none; } }
@media (max-width: 720px) { .radio-dock { left: var(--sp-4); width: auto; } .ph-actions { flex-wrap: wrap; } }
.cat-chip.cat-phonie { color: var(--accent); border-color: var(--accent); }
.ph-bus.afoot .ph-who { opacity: .6; }
.ph-bus.afoot .check { cursor: default; }

/* Phonie : plusieurs postes, « Secours phonie » */
.ph-callrow .ph-call-type { font-size: var(--fs-sm); flex: none; width: 118px; }
.ph-callrow .rd-talk { flex: none; max-width: 40%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ph-callrow.mine { background: var(--surface-selected); box-shadow: inset 3px 0 0 var(--accent); }
.ph-row small { display: block; font-size: var(--fs-xs); margin-top: 2px; }
.rd-monitor { display: flex; align-items: center; gap: var(--sp-2); padding-top: var(--sp-1); color: var(--text-2); border-top: var(--bw) solid var(--border); }
.radio-dock .rd-actions + .rd-monitor, .radio-dock .rd-req + .rd-monitor { margin-top: var(--sp-1); }
.radio-dock.alert .rd-monitor { margin: 0 var(--sp-3) var(--sp-2); }

/* ---------- horaires : éditeur (lignes, trajets) ---------- */
.tt-ed { display: flex; flex-direction: column; min-height: 0; }
.tt-pick { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); }
.tt-tours { padding: var(--sp-2) var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.tt-tour { border: var(--bw) solid var(--border); border-radius: var(--r-2); background: var(--surface); }
.tt-tour-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-2) var(--sp-3); }
.tt-tour.open .tt-tour-head { border-bottom: var(--bw) solid var(--border); }
.tt-tour-head label { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--text-2); font-size: var(--fs-sm); }
.tt-num { width: 110px; } .tt-grp { width: 220px; }
.tt-days { display: inline-flex; flex-wrap: wrap; gap: 2px var(--sp-2); }
.tw-btn { width: 22px; height: 22px; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.tw-btn::before { content: '▸'; } .tt-tour.open .tw-btn::before { content: '▾'; }
.tt-grid .input { height: 26px; }
.tt-time { width: 84px; font-variant-numeric: tabular-nums; } .tt-trip { width: 260px; }
.tt-scroll { overflow: auto; max-height: calc(100vh - 220px); }
.tt-prof-grid th.tt-prof { min-width: 230px; vertical-align: top; }
.tt-prof-head { display: flex; align-items: center; gap: var(--sp-1); margin-bottom: 4px; font-weight: 400; }
.tt-prof-head .input { min-width: 0; }
.tt-total { width: 70px; }
.tt-cell { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.tt-cell.set { font-weight: 600; }
.tt-cell::placeholder { color: var(--text-3); }
.tt-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.tt-diff summary { cursor: pointer; padding: 2px var(--sp-3); }
.tt-diff p { padding: 0 var(--sp-3); margin: 2px 0 var(--sp-2); }

/* ---------- message de bienvenue : l'aperçu tel que le jeu le montre ---------- */
.wl-preview { background: #181a1f; color: #e2e5ea; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.35); display: flex; flex-direction: column; max-height: 560px; }
.wl-text { padding: 20px 22px; overflow: auto; font-size: 14px; line-height: 1.42; }
.wl-text > :first-child { margin-top: 0; }
.wl-text h1, .wl-text h2, .wl-text h3, .wl-text h4, .wl-text h5, .wl-text h6 { color: #fff; font-weight: 700; margin: 1em 0 .4em; line-height: 1.25;  text-transform: none; letter-spacing: normal; border: 0; padding: 0; background: none; }
.wl-text h1 { font-size: 1.6em; } .wl-text h2 { font-size: 1.35em; } .wl-text h3 { font-size: 1.15em; } .wl-text h4, .wl-text h5, .wl-text h6 { font-size: 1em; }
.wl-text p { margin: 0 0 .7em; }
.wl-text ul, .wl-text ol { margin: 0 0 .7em; padding-left: 1.4em; }
.wl-text li { margin: .15em 0; }
.wl-text li::marker { color: #a5abb6; }
.wl-text em { color: #a5abb6; }
.wl-text code { color: #ecc484; background: rgba(255,255,255,.09); border-radius: 3px; padding: 0 3px; font-family: var(--font-mono); font-size: .95em; }
.wl-text pre { color: #ecc484; background: rgba(255,255,255,.055); padding: 6px 10px; margin: 0 0 .7em; white-space: pre-wrap; font-family: var(--font-mono); font-size: .95em; }
.wl-text blockquote { color: #a5abb6; border-left: 3px solid #e8a030; margin: 0 0 .7em; padding-left: 12px; }
.wl-text hr { border: 0; border-top: 1px solid rgba(255,255,255,.16); margin: .9em 0; }
.wl-text .wl-link { color: #78afff; }
.wl-text .muted { color: #8b919c; }
.wl-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 14px; display: flex; justify-content: center; }
.wl-play { background: #e8a030; color: #18140e; font-weight: 700; border-radius: 7px; padding: 9px 0; width: 160px; text-align: center; }

/* ---------- Phonie : demandes urgentes, appel d'urgence ---------- */
.ph-req.urgent, .ph-callrow.urgent { box-shadow: inset 3px 0 0 var(--st-incident); background: var(--st-incident-bg); }

.wl-text .wl-img { text-align: center; margin: 0 0 .7em; }
.wl-text .wl-img img { max-width: 100%; max-height: 420px; }
.wl-text .wl-img[data-wi] img { cursor: pointer; }
.wl-text .wl-img[data-wi] img:hover { outline: 2px solid #e8a030; outline-offset: 2px; }
.wl-size { display: flex; flex-direction: column; gap: var(--sp-2); }
.wl-size label.check { display: flex; align-items: flex-start; white-space: normal; color: var(--text); }
.wl-size label.check input { margin-top: 3px; }
.wl-size-dims { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); padding-left: 22px; }
.wl-size-dims.off { opacity: .45; pointer-events: none; }
.wl-size-dims label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.wl-size-dims label > span { display: flex; gap: 4px; }
.wl-size-dims input { width: 100%; min-width: 0; }
.wl-size-dims select { width: auto; }
.wl-imgs { margin-top: var(--sp-3); }
.wl-imgs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-2); margin: var(--sp-2) 0; }
.wl-thumb { display: flex; align-items: center; gap: var(--sp-2); border: var(--bw) solid var(--border); border-radius: var(--r-3); padding: var(--sp-1); }
.wl-thumb img { width: 64px; height: 44px; object-fit: contain; background: #181a1f; border-radius: var(--r-2); }
.wl-thumb > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wl-thumb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wl-up-l { cursor: pointer; }

/* ---------- régulation ---------- */
.regul-ops { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-3); }
.regul-op { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2); border: var(--bw) solid var(--border); border-radius: var(--r-3); cursor: pointer; }
.regul-op span { display: flex; flex-direction: column; }
.regul-op:has(input:checked) { border-color: var(--accent, #e8a030); }
.regul-buses { display: flex; flex-direction: column; gap: var(--sp-1); max-height: 280px; overflow: auto; margin-bottom: var(--sp-2); }
.regul-buses label.check { display: flex; align-items: flex-start; white-space: normal; flex-wrap: wrap; column-gap: 6px; }

/* mission en cours d'un joueur dans la liste des missions d'un service */
.table.trips tbody tr.current td { background: var(--st-online-bg); }
.table.trips tbody tr.current td:first-child { box-shadow: inset 3px 0 0 var(--st-online); }

/* ---------- synoptique d'une ligne ---------- */
.syn-pick { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.syn-legend { display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.syn-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: var(--sp-2); }
.syn-legend .sw.ok { background: var(--st-online); }
.syn-legend .sw.early { background: var(--st-early); }
.syn-legend .sw.late { background: var(--st-late); }
.syn-legend .sw.late2 { background: var(--st-incident); }
.syn-body { display: flex; flex-direction: column; overflow: hidden; }
.syn-scroll { display: flex; overflow: auto; flex: 1; min-height: 0; padding: var(--sp-2) 0; }
.syn-off { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); border-top: var(--bw) solid var(--border); }
.syn-off:empty { display: none; }
/* (centré dans les deux sens ; défile s'il déborde) */
.syn { display: block; flex: none; margin: auto; font-family: var(--font); }
.syn-grid { stroke: var(--border); stroke-dasharray: 2 4; }
.syn-name { font-size: 11.5px; fill: var(--text-2); }
.syn-name.end { font-weight: 600; fill: var(--text); }
.syn-dir { font-size: 11.5px; font-weight: 600; fill: var(--text-2); text-anchor: end; }
.syn-track { stroke: var(--text-3); stroke-width: 4; stroke-linecap: round; }
.syn-stop { fill: var(--surface); stroke: var(--text-2); stroke-width: 2; }
.syn-stop.end { stroke: var(--text); stroke-width: 2.5; }
.syn-bus { cursor: pointer; }
.syn-bus .syn-shape { fill: var(--st-off); }
.syn-bus.ok .syn-shape { fill: var(--st-online); }
.syn-bus.early .syn-shape { fill: var(--st-early); }
.syn-bus.late .syn-shape { fill: var(--st-late); }
.syn-bus.late2 .syn-shape { fill: var(--st-incident); }
.syn-bus.moving .syn-shape { opacity: .85; }
.syn-bus text { font-size: 11px; font-weight: 600; fill: #fff; text-anchor: middle; pointer-events: none; }
/* l'écart, hors de l'étiquette, sans signe : sa couleur dit avance ou retard */
.syn-bus text.syn-delay { font-size: 10.5px; fill: var(--st-off); }
.syn-delay-bg { fill: var(--surface); }
.syn-bus text.syn-lv { font-size: 10.5px; font-weight: 600; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.syn-bus.ok text.syn-delay { fill: var(--st-online); }
.syn-bus.early text.syn-delay { fill: var(--st-early); }
.syn-bus.late text.syn-delay { fill: var(--st-late); }
.syn-bus.late2 text.syn-delay { fill: var(--st-incident); }
.syn-bus:hover .syn-shape, .syn-bus:focus-visible .syn-shape { stroke: var(--text); stroke-width: 2; }
.syn-bus:focus { outline: none; }
.syn-bus.ai .syn-shape { opacity: .6; }
.syn-bus .syn-door { fill: var(--text); pointer-events: none; }
.door-ico { width: 1.05em; height: 1.05em; fill: currentColor; vertical-align: -.17em; margin-left: .35em; color: var(--text); }
.door-ico title { pointer-events: auto; }
.syn-bus.ai:hover .syn-shape, .syn-bus.ai:focus-visible .syn-shape { opacity: .85; }
.syn-stem { stroke: var(--text-3); stroke-width: 1.5; }

/* la course d'un bus (synoptique) : arrêts passés estompés, celui où il est ou vers lequel il va */
.table.syn-trip tbody tr.passed td { opacity: .5; }
.table.syn-trip tr.here td { background: var(--st-online-bg); }
.table.syn-trip tr.next td { background: var(--st-early-bg); }
.table.syn-trip tr.here td:first-child { box-shadow: inset 3px 0 0 var(--st-online); }
.table.syn-trip tr.next td:first-child { box-shadow: inset 3px 0 0 var(--st-early); }
.modal-foot .foot-sep { width: var(--bw); align-self: stretch; margin: 0 var(--sp-2); background: var(--border); }

/* motif obligatoire d'un arrêt ou d'un redémarrage du serveur */
.confirm-why { display: flex; flex-direction: column; gap: var(--sp-1); margin-top: var(--sp-3); font-weight: 600; font-size: var(--fs-sm); }
.confirm-why .muted { font-weight: 400; }
.confirm-why textarea { resize: vertical; font-weight: 400; }

/* Phonie : les lignes dont ce poste prend les appels */
.ph-lines { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw) solid var(--border); background: var(--surface-2); }
.ph-lines-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-right: var(--sp-1); }
.ph-lines .ph-line { border: var(--bw) solid var(--border); padding: 2px 8px; background: var(--surface); color: var(--text-2); }
.ph-lines .ph-line.on { border-color: var(--accent); color: var(--text); }

/* véhicules protégés : comptes autorisés ou refusés */
.obx-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }
.obx-chip { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px 4px 2px var(--sp-2); border: var(--bw) solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: var(--fs-sm); }
.obx-x { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.obx-x:hover { color: var(--st-incident); }
.obx-add { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); max-width: 520px; }
.obx-add .input { flex: 1; }
.sheet h2 .badge { margin-left: var(--sp-1); text-transform: none; letter-spacing: 0; }

/* ---------- production (VERBUND) ---------- */
.pr-live { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); margin: var(--sp-3) var(--sp-3) 0; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border: var(--bw) solid var(--border); border-left: 3px solid var(--st-off); border-radius: var(--r-2); }
.pr-live.online { border-left-color: var(--st-online); }
.pr-live.late { border-left-color: var(--st-late); }
.pr-state { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 320px; min-width: 0; }
.pr-state .badge { height: 22px; padding: 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 600; }
.pr-state p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.pr-flow { display: flex; margin: 0; padding: 0; list-style: none; counter-reset: pr; }
.pr-flow li { position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 128px; padding: 0 var(--sp-3) 0 26px; counter-increment: pr; font-size: var(--fs-xs); color: var(--text-3); }
.pr-flow li::before { content: counter(pr); position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: var(--bw) solid var(--border-strong); background: var(--surface); font-weight: 600; }
.pr-flow li + li::after { content: ""; position: absolute; left: -8px; top: 9px; width: 12px; border-top: var(--bw) solid var(--border-strong); }
.pr-flow li b { color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.pr-flow li.done::before { content: "✓"; color: var(--st-online); border-color: var(--st-online); background: var(--st-online-bg); }
.pr-flow li.now::before { color: var(--st-late); border-color: var(--st-late); background: var(--st-late-bg); }
.pr-flow li.done b, .pr-flow li.now b { color: var(--text); }
.pr-kv { margin-top: var(--sp-3); border-top: var(--bw) solid var(--border); }
.pr-ver { font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 5px; border-radius: var(--r-1); background: var(--surface-2); border: var(--bw) solid var(--border); color: var(--text-2); }
.pr-how { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); border-top: var(--bw) solid var(--border); }
.pr-empty { margin: 0; padding: var(--sp-4) var(--sp-3); color: var(--text-3); font-size: var(--fs-sm); }
.pr-scroll { overflow-x: auto; }
.table.pr-table td { height: auto; padding: 6px var(--sp-2); white-space: normal; max-width: none; vertical-align: top; overflow: visible; }
.table.pr-table td .muted { font-size: var(--fs-xs); }
.table.pr-table tbody tr:hover td { background: none; }
.table.pr-table tr.pr-is-live td { background: var(--st-online-bg); }
.table.pr-table tr.pr-is-live td:first-child { box-shadow: inset 3px 0 0 var(--st-online); }
.table.pr-table td.col-act { width: 1%; white-space: nowrap; }
.pr-acts { display: flex; justify-content: flex-end; gap: var(--sp-1); }
.pr-zip { padding: 0 var(--sp-2); color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-xs); text-decoration: none; }
.pr-checks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; max-width: 420px; }
.pr-checks li { position: relative; padding-left: 14px; font-size: var(--fs-xs); line-height: 1.35; }
.pr-checks li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 6px; height: 6px; border-radius: 50%; }
.pr-checks li.err { color: var(--st-incident); }
.pr-checks li.err::before { background: var(--st-incident); }
.pr-checks li.warn { color: var(--st-late); }
.pr-checks li.warn::before { background: var(--st-late); }
.pr-tokens-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw) solid var(--border); }
.pr-tokens-head p { flex: 1; margin: 0; font-size: var(--fs-xs); color: var(--text-3); }
.pr-when { white-space: nowrap; }
.pr-pair { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--sp-3); align-items: start; }
.table.pr-table th.pr-c-note { min-width: 170px; }
.table.pr-table th.pr-c-what { min-width: 110px; }
.table.pr-table th.pr-c-checks { min-width: 200px; }
.pr-live-tag { margin-top: 3px; }
@media (max-width: 1280px) { .pr-acts { flex-direction: column; align-items: stretch; } }

/* annonce voyageurs */
.ann-file { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.ann-audio { width: 100%; }
.ann-results { padding: var(--sp-2); border: var(--bw) solid var(--border); border-radius: var(--r-2); font-size: var(--fs-sm); }
.ann-results ul { margin: 4px 0 0; padding-left: 18px; }
.ann-results li.no { color: var(--st-incident); }

/* ---------- main courante ---------- */
dialog.modal.mc-modal { width: min(980px, calc(100vw - 32px)); }
.mc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); padding: 0; }
.mc-form fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: var(--sp-2) var(--sp-3); margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-3); border: var(--bw) solid var(--border); border-radius: var(--r-2); min-width: 0; }
.mc-form label { min-width: 0; }
.mc-form .input { width: 100%; min-width: 0; box-sizing: border-box; }
.mc-form .modal-note { grid-column: 1 / -1; margin: 0; }
.mc-form fieldset legend { padding: 0 4px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.mc-form .mc-wide, .mc-form .form-error { grid-column: 1 / -1; }
.mc-form textarea { height: auto; min-height: 72px; resize: vertical; }
@media (max-width: 760px) { .mc-form, .mc-form fieldset { grid-template-columns: minmax(0, 1fr); } }
.mc-type { display: inline-block; min-width: 34px; padding: 1px 6px; border-radius: var(--r-1); font-size: var(--fs-xs); font-weight: 700; text-align: center; border: var(--bw) solid currentColor; }
.mc-type.mc-ACC, .mc-type.mc-FSF { color: var(--st-incident); background: var(--st-incident-bg); }
.mc-type.mc-INC, .mc-type.mc-TEC { color: var(--st-late); background: var(--st-late-bg); }
.mc-type.mc-INF { color: var(--accent); }
.mc-text { margin: 0; padding: var(--sp-2) var(--sp-3); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); }
.mc-todo { display: grid; gap: 6px; padding: var(--sp-2) var(--sp-3); }
.mc-todo label.check { white-space: normal; align-items: flex-start; color: var(--text); }
.mc-todo label.check input { margin-top: 2px; }
.mc-checks { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.mc-check { display: flex; align-items: center; gap: var(--sp-2); padding: 3px var(--sp-2); border-radius: var(--r-1); }
.mc-check:hover { background: var(--surface-hover); }
.mc-check label.check { flex: 1; min-width: 0; white-space: normal; color: var(--text); }
.mc-check label.check:has(input:checked) .mc-t { text-decoration: line-through; color: var(--text-2); }
.mc-check .mc-drop { width: 24px; height: 24px; opacity: .6; }
.mc-check .mc-drop:hover { opacity: 1; }
.mc-add { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.mc-add .input { flex: 1; min-width: 0; }
.cat-chip.cat-maincourante { color: var(--st-incident); border-color: var(--st-incident); }
#side-title .badge { margin-left: 6px; }
button.link.danger { color: var(--st-incident); }

/* bus du parc : immatriculation façon plaque, aperçu de l'import */
.plate { display: inline-block; padding: 0 6px; border: var(--bw) solid var(--border-strong, var(--border)); border-radius: var(--r-1); font-family: var(--font-mono, monospace); font-size: var(--fs-sm); letter-spacing: .04em; white-space: nowrap; background: var(--surface); }
.side-form .plate-in { font-family: var(--font-mono, monospace); letter-spacing: .04em; text-transform: uppercase; }
.parc-form label, .parc-form select.input { min-width: 0; max-width: 100%; }
.imp-rows { max-height: 50vh; overflow: auto; border: var(--bw) solid var(--border); border-radius: var(--r-1); }
.cat-chip.cat-parc { color: var(--accent); border-color: var(--accent); }

/* Services : recherche de courses */
.ts-form { background: var(--bg); }
.ts-l { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--text-2); }
.ts-form input[type="time"] { width: auto; }
.ts-out { padding: var(--sp-3); }
.ts-out .side-note { padding: var(--sp-2) 0; }
.ts-table td { vertical-align: middle; }
.ts-head { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-3); }
.ts-choices { margin: 0; padding-left: var(--sp-4); }
.ts-a { background: var(--surface-selected); color: var(--text); }
.ts-b { background: var(--surface-hover); color: var(--text); }
