/* Carte en haut, panneau à onglets dessous, bouton SOS flottant. Tous les utilisateurs sont traités pareil. */
:root {
  --bg: #EDF1EC;
  --panel: #FAFBF8;
  --ink: #17211C;
  --muted: #55655B;
  --line: #D0DACF;
  --accent: #1F4D3E;
  --on-accent: #FFFFFF;
  --c-chasse: #B35E0E;
  --c-rando: #2B6AB0;
  --c-vtt: #7747AB;
  --c-autre: #4B6772;
  --sos: #D01F2A;
  --on-sos: #FFFFFF;
  --f-display: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1411;
    --panel: #161E1A;
    --ink: #E5EEE8;
    --muted: #9AAEA2;
    --line: #2B3A32;
    --accent: #6FCBA5;
    --on-accent: #0A1A13;
    --c-chasse: #E58E3C;
    --c-rando: #6BA4E8;
    --c-vtt: #B08DE3;
    --c-autre: #8EB1BD;
    --sos: #FF5C62;
    --on-sos: #1A0507;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.4;
  padding: calc(12px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { height: 100%; max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top h1 { font-family: var(--f-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; margin: 0; }
.top .tag { margin: 0; color: var(--muted); font-size: 0.8rem; }
.status { font-family: var(--f-mono); font-size: 0.75rem; color: var(--muted); }
.toast { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 0.85rem; }

.alertbar { display: flex; flex-direction: column; gap: 6px; }
.ab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 10px; background: var(--sos); color: var(--on-sos); font-size: 0.9rem; }
.ab span { min-width: 0; }
.ab .btn { background: var(--on-sos); color: var(--sos); border-color: transparent; padding: 6px 12px; flex: none; }
.ab.mine { background: var(--panel); color: var(--ink); border: 2px solid var(--sos); }
.ab.mine .btn { background: var(--sos); color: var(--on-sos); }

.mapwrap { position: relative; flex: 1 1 0; min-height: 210px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); }
#map { position: absolute; inset: 0; z-index: 0; font-family: var(--f-body); }
.mapbtm { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; pointer-events: none; z-index: 500; }
.mapbtm > * { pointer-events: auto; }
.pill { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.sosfab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--sos); color: var(--on-sos); font-family: var(--f-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.hint { position: absolute; left: 10px; top: 10px; max-width: calc(100% - 70px); margin: 0; padding: 6px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); z-index: 500; }

.leaflet-control-layers, .leaflet-bar a { color: #17211C; }

.mk { width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; border: 3px solid var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.mk.me { width: 34px; height: 34px; border-color: var(--accent); border-width: 4px; }
.mk.sos { border-color: var(--sos); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208,31,42,0.65); } 100% { box-shadow: 0 0 0 20px rgba(208,31,42,0); } }
@media (prefers-reduced-motion: reduce) { .mk.sos { animation: none; box-shadow: 0 0 0 8px rgba(208,31,42,0.4); } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 9px 6px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-family: var(--f-mono); font-size: 0.75rem; margin-left: 4px; }

.panel { flex: 0 1 auto; max-height: 42%; overflow: auto; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.panel > div { display: flex; flex-direction: column; gap: 12px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg > span { font-size: 0.8rem; color: var(--muted); margin-right: 2px; }
.seg button, .chips button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 0.85rem; }
.seg button[aria-pressed="true"], .chips button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }

ul.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 6px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 8px; }
.row:hover { background: var(--bg); }
.dot { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 0.78rem; }
.far { font-family: var(--f-mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; flex: none; }
.empty { margin: 0; color: var(--muted); font-size: 0.88rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.8rem; color: var(--muted); }
.field input { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.switch { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.switch input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.pos { margin: 0; font-family: var(--f-mono); font-size: 0.8rem; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note { margin: 0; font-size: 0.8rem; color: var(--muted); }
.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.danger { background: var(--sos); color: var(--on-sos); border-color: var(--sos); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.inc { padding: 8px 6px; border-radius: 8px; }
.inc .st { font-family: var(--f-mono); font-size: 0.72rem; padding: 2px 6px; border-radius: 4px; background: var(--sos); color: var(--on-sos); flex: none; }
.inc.done .st { background: var(--line); color: var(--muted); }
.inc .around { margin: 4px 0 0 38px; font-size: 0.8rem; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: grid; place-items: center; padding: 16px; z-index: 2000; }
.modal .card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0; font-family: var(--f-display); font-size: 1.15rem; }
.modal p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.sospanel { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,0.55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.sp-card { width: 100%; max-width: 480px; background: var(--panel); border: 2px solid var(--sos); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 100%; overflow: auto; }
.sp-card h2 { margin: 0; font-family: var(--f-display); font-size: 1.25rem; color: var(--sos); }
.sp-card p { margin: 0; font-size: 0.92rem; }
.call { display: block; text-align: center; padding: 16px; border-radius: 12px; background: var(--sos); color: var(--on-sos); font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.coords { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.coords span { font-family: var(--f-mono); font-size: 0.85rem; min-width: 0; overflow-wrap: anywhere; }
