:root {
  /* Raccoon Map — identité « Hybrid » (brief) */
  --bg: #111318;          /* fond principal */
  --panel: #1B1F27;       /* surface */
  --panel-2: #252B35;     /* surface élevée */
  --text: #F5F5F5;
  --muted: #9AA3B2;
  --accent: #F05A32;      /* accent raccoon */
  --accent-hi: #ff7a52;   /* accent survol */
  --accent-2: #2f3542;    /* surface neutre interactive */
  --border: #2b313c;
  --ok: #10b981;
  --err: #ef4444;
  --radius: 14px;
  --nav-h: 60px;          /* hauteur barre inférieure mobile */
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
h1, h2, h3, .brand { font-family: var(--display); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--border);
  position: relative; z-index: 1200;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav a { color: var(--text); }
.who { color: var(--muted); font-size: .9rem; }

button, .btn-ghost {
  cursor: pointer; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; padding: .6rem 1rem;
  font-size: 1rem; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost.small { padding: .3rem .6rem; font-size: .85rem; }
button.link, .link { background: none; color: var(--accent); padding: 0; font-weight: 600; }

/* ---------- centered cards (login/register) ---------- */
body.centered { display: flex; flex-direction: column; min-height: 100%; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.6rem; max-width: 420px;
  margin: 2.5rem auto; width: calc(100% - 2rem);
}
.card.wide { max-width: 860px; }
.card h1 { margin-top: 0; }
label { display: block; margin: .8rem 0; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; font-size: 1rem;
}
input[type=color] { height: 42px; padding: 2px; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--err); font-weight: 600; }
.error.hidden { display: none; }

/* ---------- app shell / views ---------- */
body.map-body { overflow: hidden; }
#app { display: flex; flex-direction: column; height: calc(100dvh - 54px); }
.viewbar {
  display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem;
  background: var(--panel); border-bottom: 1px solid var(--border); z-index: 1100;
}
.vtab, .vtool {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: .4rem .8rem; border-radius: 999px; font-size: .92rem; font-weight: 600;
}
.vtab.active { background: var(--panel-2); color: var(--text); }
.vtab:hover, .vtool:hover { color: var(--text); filter: none; }
.vspacer { flex: 1; }
.vtool { border: 1px solid var(--border); }
.vtool.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.view { flex: 1; position: relative; display: none; min-height: 0; }
.view.active { display: block; }
#view-wall.view.active, #view-stats.view.active { overflow-y: auto; }

#map { position: absolute; inset: 0; }
.leaflet-container { background: #0b0d10; }

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.legend {
  position: absolute; top: 1rem; right: 1rem; z-index: 800;
  padding: .7rem .9rem; max-width: 60vw; font-size: .9rem;
}
.legend h3 { margin: 0 0 .4rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.legend .row { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; cursor: pointer; user-select: none; }
.legend .row.off { opacity: .4; }
.legend .dot, .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }

.fab {
  position: fixed; bottom: 1.4rem; right: 1.4rem; z-index: 1600;
  width: 60px; height: 60px; border-radius: 20px; font-size: 2rem; line-height: 1;
  background: linear-gradient(145deg, var(--accent-hi), var(--accent)); color: #fff; border: none;
  box-shadow: 0 12px 28px rgba(240,90,50,.5), 0 4px 12px rgba(0,0,0,.45); padding: 0;
  transition: transform .15s cubic-bezier(.22,1,.36,1), box-shadow .15s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 16px 34px rgba(240,90,50,.58), 0 5px 14px rgba(0,0,0,.45); }
.fab:active { transform: scale(.96); }
.place-hint {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  z-index: 1600; background: var(--panel); border: 1px solid var(--border);
  padding: .7rem 1rem; border-radius: 12px; font-size: .95rem; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 92vw;
}
.place-hint button { margin: 0 .2rem; padding: .3rem .6rem; font-size: .9rem; }

/* ---------- add form ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 2600; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.form { width: 480px; max-width: 100%; max-height: 92dvh; overflow: auto; padding: 1.4rem; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); margin: 0 0 0 0; border-radius: 16px 16px 0 0; }
@media (min-width: 640px) { .overlay { align-items: center; } .form { border-radius: 16px; } }
.form h2 { margin-top: 0; }
.form .coords { color: var(--muted); font-size: .85rem; margin: 0 0 .5rem; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }

.hidden { display: none !important; }

/* ---------- popups ---------- */
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 12px; }
.leaflet-popup-tip { background: var(--panel); }
.sticker-popup { min-width: 180px; max-width: 240px; }
.sticker-popup img { width: 100%; border-radius: 8px; margin-bottom: .4rem; display: block; }
.sticker-popup h4 { margin: .1rem 0; font-size: 1rem; }
.sticker-popup .meta { color: var(--muted); font-size: .8rem; margin: .1rem 0; }
.sticker-popup .cat { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; }
.sticker-popup .note { margin: .4rem 0 0; font-size: .9rem; white-space: pre-wrap; }
.sticker-popup .del { color: var(--err); font-size: .8rem; margin-top: .5rem; display: inline-block; cursor: pointer; }

/* ---------- admin ---------- */
.admin { max-width: 900px; margin: 1.5rem auto; padding: 0 1rem; }
.admin table { width: 100%; border-collapse: collapse; margin-top: .8rem; font-size: .9rem; }
.admin th, .admin td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin code { background: var(--panel-2); padding: .2rem .4rem; border-radius: 6px; font-size: .8rem; word-break: break-all; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline input[type=text] { width: auto; flex: 1; min-width: 160px; margin: 0; }
.inline input[type=color] { width: 48px; margin: 0; }
.copy-btn { background: var(--accent-2); padding: .25rem .5rem; font-size: .8rem; margin-left: .4rem; }
.badge { padding: .15rem .5rem; border-radius: 999px; font-size: .78rem; background: var(--panel-2); color: var(--muted); }
.badge.open { background: #064e3b; color: #6ee7b7; }
.badge.used { background: var(--panel-2); }
.badge.admin { background: #7c2d12; color: #fdba74; }
.cats { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.cats li { display: flex; align-items: center; gap: .4rem; background: var(--panel-2); padding: .3rem .7rem; border-radius: 999px; font-size: .9rem; }

/* ---------- raccoon pins ---------- */
.rpin-wrap { background: none; border: none; position: relative; }
/* pin « goutte » dégradé avec halo pulsé (réf. maquette) */
.rpin {
  width: 40px; height: 40px;
  border-radius: 50% 50% 50% 4px; transform: rotate(45deg);
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  border: 3px solid #fff;
  box-shadow: 0 9px 20px rgba(0,0,0,.5), 0 2px 10px rgba(240,90,50,.55);
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: transform .16s cubic-bezier(.22,1,.36,1);
}
.rpin span { transform: rotate(-45deg); font-size: 21px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); }
.rpin-wrap:hover .rpin { transform: rotate(45deg) scale(1.13); }
.rpin-wrap::before {
  content: ""; position: absolute; left: 50%; top: 38%;
  width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,90,50,.5), transparent 68%);
  animation: rpin-pulse 2.4s ease-out infinite; pointer-events: none; z-index: -1;
}
@keyframes rpin-pulse {
  0%   { transform: scale(.5);  opacity: .85; }
  70%  { opacity: .1; }
  100% { transform: scale(1.95); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .rpin-wrap::before { animation: none; opacity: .4; } }

.cluster { background: none; }
.cluster-dot {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #e4572e, #a83118);
  border: 3px solid #fff; color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  box-shadow: 0 3px 10px rgba(0,0,0,.55);
}
.cluster-dot b { font-size: 12px; }

/* ---------- reactions & comments in popup ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: .3rem; margin: .55rem 0 .3rem; }
.react-chip {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: .2rem .45rem; border-radius: 999px; font-size: .95rem; line-height: 1;
  display: inline-flex; align-items: center; gap: .25rem;
}
.react-chip b { font-size: .78rem; color: var(--muted); font-weight: 700; }
.react-chip.mine { border-color: var(--accent); background: #3a241c; }
.react-chip.mine b { color: #fca; }

.comments { margin-top: .5rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.clist { display: flex; flex-direction: column; gap: .25rem; max-height: 120px; overflow-y: auto; margin-bottom: .4rem; }
.comment { font-size: .85rem; background: var(--panel-2); padding: .25rem .45rem; border-radius: 8px; position: relative; }
.comment b { color: var(--accent); }
.cdel { position: absolute; right: .3rem; top: .2rem; cursor: pointer; color: var(--muted); font-size: .75rem; }
.cdel:hover { color: var(--err); }
.cform { display: flex; gap: .3rem; }
.cform input { margin: 0; padding: .35rem .5rem; font-size: .85rem; }
.cform button { padding: .35rem .6rem; }
.small { font-size: .8rem; }

/* ---------- wall ---------- */
.wall-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; padding: 1.2rem;
}
.wall-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.wall-card:hover { border-color: var(--accent-2); }
.wc-photo { aspect-ratio: 4/3; background: var(--panel-2); overflow: hidden; }
.wc-photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; transition: transform .2s ease; }
.wc-photo img:hover { transform: scale(1.05); }
.wc-photo .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; opacity: .5; }
.wc-body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.wc-title { font-weight: 700; }
.wc-meta { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.wc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); padding-top: .3rem; }
.wc-map { background: var(--panel-2); color: var(--text); padding: .25rem .55rem; font-size: .8rem; }
.empty { text-align: center; color: var(--muted); margin-top: 3rem; font-size: 1.05rem; }

