/* Identité visuelle Notre-Dame de Chrétienté : bleu marial, blanc, touche d'or. */
:root {
  --ndc: #17539f; --ndc-dark: #0d2f5c; --ndc-light: #e8eff8; --gold: #f2c14e;
  --bg: #f3f5f8; --panel: #ffffff; --panel2: #eef2f7; --line: #d5dde7; --text: #14243a; --muted: #5d6b7e;
  --accent: var(--ndc); --red: #c62828; --red-bg: #fdecea; --amber: #9a6700; --ok: #2e7d32;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
button, .btn { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--ndc); border-color: var(--ndc); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--ndc-dark); }
button.danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
button.small { padding: 3px 8px; font-size: 12px; }
.ghost { background: transparent; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
textarea { width: 100%; }
.muted { color: var(--muted); }
.radio-tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--ndc-light); color: var(--ndc); font-size: 12px; font-weight: 600; white-space: nowrap; }
.radio-tag:empty { display: none; }

/* Connexion */
.login { display: grid; place-items: center; min-height: 100%; padding: 16px; background: linear-gradient(180deg, var(--ndc-light), var(--bg) 60%); }
.login form { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--ndc); border-radius: 14px; padding: 28px 24px; display: grid; gap: 14px; box-shadow: 0 10px 30px rgba(13, 47, 92, .12); text-align: center; }
.login .logo { width: 220px; max-width: 70%; margin: 0 auto; }
.login h1 { margin: 0; font: 700 30px/1.1 Cinzel, Georgia, serif; letter-spacing: .08em; color: var(--ndc); }
.login p { margin: 0; color: var(--muted); }
.login .big { padding: 12px; font-size: 16px; }
.login details { text-align: left; color: var(--muted); }
.login details input { width: 100%; margin: 8px 0; }
.err { color: var(--red) !important; }

