:root {
  --brand: #0b6e4f;
  --brand-dark: #08513a;
  --accent: #f2a541;
  --bg: #ffffff;
  --surface: #f6f7f8;
  --text: #1c2326;
  --muted: #5f6b70;
  --border: #dde2e4;
  --danger: #c0392b;
  --shadow: 0 6px 24px rgba(0, 0, 0, .15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Barre du haut */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg); z-index: 3;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}

main { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; }

/* Boutons */
.btn {
  border: 0; border-radius: 8px; padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; width: 100%; padding: 13px; font-size: 15px; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; }

.fab {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 22px; font-size: 15px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow); cursor: pointer; z-index: 2;
}

.hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 14px; max-width: calc(100% - 32px); text-align: center;
}

/* Panneaux */
.panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 380px; z-index: 2;
  background: var(--bg); border-radius: 12px; box-shadow: var(--shadow);
  overflow-y: auto; padding: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { font-size: 18px; margin: 0; }
.close { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }

.jamacode-box {
  background: var(--brand); color: #fff; border-radius: 10px; padding: 12px; margin-bottom: 14px;
}
.jamacode-box span { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.jamacode-box strong { display: block; font-size: 22px; letter-spacing: .04em; margin: 2px 0; }
.jamacode-box small { opacity: .85; font-size: 12px; }

form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--muted); }
form input:not([type=radio]):not([type=checkbox]), form select, form textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--bg); font-family: inherit;
}
form input:focus, form select:focus, form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { margin: 0; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label span, .chips label {
  font-weight: 500; color: var(--text);
}
.chips label {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 14px;
}
.chips label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }

.consent { display: flex !important; gap: 8px; align-items: flex-start; font-weight: 400 !important; color: var(--text) !important; }
.consent input { margin-top: 3px; }
.error { color: var(--danger); font-size: 14px; margin: 0 0 10px; }
.photo { width: 100%; border-radius: 8px; margin: -4px 0 12px; max-height: 180px; object-fit: cover; }

/* Liste */
.list-actions { margin-bottom: 10px; }
.addr-list { list-style: none; margin: 0; padding: 0; }
.addr-list li {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.addr-list li:hover { background: var(--surface); }
.addr-list .code { font-weight: 700; color: var(--brand); }
.addr-list .meta { color: var(--muted); font-size: 13px; }
.addr-list .empty { color: var(--muted); border: 0; cursor: default; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); margin-right: 4px;
}
.badge.pending { background: #fff4e0; border-color: var(--accent); }

/* Popups */
.maplibregl-popup-content { border-radius: 10px; padding: 12px 14px; font-size: 13px; max-width: 260px; }
.popup-code { font-size: 16px; font-weight: 700; color: var(--brand); }
.popup img { width: 100%; border-radius: 6px; margin-top: 6px; }
.popup .del { color: var(--danger); margin-top: 8px; display: inline-block; }

.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px;
  max-width: calc(100% - 32px);
}

/* Téléphone : panneaux en bas d'écran */
@media (max-width: 720px) {
  .brand small { display: none; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 78%; border-radius: 14px 14px 0 0; }
  .row { grid-template-columns: 1fr; gap: 0; }
}

/* Connexion JamaSuite */
.account { display: flex; align-items: center; gap: 8px; }
.account-name { font-weight: 600; font-size: 14px; white-space: nowrap; }
.login-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45);
  display: grid; place-items: center; padding: 16px;
}
.login-box {
  position: relative; width: 100%; max-width: 380px; background: var(--bg); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow);
}
.login-box h2 { margin: 0 0 6px; font-size: 20px; }
.login-box .close { position: absolute; top: 10px; right: 12px; }
.login-reason:empty { display: none; }
.login-help { font-size: 13px; margin: 12px 0 0; }
.account-line { font-size: 14px; margin: 0 0 12px; color: var(--muted); }
.account-line strong { color: var(--text); }
.addr-list .list-sep { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 4px 4px; }
