:root {
  --cream: #FFF9F6;
  --sand: #F8EEF0;
  --line: #EEDFE3;
  --ink: #4B4048;
  --muted: #9B8E96;
  --terracotta: #F4AFA4;
  --terracotta-dark: #EB968A;
  --rose: #C96F7E;
  --ochre: #F0BE5C;
  --olive: #8FCBA8;
  --wine: #E8919B;
  --stone: #C7C1D9;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(120, 80, 100, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--cream); color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif; font-size: 16px; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--rose); }

#map { position: fixed; inset: 0; background: var(--sand); }
.leaflet-tile-pane { filter: saturate(.5) brightness(1.08) contrast(.9) sepia(.08) hue-rotate(-12deg); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,249,246,.85) !important; }
.leaflet-control-zoom { display: none; }

/* ---------- Barre du haut ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 500; padding: calc(var(--safe-t) + 10px) 0 8px;
  background: linear-gradient(var(--cream) 70%, rgba(255,249,246,0)); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
h1 { font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 24px; margin: 0; letter-spacing: -.01em; }
h1 em { color: var(--rose); font-style: italic; font-weight: 500; }
.icon-btn { border: 0; background: #fff; width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 2px 8px rgba(120,80,100,.12); font-size: 18px; cursor: pointer; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.chip.on { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: var(--ink); }
.chip.on .dot { background: #fff; box-shadow: 0 0 0 1.5px rgba(75,64,72,.25); }
.chip select { border: 0; background: transparent; padding: 0; appearance: none; -webkit-appearance: none; font-weight: 500; }
.chip.count { background: transparent; border-color: transparent; color: var(--muted); cursor: default; }

/* ---------- Boutons flottants ---------- */
.fabs { position: fixed; right: 16px; bottom: calc(var(--safe-b) + 20px); z-index: 500; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fab { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--terracotta); color: var(--ink); font-size: 32px;
  box-shadow: var(--shadow); cursor: pointer; line-height: 1; }
.fab:active { transform: scale(.95); }
.fab.small { width: 46px; height: 46px; font-size: 20px; background: #fff; color: var(--ink); }

/* ---------- Épingles ---------- */
.pin-wrap { background: none; border: 0; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c);
  border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(120,80,100,.3); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1; }
.cluster { background: none; }
.cluster div { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 14px;
  background: radial-gradient(circle at 35% 30%, #FBD3CC, var(--terracotta-dark)); border: 3px solid rgba(255,255,255,.85); box-shadow: 0 3px 10px rgba(120,80,100,.28); }

/* ---------- Bandeau placement ---------- */
.pick-banner { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 96px); z-index: 600; background: var(--ink); color: #fff;
  border-radius: 14px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.pick-banner .link-btn { color: #FFD3DA; }

/* ---------- Feuille du bas ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(75,64,72,.3); z-index: 700; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; background: var(--cream); border-radius: 22px 22px 0 0;
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; padding: 6px 18px calc(var(--safe-b) + 22px); box-shadow: 0 -10px 40px rgba(120,80,100,.22);
  animation: up .22s ease-out; -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) { .sheet { left: 50%; width: 560px; transform: translateX(-50%); bottom: 16px; border-radius: 22px; max-height: 85vh; animation: none; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-close { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sand); font-size: 15px; cursor: pointer; z-index: 1; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { padding-right: 40px; font-family: "Fraunces", Georgia, serif; font-size: 24px; margin: 0 0 4px; line-height: 1.2; }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.btn.primary, a.btn.primary { background: var(--terracotta); border-color: var(--terracotta); color: var(--ink); }
.btn.danger { color: #B0505F; border-color: #F3CDD3; background: #fff; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; }
.link-btn { border: 0; background: none; color: var(--rose); font-weight: 600; cursor: pointer; padding: 4px 0; }

label.field { display: block; margin-top: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=url], input[type=date], input[type=search], input[type=password], textarea, select.input {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 12px; font-size: 16px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--terracotta-dark); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 96px; resize: vertical; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 4px; font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: var(--ink); font-weight: 700; }

.stars { display: flex; gap: 4px; }
.stars button { border: 0; background: none; font-size: 30px; color: var(--line); cursor: pointer; padding: 0 2px; line-height: 1; }
.stars button.on { color: var(--ochre); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--terracotta-dark); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--c); color: var(--ink); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--sand); }
.tag.ok { background: #DDF1E5; color: #2F6047; }
.tag.mid { background: #FBEFD2; color: #7A5A12; }
.tag.no { background: #FBE0E3; color: #8A3445; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.comment { white-space: pre-wrap; background: #fff; border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); margin-top: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.actions .btn { flex: 1 1 auto; justify-content: center; }
.posline { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1.5px dashed var(--line); font-size: 14px; }

.list { list-style: none; padding: 0; margin: 10px 0 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.list li .t { font-weight: 600; }
.list li .s { font-size: 13px; color: var(--muted); }

.menu { list-style: none; padding: 0; margin: 8px 0 0; }
.menu button, .menu a { width: 100%; text-align: left; display: flex; gap: 12px; align-items: center; padding: 14px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; font-weight: 500; color: inherit; text-decoration: none; }
.menu .ico { width: 28px; text-align: center; font-size: 18px; }

.progress { height: 10px; background: var(--sand); border-radius: 6px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: var(--terracotta-dark); width: 0; transition: width .2s; }
.log { font-size: 13px; color: var(--muted); max-height: 160px; overflow-y: auto; margin-top: 8px; white-space: pre-wrap; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 8px; }
code { background: var(--sand); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }
.warn { background: #FBEFD2; color: #7A5A12; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 100px); z-index: 900; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }

.lock { position: fixed; inset: 0; z-index: 1000; background: var(--cream); display: grid; place-items: center; padding: 24px; }
.lock-card { text-align: center; max-width: 340px; }
.lock-card h2 { font-family: "Fraunces", Georgia, serif; font-size: 28px; margin: 12px 0 8px; }
.lock-card form { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- Trouver autour ---------- */
.discover-banner { position: fixed; left: 16px; right: 16px; top: calc(var(--safe-t) + 108px); z-index: 550; background: #fff; border: 1.5px solid #BFE3CD;
  border-radius: 14px; padding: 8px 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 14px rgba(120,80,100,.12); font-weight: 600; font-size: 14px; color: #2F6047; }
.sugg, .sugg-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: #EEF8F2; color: #2F6047; border: 2.5px dashed #6FB892; box-shadow: 0 2px 6px rgba(120,80,100,.22); }
.sugg.both, .sugg-dot.both { background: #8FCBA8; color: var(--ink); border-style: solid; border-color: #fff; }
.sugg-dot { flex: none; box-shadow: none; }
