/* A2Pas — PWA événements autour de soi
   Monde visuel : une app de sortie précise et colorée. Fond calme, bandeau
   « agenda » bleu nuit (signature : calendrier à densité aux couleurs des
   catégories, pastille de sélection qui glisse), couleurs de catégories
   franches, accent outremer-violet réservé aux actions. */

@font-face {
  font-family: "Onest";
  src: url("../fonts/onest-latin.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  src: url("../fonts/onest-latin-ext.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --surface-3: #e3e5ef;
  --border: #e6e8f0;
  --text: #121433;
  --text-2: #484d68;
  --text-3: #686d87;
  --ink: #141640;            /* bandeau agenda, éléments actifs */
  --ink-2: #23265c;
  --on-ink: #ffffff;
  --on-ink-2: rgba(255, 255, 255, .66);
  --accent: #5b3df5;
  --accent-2: #4a2ce0;
  --accent-soft: #efebff;
  --accent-ink: #ffffff;
  --success: #12733a;
  --success-soft: #e3f6ea;
  --danger: #d4183d;
  --danger-soft: #fdecef;
  --shadow-sm: 0 1px 2px rgba(18, 20, 51, .06), 0 1px 3px rgba(18, 20, 51, .08);
  --shadow: 0 10px 30px -6px rgba(18, 20, 51, .18), 0 2px 6px rgba(18, 20, 51, .06);
  --shadow-up: 0 -12px 40px -8px rgba(18, 20, 51, .2), 0 -1px 3px rgba(18, 20, 51, .05);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 24px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sheet-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --logo-hole: var(--surface);
  color-scheme: light;
}
html.dark {
  --bg: #090a14;
  --surface: #13142a;
  --surface-2: #1b1d37;
  --surface-3: #2a2c4c;
  --border: #24264a;
  --text: #eef0fa;
  --text-2: #b2b6d0;
  --text-3: #8d92b2;
  --ink: #1e2052;
  --ink-2: #2b2e6a;
  --accent: #8f7bff;
  --accent-2: #a594ff;
  --accent-soft: rgba(143, 123, 255, .16);
  --accent-ink: #0b0a1f;
  --success: #5ad48a;
  --success-soft: rgba(90, 212, 138, .14);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 12px 34px -6px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-up: 0 -12px 40px -8px rgba(0, 0, 0, .65);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; height: 100dvh; }
body {
  font-family: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.4;
  background: var(--bg); color: var(--text);
  overscroll-behavior: none; overflow: hidden;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; caret-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--ring); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.ic {
  width: 20px; height: 20px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Boutons génériques ---------- */
.round-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); transition: transform .2s var(--ease), color .15s;
}
.round-btn:hover { color: var(--accent); }
.round-btn:active { transform: scale(.92); }
.round-btn.active { color: var(--accent); }
.ghost-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-2);
  transition: background .15s;
}
.ghost-btn:hover { background: var(--surface-2); }
.link-btn { color: var(--accent); font-weight: 600; font-size: 14px; padding: 8px 4px; }
.btn {
  min-height: 50px; padding: 0 1.25rem; border-radius: var(--r);
  font-size: 15.5px; font-weight: 650; letter-spacing: -.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .15s var(--ease), background .15s, box-shadow .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Carte ---------- */
#map { position: fixed; inset: 0; z-index: 1; }
#leaflet-map { position: absolute; inset: 0; background: var(--surface-2); }
.leaflet-container { font-family: inherit; background: var(--surface-2); }
.leaflet-control-attribution {
  font-size: 10px; background: color-mix(in srgb, var(--surface) 78%, transparent) !important;
  color: var(--text-3); border-radius: 8px 0 0 0; padding: 0 6px !important;
}
.leaflet-control-attribution a { color: var(--text-2); }
.leaflet-bottom.leaflet-right { bottom: var(--sheet-h); transition: bottom .38s var(--ease); }
/* Plan IGN adouci (les pins ressortent) ; inversé en mode sombre. Aérien : intact. */
.tiles-base { filter: saturate(.62) contrast(.96) brightness(1.03); }
html.dark .tiles-base { filter: invert(1) hue-rotate(180deg) saturate(.5) brightness(.88) contrast(.9); }
.aerial .tiles-base { filter: saturate(1.05) contrast(1.02); }
html.dark .aerial .tiles-base { filter: brightness(.8) saturate(.95); }

/* position de l'utilisateur */
.user-dot-wrap { position: relative; }
.user-dot { position: absolute; inset: 2px; border-radius: 50%; background: #2f6bff; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.user-pulse { position: absolute; inset: 2px; border-radius: 50%; background: #2f6bff; animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .45; } 100% { transform: scale(3.4); opacity: 0; } }

/* pins : goutte colorée + icône blanche */
.ev-marker { background: none; border: 0; }
.pin-wrap { width: 36px; height: 36px; transform-origin: 18px 42px; transition: transform .3s var(--ease); }
.pin-wrap.fresh { animation: pin-in .42s var(--ease) backwards; }
@keyframes pin-in { from { opacity: 0; transform: translateY(-16px) scale(.6); } }
.pin {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 7px;
  background: var(--c); border: 2.5px solid #fff; color: #fff;
  transform: rotate(-45deg);
  box-shadow: -2px 4px 10px -2px rgba(18, 20, 51, .45);
  display: flex; align-items: center; justify-content: center;
}
.pin .ic { transform: rotate(45deg); width: 17px; height: 17px; stroke-width: 2.2; }
.leaflet-marker-pane .ev-marker .pin img { transform: rotate(45deg); width: 25px; height: 25px; border-radius: 50%; background: #fff; object-fit: contain; }
.ev-marker.sel { z-index: 10000 !important; }
.ev-marker.sel .pin-wrap { transform: scale(1.32); }
.ev-marker.sel .pin { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 32%, transparent), -2px 6px 14px -2px rgba(18, 20, 51, .5); }
.ev-cluster { background: none; border: 0; }
.cluster {
  border-radius: 50%; padding: 4px; background: var(--g);
  box-shadow: 0 6px 16px -4px rgba(18, 20, 51, .45);
  transition: transform .25s var(--ease);
  animation: pin-in .42s var(--ease) backwards;
}
.cluster:hover { transform: scale(1.08); }
.cluster span {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text); font-weight: 750; font-size: 14px; font-variant-numeric: tabular-nums;
}

/* ---------- Barre de recherche ---------- */
#topbar {
  position: fixed; z-index: 1100;
  top: calc(10px + var(--safe-t)); left: 12px; right: 12px;
  display: flex; gap: 8px; align-items: center;
  transition: opacity .2s, transform .3s var(--ease);
}
.searchbox {
  flex: 1; min-width: 0; height: 50px;
  display: flex; align-items: center; gap: 4px; padding: 0 5px 0 7px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.searchbox:focus-within { box-shadow: var(--shadow), var(--ring); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; --logo-hole: var(--ink);
}
html.dark .brand-mark { background: var(--accent); color: var(--accent-ink); --logo-hole: var(--accent); }
.brand-mark .ic { width: 19px; height: 19px; }
#search-input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; font-weight: 500; padding: 0 6px;
}
#search-input::placeholder { color: var(--text-3); font-weight: 450; }
#search-input::-webkit-search-cancel-button { display: none; }
.lang-btn { font-weight: 700; font-size: 13px; letter-spacing: .03em; }

