/* ------------------------------------------------------------------ jetons */
:root {
  --ground: #F3F6F1;
  --surface: #FFFFFF;
  --surface-2: #EAF0E8;
  --ink: #172119;
  --ink-2: #4E5E53;
  --muted: #7A897E;
  --line: #D7DFD4;
  --line-strong: #B9C6B6;
  --accent: #1F7A4D;
  --accent-strong: #145C39;
  --accent-soft: #DCEFE3;
  --on-accent: #FFFFFF;
  --hot: #E4572E;
  --hot-strong: #B8401D;
  --hot-soft: #FBE4DB;
  --warn-soft: #FFF1D6;
  --warn-ink: #7A4B00;
  --shadow: 0 8px 28px rgba(23, 33, 25, .14);
  --shadow-sm: 0 2px 8px rgba(23, 33, 25, .10);
  --radius: 14px;
  --radius-sm: 9px;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --topbar-h: 60px;
  --panel-w: 420px;
  --tile-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0F1512; --surface: #171F1A; --surface-2: #1F2923; --ink: #E7EDE5; --ink-2: #B4C0B6; --muted: #86958A;
    --line: #29352D; --line-strong: #3B4A40; --accent: #4CC38A; --accent-strong: #7BD8A8; --accent-soft: #1C3A2B; --on-accent: #0B1A12;
    --hot: #FF7A50; --hot-strong: #FF9A78; --hot-soft: #3F2219; --warn-soft: #3A2C10; --warn-ink: #F3C77A;
    --shadow: 0 8px 28px rgba(0,0,0,.5); --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
    --tile-filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0F1512; --surface: #171F1A; --surface-2: #1F2923; --ink: #E7EDE5; --ink-2: #B4C0B6; --muted: #86958A;
  --line: #29352D; --line-strong: #3B4A40; --accent: #4CC38A; --accent-strong: #7BD8A8; --accent-soft: #1C3A2B; --on-accent: #0B1A12;
  --hot: #FF7A50; --hot-strong: #FF9A78; --hot-soft: #3F2219; --warn-soft: #3A2C10; --warn-ink: #F3C77A;
  --shadow: 0 8px 28px rgba(0,0,0,.5); --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --tile-filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.6);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------ barre haute */
