/* Layout: side panel (desktop/tablette) ou feuille basse (smartphone) + carte plein écran.
   Palette : bleu police profond, rouge balisage, ambre alerte, neutres teintés bleu. */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --surface: #eef1f6;
  --line: #d6dce6;
  --fg: #16202e;
  --muted: #5a6678;
  --accent: #1d3557;
  --accent-fg: #ffffff;
  --signal: #d62839;
  --warn: #c27a00;
  --ok: #2f7d4f;
  --focus: #3b6fd4;
  --shadow: 0 6px 24px rgba(22, 32, 46, .14);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1520; --panel: #151d2a; --surface: #1c2636; --line: #2c3a50;
    --fg: #e4e9f1; --muted: #93a0b4; --accent: #8fb3ea; --accent-fg: #0f1520;
    --signal: #ff5a67; --warn: #f0a92e; --ok: #5cc28a; --focus: #8fb3ea;
    --shadow: 0 6px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1520; --panel: #151d2a; --surface: #1c2636; --line: #2c3a50;
  --fg: #e4e9f1; --muted: #93a0b4; --accent: #8fb3ea; --accent-fg: #0f1520;
  --signal: #ff5a67; --warn: #f0a92e; --ok: #5cc28a; --focus: #8fb3ea;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.app { display: flex; height: 100%; }
.panel {
  width: 360px; flex: none; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding-block: 12px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: 14px;
  overflow-y: auto; z-index: 1000;
}
.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--surface); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px var(--line); }
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: .01em; }
.brand .sub { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.panel-toggle { margin-left: auto; display: none; }

/* Controls */
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea, .search input, .row > input, .row > select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: var(--fg); min-width: 0;
}
.field input[type=color] { padding: 2px; height: 36px; width: 48px; }
.field input[type=number] { width: 100%; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.check.big { font-weight: 500; padding: 8px 0; }
.btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px;
  cursor: pointer; font-weight: 500; white-space: nowrap; text-align: center;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { color: var(--signal); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.active { outline: 2px solid var(--signal); outline-offset: -2px; }
.btn.file { display: inline-block; }
.icon-btn { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted); border-radius: 6px; }
.icon-btn:hover { background: var(--surface); color: var(--fg); }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.status { margin: 0; font-size: 12px; color: var(--muted); min-height: 1em; }
.sect { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 8px 0 0; font-weight: 600; }

/* Search */
.search { display: flex; gap: 6px; }
.search input { flex: 1; }
.search-results { list-style: none; margin: -4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); max-height: 220px; overflow: auto; }
.search-results li { padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.search-results li:hover { background: var(--surface); }

/* Tabs */
.tabs { display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; border-bottom: 1px solid var(--line); }
.tab { white-space: nowrap; font-size: 13.5px; background: none; border: 0; padding: 9px 3px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--fg); border-bottom-color: var(--signal); }
.tabpane { display: none; flex-direction: column; gap: 10px; }
.tabpane.active { display: flex; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; background: var(--panel); }
.list.compact li { padding: 6px 8px; font-size: 13px; }
.list li .sw { width: 14px; height: 14px; border-radius: 50%; border: 2px solid; }
.list li .t { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.list li .m { grid-column: 2 / 4; color: var(--muted); font-size: 12px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.list li .acts { display: flex; gap: 2px; }
.list li.clickable { cursor: pointer; }
.list li.clickable:hover { border-color: var(--muted); }
.list .empty { display: block; color: var(--muted); border-style: dashed; text-align: center; font-size: 13px; }
.badge { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 13px; background: var(--panel); user-select: none; }
.chip input { margin: 0; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }

/* Repères et mesures : intitulés modifiables, sélecteur d'icône */
.name-wrap { display: flex; align-items: center; gap: 2px; min-width: 0; }
.name-wrap .name-in { flex: 0 1 auto; field-sizing: content; min-width: 3ch; max-width: 100%; width: auto; }
.edit-btn { flex: none; padding: 4px; color: var(--muted); }
.edit-btn:hover { color: var(--accent); }
.name-in { border: 1px solid transparent; background: none; padding: 3px 6px; margin-left: -6px; border-radius: 5px; font-weight: 500; width: 100%; }
.name-in:hover { border-color: var(--line); }
.name-in:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.list li .m .addr { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--fg); }
/* En-tête fixe : marque + mission + sauvegarde, toujours visible */
.panel-head {
  position: sticky; top: -12px; z-index: 5; margin-top: -12px; padding-top: 12px; padding-bottom: 8px;
  background: var(--panel); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px;
}
.missionbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 10px; }
.missionbar .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.missionbar .name-wrap { flex: 1 1 120px; }
.missionbar .name-in { font-weight: 600; }
.missionbar .btn { display: inline-flex; align-items: center; gap: 5px; }
.save-btn { position: relative; }
.save-btn .dirty-dot { display: none; position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--warn); border: 2px solid var(--panel); }
.save-btn.dirty .dirty-dot { display: block; }
.save-status { margin: -2px 0 0; font-size: 11.5px; color: var(--muted); min-height: 0; }
.save-status:empty { display: none; }
.save-status.warn { color: var(--warn); font-weight: 500; }

