/* 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 { 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;
}
.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: 28px; height: 28px;
  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); }
.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 */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: var(--bw) solid var(--border);
  background: var(--surface);
}
.input {
  height: 26px; padding: 0 var(--sp-2); min-width: 0;
  border: var(--bw) solid var(--border-strong); border-radius: var(--r-2);
  background: var(--surface);
}
.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; }

/* 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[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.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));
}

/* 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: 24px; 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 {
  height: 26px; 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;
}
.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: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); }
.pop .input { height: 28px; }
.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 { height: 28px; 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; 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 { align-items: center; }
.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 { display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.side-form .input { height: 28px; }
.side-note { margin: 0; font-size: var(--fs-xs); }
.side-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0; }
.panel-section .side-actions { padding: var(--sp-3); }
.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; }

@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 { width: auto; height: 45%; border-left: 0; border-top: var(--bw) solid var(--border); }
  .sheets { grid-template-columns: 1fr; }
  .clock span, .user .name { display: none; }
}
