:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #1d4ed8;
  --primary-ink: #ffffff;
  --accent: #ea580c;
  --ok: #15803d;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 8%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --primary: #60a5fa;
    --primary-ink: #0b1120;
    --accent: #fb923c;
    --ok: #4ade80;
    --danger: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: relative; z-index: 1000;
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--primary); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.topbar nav { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--text); padding: 6px 10px; border-radius: 8px; }
.topbar nav a:hover { background: var(--bg); }
.topbar nav a.btn { color: var(--primary-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600;
  background: var(--primary); color: var(--primary-ink); cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .9rem; }
.btn.link { background: none; color: var(--danger); padding: 4px 6px; font-weight: 500; }

.page { min-height: 100vh; }
.wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 520px; margin: 40px auto; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.error { color: var(--danger); font-weight: 500; }
.success { color: var(--ok); font-weight: 500; }
.notice { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.inline { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.inline input { margin-top: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }

.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.roles label {
  margin: 0; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; font-weight: 400;
}
.roles label strong { display: block; font-size: 1.02rem; }
.roles input { position: absolute; opacity: 0; }
.roles label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }

.suggest { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.suggest:empty { display: none; }
.suggest li { padding: 8px 12px; cursor: pointer; }
.suggest li:hover, .suggest li.active { background: var(--bg); }
.picker { height: 260px; border-radius: 10px; margin-top: 8px; border: 1px solid var(--line); }

/* Carte */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; height: 100dvh; }
.main { position: relative; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }
#map { min-height: 0; }
.panel { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; }
.searchbox { position: absolute; top: 12px; left: 56px; right: 396px; max-width: 420px; z-index: 900; }
.searchbox input { background: var(--surface); box-shadow: var(--shadow); border: 0; }
.hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 900;
  background: var(--surface); box-shadow: var(--shadow); padding: 8px 14px; border-radius: 999px; font-size: .9rem; white-space: nowrap;
}
.hint:empty { display: none; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-right: 4px; }
.pill.hot { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.demande { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin: 6px 0 2px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.list li:first-child { border-top: 0; }
.steps { padding-left: 18px; }
.steps li { margin-bottom: 6px; }

.marker-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 35%);
}
.marker-hot {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--accent); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; box-shadow: 0 1px 4px rgb(0 0 0 / 40%);
}
.leaflet-container { font: inherit; background: var(--bg); }

@media (max-width: 760px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .panel { border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; }
  .searchbox { left: 56px; right: 16px; }
  .topbar { gap: 8px; }
  .topbar nav a:not(.btn) { padding: 6px; }
  .roles { grid-template-columns: 1fr; }
  .hint { bottom: 12px; white-space: normal; text-align: center; width: calc(100% - 32px); }
}

/* Groupes de commerces : bleu, pour laisser l'orange aux commerces actifs */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgb(29 78 216 / 25%); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgb(29 78 216 / 85%); color: #fff; font-weight: 600; }