.search-results {
  position: absolute; top: 58px; left: 0; right: 0; list-style: none;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  padding: 6px; max-height: min(60vh, 420px); overflow-y: auto;
  animation: pop .22s var(--ease);
}
.search-results button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px; border-radius: var(--r); }
.search-results button:hover, .search-results li[aria-selected="true"] button { background: var(--surface-2); }
.sr-icon { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.sr-mine .sr-icon { background: var(--accent-soft); color: var(--accent); }
.sr-text { min-width: 0; }
.sr-text strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-text small { display: block; color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .sr-msg { padding: 14px 12px; color: var(--text-3); font-size: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

.search-here {
  position: fixed; z-index: 1050; left: 50%; top: calc(72px + var(--safe-t));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow); animation: drop .3s var(--ease);
}
.search-here .ic { width: 17px; height: 17px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- Contrôles flottants ---------- */
#map-controls {
  position: fixed; z-index: 1040; right: 12px;
  bottom: calc(var(--sheet-h) + 14px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  transition: bottom .38s var(--ease), opacity .2s;
}
body.sheet-dragging #map-controls, body.sheet-dragging .leaflet-bottom.leaflet-right { transition: none; }
.fab {
  height: 56px; min-width: 56px; padding: 0 18px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent), var(--shadow-sm);
  transition: transform .2s var(--ease), background .15s;
}
.fab .ic { width: 24px; height: 24px; stroke-width: 2.4; }
.fab:hover { background: var(--accent-2); }
.fab:active { transform: scale(.94); }
#add-btn-label { display: none; }
body.sheet-full #map-controls, body.detail-open #map-controls { opacity: 0; pointer-events: none; }

.layers { position: relative; }
.layers-menu {
  position: absolute; right: 56px; bottom: 0;
  display: flex; gap: 8px; padding: 8px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
  transform-origin: right bottom; animation: pop-side .26s var(--ease);
}
@keyframes pop-side { from { opacity: 0; transform: translateX(8px) scale(.94); } }
.layer-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.layer-thumb {
  width: 76px; height: 56px; border-radius: 12px; background-size: cover; background-position: center; background-color: var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: box-shadow .2s, transform .2s var(--ease);
}
.layer-thumb.plan { background-image: url("https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&TILEMATRIX=14&TILEROW=5636&TILECOL=8299"); }
.layer-thumb.aerial { background-image: url("https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/jpeg&TILEMATRIX=14&TILEROW=5636&TILECOL=8299"); }
.layer-opt:hover .layer-thumb { transform: scale(1.04); }
.layer-opt[aria-checked="true"] { color: var(--accent); }
.layer-opt[aria-checked="true"] .layer-thumb { box-shadow: 0 0 0 2.5px var(--accent); }

/* ---------- Bottom sheet ---------- */
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1060;
  height: 55dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-up);
  padding-bottom: var(--safe-b);
  transition: height .38s var(--ease);
  overflow: hidden;
}
body.sheet-dragging #sheet { transition: none; }
#sheet-grab { flex: 0 0 auto; touch-action: none; cursor: grab; padding-bottom: 10px; }
#sheet-handle { display: block; width: 100%; height: 20px; padding-top: 8px; cursor: grab; }
#sheet-handle span { display: block; width: 40px; height: 5px; border-radius: 3px; margin: 0 auto; background: var(--surface-3); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 2px 16px 0 18px; }
.sheet-head-text { flex: 1; min-width: 0; }
#list-title { font-size: 22px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
#list-sub { font-size: 13.5px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-link {
  color: var(--accent); font-weight: 650; font-size: inherit;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
