:root {
  --bg: #0a0f16;
  --panel: #111823;
  --panel-2: #172130;
  --panel-3: #1d2939;
  --line: #233044;
  --line-2: #2d3c53;
  --text: #e8eef6;
  --muted: #8796ab;
  --accent: #1a8cff;
  --accent-2: #0a6fd8;
  --accent-soft: rgba(26,140,255,.14);
  --ok: #22b07d;
  --warn: #f0a73a;
  --bad: #ef5656;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #5f6e83; }
textarea { resize: vertical; min-height: 70px; }
label { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin: 12px 0 5px; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; }
.hidden { display: none !important; }
.is-employee .owner-only, body:not(.is-super) .super-only { display: none !important; }

/* Icônes SVG */
svg.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
[data-ic] { display: inline-flex; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 9px;
  padding: 8px 14px; min-height: 38px; cursor: pointer; font-weight: 600; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 2px 8px rgba(26,140,255,.25);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn .ic, .btn [data-ic] svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-3); border-color: var(--line-2); }
.btn.danger { background: transparent; color: #ff8a8a; border-color: rgba(239,86,86,.45); box-shadow: none; }
.btn.danger:hover { background: rgba(239,86,86,.12); }
.btn.ok { background: var(--ok); box-shadow: 0 2px 8px rgba(34,176,125,.25); }
.btn.ok:hover { background: #1a9a6c; }
.btn.warn { background: var(--warn); color: #1d1300; box-shadow: none; }
.btn.small { padding: 5px 11px; min-height: 32px; font-size: 13px; gap: 6px; }
.btn.small .ic, .btn.small [data-ic] svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .45; cursor: default; }
kbd { font: 600 11px Inter, sans-serif; background: rgba(255,255,255,.16); border-radius: 5px; padding: 1px 6px; }

/* Logo EZSnow et ses flocons */
.ez-logo { position: relative; display: inline-block; height: 30px; line-height: 0; flex: none; }
.ez-logo img { height: 100%; width: auto; display: block; user-select: none; }
.ez-logo.ez-big { height: 54px; }
.ez-logo.ez-big .ez-snow i { width: calc(var(--s) * 1.4); height: calc(var(--s) * 1.4); }
.ez-logo.ez-side { height: 30px; }
.ez-logo.ez-top { height: 24px; }
.ez-snow { position: absolute; left: 36%; right: -2%; top: -45%; bottom: -12%; overflow: hidden; pointer-events: none; }
.ez-snow i {
  position: absolute; top: -8%; width: var(--s); height: var(--s); border-radius: 50%;
  background: #fff; box-shadow: 0 0 4px 1px rgba(26,140,255,.75); opacity: 0; /* halo bleu : visible même devant les lettres blanches */
  animation: ez-fall var(--d) linear var(--dl) infinite;
}
@keyframes ez-fall {
  0% { top: -8%; transform: translateX(0); opacity: 0; }
  12% { opacity: .95; }
  70% { opacity: .85; }
  100% { top: 100%; transform: translateX(var(--x)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .ez-snow { display: none; } }


/* ---------- connexion ---------- */
.login {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(26,140,255,.16), transparent 60%), var(--bg);
}
.login-card {
  width: 100%; max-width: 340px; text-align: center; background: rgba(17,24,35,.85); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px 24px 24px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.login-logo { display: flex; justify-content: center; margin: 4px 0 14px; }
.pin-display {
  font-size: 32px; letter-spacing: 8px; height: 56px; margin: 18px 0 10px;
  background: var(--panel); border-radius: var(--radius); display: grid; place-items: center;
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button {
  height: 62px; font-size: 24px; font-weight: 600; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; display: grid; place-items: center;
}
.pin-pad button:hover { border-color: var(--line-2); }
.pin-pad button:active { background: var(--panel-3); }
.pin-pad button .ic { width: 24px; height: 24px; }
.pin-pad button[data-k="OK"] { background: var(--accent); border-color: var(--accent); font-weight: 700; }
/* Connexion par mot de passe */
.login-card.pw { text-align: left; max-width: 380px; padding: 30px 28px 26px; }
.login-card.pw > .muted { text-align: center; margin-bottom: 6px; }
.login-card.pw .btn { width: 100%; min-height: 46px; margin-top: 8px; font-size: 15px; }
.ts-box { margin: 12px 0 4px; }

/* ---------- répartition ---------- */
.dispatch { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.storm { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.storm-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { flex: 1; max-width: 320px; height: 8px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #35c3ff); border-radius: 99px; transition: width .4s; }
.layout { flex: 1; display: flex; min-height: 0; }
.panel {
  width: 380px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; background: none; border: 0; padding: 12px 6px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 600; font-size: 13px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab { display: none; flex-direction: column; min-height: 0; flex: 1; }
.tab.active { display: flex; }
.row { display: flex; gap: 8px; padding: 10px 12px 0; align-items: center; }
.row > input, .row > select { flex: 1; }
.list { overflow-y: auto; flex: 1; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.item {
  background: var(--panel-2); border: 1px solid transparent; border-radius: 12px;
  padding: 11px 13px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; transition: border-color .15s, background .15s;
}
.item:hover { border-color: var(--line-2); background: var(--panel-3); }
.item.selected { border-color: var(--accent); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; display: flex; gap: 7px; align-items: center; }
.item-title .ic { width: 17px; height: 17px; color: var(--muted); }
.item-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--panel-3); color: var(--text); white-space: nowrap; font-weight: 600; line-height: 1.5;
}
.pill .ic { width: 12px; height: 12px; }
.dot-c { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }
.dot-c.sq { border-radius: 3px; border: 2px solid; background: transparent; transform: rotate(45deg) scale(.85); }
.pill.on { background: rgba(48,164,108,.2); color: #5fd49a; }
.pill.off { background: rgba(139,152,165,.15); color: var(--muted); }
.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px;
  display: inline-grid; place-items: center; transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
.count { color: var(--muted); font-size: 12px; padding: 8px 12px 0; }
#map { flex: 1; min-height: 0; background: #1b232c; }

.report { overflow-y: auto; padding: 12px; flex: 1; }
.report h3 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.report table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report td, .report th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.report th { color: var(--muted); font-weight: 500; }
.report table { table-layout: fixed; overflow-wrap: anywhere; }
.sms-list { display: flex; flex-direction: column; gap: 6px; }
.sms-item { background: var(--panel-2); border-radius: var(--radius); padding: 8px 10px; min-width: 0; }
.sms-top { display: flex; gap: 6px; align-items: center; min-width: 0; }
.sms-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sms-meta { font-size: 11px; margin-top: 2px; }
.sms-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.sms-stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.sms-stat b { font-size: 22px; font-weight: 800; }
.sms-stat span { font-size: 12px; color: var(--muted); }
.sms-stat.blue b { color: #5cb2ff; } .sms-stat.green b { color: #4fd3a0; } .sms-stat.red b { color: #ff8a8a; }
.sms-item.in { border-left: 3px solid var(--accent); }
.sms-reply { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.sms-body { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

/* ---------- fenêtres ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000;
  display: grid; place-items: center; padding: 16px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 500px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px;
}
.modal-card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.inline { display: flex; gap: 8px; }
.geo-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.geo-results button {
  text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; cursor: pointer; font-size: 13px;
}
.geo-results button { display: flex; gap: 8px; align-items: flex-start; }
.geo-results button .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--accent); }
.geo-results button:hover { border-color: var(--accent); }
.geo-msg { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13px; }
.geo-msg .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.geo-msg.ok { background: rgba(34,176,125,.13); color: #6fe0b3; }
.geo-msg.warn { background: rgba(240,167,58,.13); color: #ffcf85; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; font-weight: 500;
  background: #182233; border: 1px solid var(--line-2); box-shadow: var(--shadow);
  color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 4000;
  pointer-events: none; transition: .25s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.pick-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: rgba(17,24,35,.95); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  color: #fff; padding: 8px 10px 8px 16px; border-radius: 14px; font-weight: 600;
  display: flex; gap: 8px; align-items: center;
}

/* ---------- marqueurs ---------- */
.draw-banner { flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px); }
.zone-handle { background: #fff; border: 3px solid var(--accent); border-radius: 50%; cursor: move; }
.veh-icon { background: none; border: 0; }
.tiles-dark img.leaflet-tile { filter: url(#ez-dark-map); }
.leaflet-container:has(.tiles-dark) { background: #181c23; }

.imagery-date {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(10,15,22,.85); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  margin-bottom: 18px !important;
}

/* ---------- textos ---------- */
.sms-banner { padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
.sms-banner.test { background: rgba(245,165,36,.14); color: #ffd28a; }
.sms-banner.live { background: rgba(48,164,108,.16); color: #7ee0ae; }
.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600; transition: border-color .15s;
}
.chip-btn .ic { width: 14px; height: 14px; }
.chip-btn:hover { border-color: var(--accent); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; margin: 10px 0 0; cursor: pointer; }
label.check input { width: auto; }
.veh { position: relative; width: 44px; height: 44px; }
.veh-dot {
  width: 34px; height: 34px; margin: 5px; border-radius: 50%; background: var(--c); color: #fff;
  border: 3px solid #fff; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); position: relative;
}
.veh-dot .ic { width: 18px; height: 18px; }
.veh.me .veh-dot { width: 40px; height: 40px; margin: 2px; box-shadow: 0 0 0 6px rgba(59,158,255,.35), 0 2px 8px rgba(0,0,0,.5); }
.veh.off .veh-dot { filter: grayscale(1); opacity: .6; }
.veh-arrow {
  position: absolute; inset: -12px; pointer-events: none;
}
.veh-arrow::before {
  content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom: 10px solid var(--c); border-top: 0;
}
.veh-label {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
  background: #000b; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px;
  border-radius: 4px; white-space: nowrap;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.popup h4 { margin: 0 0 4px; font-size: 15px; }
.popup h4 { display: flex; align-items: center; gap: 4px; }
.popup .line { color: var(--muted); font-size: 12px; margin: 3px 0; display: flex; align-items: center; gap: 6px; }
.popup .line .ic { width: 14px; height: 14px; }
.popup .notes { background: rgba(240,167,58,.12); color: #ffd28a; padding: 6px 8px; border-radius: 8px; margin: 6px 0; display: flex; gap: 6px; }
.popup .notes .ic, .job .notes .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.popup .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- tablette ---------- */
.driver { display: flex; flex-direction: column; height: 100%; overflow: hidden; font-size: 16px; }
.d-status {
  display: flex; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
  align-items: center; flex-wrap: wrap;
}
.d-status .veh-name { font-weight: 800; font-size: 18px; margin-right: auto; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--panel-2); white-space: nowrap; }
.chip.good { background: rgba(48,164,108,.2); color: #5fd49a; }
.chip.bad { background: rgba(229,72,77,.2); color: #ff8b8e; }
.chip.warn { background: rgba(245,165,36,.2); color: #ffc65c; }
.d-body { flex: 1; display: grid; grid-template-columns: 1fr 420px; min-height: 0; }
.d-map-wrap { position: relative; min-height: 0; }
.d-map-wrap #map { position: absolute; inset: 0; }
.d-map-btns { position: absolute; right: 10px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.d-map-btns button {
  width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer;
}
.d-map-btns button .ic { width: 24px; height: 24px; }
.d-map-btns button.active { background: var(--accent); }
/* Bandeau de guidage (gros, contrasté, lisible d'un coup d'œil en conduisant) */
.nav-banner {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 950; display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #0d6fe0, #1a8cff); color: #fff; border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.nav-arrow { width: 70px; height: 70px; flex: none; border-radius: 14px; background: rgba(0,0,0,.18); display: grid; place-items: center; }
.nav-arrow .ic { width: 48px; height: 48px; stroke-width: 2.6; }
.nav-text { flex: 1; min-width: 0; }
.nav-dist { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -.5px; }
.nav-main { font-size: 19px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.nav-sub { font-size: 14px; opacity: .85; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; font-size: 13px; }
.nav-side b { font-size: 20px; }
.nav-side span { opacity: .85; }
.nav-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(0,0,0,.2); color: #fff; display: grid; place-items: center; cursor: pointer; }
.nav-btn .ic { width: 20px; height: 20px; }
.gmaps-link { display: block; text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.d-side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.job { padding: 14px; border-bottom: 1px solid var(--line); }
.job .label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.job .name { font-size: 22px; font-weight: 800; margin: 2px 0; }
.job .addr { font-size: 16px; }
.job .notes { background: rgba(240,167,58,.13); color: #ffd28a; padding: 8px 10px; border-radius: 10px; margin-top: 8px; display: flex; gap: 8px; }
.job .arrived { background: rgba(34,176,125,.18); color: #5fd49a; padding: 7px 10px; border-radius: 10px; margin-top: 8px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.job-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.job-btns .btn { padding: 14px; min-height: 54px; font-size: 17px; border-radius: 12px; }
.job-btns .btn .ic { width: 22px; height: 22px; }
.job-btns .btn.done { grid-column: 1 / -1; padding: 20px; min-height: 72px; font-size: 22px; letter-spacing: .5px; }
.job-btns .btn.done .ic { width: 28px; height: 28px; }
.d-tabs { display: flex; gap: 6px; padding: 10px 14px 0; }
.d-tabs button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: none; cursor: pointer;
}
.d-tabs button.active { background: var(--panel-2); border-color: var(--accent); }
.d-list { overflow-y: auto; flex: 1; padding: 10px 14px 20px; display: flex; flex-direction: column; gap: 6px; }
.d-list .item { padding: 12px; font-size: 15px; }
.d-list .item-sub { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.vehicle-pick { display: grid; gap: 10px; margin-top: 18px; }
.vehicle-pick button .ic { width: 24px; height: 24px; color: var(--accent); }
.vehicle-pick button {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); font-size: 18px; font-weight: 700; text-align: left;
}

/* ---------- secteurs, menu ---------- */
.sector-label {
  background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 800; font-size: 12px;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 6px #000; pointer-events: none;
}
.sector-label::before { display: none; }
.tabs .ti { display: none; }
.only-mobile, .menu-btn { display: none; }
.top-actions { display: flex; gap: 8px; }
.sheet-menu { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2500; display: flex; align-items: flex-end; }
.sheet-card {
  width: 100%; background: var(--panel); border-radius: 16px 16px 0 0; padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
}
.sheet-card button {
  background: var(--panel-2); border: 0; border-radius: 12px; padding: 15px 16px; font-size: 16px; font-weight: 600;
  text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.sheet-card button .ic { width: 20px; height: 20px; color: var(--accent); }
.sheet-card button.muted { background: none; text-align: center; color: var(--muted); }

/* Écrans tactiles (téléphone, tablette) : cibles plus grandes, et 16 px dans les champs pour que l'iPhone ne zoome pas. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  .btn { padding: 11px 16px; }
  .btn.small { padding: 9px 12px; font-size: 14px; }
  .icon-btn { padding: 8px 12px; font-size: 18px; }
  .item { padding: 12px 14px; }
  .chip-btn { padding: 6px 12px; font-size: 14px; }
  label.check { font-size: 15px; }
  label.check input { width: 20px; height: 20px; }
}

/* Téléphone et tablette en portrait : la carte plein écran, une barre d'onglets en bas comme une app. */
@media (max-width: 899px) {
  .dispatch { --nav: calc(62px + env(safe-area-inset-bottom)); }
  /* Écran d'app : la page elle-même ne défile jamais (sinon iOS fait glisser la barre du haut sous l'heure
     et élargit tout dès qu'un élément dépasse). Seules les listes défilent. */
  body.dispatch { position: fixed; inset: 0; width: 100%; height: auto; overflow: hidden; overscroll-behavior: none; }
  .dispatch .panel, .dispatch .tab, .dispatch .report, .dispatch .list { overflow-x: hidden; }
  .dispatch .list, .dispatch .report { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .dispatch .topbar { position: relative; z-index: 1300; }
  .dispatch .topbar { flex-wrap: nowrap; gap: 10px; padding: calc(6px + env(safe-area-inset-top)) 6px 6px 12px; }
  .dispatch .top-actions { display: none; }
  .dispatch .menu-btn { display: inline-grid; padding: 8px; color: var(--text); }
  .dispatch .menu-btn .ic { width: 24px; height: 24px; }
  .dispatch .storm { min-width: 0; gap: 8px; }
  .dispatch .storm-name { display: none; }
  .dispatch .progress { max-width: none; }
  .dispatch #stormCount { font-size: 12px; white-space: nowrap; }
  .dispatch .layout { position: relative; }
  .dispatch #map { position: absolute !important; left: 0; right: 0; top: 0; bottom: var(--nav); }
  .dispatch .panel { position: absolute; left: 0; right: 0; top: 0; bottom: var(--nav); width: auto; z-index: 1100; border: 0; }
  .dispatch.view-map .panel { background: transparent; pointer-events: none; }
  .dispatch.view-map .panel .tab { display: none; }
  .dispatch .only-mobile { display: flex; }
  .dispatch .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav); z-index: 1200; pointer-events: auto;
    background: var(--panel); border-top: 1px solid var(--line); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .dispatch .tabs button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 0;
    border-bottom: 0; border-top: 2px solid transparent; font-size: 11px; min-width: 0;
  }
  .dispatch .tabs .ti { display: block; line-height: 0; }
  .dispatch .tabs .ti .ic { width: 22px; height: 22px; }
  .dispatch .tabs button { font-weight: 600; }
  .dispatch .tabs button.active { border-top-color: transparent; color: var(--accent); background: none; }
  .dispatch .row { flex-wrap: wrap; }
  .dispatch .row > input[type=search] { flex-basis: 60%; }
  .dispatch .list { padding-bottom: 24px; }
  .dispatch .toast { bottom: calc(var(--nav) + 14px); }
  .dispatch .pick-banner {
    top: auto; bottom: 12px; border-radius: 14px; width: calc(100% - 20px); max-width: none; padding: 10px 12px;
  }
  .dispatch .pick-banner .btn { flex: 1; }
  .dispatch .draw-banner #dz_info { width: 100%; text-align: center; }
  .dispatch .imagery-date { margin-bottom: 4px !important; }
  .modal { place-items: end stretch; padding: 0; }
  .modal-card {
    max-width: none; border-radius: 18px 18px 0 0; max-height: calc(100% - 24px - env(safe-area-inset-top));
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); border-bottom: 0;
  }
  .modal-actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--panel);
    margin: 14px -16px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); }
  .modal-actions .btn { flex: 1; }
  .modal-actions .spacer { display: none; }
  .leaflet-popup-content { min-width: 200px; }
  .popup .actions .btn { flex: 1; }
  .d-body { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .guiding .d-body { grid-template-rows: 60% 40%; }
  .d-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { gap: 8px; }
}
