* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1d24; color: #eef0f4;
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: #7ab8ff; }
.hidden { display: none !important; }
.muted { color: #9aa3b2; }
.small { font-size: .82rem; }
.warn { background: #3a2320; border: 1px solid #7a4a3a; border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; }
.warn-inline { color: #ff9b6a; font-weight: 600; }

/* ---- carte ---- */
#map { flex: 1; min-height: 0; background: #222; }
.leaflet-container { font: inherit; }

/* ---- topbar ---- */
#topbar { padding: .6rem .8rem .55rem; background: #1a1d24; z-index: 500; }
#topbar .row1 { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.logo { font-weight: 800; font-size: 1.15rem; }
.profile-btn { font-size: 1.05rem; padding: .45rem .8rem; }
#topbar .chips {
  margin: .45rem 0 0; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#topbar .chips::-webkit-scrollbar { display: none; }
#topbar .chip { white-space: nowrap; flex-shrink: 0; }

/* ---- chips ---- */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .45rem 0; }
.chip {
  border: 1px solid #3a4152; background: #232838; color: #cdd3de;
  border-radius: 999px; padding: .45rem .85rem; font-size: .88rem; cursor: pointer;
}
.chip.on { background: #2f6fed; border-color: #2f6fed; color: #fff; font-weight: 600; }

/* ---- boutons ---- */
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; cursor: pointer;
  background: #2f6fed; color: #fff; font-size: 1rem; font-weight: 700; padding: .8rem 1rem; margin: .35rem 0;
}
.btn.big { font-size: 1.15rem; padding: 1rem; }
.btn.need { background: #d64541; }
.btn.help { background: #2e9e5b; }
.btn.refuge { background: #2f6fed; }
.logo { cursor: pointer; }
.btn.ghost { background: #2a3040; color: #cdd3de; font-weight: 600; }
.btn.small-btn { width: auto; display: inline-block; padding: .5rem .8rem; font-size: .9rem; }
.btn:disabled { opacity: .5; }
.linklike { background: none; border: 0; color: #9aa3b2; text-decoration: underline; cursor: pointer; padding: .6rem; width: 100%; }
a.linklike { display: inline-block; width: auto; }
/* guichet support : fil de demandes */
.ticket { background: #1a1f2c; border: 1px solid #3a4152; border-radius: 10px; padding: .6rem .7rem; margin: .5rem 0; }
.tmsg { background: #232838; border-radius: 8px; padding: .4rem .55rem; margin: .35rem 0; }
.tmsg.tadmin { background: #1f2f45; border-left: 3px solid #2f6fed; }
.row { display: flex; gap: .5rem; align-items: center; }
.row .btn { flex: 1; }

#mainBtns {
  position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + .9rem);
  left: .8rem; right: .8rem; z-index: 600;
  display: flex; gap: .7rem;
}
#mainBtns { gap: .5rem; }
#mainBtns .btn { margin: 0; box-shadow: 0 4px 16px rgba(0,0,0,.45); font-size: .95rem; padding: .8rem .4rem; white-space: nowrap; }

/* ---- overlays / modals ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,.72); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto;
}
.modal, .ob-card {
  background: #232838; border-radius: 18px; padding: 1.35rem; width: 100%; max-width: 440px;
  max-height: 92vh; overflow-y: auto; line-height: 1.45;
}
/* onboarding : étapes plein écran, une idée à la fois */
.ob-full { padding: 0; background: #1a1d24; }
.ob-full .ob-card {
  max-width: none; height: 100%; max-height: none; border-radius: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 2rem 1.4rem; text-align: center;
}
.ob-full .ob-step { max-width: 420px; margin: 0 auto; width: 100%; }
.ob-emoji { font-size: 3.2rem; margin-bottom: .8rem; }
.ob-dots { display: flex; justify-content: center; gap: .7rem; margin-top: 1.5rem; }
.ob-dot {
  width: 15px; height: 15px; border-radius: 50%; border: 0; padding: 0;
  background: #3a4356; cursor: pointer; transition: transform .15s, background .15s;
}
.ob-dot.on { background: #7ab8ff; transform: scale(1.35); }
.ob-full .chips { justify-content: center; }
.ob-full .warn { text-align: center; font-size: 1rem; }
.ob-card h1 { margin-bottom: .6rem; }
.ob-card h2, .modal h2 { margin-bottom: .5rem; }
.lead { margin: .5rem 0 .8rem; line-height: 1.45; }
.ob-card p { margin: .5rem 0; }
input[type=text], input[type=tel], input[type=email], input[type=number], textarea {
  width: 100%; background: #1a1f2c; color: #eef0f4; border: 1px solid #3a4152;
  border-radius: 10px; padding: .7rem; font-size: 1rem; margin: .35rem 0; font-family: inherit;
}
.code { font-size: 2rem; font-weight: 800; letter-spacing: .4rem; text-align: center; background: #1a1f2c; border-radius: 10px; padding: .5rem; }

.switch { display: flex; gap: .5rem; align-items: flex-start; margin: .6rem 0; font-size: .95rem; cursor: pointer; }
.switch input { transform: scale(1.3); margin-top: .2rem; }
.rangeLabel { display: block; margin: .6rem 0; font-size: .95rem; }
.rangeLabel input { width: 100%; }

/* ---- bottom sheet ---- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  background: #232838; border-radius: 20px 20px 0 0; max-height: 74vh; overflow-y: auto;
  padding: .5rem 1.1rem calc(env(safe-area-inset-bottom, 0px) + 1.3rem);
  box-shadow: 0 -6px 24px rgba(0,0,0,.5);
}
.sheet-handle { text-align: right; color: #9aa3b2; cursor: pointer; padding: .3rem; font-size: 1.1rem; position: sticky; top: 0; }
.sheet h3 { margin: .2rem 0 .4rem; }
.badge {
  display: inline-block; font-size: .75rem; background: #2a3040; border-radius: 6px;
  padding: .15rem .5rem; margin-right: .3rem; color: #cdd3de;
}
.badge.prof { background: #294a6e; color: #bcd8ff; }
.badge.zone { background: #6e2929; color: #ffc9c9; }
.sheet img { max-width: 100%; border-radius: 10px; margin: .5rem 0; }
.sheet audio { width: 100%; margin: .4rem 0; }
/* mises à jour : le canal vivant de la fiche, bien visible */
.updates-box {
  background: #1e2c42; border-left: 4px solid #2f6fed; border-radius: 10px;
  padding: .7rem .9rem; margin: .6rem 0; font-size: .95rem;
}
.updates-box > b { color: #9cc2ff; font-size: .85rem; }
.upd-item { margin: .45rem 0 0; line-height: 1.4; }
.upd-item:first-of-type { font-weight: 600; } /* la plus récente ressort */
.upd-compose {
  background: #1e2c42; border: 1px dashed #3a5a8a; border-radius: 12px;
  padding: .7rem .8rem .2rem; margin: .5rem 0 .7rem;
}
.upd-compose > b { color: #9cc2ff; font-size: .85rem; }
.upd-compose .btn { margin-top: .1rem; }
.arrivals { margin: .5rem 0; font-size: .92rem; }
.arrivals li { margin: .2rem 0 .2rem 1.2rem; }

/* ---- hors-ligne ---- */
#offlineBar {
  position: absolute; top: 5.6rem; left: .8rem; right: .8rem; z-index: 750;
  background: #6e2929; color: #ffd7d7; border-radius: 12px; padding: .6rem .9rem;
  font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

/* focus clavier visible partout */
:focus-visible { outline: 2px solid #7ab8ff; outline-offset: 2px; }

/* ---- bannières ---- */
.banner {
  position: absolute; top: 5.6rem; left: .8rem; right: .8rem; z-index: 700;
  background: #294a6e; border-radius: 12px; padding: .7rem .9rem; font-size: .92rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.banner .row { margin-top: .5rem; }

/* ---- repère central de placement ---- */
#centerPin {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -100%);
  z-index: 650; font-size: 2.4rem; pointer-events: none;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.55));
  animation: pinbounce .4s;
}
#centerPin::after {
  content: ''; position: absolute; left: 50%; bottom: -4px;
  transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(26,29,36,.85); border: 2px solid #fff;
}
@keyframes pinbounce { from { transform: translate(-50%, -140%); } }

/* ---- mode démonstration ---- */
#demoBar {
  position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + .9rem);
  left: .8rem; right: .8rem; z-index: 800;
  background: #2b2145; border: 1px solid #6a4fc9; border-radius: 14px;
  padding: .8rem .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.5); font-size: .92rem;
}
#demoBar .btn { margin: .5rem 0 0; }

/* ---- placement pin ---- */
#placeBar {
  position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + .9rem);
  left: .8rem; right: .8rem; z-index: 800;
  background: #232838; border-radius: 14px; padding: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

/* ---- page « Mon espace » ---- */
.ob-card.page {
  justify-content: flex-start; text-align: left; max-width: 480px; margin: 0 auto;
  padding: 1.1rem 1.3rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
}
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.page-close {
  background: #2a3040; border: 0; color: #cdd3de; border-radius: 999px;
  width: 2.4rem; height: 2.4rem; font-size: 1rem; cursor: pointer;
}
.prow {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: #232838; border: 1px solid #2c3344; color: #eef0f4; text-decoration: none;
  border-radius: 12px; padding: .9rem 1rem; margin: .35rem 0; font-size: .98rem;
  font-family: inherit; cursor: pointer; text-align: left;
}
.prow:active { background: #2a3040; }
.prow-danger { border-color: #6e2929; color: #ff9b9b; }
.prow .chev { color: #5a6478; font-size: 1.2rem; }
.sep { height: 1px; background: #2c3344; margin: 1.1rem 0; }

/* attribution Leaflet : minuscule et translucide, hors des boutons */
.leaflet-control-attribution {
  background: rgba(20, 22, 28, .45) !important; color: rgba(154,163,178,.8) !important;
  font-size: .6rem !important; border-radius: 0 0 0 6px; padding: 0 4px !important;
}
.leaflet-control-attribution a { color: rgba(122,184,255,.8) !important; }

/* ---- points officiels ---- */
.offpin {
  width: 34px; height: 34px; border-radius: 50%;
  background: #294a6e; border: 2px solid #7ab8ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.leaflet-popup-content-wrapper { background: #232838; color: #eef0f4; border-radius: 12px; }
.leaflet-popup-tip { background: #232838; }
.leaflet-popup-content a { color: #7ab8ff; }

/* ---- toasts ---- */
#toasts { position: fixed; top: .6rem; left: 50%; transform: translateX(-50%); z-index: 2000; width: min(92vw, 420px); }
.toast {
  background: #2e9e5b; color: #fff; border-radius: 10px; padding: .6rem .9rem; margin: .3rem 0;
  font-size: .92rem; box-shadow: 0 4px 16px rgba(0,0,0,.4); animation: fadein .25s;
}
.toast.err { background: #d64541; }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }

/* ---- demandes de refuge (tableau de bord hébergeur) ---- */
.req-box {
  background: #2b2416; border-left: 4px solid #e0a939; border-radius: 10px;
  padding: .7rem .9rem .4rem; margin: .6rem 0; font-size: .95rem;
}
.req-box > b { color: #ffd27a; font-size: .85rem; }
.req-row {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin: .55rem 0; flex-wrap: wrap;
}
.req-actions { display: flex; gap: .45rem; }
.req-actions .btn { margin: 0; width: auto; }

/* ---- partage ---- */
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: .6rem 0; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  background: #2a3040; border: 1px solid #3a4152; color: #eef0f4; text-decoration: none;
  border-radius: 12px; padding: .8rem .5rem; font-size: .95rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.share-btn:active { background: #333b4e; }
.nav-row { margin: .45rem 0; }
.nav-row a { font-weight: 700; }

/* ---- légende ---- */
.legend { list-style: none; margin: .4rem 0 .8rem; }
.legend li { margin: .45rem 0; font-size: .92rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.offpin-mini {
  width: 24px; height: 24px; border-radius: 50%; background: #294a6e; border: 2px solid #7ab8ff;
  display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; flex-shrink: 0;
}
.halo-mini { width: 20px; height: 20px; border-radius: 50%; background: rgba(46,158,91,.25); border: 1px solid #2e9e5b; flex-shrink: 0; }
.fire-mini { width: 20px; height: 12px; background: radial-gradient(circle 3px at 5px 6px, #e33 90%, transparent), radial-gradient(circle 3px at 14px 5px, #e33 90%, transparent); flex-shrink: 0; }
.zone-mini { width: 20px; height: 20px; border-radius: 50%; border: 2px dashed #d64541; background: rgba(214,69,65,.1); flex-shrink: 0; }
.cluster-mini {
  width: 24px; height: 24px; border-radius: 50%; background: #a5d67d; color: #333; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0;
}

/* ---- marqueurs ---- */
.pin { font-size: 1.7rem; text-shadow: 0 2px 4px rgba(0,0,0,.6); position: relative; }
.pin .cnt {
  position: absolute; top: -6px; right: -10px; background: #2e9e5b; color: #fff;
  font-size: .62rem; font-weight: 800; border-radius: 999px; padding: 1px 5px; font-family: system-ui;
}
.pin .cnt.full { background: #d64541; filter: none; }
.helper-pin {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1e3a26; border: 2px solid #2e9e5b;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.pin.closedk { filter: grayscale(1); }
