:root {
  --bg: #0c0912;
  --panel: #17111f;
  --panel-2: #21162e;
  --text: #f8f2ff;
  --muted: #b8a9c6;
  --orange: #ff7a00;
  --orange-2: #ff9d2e;
  --purple: #7f4bff;
  --green: #8ddf3c;
  --danger: #d84b56;
  --line: rgba(255,255,255,.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
body { background-image: radial-gradient(circle at 15% -5%, rgba(127,75,255,.23), transparent 28%), radial-gradient(circle at 90% 0%, rgba(255,122,0,.18), transparent 30%); }
button, input, select, textarea { font: inherit; }
button:disabled { opacity: .55; cursor: wait; }
.hero { padding: 32px 18px 20px; border-bottom: 1px solid var(--line); }
.hero__inner { max-width: 1250px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.hero-btn { white-space: nowrap; }
.eyebrow { margin: 0 0 5px; letter-spacing: .18em; font-size: .75rem; font-weight: 900; color: var(--orange-2); }
h1 { margin: 0; font-size: clamp(2.1rem, 5vw, 4.6rem); line-height: .95; letter-spacing: -.045em; }
.subtitle { max-width: 760px; margin: 12px 0 0; color: var(--muted); font-size: 1.05rem; }
main { max-width: 1250px; margin: auto; padding: 18px; }
.status-strip { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; color: #f5c896; font-size: .84rem; font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 15px rgba(255,122,0,.8); }
.status-strip.online { color: #bce989; }
.status-strip.online .status-dot { background: var(--green); box-shadow: 0 0 15px rgba(141,223,60,.75); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.045); border-radius: 999px; cursor: pointer; font-weight: 750; font-size: .91rem; user-select: none; }
.chip input { accent-color: var(--orange); }
.chip span { font-size: 1.2rem; }
.search-wrap { display: flex; min-width: min(100%, 315px); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--panel); }
.search-wrap input { width: 100%; border: 0; background: transparent; color: white; padding: 11px 12px; outline: 0; }
.search-wrap button { border: 0; border-left: 1px solid var(--line); width: 46px; background: transparent; color: white; cursor: pointer; }
.map-shell { position: relative; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
#map { height: min(68vh, 720px); min-height: 480px; background: #24202b; }
.map-note { position: absolute; z-index: 500; left: 14px; bottom: 14px; padding: 9px 12px; background: rgba(12,9,18,.88); border: 1px solid var(--line); border-radius: 12px; font-size: .83rem; pointer-events: none; backdrop-filter: blur(6px); }
.info-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.panel h2 { margin: 0 0 12px; }
.panel p { line-height: 1.55; }
.panel--highlight { background: linear-gradient(135deg, rgba(255,122,0,.16), rgba(127,75,255,.13)); }
.safety-panel { margin-top: 14px; }
.mini-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }
.mini-legend p { margin: 0; color: var(--muted); }
.mini-legend span { font-size: 1.25rem; margin-right: 7px; }
.mini-legend strong { color: var(--text); }
footer { max-width: 1250px; margin: 0 auto; padding: 0 18px 32px; color: #796b87; font-size: .8rem; }
.ghost-btn, .primary-btn, .secondary-btn, .danger-btn, .file-btn, .approve-btn, .reject-btn, .delete-btn, .tab-btn { border-radius: 12px; padding: 10px 13px; font-weight: 800; cursor: pointer; transition: transform .15s ease, opacity .15s ease, border-color .15s ease; }
.ghost-btn:hover, .primary-btn:hover, .secondary-btn:hover, .danger-btn:hover, .file-btn:hover, .approve-btn:hover, .reject-btn:hover, .delete-btn:hover { transform: translateY(-1px); }
.ghost-btn { border: 1px solid var(--line); background: rgba(255,255,255,.06); color: white; }
.primary-btn { border: 0; background: var(--orange); color: #17100b; }
.secondary-btn, .file-btn { border: 1px solid var(--line); background: var(--panel-2); color: white; }
.danger-btn, .delete-btn { border: 1px solid rgba(216,75,86,.4); background: rgba(216,75,86,.11); color: #ffbdc2; }
.approve-btn { border: 1px solid rgba(141,223,60,.35); background: rgba(141,223,60,.12); color: #c9f49f; }
.reject-btn { border: 1px solid rgba(255,157,46,.35); background: rgba(255,157,46,.10); color: #ffd09c; }
.marker-wrap { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50% 50% 50% 15%; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 4px 16px rgba(0,0,0,.48); }
.marker-wrap > span { transform: rotate(45deg); font-size: 22px; }
.marker-candy { background: #ff7a00; }
.marker-decor { background: #7f4bff; }
.marker-animation { background: #76bf31; }
.marker-shop { background: #3f4650; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #17111f; color: #f8f2ff; }
.leaflet-popup-content { min-width: 220px; }
.popup-title { font-weight: 900; font-size: 1.03rem; margin-bottom: 4px; }
.popup-type { color: #ff9d2e; font-weight: 800; }
.popup-meta { margin-top: 8px; color: #d9cfe3; }
.popup-note { color: #b8a9c6; margin-top: 7px; }
.popup-link { display: inline-block; margin-top: 10px; color: #ffb362; font-weight: 800; text-decoration: none; }
dialog { width: min(690px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; border: 1px solid var(--line); border-radius: 20px; padding: 0; background: var(--panel); color: white; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
dialog.wide-dialog { width: min(900px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.admin-card { padding: 20px; }
.admin-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.admin-head h2 { margin: 0; font-size: 1.8rem; }
.icon-btn { background: transparent; color: white; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; flex: 0 0 auto; }
.notice { background: rgba(255,122,0,.10); border: 1px solid rgba(255,122,0,.24); border-radius: 12px; padding: 11px; color: #f8d9bc; line-height: 1.45; }
.notice.successish { background: rgba(141,223,60,.08); border-color: rgba(141,223,60,.20); color: #d7f2bc; }
.admin-card label { display: grid; gap: 6px; margin-top: 12px; font-size: .9rem; font-weight: 800; }
.admin-card input, .admin-card select, .admin-card textarea { width: 100%; background: #0f0b15; color: white; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; outline: none; }
.admin-card input:focus, .admin-card select:focus, .admin-card textarea:focus { border-color: rgba(255,122,0,.6); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent-row { grid-template-columns: 22px 1fr !important; align-items: start; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.consent-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--orange); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.small { color: var(--muted); font-size: .8rem; margin-bottom: 0; line-height: 1.45; }
.feedback { min-height: 22px; margin-top: 12px; font-size: .9rem; font-weight: 750; color: var(--muted); }
.feedback.success { color: #c9f49f; }
.feedback.error { color: #ff9fa6; }
.admin-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin: 18px 0 12px; }
.admin-stats > div { border: 1px solid var(--line); background: #100c16; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-stats strong { font-size: 1.55rem; }
.admin-stats span { color: var(--muted); font-size: .8rem; }
.admin-tabs { display: flex; gap: 8px; overflow: auto; padding-bottom: 3px; }
.tab-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); white-space: nowrap; }
.tab-btn.active { color: white; border-color: rgba(255,122,0,.5); background: rgba(255,122,0,.11); }
.request-list { display: grid; gap: 10px; margin-top: 13px; }
.request-card { display: grid; grid-template-columns: 52px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 13px; background: #100c16; }
.request-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.75); border-radius: 14px; font-size: 24px; }
.request-content { min-width: 0; }
.request-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.request-title-line h3 { margin: 0; font-size: 1.02rem; }
.status-pill { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; font-size: .72rem; font-weight: 900; }
.status-pending { background: rgba(255,157,46,.12); color: #ffd09c; }
.status-approved { background: rgba(141,223,60,.12); color: #c9f49f; }
.status-rejected { background: rgba(216,75,86,.12); color: #ffbdc2; }
.request-address, .request-type, .request-note, .private-contact, .request-meta { margin: 6px 0 0; line-height: 1.4; }
.request-address { color: #e9dfef; }
.request-type, .request-note { color: var(--muted); }
.private-contact { color: #dbc5ee; background: rgba(127,75,255,.08); border-radius: 8px; padding: 7px 9px; overflow-wrap: anywhere; }
.request-meta { color: #80738e; font-size: .77rem; }
.request-meta a { color: #c4a0f0; }
.request-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.request-actions button { padding: 8px 10px; font-size: .82rem; }
.empty-state { border: 1px dashed var(--line); border-radius: 14px; padding: 28px 16px; text-align: center; color: var(--muted); }
.admin-footer-actions { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
@media (max-width: 800px) {
  .hero__inner, .toolbar { align-items: stretch; flex-direction: column; }
  .hero-actions { justify-content: stretch; }
  .hero-actions button { flex: 1 1 auto; }
  .search-wrap { width: 100%; }
  .info-grid, .mini-legend, .two-cols { grid-template-columns: 1fr; }
  #map { min-height: 60vh; }
}
@media (max-width: 560px) {
  .hero { padding-top: 22px; }
  .admin-card { padding: 15px; }
  .admin-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .admin-stats > div { padding: 9px; }
  .request-card { grid-template-columns: 1fr; }
  .request-icon { width: 44px; height: 44px; }
  .request-title-line { align-items: flex-start; }
}

/* V3 — sélection de l'emplacement avant déclaration */
.selection-banner {
  position: absolute;
  z-index: 800;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 157, 46, .55);
  border-radius: 15px;
  background: rgba(18, 10, 25, .95);
  box-shadow: 0 12px 35px rgba(0,0,0,.45), 0 0 30px rgba(255,122,0,.12);
  backdrop-filter: blur(8px);
}
.selection-banner[hidden] { display: none !important; }
.selection-banner > div { display: grid; gap: 2px; }
.selection-banner strong { color: #ffb362; font-size: .96rem; }
.selection-banner span { color: #e8d9ef; font-size: .84rem; line-height: 1.35; }
#map.map-selecting { cursor: crosshair; }
#map.map-selecting .leaflet-interactive { cursor: crosshair; }
.selection-marker {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 14%;
  transform: rotate(-45deg);
  background: #ff7a00;
  border: 3px solid white;
  box-shadow: 0 5px 20px rgba(0,0,0,.55), 0 0 0 7px rgba(255,122,0,.18);
  animation: selectedPulse 1.2s ease-in-out infinite alternate;
}
.selection-marker span { transform: rotate(45deg); font-size: 25px; }
@keyframes selectedPulse {
  from { box-shadow: 0 5px 20px rgba(0,0,0,.55), 0 0 0 5px rgba(255,122,0,.12); }
  to { box-shadow: 0 5px 20px rgba(0,0,0,.55), 0 0 0 11px rgba(255,122,0,.25); }
}
.selected-location-card {
  margin-top: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,122,0,.32);
  border-radius: 13px;
  background: rgba(255,122,0,.075);
}
.selected-location-card > div { display: grid; gap: 3px; min-width: 0; }
.selected-location-label { color: #ff9d2e; font-size: .67rem; letter-spacing: .13em; font-weight: 900; }
#selectedLocationText { color: #fff; font-size: .88rem; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .selection-banner, .selected-location-card { align-items: stretch; flex-direction: column; }
  .selection-banner button, .selected-location-card button { width: 100%; }
}

/* PWA Android + iPhone */
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
.hero { padding-top: calc(32px + env(safe-area-inset-top)); padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
main { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
footer { padding-bottom: calc(32px + env(safe-area-inset-bottom)); padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
.standalone-app .install-app-btn { display: none !important; }
.install-app-btn { border-color: rgba(255,157,46,.32); background: rgba(255,122,0,.08); }
.install-card { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.install-hero { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; margin: 18px 0; padding: 14px; border-radius: 17px; border: 1px solid rgba(255,122,0,.22); background: linear-gradient(135deg, rgba(255,122,0,.11), rgba(127,75,255,.10)); }
.install-hero img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 12px 28px rgba(0,0,0,.32); }
.install-hero strong { display: block; font-size: 1.08rem; line-height: 1.25; }
.install-hero p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.install-platform { margin-top: 12px; padding: 14px; border-radius: 15px; border: 1px solid var(--line); background: #100c16; }
.install-platform[hidden] { display: none !important; }
.install-platform h3 { margin: 0 0 8px; font-size: 1.05rem; }
.install-platform p { color: var(--muted); line-height: 1.5; }
.install-native-btn { width: 100%; min-height: 48px; margin: 4px 0 4px; }
.install-steps { margin: 8px 0 0; padding-left: 25px; color: #e9dfef; }
.install-steps li { margin: 9px 0; line-height: 1.45; }
.share-glyph { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.22); border-radius: 7px; color: #8cbcff; font-size: 1.05rem; }

@media (display-mode: standalone) {
  body { user-select: none; -webkit-user-select: none; }
  input, textarea, select { user-select: text; -webkit-user-select: text; }
  .hero { padding-top: calc(22px + env(safe-area-inset-top)); }
}

@media (max-width: 800px) {
  #map { height: 62dvh; min-height: 440px; }
  dialog { max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .primary-btn { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .hero { padding-top: calc(20px + env(safe-area-inset-top)); }
  h1 { font-size: clamp(2.15rem, 13vw, 3.6rem); }
  .subtitle { font-size: .98rem; }
  .toolbar { gap: 11px; }
  .legend { display: grid; grid-template-columns: 1fr 1fr; }
  .chip { justify-content: flex-start; min-height: 46px; padding: 9px 10px; }
  #map { height: 58dvh; min-height: 410px; }
  .map-note { max-width: calc(100% - 28px); bottom: calc(14px + env(safe-area-inset-bottom)); }
  .install-hero { grid-template-columns: 76px 1fr; gap: 12px; padding: 12px; }
  .install-hero img { width: 76px; height: 76px; border-radius: 18px; }
  .install-hero strong { font-size: .98rem; }
  .install-hero p { font-size: .86rem; }
}

@media (pointer: coarse) {
  button, .chip, .tab-btn, .file-btn { min-height: 44px; }
  .admin-card input, .admin-card select, .admin-card textarea, .search-wrap input { font-size: 16px; }
}



/* Splash léger Android + iPhone — optimisé mobile */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #16081f 0%, #0b0610 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease, visibility .28s ease;
  contain: strict;
}
.app-splash__glow {
  position: absolute;
  width: min(78vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,122,0,.16) 0%, rgba(115,55,165,.13) 42%, transparent 72%);
  transform: scale(.96);
}
.app-splash__logo {
  position: relative;
  width: min(68vw, 340px);
  max-width: 340px;
  height: auto;
  max-height: 58dvh;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0,0,0,.42));
  animation: appSplashIn .46s cubic-bezier(.2,.75,.2,1) both;
  will-change: transform, opacity;
}
.app-splash.is-leaving .app-splash__logo {
  transform: scale(1.015);
  opacity: 0;
  transition: transform .24s ease, opacity .24s ease;
}
.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@keyframes appSplashIn {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}
@media (max-width: 390px) {
  .app-splash__logo { width: min(64vw, 290px); max-height: 52dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .app-splash__logo { animation: none; }
  .app-splash, .app-splash__logo { transition: none !important; }
}


/* Correctif : splash seulement au démarrage de l'application installée */
.app-splash[hidden] { display: none !important; }
.app-splash { justify-items: center; align-items: center; }
.app-splash__logo { display: block; margin: 0 auto; }


/* Correctif carte PWA mobile */
#map {
  width: 100%;
  min-width: 0;
  background: #ddd;
}
@media (max-width: 800px) {
  .map-shell { min-height: 460px; }
  #map { height: 62svh; min-height: 460px; max-height: 720px; }
}
@media (display-mode: standalone) and (max-width: 800px) {
  .map-shell { min-height: 470px; }
  #map { height: 64svh; min-height: 470px; }
}