.badge {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 10px 0 8px; border-radius: 999px;
  background: #fff3e6; color: #b4470a; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
html.dark .badge { background: rgba(251, 146, 60, .14); color: #fdba74; }
.badge .ic { width: 15px; height: 15px; }
.filter-btn {
  position: relative; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 14px;
  transition: background .2s, color .2s;
}
.filter-btn .ic { width: 18px; height: 18px; }
.filter-btn:hover { background: var(--surface-3); }
.filter-btn.on, #sheet.filters-open .filter-btn { background: var(--ink); color: #fff; }
html.dark .filter-btn.on, html.dark #sheet.filters-open .filter-btn { background: var(--accent); color: var(--accent-ink); }
.filter-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 750;
  animation: pop .3s var(--ease);
}
html.dark .filter-count { background: var(--accent-ink); color: var(--accent); }

#sheet-views { position: relative; flex: 1 1 0%; min-height: 0; display: flex; }
.sheet-view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#view-list { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 20px; }
#view-list > * { flex-shrink: 0; }
#view-filters { animation: view-in .34s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateX(28px); } }
#sheet.filters-open #view-list { display: none; }

/* --- Bandeau agenda (signature) --- */
.agenda {
  margin: 2px 12px 0; padding: 12px 0 10px; border-radius: 20px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 34%, transparent) 0%, transparent 55%),
    var(--ink);
  color: var(--on-ink);
  box-shadow: 0 14px 30px -18px rgba(20, 22, 64, .9);
}
.presets { display: flex; gap: 6px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets button {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .09); color: var(--on-ink);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .2s, color .2s;
}
.presets button:hover { background: rgba(255, 255, 255, .16); }
.presets button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.presets .ic { width: 15px; height: 15px; }
.ribbon { overflow-x: auto; scrollbar-width: none; margin-top: 8px; scroll-padding: 0 12px; }
.ribbon::-webkit-scrollbar { display: none; }
.ribbon-track { position: relative; display: flex; padding: 0 8px; width: max-content; }
.ribbon-sel {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 16px; background: #fff;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .55);
  transition: transform .45s var(--ease), width .45s var(--ease), opacity .2s;
  pointer-events: none;
}
.day {
  position: relative; width: 46px; flex: 0 0 46px;
  display: flex; flex-direction: column; align-items: center;
  padding: 7px 0 6px; border-radius: 16px; color: var(--on-ink);
  transition: color .3s var(--ease);
}
.day:hover:not(.in) { background: rgba(255, 255, 255, .06); }
.day .dow { font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--on-ink-2); transition: color .3s; }
.day.we .dow { color: #c7bcff; }
.day .dnum { font-size: 17px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.day.today .dnum::after { content: ''; display: block; width: 4px; height: 4px; margin: 1px auto 0; border-radius: 50%; background: currentColor; }
.day .bars { height: 30px; width: 18px; display: flex; align-items: flex-end; margin-top: 3px; }
.day .bar {
  width: 100%; height: 0; border-radius: 4px 4px 2px 2px; overflow: hidden;
  display: flex; flex-direction: column-reverse;
  transition: height .5s var(--ease);
}
.day .bar i { display: block; min-height: 2px; }
.day.in { color: var(--ink); }
.day.in .dow { color: color-mix(in srgb, var(--ink) 60%, #fff); }
.day.in.we .dow { color: var(--accent); }
html.dark .day.in.we .dow { color: #5b3df5; }
.ribbon-hint {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  margin: 0 14px; font-size: 12.5px; color: var(--on-ink-2); overflow: hidden;
  transition: grid-template-rows .3s var(--ease), opacity .3s, margin .3s var(--ease);
}
.ribbon-hint.show { grid-template-rows: 1fr; opacity: 1; margin-top: 8px; }

/* --- Puces --- */
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 2px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
/* dégradé sur les bords quand des catégories dépassent */
.chips-row { --fl: 0px; --fr: 0px; -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); }
.chips-row.fade-l { --fl: 32px; }
.chips-row.fade-r { --fr: 32px; }
.chips-row.dragging { cursor: grabbing; user-select: none; }
.chips-row.dragging .chip { pointer-events: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .2s, box-shadow .2s, color .2s, transform .15s var(--ease);
}
.chip:hover { background: var(--surface-3); }
.chip:active { transform: scale(.96); }
.chip .ic { width: 16px; height: 16px; color: var(--c); stroke-width: 2.2; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
html.dark .chip[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.chip.cat[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--c); }
html.dark .chip.cat[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 28%, var(--surface)); }
html.dark .chip .ic { color: color-mix(in srgb, var(--c) 70%, #fff); }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
.active-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 8px 0 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 650;
  animation: pop .25s var(--ease);
}
.active-chip .ic { width: 15px; height: 15px; }

/* --- Liste --- */
.event-list { padding: 8px 10px 0; }
.day-head {
  position: sticky; top: 0; z-index: 2;
  padding: 14px 8px 6px; background: var(--surface);
  font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
}
.ev-card {
  width: 100%; display: flex; align-items: center; gap: 13px; text-align: left;
  padding: 10px 8px; border-radius: 16px;
  transition: background .2s, transform .15s var(--ease);
}
.ev-card + .ev-card { margin-top: 2px; }
.ev-card:hover { background: var(--surface-2); }
.ev-card:active { transform: scale(.985); }
.ev-card.sel { background: var(--accent-soft); }
.ev-card.enter { animation: card-in .44s var(--ease) backwards; animation-delay: calc(var(--i) * 30ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }
.ev-thumb {
  position: relative; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 82%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 82%, #000) 100%);
  box-shadow: 0 8px 16px -10px var(--c);
}
.ev-thumb > .ic { width: 22px; height: 22px; stroke-width: 2.1; }
/* logo/image de l'organisateur : entier (contain) sur fond blanc, liseré catégorie */
.ev-thumb.has-img { background: #fff; box-shadow: inset 0 0 0 2px var(--c), 0 8px 16px -10px var(--c); }
.ev-thumb > img { width: 100%; height: 100%; padding: 4px; border-radius: 15px; object-fit: contain; }
.ev-thumb .rec {
  position: absolute; right: -5px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--c); box-shadow: var(--shadow-sm);
}
.ev-thumb .rec .ic { width: 12px; height: 12px; stroke-width: 2.8; }
.ev-body { flex: 1; min-width: 0; }
.ev-title { display: block; font-weight: 650; font-size: 15.5px; letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s; }
.ev-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.ev-meta .when { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ev-meta .dot { color: var(--text-3); }
.ev-meta .place { overflow: hidden; text-overflow: ellipsis; }
.ev-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ev-dist { font-size: 12.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ev-price { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.ev-price.free { background: var(--success-soft); color: var(--success); }
.ev-hidden { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12.5px; font-weight: 650; color: var(--danger); }
.ev-hidden .ic { width: 13px; height: 13px; }
.ev-src { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; }

.skel { display: flex; align-items: center; gap: 13px; padding: 10px 8px; }
.skel i { display: block; border-radius: 8px; background: var(--surface-2); position: relative; overflow: hidden; }
.skel i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.2s infinite; transform: translateX(-100%); }
.skel .s-thumb { width: 48px; height: 48px; border-radius: 15px; flex: 0 0 auto; }
.skel .s-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty { padding: 28px 20px 12px; text-align: center; animation: card-in .4s var(--ease); }
.empty-art { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.empty-art .ic { width: 32px; height: 32px; stroke-width: 1.8; }
.empty h3 { font-size: 17px; font-weight: 700; }
.empty p { color: var(--text-2); font-size: 14px; margin: 4px auto 16px; max-width: 290px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.empty-actions .chip { background: var(--accent-soft); color: var(--accent); }

/* --- Vue Filtres --- */
.fv-head { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 0 12px 6px 6px; }
.fv-head h2 { flex: 1; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.fv-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px 20px; }
.fv-sec { padding: 18px 0; border-bottom: 1px solid var(--border); border-radius: 4px; }
.fv-sec:last-child { border-bottom: 0; }
.fv-sec.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 30% { background: var(--accent-soft); box-shadow: 0 0 0 10px var(--accent-soft); } 100% { background: transparent; box-shadow: 0 0 0 10px transparent; } }
.fv-sec h3 { display: flex; align-items: baseline; justify-content: space-between; font-size: 15.5px; font-weight: 700; margin-bottom: 12px; }
.fv-sec h3 output { font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.fv-hint { margin: -6px 0 12px; font-size: 13.5px; color: var(--text-2); }
.fv-error { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--danger); }
.date-pair { display: flex; align-items: flex-end; gap: 8px; }
.date-pair label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.date-pair input {
  width: 100%; height: 48px; padding: 0 12px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15.5px; font-weight: 600; text-transform: none; letter-spacing: 0;
}
.date-pair input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.date-pair-sep { width: 10px; height: 2px; margin-bottom: 23px; border-radius: 1px; background: var(--surface-3); flex: 0 0 auto; }
.mini-presets { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.mini-presets button { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; transition: background .15s; }
.mini-presets button:hover { background: var(--surface-3); }
.price-range { margin-top: 16px; }
.price-range-head { font-size: 14px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.dual-range { position: relative; height: 34px; }
.dual-range::before { content: ''; position: absolute; left: 0; right: 0; top: 14px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.dual-fill { position: absolute; top: 14px; height: 6px; border-radius: 3px; background: var(--accent); }
.dual-range input {
  position: absolute; inset: 0; width: 100%; height: 34px; margin: 0;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none;
}
.dual-range input::-webkit-slider-runnable-track { height: 34px; background: none; }
.dual-range input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: grab;
  width: 26px; height: 26px; margin-top: 4px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(18, 20, 51, .1), 0 3px 10px rgba(18, 20, 51, .3);
}
.dual-range input::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(18, 20, 51, .3); }
.dual-range input::-moz-range-track { background: none; }
.dual-range input:focus-visible { box-shadow: none; }
.dual-range input:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring), 0 3px 10px rgba(18, 20, 51, .3); }
.switch-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; cursor: pointer; transition: opacity .2s; }
.switch-row > span { flex: 1; min-width: 0; }
.switch-row strong { display: block; font-size: 14.5px; font-weight: 600; }
.switch-row small { display: block; font-size: 13px; color: var(--text-2); margin-top: 1px; }
.switch-row.disabled { opacity: .45; pointer-events: none; }
.switch {
  -webkit-appearance: none; appearance: none; flex: 0 0 auto; cursor: pointer;
  width: 48px; height: 28px; border-radius: 999px; background: var(--surface-3); position: relative;
  transition: background .25s var(--ease);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(18, 20, 51, .3); transition: transform .3s var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.fv-foot { flex: 0 0 auto; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }

#radius {
  --p: 40%; width: 100%; height: 30px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
#radius::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p), var(--surface-3) var(--p)); }
#radius::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-3); }
#radius::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
#radius::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(18, 20, 51, .1), 0 3px 10px rgba(18, 20, 51, .3); }
#radius::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(18, 20, 51, .3); }
#radius:focus-visible { box-shadow: none; }
#radius:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring), 0 3px 10px rgba(18, 20, 51, .3); }

/* tuiles catégories (filtres + formulaire) */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 2px 9px; border-radius: var(--r);
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 11.5px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.15;
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.cat-tile:active { transform: scale(.96); }
.cat-ic {
  width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--c);
  transition: background .2s, color .2s;
}
html.dark .cat-ic { color: color-mix(in srgb, var(--c) 70%, #fff); background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.cat-ic .ic { width: 19px; height: 19px; }
.cat-tile[aria-checked="true"], .cat-tile[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); color: var(--text); }
.cat-tile[aria-checked="true"] .cat-ic, .cat-tile[aria-pressed="true"] .cat-ic { background: var(--c); color: #fff; }

.segmented { display: flex; padding: 4px; gap: 4px; border-radius: var(--r); background: var(--surface-2); }
.segmented button { flex: 1; height: 40px; border-radius: 10px; font-weight: 650; font-size: 14.5px; color: var(--text-2); transition: background .25s var(--ease), color .2s, box-shadow .25s; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
html.dark .segmented button[aria-checked="true"] { background: var(--surface-3); }
.modal-body .segmented { background: var(--surface-3); }
html.dark .modal-body .segmented { background: var(--surface-2); }

/* ---------- Fiche événement ---------- */
#detail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1080; pointer-events: none; }
.detail-card {
  pointer-events: auto; position: relative;
  max-height: min(80dvh, 660px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-up);
  padding: 0 0 calc(18px + var(--safe-b));
  animation: slideup .42s var(--ease);
}
@keyframes slideup { from { transform: translateY(100%); } }
.detail-card > * { animation: fade-up .5s var(--ease) backwards; }
.detail-card > :nth-child(2) { animation-delay: 60ms; }
.detail-card > :nth-child(3) { animation-delay: 110ms; }
.detail-card > :nth-child(4) { animation-delay: 150ms; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.d-hero { position: relative; padding: 22px 20px 14px; background: linear-gradient(170deg, color-mix(in srgb, var(--c) 17%, var(--surface)) 0%, var(--surface) 80%); }
.d-close { position: absolute; top: 12px; right: 12px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.d-icon {
  width: 54px; height: 54px; border-radius: 17px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 82%, #000));
  box-shadow: 0 12px 22px -10px var(--c);
}
.d-icon .ic { width: 26px; height: 26px; }
.d-icon.has-img { width: 76px; height: 76px; border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 2px var(--c), 0 12px 22px -12px var(--c); }
.d-icon > img { width: 100%; height: 100%; padding: 6px; border-radius: 20px; object-fit: contain; }
.d-title { font-size: 23px; font-weight: 750; letter-spacing: -.025em; line-height: 1.18; margin-top: 14px; padding-right: 36px; text-wrap: balance; -webkit-user-select: text; user-select: text; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.tag .ic { width: 14px; height: 14px; }
.tag.cat-tag { background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--text)); }
html.dark .tag.cat-tag { color: color-mix(in srgb, var(--c) 55%, #fff); }
.d-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; padding: 8px 20px 4px; }
.d-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px 10px; border-radius: var(--r);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 650;
  text-decoration: none; transition: background .15s, transform .15s var(--ease);
}
.d-action:hover { background: var(--surface-3); }
.d-action:active { transform: scale(.95); }
.d-action .ic { width: 22px; height: 22px; }
.d-action.primary { background: var(--accent); color: var(--accent-ink); }
.d-action.primary:hover { background: var(--accent-2); }
.d-action.danger { color: var(--danger); }
.d-action.danger.armed { background: var(--danger); color: #fff; }
.d-hidden { display: flex; gap: 12px; margin: 12px 20px 0; padding: 12px 14px; border-radius: var(--r); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.d-hidden strong { display: block; font-weight: 700; color: var(--danger); }
.d-hidden span { color: var(--text-2); }
.d-hidden .ic { flex: 0 0 auto; margin-top: 1px; }
.d-rows { padding: 8px 20px 0; }
.d-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.d-row:last-child { border-bottom: 0; }
.d-row > .ic { color: var(--text-3); margin-top: 1px; }
.d-row strong { display: block; font-weight: 600; }
.d-row small { display: block; color: var(--text-2); font-size: 13.5px; margin-top: 1px; }
.d-row > div { min-width: 0; }
.d-row .url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-row a { color: var(--accent); text-decoration: none; }
.d-desc { padding: 6px 20px 0; color: var(--text-2); line-height: 1.6; max-width: 68ch; white-space: pre-line; -webkit-user-select: text; user-select: text; }

/* ---------- Formulaire d'ajout ---------- */
#add-panel, #auth-panel {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(9, 10, 26, .5);
  animation: fade .25s ease;
}
#add-panel.hidden, #auth-panel.hidden { display: none; }
#auth-panel { z-index: 1300; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg); animation: slideup .42s var(--ease); }
.modal-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px; background: var(--bg); }
.modal-head h2 { flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.modal-head-spacer { width: 40px; }
.modal-body { flex: 1; overflow-y: auto; padding: 4px 18px 24px; overscroll-behavior: contain; }
.modal-foot { flex: 0 0 auto; padding: 12px 18px calc(12px + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--border); }

.field { margin-top: 20px; min-width: 0; }
.field:first-child { margin-top: 8px; }
.field > label, .field > .label, .price-inputs label { display: block; font-size: 13.5px; font-weight: 650; color: var(--text-2); margin-bottom: 7px; }
.field .opt { font-style: normal; font-weight: 500; color: var(--text-3); }
.field input[type="text"], .field input[type="email"], .field input[type="date"], .field input[type="time"], .field input[type="number"], .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.field textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.field-row .field { margin-top: 20px; }
.price-inputs { margin-top: 12px; grid-template-columns: 1fr 1fr; }
.price-inputs label { margin-bottom: 0; }
.price-inputs input { margin-top: 7px; }
.field-error { display: none; color: var(--danger); font-size: 13px; font-weight: 600; margin-top: 6px; }
.field.invalid .field-error { display: block; }
.field.invalid input, .field.invalid .place-btn { border-color: var(--danger); }
.field.invalid .place-btn { background: var(--danger-soft); }
.field.invalid { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.day-picker { display: flex; gap: 6px; }
.day-picker button { flex: 1; height: 42px; border-radius: 12px; font-weight: 650; font-size: 13.5px; background: var(--surface); border: 1.5px solid var(--border); color: var(--text-2); transition: background .2s, color .2s, border-color .2s; }
.day-picker button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
html.dark .day-picker button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-picker button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--surface); border: 1.5px solid var(--border); color: var(--text-2); transition: background .2s, color .2s, border-color .2s; }
.chip-picker button .ic { width: 16px; height: 16px; display: none; }
.chip-picker button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-picker button[aria-pressed="true"] .ic { display: block; }
html.dark .chip-picker button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.addr-field { position: relative; }
.addr-results { top: calc(100% + 6px); z-index: 5; max-height: 290px; }
.place-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px;
  border-radius: var(--r); background: var(--accent-soft); border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text);
}
.place-btn.set { border-style: solid; border-color: var(--border); background: var(--surface); }
.place-btn-icon { width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); }
.place-btn.set .place-btn-icon { background: var(--success); color: #fff; }
.place-btn-text { flex: 1; min-width: 0; }
.place-btn-text strong { display: block; font-weight: 650; color: var(--accent); }
.img-pick { display: flex; align-items: center; gap: 8px; }
.img-pick .place-btn { cursor: pointer; }
.img-pick .place-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.img-pick-thumb { width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); overflow: hidden; }
.img-pick .place-btn.set .img-pick-thumb { background: #fff; box-shadow: inset 0 0 0 1px var(--border); }
.img-pick-thumb img { width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.place-btn.set .place-btn-text strong { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-btn-text small { display: block; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-btn .chev { color: var(--text-3); }

/* ---------- Connexion (code e-mail) ---------- */
.auth-card { height: auto; border-radius: 26px 26px 0 0; padding-bottom: var(--safe-b); }
.auth-intro { margin-top: 4px; color: var(--text-2); line-height: 1.5; }
.auth-sent { margin-top: 12px; color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.code-input { letter-spacing: .35em; font-variant-numeric: tabular-nums; font-weight: 650; text-align: center; }
.auth-links { margin-top: 10px; font-size: 13.5px; color: var(--text-3); }
.auth-submit { margin-top: 22px; }
.link-btn { padding: 0; background: none; border: 0; font: inherit; font-weight: 650; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.account-line { margin-top: 10px; text-align: center; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }

/* ---------- Mode « placer sur la carte » ---------- */
body.picking #topbar, body.picking #sheet, body.picking #map-controls, body.picking #search-here, body.picking #detail { opacity: 0; pointer-events: none; }
body.picking #sheet { transform: translateY(100%); }
body.picking .leaflet-bottom.leaflet-right { bottom: 0; }
#pick-overlay { position: fixed; inset: 0; z-index: 1150; pointer-events: none; }
.pick-hint {
  position: absolute; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; white-space: nowrap;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow);
  animation: drop .32s var(--ease);
}
.pick-pin { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -46px 0 0 -24px; color: var(--accent); --logo-hole: #fff; filter: drop-shadow(0 6px 8px rgba(18, 20, 51, .35)); transition: transform .2s var(--ease); }
.pick-pin .ic { width: 48px; height: 48px; }
.pick-shadow { position: absolute; left: 50%; bottom: -4px; width: 12px; height: 4px; margin-left: -6px; border-radius: 50%; background: rgba(18, 20, 51, .35); transition: transform .2s var(--ease); }
body.map-moving .pick-pin { transform: translateY(-12px); }
.pick-bar { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: auto; display: flex; gap: 10px; padding: 14px 16px calc(14px + var(--safe-b)); background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-up); animation: slideup .36s var(--ease); }
.pick-bar .btn { flex: 1; }
.pick-bar .btn.primary { flex: 1.6; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; z-index: 1300; left: 50%; top: calc(72px + var(--safe-t));
  max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px;
  transform: translate(-50%, -14px) scale(.98);
  padding: 12px 8px 12px 16px; border-radius: 16px; min-height: 48px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .4s var(--ease);
}
html.dark #toast { background: #eef0fa; color: #121433; }
#toast-msg { padding-right: 8px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast-action { flex: 0 0 auto; padding: 6px 10px; border-radius: 10px; color: #b9adff; font-weight: 700; }
html.dark #toast-action { color: var(--accent-ink); background: var(--accent); }

/* ---------- Desktop / tablette paysage ---------- */
@media (min-width: 900px) {
  :root { --panel-w: 420px; }
  #topbar { left: 16px; right: auto; top: 16px; width: var(--panel-w); }
  .search-here { top: 20px; left: calc(50% + (var(--panel-w) + 16px) / 2); }
  #toast { top: 20px; left: calc(50% + (var(--panel-w) + 16px) / 2); }
  .pick-hint { top: 20px; }
  #sheet { top: 82px; left: 16px; bottom: 16px; right: auto; width: var(--panel-w); height: auto !important; border-radius: var(--r-lg); box-shadow: var(--shadow); padding-bottom: 0; }
  #sheet-handle { display: none; }
  #sheet-grab { cursor: default; padding-top: 16px; }
  #map-controls { right: 16px; bottom: 28px; }
  #add-btn-label { display: inline; }
  body.sheet-full #map-controls, body.detail-open #map-controls { opacity: 1; pointer-events: auto; }
  .leaflet-bottom.leaflet-right { bottom: 0; }
  #detail { left: calc(16px + var(--panel-w) + 12px); right: auto; top: 82px; bottom: auto; width: 380px; }
  .detail-card { max-height: calc(100dvh - 100px); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: pop-side-l .34s var(--ease); padding-bottom: 18px; }
  #add-panel, #auth-panel { align-items: center; }
  .modal-card.auth-card { width: 420px; border-radius: 26px; padding-bottom: 0; }
  .modal-card { width: 540px; height: auto; max-height: min(880px, calc(100dvh - 48px)); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); animation: pop .3s var(--ease); }
  .modal-head { padding-top: 10px; }
  .pick-bar { left: 50%; right: auto; bottom: 24px; width: 440px; transform: translateX(-50%); border-radius: 20px; animation: none; }
}
@keyframes pop-side-l { from { opacity: 0; transform: translateX(-14px) scale(.98); } }

/* écrans courts : bandeau agenda plus compact pour laisser voir la liste */
@media (max-height: 740px) and (max-width: 899px) {
  #list-title { font-size: 20px; }
  .agenda { padding: 9px 0 7px; }
  .presets button { height: 29px; font-size: 13px; padding: 0 11px; }
  .ribbon { margin-top: 6px; }
  .day { padding: 5px 0 4px; }
  .day .dnum { font-size: 15.5px; }
  .day .bars { height: 20px; }
  .chips-row { padding-top: 10px; }
  .chip { height: 34px; }
}

@media (hover: hover) {
  .ev-card:hover .ev-title { color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .ribbon-sel { transition: opacity .2s !important; }
}