/* ---------- stats ---------- */
.stats-wrap { padding: 1.2rem; max-width: 960px; margin: 0 auto; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; text-align: center; }
.tile .te { font-size: 1.8rem; }
.tile .tn { font-size: 2rem; font-weight: 800; color: var(--accent); }
.tile .tl { color: var(--muted); font-size: .85rem; }
.stat-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; opacity: 0; }
.stat-card.rise { animation: rise .4s ease forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.stat-card h3 { margin: 0 0 .7rem; font-size: .95rem; }
.barrow { display: grid; grid-template-columns: 1fr 2fr auto; align-items: center; gap: .5rem; margin: .35rem 0; font-size: .88rem; }
.bl { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt { background: var(--panel-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bf { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.bn { color: var(--muted); font-weight: 700; min-width: 1.5rem; text-align: right; }
.months { display: flex; align-items: flex-end; gap: .5rem; overflow-x: auto; padding-top: .5rem; }
.month { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.month .mbar { width: 22px; background: linear-gradient(var(--accent), #a83118); border-radius: 5px 5px 0 0; }
.month span { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .7rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: .85rem; color: var(--muted); opacity: .55; }
.badge-chip.got { opacity: 1; color: var(--text); border-color: var(--accent); background: #2a1d18; }
.badge-chip .be { font-size: 1.1rem; filter: grayscale(1); }
.badge-chip.got .be { filter: none; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lb-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,.12); width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; }

/* ---------- owner actions & edit form extras ---------- */
.owner-actions { display: flex; gap: .8rem; margin-top: .6rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.owner-actions .edit, .owner-actions .del { cursor: pointer; font-size: .82rem; }
.owner-actions .edit { color: var(--muted); }
.owner-actions .edit:hover { color: var(--text); }
.owner-actions .del { color: var(--muted); }
.owner-actions .del:hover { color: var(--err); }
.checkline { display: flex; flex-direction: row; align-items: center; gap: .5rem; color: var(--text); font-size: .9rem; }
.checkline input { width: auto; margin: 0; }
#f-move { align-self: flex-start; margin-bottom: .3rem; }

/* ---------- account & admin management ---------- */
.ok { color: var(--ok); font-weight: 600; }
.banner { padding: .6rem .9rem; border-radius: 10px; background: var(--panel-2); margin: .6rem 0 1rem; }
.ok.banner { background: #06281f; }
.error.banner { background: #2a1414; }
.card hr, hr { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }
.card h2 { font-size: 1.05rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.row-actions form { display: flex; gap: .3rem; align-items: center; margin: 0; }
.pw-form input { width: 130px; margin: 0; padding: .3rem .45rem; font-size: .82rem; }
.btn-ghost.danger { color: #fca5a5; border-color: #7f1d1d; }
.btn-ghost.danger:hover { background: #2a1414; }
.cat-edit-list { display: flex; flex-direction: column; gap: .5rem; }
.cat-edit-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.cat-edit-row .inline { flex: 1; }
.cat-edit-row input[type=text] { flex: 1; min-width: 120px; margin: 0; }
.cat-edit-row input[type=color] { width: 44px; margin: 0; }

/* ---------- leaflet controls, dark theme ---------- */
.leaflet-bar a, .leaflet-control-layers {
  background: var(--panel) !important; color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-bar a:hover { background: var(--panel-2) !important; }
.leaflet-control-layers-expanded { padding: .5rem .8rem !important; }
.leaflet-control-layers label { margin: .2rem 0; color: var(--text); font-size: .9rem; }
.leaflet-control-layers-toggle { filter: invert(1) hue-rotate(180deg); }
.leaflet-control-attribution {
  background: rgba(26,30,38,.82) !important; color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }

/* =========================================================
   PHASE 1 — coquille mobile-first : barre inférieure, safe-areas, responsive
   ========================================================= */
.botnav { display: none; }
body.has-nav { }

@media (max-width: 768px) {
  /* barre inférieure */
  .botnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
    background: var(--panel); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .botnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--muted); font-size: .66rem; font-weight: 600; text-decoration: none;
    padding-top: 6px;
  }
  .botnav a svg { width: 22px; height: 22px; }
  .botnav a.on { color: var(--accent); }
  .botnav a:active { background: var(--panel-2); }

  /* top bar : garder marque + déconnexion, masquer les liens redondants */
  .topbar nav a:not(.btn-ghost) { display: none; }
  .topbar { padding: .5rem .9rem; }
  .brand { font-size: 1.05rem; }

  /* laisser la place à la barre en bas sur les pages qui défilent */
  body.has-nav:not(.map-body) { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }

  /* carte : réserver la hauteur de la barre inférieure */
  body.map-body.has-nav #app { height: calc(100dvh - 54px - var(--nav-h) - env(safe-area-inset-bottom, 0px)); }
  /* sur mobile la barre de vues du haut ne garde que les outils (heatmap) */
  .viewbar .vtab { display: none; }
  .viewbar { justify-content: flex-end; }
  /* remonter les contrôles flottants au-dessus de rien (la carte s'arrête avant la barre) */
  .fab { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); right: 14px; }
  .place-hint { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); }
  .legend { max-width: 52vw; }
  .form { border-radius: 16px 16px 0 0; }
}

/* contrôles tactiles un peu plus grands partout */
.botnav a { -webkit-tap-highlight-color: transparent; }

/* =========================================================
   PHASE 1 — Mur refait en FEED communautaire
   ========================================================= */
.wall-grid {
  column-width: 340px; column-gap: 1.1rem; padding: 1.3rem;
  max-width: 1120px; margin: 0 auto; display: block;
}
@media (max-width: 560px){ .wall-grid { columns: 1; column-width: auto; padding: .9rem; } }

.post {
  break-inside: avoid; display: inline-block; width: 100%; margin: 0 0 1.1rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.post-h { display: flex; align-items: center; gap: .6rem; padding: .8rem .9rem .6rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; font-family: var(--display); flex: 0 0 auto; font-size: 1rem; }
.post-h .pi { flex: 1; min-width: 0; }
.post-h .pa { font-weight: 700; font-size: .92rem; }
.post-h .pd { color: var(--muted); font-size: .76rem; }
.chip-cat { display: inline-flex; align-items: center; gap: .35rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px; padding: .2rem .55rem; font-size: .74rem; color: var(--muted); }
.post-ph { background: #0c0e12; }
.post-ph img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.post-t { font-family: var(--display); font-size: 1.02rem; margin: .7rem .9rem .1rem; }
.post-n { margin: .35rem .9rem 0; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.post-react { display: flex; flex-wrap: wrap; gap: .3rem; padding: .7rem .9rem .2rem; }
.post-actions { display: flex; align-items: center; gap: .5rem; padding: .3rem .7rem .7rem; }
.post-actions button { background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: .35rem .7rem; font-size: .82rem; font-weight: 600; }
.post-actions button:hover { color: var(--text); }
.post-actions .post-cbtn b { color: var(--text); }
.post-actions .post-edit { margin-left: auto; padding: .35rem .6rem; }
.post-comments { padding: 0 .9rem .9rem; }
.post-comments.comments { border-top: 1px solid var(--border); margin-top: .2rem; padding-top: .6rem; }

/* =========================================================
   PHASE 1 — Stats modernisées (donut, classement) + page Profil
   ========================================================= */
.donut-wrap { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.donut { width: 130px; height: 130px; flex: 0 0 auto; }
.donut .dnum { fill: var(--text); font-family: var(--display); font-weight: 700; font-size: 20px; }
.donut .dlbl { fill: var(--muted); font-size: 9px; letter-spacing: .05em; }
.donut-legend { display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 140px; }
.dleg { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.dleg b { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.lrow { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
.lrow .avatar { width: 32px; height: 32px; font-size: .85rem; }
.lmain { flex: 1; min-width: 0; }
.lname { font-size: .88rem; font-weight: 600; margin-bottom: .2rem; }
.lcount { font-weight: 800; color: var(--accent); font-family: var(--display); font-variant-numeric: tabular-nums; }

/* profil */
.profil { max-width: 820px; margin: 1.3rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 1.1rem; }
.prof-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.prof-id { display: flex; align-items: center; gap: 1rem; }
.avatar.big { width: 68px; height: 68px; font-size: 1.8rem; border-radius: 20px; }
.prof-meta h1 { font-size: 1.5rem; margin: 0; }
.prof-sub { display: flex; align-items: center; gap: .6rem; margin: .3rem 0; flex-wrap: wrap; }
.prof-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.prof-stats { margin: 0; }
.mygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.mycard { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.myph { aspect-ratio: 4/3; background: var(--panel-2); overflow: hidden; }
.myph img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.myph .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2rem; opacity: .5; }
.mybd { padding: .55rem .65rem; }
.myt { font-weight: 700; font-size: .9rem; }
.mym { color: var(--muted); font-size: .76rem; display: flex; align-items: center; gap: .25rem; margin-top: .15rem; }

/* =========================================================
   PHASE 2 — Lucide, bottom sheet, photo-marqueur, sidebar desktop
   ========================================================= */
.ic{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto;display:inline-block;vertical-align:-3px}
.ic.sm{width:17px;height:17px}

/* pin raccoon uniforme (plus de catégorie) */
.rpin{background:var(--accent)!important}

/* contrôle flottant (heatmap) */
.mapctl{position:absolute;top:1rem;left:1rem;z-index:800;width:44px;height:44px;border-radius:12px;background:var(--panel);
  border:1px solid var(--border);color:var(--muted);display:flex;align-items:center;justify-content:center;
  box-shadow:0 6px 18px rgba(0,0,0,.4);padding:0}
.mapctl.on{background:var(--accent);border-color:var(--accent);color:#fff}
.fab .ic{width:26px;height:26px;stroke-width:2.4}

/* photo-marqueur (zoom élevé) */
.photopin-wrap{background:none;border:none;position:relative;transition:transform .16s cubic-bezier(.22,1,.36,1)}
.photopin-wrap:hover{transform:scale(1.08)}
.photopin{width:58px;height:58px;border-radius:15px;border:3px solid #fff;overflow:hidden;position:relative;
  box-shadow:0 10px 22px rgba(0,0,0,.55),0 2px 12px rgba(240,90,50,.4);background:var(--panel-2)}
.photopin img{width:100%;height:100%;object-fit:cover;display:block}
.photopin-wrap::after{content:"";position:absolute;bottom:-8px;left:50%;transform:translateX(-50%);
  border-left:8px solid transparent;border-right:8px solid transparent;border-top:11px solid #fff;
  filter:drop-shadow(0 3px 2px rgba(0,0,0,.4))}

/* bottom sheet (fiche sticker) */
.sheet{position:fixed;inset:0;z-index:2000}
.sheet.hidden{display:none}
.sheet-scrim{position:absolute;inset:0;background:rgba(0,0,0,.5);opacity:0;transition:opacity .22s}
.sheet.open .sheet-scrim{opacity:1}
.sheet-card{position:absolute;left:0;right:0;bottom:0;background:var(--panel);border-radius:24px 24px 0 0;
  border-top:1px solid var(--border);box-shadow:0 -16px 44px rgba(0,0,0,.55);max-height:84vh;overflow-y:auto;
  transform:translateY(100%);transition:transform .24s cubic-bezier(.22,1,.36,1);padding-bottom:env(safe-area-inset-bottom,0px)}
.sheet.open .sheet-card{transform:translateY(0)}
.sheet-grip{width:42px;height:4px;border-radius:999px;background:var(--border);margin:10px auto 2px}
.sheet-body{position:relative;padding:0 0 .6rem}
.sheet-x{position:absolute;top:12px;right:12px;z-index:3;width:34px;height:34px;border-radius:50%;
  background:rgba(0,0,0,.45);color:#fff;border:none;display:flex;align-items:center;justify-content:center;padding:0}
.sheet-cover{width:100%;max-height:260px;object-fit:cover;display:block;cursor:zoom-in}
.sheet-main{padding:.9rem 1.1rem}
.sheet-main .srow .pi{min-width:0}
.sheet-main .srow .pa{font-weight:700}
.sheet-main .srow .pm{color:var(--muted);font-size:.78rem}
.sheet-title{font-family:var(--display);font-size:1.2rem;margin:.7rem 0 .15rem}
.sheet-note{color:var(--muted);font-size:.92rem;margin:0;white-space:pre-wrap;line-height:1.5}
.sheet-acts{display:flex;flex-wrap:wrap;gap:.5rem;margin:.85rem 0 .3rem}
.sheet-acts .act{display:inline-flex;align-items:center;gap:.4rem;background:var(--panel-2);border:1px solid var(--border);
  color:var(--text);border-radius:11px;padding:.5rem .75rem;font-size:.84rem;font-weight:600;text-decoration:none;cursor:pointer}
.sheet-acts .act:hover{border-color:var(--accent-2)}
.sheet-acts .act-del{color:#fca5a5}
.sheet-main .reactions{margin:.3rem 0 .2rem}
.sheet-main .comments{border-top:1px solid var(--border);margin-top:.4rem;padding-top:.6rem}

/* actions de post en icônes */
.post-actions .act{display:inline-flex;align-items:center;gap:.4rem}
.post-edit{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:10px;padding:.3rem .5rem}
.post-h .pd{color:var(--muted);font-size:.74rem}

/* ---- sidebar desktop (masquée en mobile) ---- */
.sidebar{display:none}
@media(min-width:769px){
  .sidebar{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:230px;background:var(--panel);
    border-right:1px solid var(--border);padding:1.1rem .8rem;z-index:1200}
  .sidebar .brand{font-size:1.15rem;padding:.2rem .6rem 1.1rem;display:block}
  .side-nav{display:flex;flex-direction:column;gap:.2rem;flex:1}
  .side-nav a{display:flex;align-items:center;gap:.75rem;padding:.6rem .7rem;border-radius:11px;color:var(--muted);
    font-weight:600;font-size:.95rem;text-decoration:none}
  .side-nav a svg{width:20px;height:20px}
  .side-nav a:hover{background:var(--panel-2);color:var(--text)}
  .side-nav a.on{background:var(--panel-2);color:var(--accent)}
  .side-foot{display:flex;flex-direction:column;gap:.5rem;border-top:1px solid var(--border);padding-top:.8rem}
  .side-user{color:var(--text);font-weight:600;text-decoration:none;padding:0 .4rem}
  .topbar{display:none}
  body.has-nav{padding-left:230px}
  body.map-body #app{height:100dvh}
  .sheet-card{left:auto;right:24px;bottom:24px;width:390px;border-radius:18px;border:1px solid var(--border);max-height:80vh}
  .sheet-scrim{background:rgba(0,0,0,.25)}
}

/* ---- recherche flottante (géocodage) ---- */
.searchwrap{position:absolute;top:12px;left:12px;right:12px;z-index:1100;max-width:560px;margin:0 auto}
@media(min-width:769px){ .searchwrap{left:16px;right:auto;width:440px;margin:0} }
.searchbar{display:flex;align-items:center;gap:.55rem;background:var(--panel);border:1px solid var(--border);
  border-radius:14px;padding:.55rem .7rem;box-shadow:0 10px 30px rgba(0,0,0,.45);color:var(--muted)}
.searchbar input{flex:1;min-width:0;background:none;border:none;color:var(--text);font-size:.95rem;padding:0;margin:0}
.searchbar input::placeholder{color:var(--muted)}
.searchbar input:focus{outline:none}
.geo-btn{background:var(--panel-2);border:1px solid var(--border);color:var(--muted);width:32px;height:32px;
  border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0;flex:0 0 auto}
.geo-btn.gps{color:var(--accent)}
.geo-results{margin-top:6px;background:var(--panel);border:1px solid var(--border);border-radius:12px;overflow:hidden;
  box-shadow:0 12px 34px rgba(0,0,0,.5);max-height:52vh;overflow-y:auto}
.geo-item{display:flex;align-items:center;gap:.6rem;padding:.6rem .8rem;cursor:pointer;color:var(--text);
  font-size:.9rem;border-bottom:1px solid var(--border)}
.geo-item:last-child{border-bottom:none}
.geo-item:hover{background:var(--panel-2)}
.geo-item .ic{color:var(--muted)}
.geo-empty{padding:.7rem .8rem;color:var(--muted);font-size:.88rem}
.geo-attr{padding:.4rem .8rem;color:var(--muted);font-size:.7rem;border-top:1px solid var(--border);background:var(--panel-2)}
/* dégager les contrôles sous la barre de recherche */
.mapctl{top:68px;right:12px;left:auto}
.leaflet-top.leaflet-left{margin-top:64px}
@media(min-width:769px){ .mapctl{top:12px;right:12px} .leaflet-top.leaflet-left{margin-top:64px} }

/* ---- carte mobile immersive : pas de barre du haut, recherche sous l'encoche ---- */
@media (max-width:768px){
  body.map-body .topbar{display:none}
  body.map-body.has-nav #app{height:calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom,0px))}
  .searchwrap{top:calc(10px + env(safe-area-inset-top,0px))}
  .mapctl{top:calc(66px + env(safe-area-inset-top,0px))}
  .leaflet-top.leaflet-left{margin-top:calc(62px + env(safe-area-inset-top,0px))}
  #view-wall.view.active, #view-stats.view.active{padding-top:calc(env(safe-area-inset-top,0px) + 4px)}
}

/* ---- admin : tableaux -> cartes empilées sur mobile ---- */
@media (max-width:768px){
  .admin{overflow-x:hidden}
  .admin table, .admin thead, .admin tbody, .admin tr, .admin td{display:block;width:auto}
  .admin thead{display:none}
  .admin tr{border:1px solid var(--border);border-radius:12px;margin-bottom:.7rem;padding:.3rem .2rem;background:var(--panel-2)}
  .admin td{border:none;display:flex;gap:.6rem;align-items:flex-start;padding:.4rem .7rem;font-size:.9rem}
  .admin td::before{content:attr(data-label);color:var(--muted);font-size:.72rem;font-weight:700;min-width:62px;flex:0 0 auto;padding-top:.2rem}
  .admin td[data-label=""]::before{display:none}
  .admin td[data-label=""]{padding-top:0}
  .admin .row-actions{flex-direction:column;align-items:stretch;width:100%;gap:.45rem}
  .admin .row-actions form{display:flex;flex-wrap:wrap;gap:.4rem;margin:0}
  .admin .pw-form input{flex:1;min-width:0;width:auto}
  .admin code.invite-link{word-break:break-all;font-size:.72rem}
  .admin .inline{flex-wrap:wrap}
  .admin .inline input[type=text]{width:100%}
}

/* ---- MapLibre GL (thème sombre) ---- */
.maplibregl-ctrl-group{background:var(--panel)!important;border:1px solid var(--border)!important;box-shadow:0 6px 18px rgba(0,0,0,.4)!important}
.maplibregl-ctrl-group button+button{border-top:1px solid var(--border)!important}
.maplibregl-ctrl-group button .maplibregl-ctrl-icon{filter:invert(1) hue-rotate(180deg) brightness(1.1)}
.maplibregl-ctrl-attrib{background:rgba(27,31,39,.82)!important;color:var(--muted)!important}
.maplibregl-ctrl-attrib a{color:var(--muted)!important}
.maplibregl-ctrl-attrib-button{filter:invert(1)}
/* bouton géoloc natif masqué : on le déclenche depuis la barre de recherche */
.maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate){display:none}
/* descendre les contrôles haut-gauche sous la barre de recherche */
.maplibregl-ctrl-top-left{margin-top:64px}
@media (max-width:768px){ .maplibregl-ctrl-top-left{margin-top:calc(62px + env(safe-area-inset-top,0px))} }
/* 2e contrôle flottant (fond de carte), sous le heatmap */
.mapctl-2{top:118px}
@media (min-width:769px){ .mapctl-2{top:62px} }
@media (max-width:768px){ .mapctl-2{top:calc(66px + env(safe-area-inset-top,0px) + 50px)} }

/* ---- boutons de contrôle custom (2D/3D, vue d'origine) + compass ---- */
.maplibregl-ctrl-group button.ctrl-icon-btn{display:flex;align-items:center;justify-content:center;color:var(--text);background:var(--panel)}
.maplibregl-ctrl-group button.ctrl-icon-btn svg{width:18px;height:18px}
.maplibregl-ctrl-group button.ctrl-icon-btn.on{color:var(--accent)}
.maplibregl-ctrl-compass .maplibregl-ctrl-compass-arrow,.maplibregl-ctrl-compass-arrow{filter:invert(1)}
/* attribution : minimale (ⓘ repliable), légalement requise */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{min-height:22px;background:rgba(27,31,39,.55)!important;border-radius:11px}
.maplibregl-ctrl-attrib-button{background-color:rgba(255,255,255,.08)}