/* Groupes repliables (onglet Obstacles) */
.group { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.group > summary { list-style: none; cursor: pointer; padding: 10px 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.group[open] > summary::before { transform: rotate(45deg); }
.group > summary .badge { margin-left: auto; font-weight: 500; }
.group > summary .badge:empty { display: none; }
.group-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }

/* Plan de vol */
.route .picker .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.ico-grid.small { grid-template-columns: repeat(auto-fill, minmax(28px, 1fr)); }
.ico-grid.small button { height: 28px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; background: var(--surface); border: 0; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-fg); }
.route .wps { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0 0 0 12px; display: flex; flex-direction: column; gap: 4px; border-left: 2px solid var(--line); }
.route .wps:empty { display: none; }
.route .wps li { padding: 5px 8px; border-radius: 6px; }
.route .add-wp { grid-column: 1 / -1; justify-self: start; }
.rep-ico.sm { width: 24px; height: 24px; }
.icon-btn.on { background: var(--accent); color: var(--accent-fg); }
.dist-handle { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #d62839; box-shadow: 0 1px 3px rgba(0,0,0,.45); cursor: grab; }
.dist-handle:hover { transform: scale(1.2); }
.vtx { width: 14px; height: 14px; background: #fff; border: 3px solid; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: move; }
.sw-btn { width: 18px; height: 18px; border-radius: 50%; border: 3px solid; padding: 0; cursor: pointer; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--line); }
.sw-btn:hover { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--muted); }
.rep-ico { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; cursor: pointer; padding: 0; }
.mtype { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer; font-weight: 700; box-shadow: 0 0 0 1px var(--line); }
.mtype:hover { box-shadow: 0 0 0 2px var(--muted); }
.picker { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 4px; }
.ico-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.ico-grid button { height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; display: grid; place-items: center; }
.ico-grid button.on { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.col-grid { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.col-grid button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.col-grid button.on { box-shadow: 0 0 0 2px var(--fg); }
.col-grid input[type=color] { width: 32px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.icon-btn.plus { font-size: 20px; line-height: 1; width: 30px; height: 30px; padding: 0; color: var(--accent); border: 1px solid var(--line); }
.btn b { font-size: 16px; margin-right: 2px; }

.coords { margin-top: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; font-variant-numeric: tabular-nums; white-space: pre-line; }

/* Map overlays */
.modebar {
  position: absolute; top: max(12px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--accent); color: var(--accent-fg); padding: 6px 8px 6px 14px; border-radius: 999px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); font-weight: 500;
}
.modebar .btn { background: var(--accent-fg); color: var(--accent); border: 0; }
.modebar { width: max-content; max-width: calc(100% - 120px); }
#modeText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.toast {
  position: absolute; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* Leaflet theming */
.leaflet-container { font: 13px/1.4 var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--fg); }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 14px; }
.leaflet-popup-content .kv { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.leaflet-popup-content table { border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.leaflet-popup-content td { padding: 2px 6px 2px 0; }
.leaflet-bar a, .leaflet-control-layers { background: var(--panel); color: var(--fg); border-color: var(--line); }
.leaflet-control-layers-expanded { color: var(--fg); }
.radius-label { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font: 500 12px var(--mono); white-space: nowrap; box-shadow: var(--shadow); }
.h-label { background: var(--signal); color: #fff; border-radius: 4px; padding: 2px 6px; font: 600 12px var(--mono); white-space: nowrap; }
.center-handle { background: var(--panel); border: 3px solid; border-radius: 50%; }
.edge-handle { background: #fff; border: 2px solid #16202e; border-radius: 50%; }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); padding: 16px; width: min(420px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog h2 { margin: 0 0 10px; font-size: 16px; }
dialog form { display: flex; flex-direction: column; gap: 10px; }

/* Smartphone : panneau en feuille basse */
@media (max-width: 760px) {
  .app { flex-direction: column-reverse; }
  /* Panneau en feuille basse à trois hauteurs (réduit / moitié / plein écran) */
  .panel {
    width: 100%; height: var(--sheet-h, 50%); max-height: calc(100% - 56px); flex: none;
    border-right: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(0,0,0,.25); transition: height .22s ease;
  }
  .panel.dragging { transition: none; }
  .panel[data-sheet="min"] { overflow: hidden; }
  .panel[data-sheet="max"] .panel-toggle svg { transform: rotate(180deg); }
  .sheet-handle { display: flex; justify-content: center; padding: 2px 0 6px; margin-top: -6px; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
  .panel-toggle { display: block; }
  .coords { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .brand h1 { font-size: 16px; }
  .brand .sub { font-size: 10.5px; }
  /* Barre de mission sur une ligne : icônes seules pour Ouvrir et Remise à zéro */
  .missionbar { flex-wrap: nowrap; padding: 4px 4px 4px 8px; gap: 4px; }
  .missionbar .lbl { display: none; }
  .missionbar .file .btn-txt, #resetMission .btn-txt { display: none; }
  .missionbar .btn { padding: 7px 9px; }
  /* Étiquettes de carte plus discrètes sur petit écran */
  .radius-label { font-size: 10.5px; padding: 0 4px; }
  .leaflet-control-zoom { display: none; }
}
@media (min-width: 761px) { .sheet-handle { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Remise à zéro */
.btn.danger-fill { background: var(--signal); border-color: var(--signal); color: #fff; }
.warn-text { color: var(--warn); font-weight: 500; margin: 0; }
.warn-text:empty { display: none; }

/* Bouton « Ma position » et point bleu */
.me-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; box-shadow: var(--shadow); }
.me-btn.on { color: #2b7bff; }
.me-btn.wait svg { animation: me-pulse 1s ease-in-out infinite; }
@keyframes me-pulse { 50% { opacity: .3; } }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #2b7bff; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(43,123,255,.35), 0 1px 4px rgba(0,0,0,.4); }

/* Fiche mission */
dialog.wide { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; }
dialog fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
dialog legend { padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.grid2 .span2 { grid-column: 1 / -1; }
.grid2 .field input { width: 100%; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.spec { margin: 0; font-size: 12px; color: var(--fg); background: var(--surface); border-left: 3px solid var(--accent); padding: 6px 8px; border-radius: 4px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.people li { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.people input { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; color: var(--fg); }
@media (max-width: 480px) { .people li { grid-template-columns: 1fr auto; } .people .p-role { grid-column: 1; } .people li button { grid-row: 1 / span 2; grid-column: 2; } }
#fiPeopleBox { display: flex; flex-direction: column; gap: 8px; }
#fiPeopleBox[hidden] { display: none; }
.info-summary { text-align: left; background: none; border: 1px dashed var(--line); border-radius: 6px; padding: 5px 8px; font: 12px/1.4 var(--font); color: var(--muted); cursor: pointer; }
.info-summary:hover { border-color: var(--muted); color: var(--fg); }
#openInfo.filled { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { #openInfo .btn-txt { display: none; } .info-summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }

/* Barre de mission : boutons secondaires compacts */
.missionbar .btn.small { font-size: 12.5px; padding: 5px 8px; }
@media (max-width: 760px) { #printMission .btn-txt, #shareMission .btn-txt { display: none; } }

/* Partage */
.share-grid { display: flex; flex-direction: column; gap: 8px; }
.share-opt { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; font: inherit; }
.share-opt:hover { border-color: var(--accent); }
.share-opt svg { flex: none; color: var(--accent); }
.share-opt span { display: flex; flex-direction: column; gap: 2px; }
.share-opt small { color: var(--muted); font-size: 12px; }
.share-opt[hidden] { display: none; }
.share-preview summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.share-preview pre { white-space: pre-wrap; font: 12px/1.45 var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px; max-height: 220px; overflow: auto; margin: 6px 0 0; }

/* ---------- Dossier de mission imprimable ---------- */
#printReport { display: none; }
body.printing { background: #e9ecf1; overflow: auto; height: auto; }
body.printing .app { display: none; }
body.printing #printReport {
  display: block; width: 190mm; max-width: calc(100% - 24px); margin: 16px auto; padding: 12mm; background: #fff; color: #16202e;
  font: 10.5pt/1.4 var(--font); box-shadow: 0 4px 24px rgba(0,0,0,.15); color-scheme: light;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
#printReport .pr-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #04361a; padding-bottom: 8px; margin-bottom: 10px; }
#printReport .pr-head img { width: 15mm; height: 15mm; border-radius: 3mm; }
#printReport .pr-app { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .1em; color: #4b5a6e; }
#printReport h1 { font-size: 17pt; margin: 0; }
#printReport .pr-date { margin-left: auto; font-size: 8.5pt; color: #4b5a6e; text-align: right; }
#printReport h2 { font-size: 11.5pt; margin: 0 0 5px; color: #04361a; text-transform: uppercase; letter-spacing: .06em; }
#printReport h3 { font-size: 10pt; margin: 8px 0 4px; }
#printReport .pr-block { margin-bottom: 9px; break-inside: avoid; }
#printReport .pr-dl { display: grid; grid-template-columns: 38mm 1fr; gap: 2px 8px; margin: 0 0 6px; }
#printReport dt { color: #4b5a6e; }
#printReport dd { margin: 0; font-weight: 500; }
#printReport table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-bottom: 4px; }
#printReport th { text-align: left; background: #eef2ee; border-bottom: 1px solid #b9c4bb; padding: 3px 5px; font-weight: 600; }
#printReport td { border-bottom: 1px solid #e1e6e1; padding: 3px 5px; vertical-align: top; font-variant-numeric: tabular-nums; }
#printReport tr { break-inside: avoid; }
#printReport .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
#printReport .none { color: #8a96a8; margin: 0; }
#printReport .pr-foot { margin-top: 10px; padding-top: 6px; border-top: 1px solid #ccd3cc; font-size: 8pt; color: #4b5a6e; }
#printReport .mapwrap { position: relative; height: 125mm; border: 1px solid #b9c4bb; }
#printReport .leaflet-control-zoom, #printReport .leaflet-control-layers, #printReport .me-btn, #printReport .modebar, #printReport .toast { display: none !important; }
@page { size: A4 portrait; margin: 10mm; }
@media print {
  body.printing { background: #fff; }
  body.printing #printReport { width: auto; max-width: none; margin: 0; padding: 0; box-shadow: none; }
  body > dialog { display: none !important; }
}

/* Hauteur automatique dans les fiches d'obstacles */
.lidar-box { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: var(--surface); border-left: 3px solid #c27a00; font-size: 12.5px; }
.lidar-box b { font-size: 14px; }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.add-obs { margin-top: 6px; }
.add-obs:disabled { opacity: .75; cursor: default; }

/* ---------- Comptes : écran de connexion ---------- */
body.locked .app { filter: blur(3px); pointer-events: none; user-select: none; }
.auth { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; overflow: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(2px); }
.auth[hidden] { display: none; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { border-radius: 12px; }
.auth-brand h1 { margin: 0; font-size: 20px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth h2 { margin: 4px 0 6px; font-size: 17px; }
.auth form { display: flex; flex-direction: column; gap: 10px; }
.auth .field input { width: 100%; }
.auth .btn.primary { padding: 10px; font-size: 15px; }
.auth .opt { color: var(--muted); font-weight: 400; }
.auth .terms { align-items: flex-start; font-size: 13px; line-height: 1.4; }
.auth .terms input { margin-top: 3px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin: 6px 0 0; font-size: 13px; flex-wrap: wrap; }
.auth a { color: var(--accent); }
.auth-msg { margin: 0; font-size: 13px; min-height: 0; }
.auth-msg:empty { display: none; }
.auth-msg.err { color: var(--signal); }
.auth-msg.ok { color: var(--ok); }
.auth-wait { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 0; }
.auth-foot { margin: 0; font-size: 12px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- Comptes : menu dans l'en-tête ---------- */
.account { position: relative; margin-left: auto; }
.account-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 13px; cursor: pointer; position: relative; }
.account-btn.alert::after { content: ""; position: absolute; top: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--warn); border: 2px solid var(--panel); }
.account-menu { position: absolute; right: 0; top: 40px; z-index: 30; width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.account-menu .who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-menu .who span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.account-menu button, .account-menu a { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--fg); font: inherit; text-decoration: none; }
.account-menu button:hover, .account-menu a:hover { background: var(--surface); }
.account-menu .danger { color: var(--signal); }
.brand .panel-toggle { margin-left: 4px; }

/* ---------- Mes missions / administration ---------- */
.missions-list { max-height: 50vh; overflow: auto; }
.missions-list li.current { border-color: var(--accent); }
dialog.xwide { width: min(860px, calc(100% - 24px)); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--line); padding: 6px; }
.admin-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
.admin-table td.acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.st { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.st-pending { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.st-approved { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.st-blocked { background: color-mix(in srgb, var(--signal) 22%, transparent); color: var(--signal); }