.topbar {
  position: relative; z-index: 1200; height: var(--topbar-h);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: conic-gradient(from 210deg, var(--hot) 0 110deg, var(--accent) 110deg 360deg); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 9px; background: var(--surface); border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.countdown { color: var(--hot); font-weight: 600; }

.search { position: relative; display: flex; align-items: center; max-width: 560px; width: 100%; justify-self: center; }
.search-icon { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 44px 0 38px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--ground); color: var(--ink); outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .icon-btn { position: absolute; right: 4px; }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.search-results li { padding: 9px 12px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.search-results li:hover, .search-results li[aria-selected="true"] { background: var(--surface-2); }
.search-results .sr-main { font-weight: 500; }
.search-results .sr-sub { font-size: 12.5px; color: var(--muted); }
.search-results .sr-note { padding: 9px 12px; color: var(--muted); font-size: 13px; cursor: default; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.me-btn { position: relative; width: 40px; height: 40px; border: 1px solid var(--line-strong); background: var(--surface); }
.me-btn svg { width: 22px; height: 22px; }
.me-btn.is-on { color: var(--accent); border-color: var(--accent); }
.me-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--hot); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.people-list li.is-me { background: var(--accent-soft); grid-template-columns: 1fr auto; }
.people-list li.is-me .pp-name { white-space: normal; }
.people-list li.is-me .pp-actions { grid-column: 1 / -1; justify-self: end; }
.people-list .pp-me { font-size: 12px; font-weight: 600; color: var(--accent-strong); }
.people-list .pp-actions { display: inline-flex; gap: 4px; }
.mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mine-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mine-list .mi-place { grid-column: 1; font-weight: 600; }
.mine-list .mi-when { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.mine-list .mi-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.account-box { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.account-box b { font-family: var(--font-display); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; cursor: pointer; font-size: 13.5px; text-decoration: underline; }
.check.optin { margin-top: 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.check.optin.is-disabled { background: var(--surface-2); color: var(--muted); }
.notice.optin-off { margin-top: 4px; font-size: 13px; }
.notice.optin-off a { color: inherit; font-weight: 600; }
.optin-note { margin-top: 4px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-strong); }
.code-input { font-family: Consolas, Menlo, monospace; font-size: 24px; letter-spacing: .3em; text-align: center; }
.resend-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.field-row.inline { grid-template-columns: 1fr auto; align-items: center; }
.field-row.inline input { height: 40px; }
.inline-form .field { font-weight: 500; }
.modal h3 { font-size: 15px; margin: 6px 0 8px; }

/* -------- back-office */
.modal.modal-wide { width: min(1100px, 100%); }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 14px; }
.admin-counts .stat b { font-size: 22px; }
.admin-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.admin-search { flex: 1; min-width: 200px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--ground); color: var(--ink); }
.admin-tools select { height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 0 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.admin-table thead th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); white-space: nowrap; }
.admin-table tbody tr.is-open > td { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.admin-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table a { color: var(--ink); text-decoration: none; }
.admin-table a:hover { color: var(--accent); }
.th-btn { border: 0; background: transparent; font: inherit; color: inherit; padding: 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.th-btn.is-active { color: var(--accent-strong); }
tr.admin-detail > td { background: var(--ground); padding: 10px 14px 12px 44px; }
.admin-slot { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.admin-slot:last-child { border-bottom: 0; }
.admin-slot-head { margin-bottom: 6px; }
.admin-subtable { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.admin-subtable th, .admin-subtable td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.admin-subtable th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.admin-settings fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0 0 12px; }
.admin-settings legend { font-family: var(--font-display); font-weight: 700; padding: 0 6px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.settings-grid .field small { font-weight: 400; }
.hint code { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2);
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.is-on { color: var(--accent); }

/* ------------------------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-hot { background: var(--hot); color: #fff; }
.btn-hot:hover { background: var(--hot-strong); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { height: 48px; font-size: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ------------------------------------------------------------------ disposition */
.app { position: relative; height: calc(100% - var(--topbar-h)); display: flex; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.leaflet-tile-pane { filter: var(--tile-filter); }
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-zoom a { color: var(--ink) !important; background: var(--surface) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--ink-2) !important; font-size: 10.5px !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-container.is-adding { cursor: crosshair; }

.legend {
  position: absolute; left: 12px; bottom: 22px; z-index: 800; display: flex; gap: 12px; padding: 7px 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); }
.legend-dot.lvl1 { background: var(--accent); }
.legend-dot.lvl2 { background: var(--hot); border-color: var(--hot); }

.add-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 900; width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: var(--ink); color: var(--ground); border-radius: var(--radius); box-shadow: var(--shadow);
}
.add-banner .btn-ghost { color: var(--ground); border-color: color-mix(in srgb, var(--ground) 35%, transparent); }
/* Survol : fond orange, texte blanc — jamais la même couleur pour le fond et la typo */
.add-banner .btn-ghost:hover, .add-banner .btn-ghost:focus-visible { background: var(--hot); color: #fff; border-color: var(--hot); }
.add-banner .btn-ghost:focus-visible { outline-color: #fff; }
.add-banner-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13.5px; }
.add-banner-text strong { font-family: var(--font-display); font-size: 15px; }

/* -------- marqueurs */
.pin { position: relative; width: 38px; height: 38px; }
.pin-body {
  position: absolute; inset: 0; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}
.pin-count {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 14px;
  color: var(--accent-strong); font-variant-numeric: tabular-nums; padding-bottom: 2px;
}
.pin.lvl1 .pin-body { background: var(--accent); }
.pin.lvl1 .pin-count { color: var(--on-accent); }
.pin.lvl2 .pin-body { background: var(--hot); border-color: var(--hot); }
.pin.lvl2 .pin-count { color: #fff; }
.pin.is-selected .pin-body { transform: rotate(-45deg) scale(1.18); border-color: var(--ink); }
.pin.is-past .pin-body { border-style: dashed; opacity: .85; }
.pin-type { position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line-strong);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; color: var(--ink-2); }

.cluster { position: relative; width: 46px; height: 46px; }
.cluster-ring {
  position: absolute; inset: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border: 2px solid var(--accent); display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.cluster-num { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--accent-strong); line-height: 1; font-variant-numeric: tabular-nums; }
.cluster-sub { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-size: 10px; background: var(--ink); color: var(--ground); padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.cluster.lvl2 .cluster-ring { background: color-mix(in srgb, var(--hot) 26%, var(--surface)); border-color: var(--hot); }
.cluster.lvl2 .cluster-num { color: var(--hot-strong); }
.cluster.big { width: 58px; height: 58px; }
.cluster.big .cluster-num { font-size: 18px; }
/* Marchés du catalogue (visibles uniquement pendant l'ajout d'un lieu) */
.cat-pin { width: 26px; height: 26px; border-radius: 6px; background: var(--surface); border: 2px solid #D98E04; color: #8a5a00; font-family: var(--font-display); font-weight: 800; font-size: 13px; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: transform .12s ease; }
.cat-pin:hover, .cat-pin.is-active { transform: scale(1.2); background: #D98E04; color: #fff; }
.choice-grid { display: grid; gap: 10px; }
.choice-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: left; color: inherit; cursor: pointer; }
.choice-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-card b { font-family: var(--font-display); font-size: 16px; }
.choice-card small { color: var(--ink-2); font-size: 13px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid #D98E04; border-radius: var(--radius-sm); background: var(--surface); text-align: left; color: inherit; width: 100%; }
.cat-item:hover, .cat-item.is-active { background: var(--surface-2); }
.cat-item .ci-name { font-weight: 600; grid-column: 1; }
.cat-item .ci-meta { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.cat-item .ci-dist { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.draft-pin { width: 28px; height: 28px; border-radius: 50%; background: var(--hot); border: 4px solid #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--hot) 35%, transparent), var(--shadow); }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2B7DE9; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(43,125,233,.25); }

/* ------------------------------------------------------------------ volet droit */
.panel {
  position: relative; width: var(--panel-w); flex: none; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; overflow: clip; z-index: 1000;
}
.sheet-handle { display: none; }
/* clip (et non hidden) : empêche le défilement horizontal provoqué par le focus d'un champ des vues hors écran */
.panel-track { position: relative; flex: 1; min-height: 0; overflow: hidden; overflow: clip; }
.view {
  position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface);
  transition: transform .32s cubic-bezier(.2,.7,.2,1), opacity .32s ease;
  overflow: hidden;
}
.view[inert] { pointer-events: none; }
.view-list { transform: translateX(0); }
.view-list.is-out { transform: translateX(28%); opacity: 0; }
.view-detail, .view-add { transform: translateX(100%); }
.view-detail.is-in, .view-add.is-in { transform: translateX(0); }

.view-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.view-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.view-title { font-size: 19px; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.count-pill { font-family: var(--font-body); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.seg-btn { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 500;
}
.chip.is-active { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.toggle-row input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* Pastilles de type : une teinte par type, encodée dans la bordure gauche */
.type-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--ink-2); }
.type-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--type-color, var(--muted)); }
.t-marche { --type-color: #D98E04; }
.t-espace_public { --type-color: #2B7DE9; }
.t-panneau { --type-color: #8E44AD; }
.t-festival { --type-color: #E4572E; }
.t-depot { --type-color: #1F7A4D; }
.t-autre { --type-color: #7A897E; }

.place-list { list-style: none; margin: 0; padding: 8px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.place-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 12px 12px 14px; border-radius: var(--radius-sm); width: 100%;
  border: 0; background: transparent; text-align: left; color: inherit; border-left: 3px solid var(--type-color, var(--line));
}
.place-item:hover, .place-item.is-active { background: var(--surface-2); }
.place-item .pi-name { font-weight: 600; font-size: 15px; grid-column: 1; }
.place-item .pi-address { grid-column: 1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-people .hours { color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-wide { display: flex; margin-bottom: 10px; }
.seg-wide .seg-btn { flex: 1; text-align: center; cursor: pointer; }
.seg-wide input { position: absolute; opacity: 0; width: 0; height: 0; }
.place-item .pi-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.place-item .pi-when { color: var(--ink); }
.place-item .pi-when.is-past { color: var(--muted); }
.place-item .pi-count { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: center; min-width: 46px; }
.pi-count b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 800; line-height: 1; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.pi-count.lvl0 b { color: var(--muted); }
.pi-count.lvl2 b { color: var(--hot); }
.pi-count small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.empty { padding: 28px 22px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty p { margin: 0; max-width: 32ch; }

/* -------- fiche */
.detail-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 6px; border-bottom: 1px solid var(--line); flex: none; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; padding: 6px 10px 6px 6px; border-radius: 8px; }
.back-btn svg { width: 18px; height: 18px; }
.back-btn:hover { background: var(--surface-2); color: var(--ink); }
#detail-body, #add-body { overflow: auto; flex: 1; padding: 18px 18px 28px; display: flex; flex-direction: column; gap: 18px; }

.d-head { display: flex; flex-direction: column; gap: 8px; }
.d-title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.d-sub { color: var(--ink-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.d-desc { margin: 0; color: var(--ink-2); font-size: 14px; }

.d-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-strong); }
.stat.hot b { color: var(--hot); }
.stat span { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }

.d-cta { display: flex; flex-direction: column; gap: 8px; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; background: var(--warn-soft); color: var(--warn-ink); }
.notice.ok { background: var(--accent-soft); color: var(--accent-strong); }
.notice code { font-family: Consolas, Menlo, monospace; font-size: 12px; background: color-mix(in srgb, var(--warn-ink) 12%, transparent); padding: 1px 5px; border-radius: 4px; }
.modal .notice { margin-bottom: 14px; }

.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--font-body); margin: 0 0 8px; }
.section-title .opt { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.agenda { display: flex; flex-direction: column; gap: 14px; }
.week { display: flex; flex-direction: column; gap: 6px; }
.week-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.week-title.is-event::after { content: "Semaine J"; font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--hot); background: var(--hot-soft); border-radius: 999px; padding: 1px 7px; }
.slot {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.slot.is-past { background: var(--ground); border-style: dashed; }
.slot.is-today { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.slot-day { grid-row: 1 / span 2; text-align: center; font-family: var(--font-display); line-height: 1; }
.slot-day b { display: block; font-size: 20px; font-weight: 800; }
.slot-day span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.slot-time { grid-column: 2; grid-row: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-people { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-people b { color: var(--accent-strong); }
.slot-people.lvl2 b { color: var(--hot); }
.slot-action { grid-column: 3; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px; max-width: 150px; }
.slot-toggle { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; flex: none; }
.slot-toggle svg { width: 16px; height: 16px; transition: transform .2s ease; }
.slot-toggle:hover { background: var(--hot); color: #fff; border-color: var(--hot); }
.slot.is-open .slot-toggle svg { transform: rotate(180deg); }
.slot-detail { grid-column: 1 / -1; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.people-list li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--ground); font-size: 13.5px; }
.people-list .pp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-list .pp-hours { color: var(--ink-2); font-size: 12.5px; }
.slot-action .is-done { font-size: 12.5px; color: var(--accent-strong); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* -------- formulaires */
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); min-width: 0; }
.field > span { display: flex; justify-content: space-between; }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  height: 42px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: 1.4fr 1fr 1fr; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink); }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin-top: 1px; flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.form-error { color: var(--hot-strong); font-size: 13.5px; font-weight: 500; margin: 0; }
.form-error:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-opt { position: relative; }
.type-opt input { position: absolute; opacity: 0; inset: 0; }
.type-opt label {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; height: 100%;
  border-left: 4px solid var(--type-color, var(--line-strong));
}
.type-opt label b { font-size: 14px; font-weight: 600; }
.type-opt label small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.type-opt input:checked + label { background: var(--accent-soft); border-color: var(--accent); border-left-color: var(--type-color); box-shadow: 0 0 0 1px var(--accent) inset; }
.type-opt input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.near-list { display: flex; flex-direction: column; gap: 6px; }
.near-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: left; color: inherit; width: 100%; }
.near-item:hover { background: var(--surface-2); }
.near-item .ni-name { font-weight: 600; grid-column: 1; }
.near-item .ni-meta { grid-column: 1; font-size: 12.5px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.near-item .ni-count { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.near-item .ni-count.lvl0 { color: var(--muted); }
.near-item .ni-count.lvl2 { color: var(--hot); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* -------- modale */
.modal-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 16, 12, .5); display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; max-height: calc(100% - 32px); overflow: auto; }
.modal h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.modal .m-sub { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 2500; margin: 0 auto; max-width: 720px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px;
}
.consent > span:first-child { flex: 1 1 320px; }
.consent-actions { display: inline-flex; gap: 6px; margin-left: auto; }
@media (max-width: 760px) { .consent { bottom: calc(38vh + 12px); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 3000; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ tablette */
@media (max-width: 1024px) { :root { --panel-w: 360px; } }

/* ------------------------------------------------------------------ mobile : le volet devient un tiroir bas */
@media (max-width: 760px) {
  :root { --topbar-h: 104px; }
  .topbar { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 10px; padding: 8px 12px; }
  .brand { grid-column: 1; grid-row: 1; }
  .topbar-actions { grid-column: 2; grid-row: 1; }
  .add-btn { height: 36px; padding: 0 12px; }
  .me-btn { width: 36px; height: 36px; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .search input { height: 38px; }
  .brand-sub { font-size: 11.5px; }

  .app { flex-direction: column; }
  .map-wrap { flex: 1; }
  .legend { bottom: auto; top: 12px; left: 12px; font-size: 11px; gap: 8px; padding: 5px 10px; }
  .add-banner { top: auto; bottom: calc(38vh + 12px); }
  .leaflet-bottom { bottom: 0; }

  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 38vh; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.14);
    transition: height .28s cubic-bezier(.2,.7,.2,1);
  }
  .panel[data-sheet="full"] { height: calc(100% - 8px); }
  .sheet-handle { display: grid; place-items: center; height: 22px; border: 0; background: transparent; flex: none; width: 100%; }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 999px; background: var(--line-strong); }
  .view-head { padding-top: 6px; }
  .view-title { font-size: 17px; }
  #detail-body, #add-body { padding: 14px 14px 24px; }
  .d-title { font-size: 21px; }
  .type-grid { grid-template-columns: 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
  .slot { grid-template-columns: 48px 1fr; }
  .slot-people { white-space: normal; }
  .slot-action { grid-row: 3; grid-column: 2; justify-self: start; margin-top: 4px; }
  .slot-detail { grid-row: 4; }
  .people-list li { grid-template-columns: 1fr auto; }
  .people-list li .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 400px) {
  .add-btn span { display: none; }
  .add-btn { width: 36px; padding: 0; border-radius: 50%; }
}