/* Structure */
.app { display: flex; flex-direction: column; height: 100%; }
.top { display: flex; align-items: center; gap: 16px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand .emblem { width: 38px; height: 38px; }
.brand .appname { font: 700 22px/1 Cinzel, Georgia, serif; letter-spacing: .08em; color: var(--ndc); }
.brand .who { display: flex; flex-direction: column; line-height: 1.2; }
.brand .who small { color: var(--muted); }
.brand a { color: var(--ndc); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.dot.on { background: var(--ok); }
.counters { display: flex; gap: 6px; flex: 1 1 600px; min-width: 0; flex-wrap: wrap; }
.counter { padding: 3px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); border-left-width: 4px; white-space: nowrap; font-size: 13px; }
.counter b { font-size: 15px; margin-right: 4px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Bandeau d'alertes */
.alerts { display: grid; gap: 4px; padding: 6px 12px; background: var(--red-bg); border-bottom: 2px solid var(--red); }
.alerts:empty { display: none; }
.alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-radius: 8px; background: var(--red); color: #fff; }
.alert.unack { animation: pulse 1.2s infinite; }
.alert.acked { background: #8e3b3b; }
.alert.p0 { background: #8b0010; }
.alert .who { font-weight: 800; font-size: 17px; cursor: pointer; text-decoration: underline dotted; }
.alert .what { font-weight: 700; font-size: 15px; }
.alert .meta { opacity: .85; font-size: 13px; }
.alert .grow { flex: 1; }
.alert button { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); color: #fff; }
.alert button.go { background: #fff; color: #8b0010; font-weight: 700; }
.alerts .more { justify-self: start; background: transparent; color: var(--red); border-color: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(229, 56, 59, .45); } }

/* Onglets principaux */
.maintabs { display: flex; align-items: center; gap: 2px; padding: 0 12px; background: var(--ndc); }
.maintabs > button:not(.primary) { border: 0; border-radius: 0; background: transparent; padding: 11px 14px; color: rgba(255,255,255,.75); font-weight: 600; }
.maintabs > button:not(.primary):hover { color: #fff; }
.maintabs > button.on { color: #fff; box-shadow: inset 0 -4px var(--gold); }
.maintabs > button.primary { background: #fff; color: var(--ndc); border-color: #fff; }
.maintabs > button.primary:hover { background: var(--ndc-light); }
.maintabs .spacer { flex: 1; }
.maintabs .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--ndc-dark); font-size: 12px; }
.maintabs .count:empty { display: none; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; gap: 8px; padding: 8px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }

/* Carte */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.columns:empty { display: none; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.col h3 { margin: 0; font-size: 13px; grid-column: 1 / -1; display: flex; justify-content: space-between; }
.col .k { color: var(--muted); font-size: 12px; }
.col .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.col .warn { color: var(--amber); }
.col .bar { grid-column: 1 / -1; height: 6px; background: var(--panel2); border-radius: 3px; position: relative; margin: 3px 0; }
.col .bar span { position: absolute; top: 0; bottom: 0; background: var(--ndc); border-radius: 3px; min-width: 3px; }
.main { display: grid; grid-template-columns: 1fr 360px; flex: 1; min-height: 0; }
.map { min-height: 0; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.filters { padding: 8px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 2px 8px; border-radius: 12px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); }
.chip.on { background: var(--ndc); border-color: var(--ndc); color: #fff; }
.list, .log { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.list li { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover, .list li.sel { background: var(--panel2); }
.list li.stale { opacity: .55; }
.badge { display: inline-block; min-width: 56px; text-align: center; padding: 3px 6px; border-radius: 5px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.list .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alertmark { color: var(--red); font-weight: 700; }
.group-h { padding: 4px 8px; background: var(--panel2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; cursor: default !important; display: block !important; }

/* Tableau des équipes */
.tablewrap { overflow: auto; flex: 1; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { position: sticky; top: 0; background: var(--panel); text-align: left; padding: 7px 8px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:hover td { background: var(--ndc-light); }
table.grid tr.stale td { opacity: .6; }
table.grid td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .acts { white-space: nowrap; text-align: right; }

/* Interventions */
.inters { overflow: auto; flex: 1; padding: 10px 12px; display: grid; gap: 10px; align-content: start; }
.inter { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--c, #555); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.inter.closed { opacity: .6; }
.inter .head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.inter .id { font-weight: 800; font-size: 16px; }
.inter .type { padding: 1px 8px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 12px; background: var(--c, #555); }
.inter .motif { font-weight: 700; font-size: 15px; }
.inter .notes { white-space: pre-wrap; background: var(--panel2); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.inter table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inter td, .inter th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.inter th { color: var(--muted); font-weight: 600; }
.inter .btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inter .step { font-variant-numeric: tabular-nums; color: var(--muted); }
.section-h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Main courante */
.radioform { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--ndc-light); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.radioform #rText { flex: 1; min-width: 240px; }
.radioform #rTeam { width: 160px; }
.log li { padding: 5px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 74px 1fr; gap: 8px; font-size: 13px; cursor: pointer; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.log .k-request { color: var(--red); font-weight: 600; }
.log .k-ack, .log .k-close { color: var(--amber); }
.log .k-order, .log .k-confirm { color: #1565c0; }
.log .k-radio { color: var(--ndc); font-weight: 600; }
.log .k-inter, .log .k-engage { color: #6a1b9a; }
.log .op { color: var(--muted); font-size: 12px; }
.log .k-admin { color: var(--muted); font-style: italic; }

/* Marqueurs */
.tm { position: relative; }
.tm .pin { padding: 2px 6px; border-radius: 6px; font: 700 12px/16px system-ui; border: 2px solid rgba(0, 0, 0, .55); white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); transform: translate(-50%, -50%); position: absolute; left: 0; top: 0; }
.tm.stale .pin { opacity: .45; border-style: dashed; }
.tm.alert .pin { outline: 3px solid var(--red); outline-offset: 2px; animation: ring 1s infinite; }
.tm .pres { position: absolute; left: 0; top: 12px; transform: translateX(-50%); display: flex; gap: 2px; }
.tm .pres span { font: 700 9px/12px system-ui; padding: 0 3px; border-radius: 3px; background: #fff; color: #000; white-space: nowrap; }
@keyframes ring { 50% { outline-color: transparent; } }
.im { position: absolute; transform: translate(-50%, -100%); font: 800 12px/16px system-ui; color: #fff; padding: 2px 6px; border-radius: 6px 6px 6px 0; border: 2px solid #fff; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.pl { font: 700 10px/14px system-ui; color: #fff; padding: 0 3px; border-radius: 3px; transform: translate(-50%, -50%); position: absolute; white-space: nowrap; border: 1px solid rgba(255, 255, 255, .7); }
.pl-romeo { background: #c2185b; } .pl-halte { background: #00897b; } .pl-carrefour { background: #5d4037; }
.pl-bivouac { background: #283593; font-size: 12px; padding: 2px 5px; } .pl-ch { background: #d32f2f; } .pl-point { background: #455a64; opacity: .8; }
.z-low .pl:not(.pl-bivouac):not(.pl-ch) { font-size: 0; line-height: 0; padding: 4px; border-radius: 50%; }
.z-low .tm .pres { display: none; }
.leaflet-popup-content { color: #111; }

/* Fiche équipe */
.drawer { position: fixed; left: 60px; bottom: 16px; width: 380px; max-height: 66vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--ndc); border-radius: 10px; box-shadow: 0 8px 30px rgba(13, 47, 92, .25); z-index: 1000; padding: 12px; display: grid; gap: 10px; }
.drawer h2 { margin: 0; display: flex; justify-content: space-between; align-items: center; font-size: 20px; }
.drawer .st { padding: 8px 10px; border-radius: 8px; font-weight: 700; font-size: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.drawer ul { list-style: none; padding: 0; margin: 0; font-size: 13px; max-height: 220px; overflow: auto; }
.drawer li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.drawer .row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Fenêtres */
.modal { position: fixed; inset: 0; background: rgba(13, 47, 92, .45); display: grid; place-items: center; z-index: 2000; padding: 16px; }
.modal .box { width: min(700px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--ndc); border-radius: 12px; padding: 18px; display: grid; gap: 10px; }
.modal h2 { margin: 0; color: var(--ndc-dark); }
.modal table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modal td, .modal th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.modal label.fam { display: inline-flex; gap: 3px; margin-right: 6px; white-space: nowrap; }
.form { display: grid; grid-template-columns: 150px 1fr; gap: 8px 10px; align-items: center; }
.form > label { color: var(--muted); font-weight: 600; }
.form select, .form input, .form textarea { width: 100%; }
.form .line { display: flex; gap: 6px; align-items: center; }
.form .line > select { flex: 1; }
.reminder { background: var(--ndc-light); border: 1px solid #b9cce6; border-radius: 8px; padding: 8px 10px; color: var(--ndc-dark); }
.pick-hint { position: fixed; left: 50%; top: 120px; transform: translateX(-50%); background: var(--ndc); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 1500; font-weight: 600; }

/* Téléphone (chefs de famille) */
@media (max-width: 900px) {
  html, body { height: auto; }
  .app { height: auto; }
  .top { gap: 6px; padding: 6px 8px; position: sticky; top: 0; z-index: 1100; }
  .brand { font-size: 13px; flex: 1; }
  .brand .appname { font-size: 18px; }
  .brand .emblem { width: 30px; height: 30px; }
  .counters { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .counter { font-size: 12px; padding: 2px 7px; }
  .counter b { font-size: 14px; }
  .actions .btn, #adminBtn { display: none; }
  .maintabs { overflow-x: auto; padding: 0 4px; }
  .maintabs > button:not(.primary) { padding: 10px 9px; white-space: nowrap; }
  .columns { display: flex; overflow-x: auto; padding: 6px 8px; }
  .col { min-width: 250px; font-size: 12px; }
  .main { display: flex; flex-direction: column; }
  .map { height: 55vh; flex: none; }
  .side { border-left: 0; }
  .list, .log { overflow: visible; }
  .drawer { right: 8px; left: 8px; width: auto; bottom: 8px; max-height: 70vh; }
  .form { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 60px 1fr; }
  .log li > b { display: none; }
}

/* Planning */
.pstate { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.ps-alerte { background: var(--red); color: #fff; }
.ps-declenche, .ps-remplace { background: #f07d12; color: #1d1d1f; }
.ps-a_venir { background: var(--ndc-light); color: var(--ndc); }
tr.plan-termine td, tr.plan-annule td { opacity: .55; }
.maintabs .count.alertc { background: var(--red); color: #fff; }
label.check { display: inline-flex; gap: 6px; align-items: center; }

/* ================= Thème sombre (salle de commandement de nuit) ================= */
.dark-only { display: none !important; }
:root[data-theme="dark"] .dark-only { display: inline-block !important; }
:root[data-theme="dark"] .login .dark-only { display: block !important; }
:root[data-theme="dark"] .light-only { display: none !important; }
:root[data-theme="dark"] {
  --ndc: #2f67b3; --ndc-dark: #24569a; --ndc-light: #16294a; --gold: #f2c14e;
  --bg: #0a1424; --panel: #101d32; --panel2: #172846; --line: #253857; --text: #e3eaf5; --muted: #93a4bd;
  --red: #e5484d; --red-bg: #33161a; --amber: #f0b429; --ok: #4caf50;
  color-scheme: dark;
}
:root[data-theme="dark"] .brand .appname,
:root[data-theme="dark"] .brand a,
:root[data-theme="dark"] .radio-tag,
:root[data-theme="dark"] .log .k-radio,
:root[data-theme="dark"] .ps-a_venir { color: #9cc0f2; }
:root[data-theme="dark"] .maintabs { background: #0f2747; }
:root[data-theme="dark"] .maintabs > button.primary { background: #1f4a85; border-color: #3a74c4; color: #fff; }
:root[data-theme="dark"] .maintabs > button.primary:hover { background: #2a5a9e; }
:root[data-theme="dark"] .modal h2 { color: var(--text); }
:root[data-theme="dark"] .reminder { color: #cfe0f8; border-color: #2b4a78; }
:root[data-theme="dark"] .log .k-order, :root[data-theme="dark"] .log .k-confirm { color: #8ab8ff; }
:root[data-theme="dark"] .log .k-inter, :root[data-theme="dark"] .log .k-engage { color: #d7a8ff; }
:root[data-theme="dark"] .log .k-request { color: #ff8a8c; }
:root[data-theme="dark"] .login { background: linear-gradient(180deg, #0f2747, var(--bg) 60%); }
:root[data-theme="dark"] .login h1 { color: #e3eaf5; }
:root[data-theme="dark"] .drawer, :root[data-theme="dark"] .login form, :root[data-theme="dark"] .modal .box { box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
/* Fond de carte assombri ; marqueurs et tracés gardent leurs couleurs */
:root[data-theme="dark"] .ign-gl, :root[data-theme="dark"] .leaflet-tile-pane img[src*="PLANIGNV2"] { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55); }
:root[data-theme="dark"] .leaflet-container { background: #0a1424; }
:root[data-theme="dark"] .leaflet-bar a, :root[data-theme="dark"] .leaflet-control-layers { background: var(--panel); color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(16, 29, 50, .8); color: var(--muted); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #9cc0f2; }

/* Passages de colonne détectés par GPS (bandeau bleu) */
.colevents { display: grid; gap: 4px; padding: 6px 12px; background: var(--ndc-light); border-bottom: 2px solid var(--ndc); }
.colevents:empty { display: none; }
.colevent { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 5px 10px; border-radius: 8px; background: var(--ndc); color: #fff; }
.colevent .what { font-weight: 700; flex: 1; }
.colevent .meta { opacity: .85; font-size: 13px; }
.colevent button { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); color: #fff; padding: 2px 8px; }
.exercise-tag { background: #b00020; color: #fff; font-weight: 800; border-radius: 6px; padding: 3px 8px; font-size: 13px; letter-spacing: .03em; }
:root[data-theme="dark"] .colevents { background: #0f2747; border-bottom-color: #2f67b3; }
:root[data-theme="dark"] .colevent { background: #2f67b3; }
.need-tag { flex: none; min-width: 92px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: var(--chip, rgba(31,111,209,.12)); color: var(--accent, #1f6fd1); text-align: center; }
.need-row select { flex: 1; min-width: 0; }

/* Alertes du serveur (engagement non acquitté, Sur les lieux non reçu) : orange foncé, distinctes des demandes */
.alert.system { background: #a04500; }
.alert.system.p0 { background: #7a2e00; }
.alert button.go.danger { background: #fff; color: var(--red); }

/* Alerte majeure : bandeau sur tous les écrans */
.major-banner { display: grid; gap: 6px; padding: 6px 12px 0; }
.major { background: var(--c, #b71c1c); color: #fff; border-radius: 10px; padding: 10px 14px; display: grid; gap: 4px; box-shadow: 0 0 0 3px rgba(255,255,255,.35) inset; animation: majorpulse 1.4s infinite; }
.major.ended { animation: none; opacity: .85; background: #2e7d32; }
.major .big { font: 800 20px/1.2 system-ui, sans-serif; letter-spacing: .02em; }
.major .instr { font-size: 15px; background: rgba(0,0,0,.18); border-radius: 6px; padding: 6px 8px; }
.major .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.major button { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5); color: #fff; }
.ackbar { width: 160px; height: 8px; background: rgba(255,255,255,.3); border-radius: 4px; overflow: hidden; display: inline-block; }
.ackbar span { display: block; height: 100%; background: #fff; }
@keyframes majorpulse { 50% { box-shadow: 0 0 0 3px rgba(255,255,255,.9) inset; } }
#majorBtn { margin-right: 6px; }
.major-form .mtype { cursor: pointer; padding: 5px 10px; font-size: 13px; }
.major-form .mtype:has(input:checked) { background: var(--red); border-color: var(--red); color: #fff; }
.major-form .mtype input { display: none; }

/* Engagement qui sonne sur le téléphone */
.inter tr.ringing td { background: rgba(240, 125, 18, .12); }

/* Statut saisi par le PC (reçu par radio) */
.radio-status { display: grid; gap: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; }
.st-chip { cursor: pointer; border-left: 6px solid var(--c); }
.st-chip.on { background: var(--c); color: var(--t); border-color: var(--c); }

/* Fiches bilan (confidentiel) */
.confidential { color: var(--red); font-weight: 600; }
.bilans { display: grid; gap: 10px; padding: 10px; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); align-content: start; align-items: start; overflow: auto; }
.bilan { min-width: 0; overflow-wrap: anywhere; align-content: start; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid #ad1457; border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.bilan.done { border-left-color: var(--ok); }
.bilan.closed { opacity: .6; }
.bilan .motif { font-size: 15px; font-weight: 600; }
.bilan .kv { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 2px 10px; font-size: 13px; }
.bilan .kv:empty { display: none; }
.bilan .kv span:nth-child(odd) { color: var(--muted); }
.bilan .regul { background: var(--panel2); color: var(--text); border-left: 4px solid var(--ok); border-radius: 6px; padding: 6px 8px; }
.regform { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.regform input[name=comment] { grid-column: 1 / -1; }
.regform input, .regform select, .regform button { min-width: 0; width: 100%; }

/* États des lieux : point Roméo ouvert (Tango présent) ou fermé ; halte ouverte / fermée (Hotel) */
.pl.pl-closed { background: #6b7280; opacity: .75; border-style: dashed; }
.pl.pl-open { box-shadow: 0 0 0 3px #22a447; }
.pl.pl-open::after { content: " ●"; color: #7dff9a; }

/* Missions du planning (comme des inters à venir, à la couleur de leur type) */
.inter.mission { border-style: dashed; opacity: .92; }
.inter.mission .head { gap: 8px; }
.inter.mission.malert { border-color: var(--red); border-style: solid; }
.mission-type { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 700; color: #fff; background: var(--c); border-radius: 8px; padding: 0 6px; }

/* Menu ⚙ (administration et outils) */
.menu { position: relative; }
.menupop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1600; min-width: 280px; display: grid; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(13, 47, 92, .25); }
.menupop .btn, .menupop button { text-align: left; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; }
.menupop .btn:hover, .menupop button:hover, .menupop .btn:focus-visible, .menupop button:focus-visible { background: var(--panel2); outline: none; }

/* Bandeau de fin d'alerte : croix pour le retirer */
.major .big { display: flex; align-items: center; gap: 10px; }
.major .big .x { margin-left: auto; font-size: 14px; padding: 2px 9px; }

/* Mode mur d'écran : carte plein écran, alertes par-dessus, colonnes en bas, gros caractères, sans boutons */
body.wall { font-size: 17px; }
body.wall .top .actions, body.wall #mainTabs, body.wall .side, body.wall .leaflet-control-container .leaflet-top { display: none !important; }
body.wall .top { padding: 4px 12px; }
body.wall .brand .appname { font-size: 26px; }
body.wall .counter { font-size: 16px; } body.wall .counter b { font-size: 20px; }
body.wall #view-map { display: flex !important; flex-direction: column-reverse; }
body.wall .main { grid-template-columns: 1fr; }
body.wall .columns { border-top: 1px solid var(--line); border-bottom: 0; }
body.wall .col h3 { font-size: 17px; }
body.wall .alerts, body.wall .major-banner, body.wall .colevents { position: fixed; left: 12px; right: 12px; z-index: 1300; }
body.wall .major-banner { top: 64px; }
body.wall .alerts { top: 64px; background: transparent; border: 0; padding: 0; }
body.wall .major-banner:not([hidden]) ~ .alerts { top: 230px; }
body.wall .alert button, body.wall .major button { display: none; }
body.wall .alert { font-size: 19px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
body.wall .colevents { bottom: 150px; top: auto; }
body.wall .tm .pin { font-size: 15px; line-height: 20px; }
.wall-exit { position: fixed; right: 12px; bottom: 12px; z-index: 1400; opacity: .55; }
.wall-exit:hover { opacity: 1; }

/* Marqueurs par famille : bord gauche à la couleur de la famille ; chef = carré ; regroupements aux petits zooms */
.tm .pin { border-left: 5px solid var(--fc, rgba(0, 0, 0, .55)); }
.tm.chief .pin { border-radius: 0; border-width: 3px; border-left-width: 6px; }
.cl { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border-radius: 16px;
  background: var(--panel); color: var(--text); border: 2px solid var(--fc); font: 700 13px/18px system-ui; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); cursor: pointer; }
.cl b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--fc); color: #fff; font-size: 12px; }
.cl i { font-style: normal; font-size: 11px; background: #f07d12; color: #1d1d1f; border-radius: 8px; padding: 0 5px; }

/* Planning en frise */
.tl { position: relative; min-width: 760px; padding-bottom: 6px; }
.tl-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; min-height: 26px; border-bottom: 1px solid var(--line); }
.tl-axis { position: sticky; top: 0; z-index: 2; background: var(--panel2); min-height: 24px; }
.tl-label { padding: 0 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 26px; }
.tl-axis .tl-track span { position: absolute; top: 4px; transform: translateX(-50%); font: 600 11px system-ui; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.tl-bar { position: absolute; top: 4px; height: 18px; border-radius: 4px; font: 700 11px/18px system-ui; padding: 0 4px; overflow: hidden; white-space: nowrap; color: #fff; cursor: default; }
.tl-bar.slot { background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.tl-bar.slot.st-a_venir { opacity: .75; }
.tl-bar.slot.st-termine, .tl-bar.slot.st-annule { opacity: .35; }
.tl-bar.slot.st-alerte { background: repeating-linear-gradient(45deg, var(--red) 0 6px, #8b0010 6px 12px); }
.tl-bar.slot.late { outline: 2px solid var(--red); outline-offset: 1px; }
.tl-bar.act { background: #8a8f98; color: #fff; top: 7px; height: 12px; line-height: 12px; font-size: 9px; }
.tl-bar.act.free { background: #c9ccd1; color: #1d1d1f; }
.tl-pass { position: absolute; top: 3px; transform: translateX(-50%); font-size: 15px; text-shadow: 0 0 2px #000; z-index: 1; }
.tl-now { position: absolute; top: 0; bottom: 0; left: calc(210px + (100% - 210px) * var(--now) / 100); border-left: 2px solid var(--red); pointer-events: none; z-index: 3; }
.tl-legend { padding: 6px 10px; font-size: 12px; }
/* Petits zooms : les inters se réduisent à leur numéro, les noms des lieux disparaissent */
.z-low .im span { display: none; }
.z-low .im { padding: 1px 5px; font-size: 11px; }
.z-low .pl-point, .z-low .pl-carrefour { display: none; }
.data-update { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--amber); color: #fff; font-weight: 600; }
.data-update .btn { background: #fff; color: var(--amber); border: 0; }

/* ---------- 0.9 : bivouacs, fiches bilan détaillées ---------- */
.bv { position: absolute; transform: translate(-50%, -50%); min-width: 20px; height: 20px; padding: 0 3px; border-radius: 10px; display: grid; place-items: center;
  font: 700 11px/1 system-ui; color: #fff; background: var(--c, #455a64); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); white-space: nowrap; }
.bv.bv-rassemblement { background: #2e9d4a; height: 24px; min-width: 24px; font-size: 13px; }
.bv.open { background: #2e7d32; } .bv.closed { background: #c62828; } .bv.unknown { background: #78909c; }
.z-low .bv:not(.bv-rassemblement) { display: none; }
.bivouacs { display: grid; gap: 12px; padding: 12px; overflow: auto; }
.biv { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid #283593; border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.biv .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.biv .head .grow { flex: 1; }
.biv .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.biv h4 { margin: 0 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.biv .door, .biv .sector { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 4px 6px; border-radius: 6px; background: var(--panel2); margin-bottom: 4px; }
.biv .door .muted, .biv .sector .muted { grid-column: 1; font-size: 12px; }
.biv .door button { grid-row: 1 / span 2; grid-column: 2; }
.biv .door.open { border-left: 4px solid #2e7d32; } .biv .door.closed { border-left: 4px solid #c62828; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.bilan details summary { cursor: pointer; color: var(--accent, #17539f); font-size: 13px; }
.bilan .bsec { margin-top: 6px; }
.bilan .bsec > b { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bilan .vital { font-size: 13px; font-weight: 600; }
.bilan .transport { background: #e0f2f1; color: #00695c; border-radius: 6px; padding: 4px 8px; font-size: 13px; }
[data-theme=dark] .bilan .transport { background: #12332f; color: #80cbc4; }
.regform .row2 { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.regform .row2 button { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel); }
.seg button.on { background: var(--accent); color: #fff; }
.biv.halte { border-left-color: #00897b; }

/* Radio : saisie rapide des messages à la main courante */
.radio-desk { display: grid; grid-template-columns: minmax(380px, 560px) 1fr; flex: 1; min-height: 0; }
.rd-entry { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-right: 1px solid var(--line); overflow: auto; background: var(--panel); }
.rd-team { display: flex; gap: 8px; align-items: center; }
.rd-team input { flex: 1; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.rd-team input::placeholder { text-transform: none; font-weight: 400; font-size: 14px; letter-spacing: 0; }
.rd-info { min-height: 20px; color: var(--muted); }
.rd-info b { color: var(--text); }
.rd-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rd-chips:empty { display: none; }
.rd-dir { align-self: flex-start; }
.rd-dir button { padding: 8px 14px; font-weight: 600; }
.rd-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.rd-quick button { padding: 3px 9px; border-radius: 14px; font-size: 13px; }
.rd-entry textarea#rdText { font-size: 16px; min-height: 84px; resize: vertical; border-width: 2px; }
.rd-entry textarea#rdText:focus { border-color: var(--ndc); outline: none; }
.rd-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rd-row label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.rd-row .grow { flex: 1; }
.rd-row #rdSend { padding: 9px 18px; font-size: 15px; }
.rd-msg { min-height: 20px; }
#rdStatusBox { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
#rdStatuses button { padding: 4px 10px; }
.rd-sms { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }
.rd-sms summary { cursor: pointer; font-weight: 600; }
.rd-sms textarea { margin: 6px 0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rd-log { display: flex; flex-direction: column; min-height: 0; }
.rd-log .log { flex: 1; overflow: auto; margin: 0; padding: 0; list-style: none; }
.ok-msg { color: var(--ok); font-weight: 600; }
@media (max-width: 900px) {
  .radio-desk { grid-template-columns: 1fr; overflow: auto; }
  .rd-entry { border-right: 0; border-bottom: 1px solid var(--line); }
  .rd-log .log { overflow: visible; }
}

/* Maintenance (PC Admin) */
.maint { display: grid; gap: 12px; padding: 12px; overflow: auto; max-width: 1100px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.mcard h3 { margin: 0 0 8px; font-size: 16px; }
.mcard p { margin: 6px 0; }
.mcard .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.mcard ol { margin: 8px 0; padding-left: 22px; display: grid; gap: 6px; }
.mcard ul { margin: 6px 0; padding-left: 20px; }
.danger-zone { border: 2px solid var(--red); background: var(--red-bg); }
.danger-zone h3 { color: var(--red); }
.danger-box { border-top: 6px solid var(--red) !important; }
.danger-box h2 { color: var(--red); margin-top: 0; }
:root[data-theme="dark"] .danger-zone { background: rgba(229, 57, 53, .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .danger-zone { background: rgba(229, 57, 53, .12); } }

/* Entraînement */
.train-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; background: #6a1b9a; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.train-login { display: grid; gap: 10px; text-align: left; border: 2px solid #6a1b9a; border-radius: 10px; padding: 12px; }
.train-login .train-head { font-weight: 700; color: #6a1b9a; text-align: center; }
.train-login input { width: 100%; }
.train-group { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.train-group small { color: var(--muted); }
.train-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.train { display: grid; gap: 12px; padding: 12px; overflow: auto; max-width: 1200px; }
.tr-form { display: grid; gap: 10px; margin: 10px 0; }
.tr-form > label { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tr-inject { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-inject button.flash { background: var(--ok); color: #fff; border-color: var(--ok); }
.tr-journal { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; }
.tr-journal li { display: grid; grid-template-columns: 64px 120px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tr-journal .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.tr-journal .sim { color: #6a1b9a; }
.tr-demo { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.tr-qr { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 6px; }
.tr-demo > div { flex: 1; min-width: 260px; }
