/*
  Glane : carte de glanage.
  Vert profond des champs, jaune blé pour l'accent, blanc net.
  Interface d'appli mobile : carte plein écran, barre de recherche flottante, feuille du bas, onglets.
*/
:root{
  --g:#1f4d3a;--g2:#2c6a50;--wheat:#e8b04a;--ink:#16211c;--mute:#5d6b64;--bg:#fff;--soft:#f2f4f1;--line:#e3e7e2;
  --ok:#2e9a55;--check:#e0a21b;--closed:#c8443a;--dm:#8b5cf6;--shop:#3f5b74;
  --safe-b:env(safe-area-inset-bottom,0px);--safe-t:env(safe-area-inset-top,0px);
  --tabs:60px;
}
@media (prefers-color-scheme:dark){
  :root{--ink:#eef2ee;--mute:#a3b0a9;--bg:#151b18;--soft:#1f2723;--line:#2c3631;--shop:#8fb0cc}
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
[hidden]{display:none!important}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);
  font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
svg{display:block}
#map{position:fixed;inset:0;bottom:calc(var(--tabs) + var(--safe-b));background:#e9ece6;z-index:0}
@media (prefers-color-scheme:dark){#map{background:#202623}.leaflet-tile-pane{filter:brightness(.78) contrast(1.05) saturate(.8)}}

/* Haut */
.top{position:fixed;left:0;right:0;top:0;padding:calc(10px + var(--safe-t)) 12px 0;z-index:500;pointer-events:none}
.search{pointer-events:auto;display:flex;align-items:center;gap:10px;background:var(--bg);border-radius:16px;padding:0 14px;height:50px;
  box-shadow:0 2px 10px rgba(0,0,0,.14),0 0 0 1px rgba(0,0,0,.04);max-width:640px;margin:0 auto}
.search svg{width:20px;height:20px;fill:none;stroke:var(--mute);stroke-width:2;stroke-linecap:round;flex:none}
.search input{flex:1;border:0;outline:0;background:none;font-size:16px;color:var(--ink);height:100%;min-width:0}
.sync{width:10px;height:10px;border-radius:50%;background:#b8c1bb;flex:none}
.sync.on{background:var(--ok)}.sync.busy{background:var(--wheat);animation:pulse 1s infinite}.sync.err{background:var(--closed)}
@keyframes pulse{50%{opacity:.35}}
.results{pointer-events:auto;max-width:640px;margin:6px auto 0;background:var(--bg);border-radius:14px;overflow:hidden;box-shadow:0 6px 20px rgba(0,0,0,.16)}
.results button{display:block;width:100%;text-align:left;padding:12px 16px;border-bottom:1px solid var(--line)}
.results button:last-child{border:0}
.results small{display:block;color:var(--mute);font-size:13px}
.chips{pointer-events:auto;display:flex;gap:8px;overflow-x:auto;padding:10px 0 6px;scrollbar-width:none;max-width:640px;margin:0 auto}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;display:flex;align-items:center;gap:7px;height:36px;padding:0 13px;border-radius:18px;background:var(--bg);
  box-shadow:0 1px 5px rgba(0,0,0,.14);font-size:14px;color:var(--mute);white-space:nowrap}
.chip i{width:10px;height:10px;border-radius:50%;background:var(--c);opacity:.35}
.chip i.sq{border-radius:3px;background:var(--shop)}
.chip.on{color:var(--ink);font-weight:600}.chip.on i{opacity:1}

.status{position:fixed;left:50%;transform:translateX(-50%);top:calc(118px + var(--safe-t));z-index:500;background:var(--ink);color:var(--bg);
  padding:8px 14px;border-radius:20px;font-size:13px;box-shadow:0 4px 14px rgba(0,0,0,.2);white-space:nowrap;max-width:92vw;overflow:hidden;text-overflow:ellipsis}

/* Flottants */
.fab,.fab-loc{position:fixed;z-index:450;box-shadow:0 4px 14px rgba(0,0,0,.22)}
.fab{right:14px;bottom:calc(var(--tabs) + var(--safe-b) + 16px);height:54px;padding:0 20px 0 16px;border-radius:27px;background:var(--g);color:#fff;
  display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px}
.fab svg{width:22px;height:22px;stroke:var(--wheat);stroke-width:2.6;stroke-linecap:round;fill:none}
.fab-loc{right:14px;bottom:calc(var(--tabs) + var(--safe-b) + 82px);width:48px;height:48px;border-radius:50%;background:var(--bg);display:grid;place-items:center}
.fab-loc svg{width:24px;height:24px;fill:none;stroke:var(--ink);stroke-width:2}
.fab-loc.on svg{stroke:#2563eb}
body.sheet-open .fab,body.sheet-open .fab-loc,body.aiming .fab,body.aiming .fab-loc{display:none}

/* Viseur d'ajout */
.aim{position:fixed;inset:0;bottom:calc(var(--tabs) + var(--safe-b));z-index:600;pointer-events:none}
.aim-pin{position:absolute;left:50%;top:50%;width:40px;height:52px;transform:translate(-50%,-100%);filter:drop-shadow(0 4px 4px rgba(0,0,0,.3))}
.aim-pin path{fill:var(--g)}.aim-pin circle{fill:var(--wheat)}
.aim-bar{pointer-events:auto;position:absolute;left:12px;right:12px;bottom:14px;background:var(--bg);border-radius:18px;padding:14px 16px;
  box-shadow:0 6px 24px rgba(0,0,0,.25);max-width:520px;margin:0 auto}
.aim-bar p{margin:0 0 12px}

/* Feuille */
.sheet{position:fixed;left:0;right:0;bottom:calc(var(--tabs) + var(--safe-b));z-index:700;background:var(--bg);border-radius:22px 22px 0 0;
  box-shadow:0 -6px 30px rgba(0,0,0,.18);max-height:72vh;display:flex;flex-direction:column;transform:translateY(110%);transition:transform .28s cubic-bezier(.2,.8,.2,1);
  max-width:680px;margin:0 auto}
.sheet.on{transform:none}
.sheet.full{max-height:calc(100vh - 80px - var(--tabs) - var(--safe-b) - var(--safe-t))}
@media (prefers-reduced-motion:reduce){.sheet{transition:none}}
.grip{padding:10px 0 4px;display:grid;place-items:center;cursor:grab;flex:none}
.grip span{width:40px;height:5px;border-radius:3px;background:var(--line)}
.sheet-body{overflow:auto;padding:4px 18px 22px;overscroll-behavior:contain}
.sheet h2{font-size:21px;line-height:1.2;margin:2px 0 4px;letter-spacing:-.01em}
.sheet h3{font-size:15px;margin:20px 0 8px}
.meta{color:var(--mute);font-size:14px;margin:0 0 12px;display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center}
.tag{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;padding:4px 10px;border-radius:12px;background:var(--soft);color:var(--ink)}
.tag i{width:8px;height:8px;border-radius:50%;background:var(--c)}
.facts{display:grid;gap:1px;background:var(--line);border-radius:14px;overflow:hidden;margin:12px 0}
.fact{background:var(--soft);padding:11px 14px;display:grid;grid-template-columns:110px 1fr;gap:10px;font-size:14px}
.fact b{color:var(--mute);font-weight:500}
.photo{width:100%;max-height:260px;object-fit:cover;border-radius:14px;margin:6px 0;display:block}
.score{display:flex;gap:4px;align-items:center}
.score s{width:22px;height:8px;border-radius:4px;background:var(--line);text-decoration:none}
.score s.f{background:var(--ok)}
.visit{padding:12px 0;border-top:1px solid var(--line);font-size:14px}
.visit:first-of-type{border-top:0}
.visit .vh{display:flex;justify-content:space-between;gap:10px;font-weight:600}
.visit p{margin:4px 0 0;color:var(--mute)}
.empty{color:var(--mute);font-size:14px;padding:6px 0}

/* Boutons et formulaires */
.row{display:flex;gap:10px;flex-wrap:wrap}.row>*{flex:1 1 0}
.btn{height:48px;padding:0 18px;border-radius:14px;font-weight:600;background:var(--soft);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;color:var(--ink);white-space:nowrap}
.btn.pri{background:var(--g);color:#fff}
.btn.ghost{background:transparent;box-shadow:inset 0 0 0 1.5px var(--line)}
.btn.danger{color:var(--closed)}
.btn.big{width:100%;height:54px;font-size:16px}
.btn:focus-visible,.chip:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--wheat);outline-offset:2px}
.acts{display:flex;gap:10px;margin:16px 0 4px;flex-wrap:wrap}.acts .btn{flex:1 1 auto}
.field{margin:14px 0}
.field>label{display:block;font-size:13px;font-weight:600;color:var(--mute);margin-bottom:6px}
.field input,.field textarea,.field select{width:100%;font:inherit;font-size:16px;color:var(--ink);background:var(--soft);border:1.5px solid transparent;border-radius:12px;padding:12px}
.field textarea{min-height:84px;resize:vertical}
.seg{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;background:var(--soft);padding:4px;border-radius:14px}
.seg.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.seg.four{grid-template-columns:repeat(4,minmax(0,1fr))}
.seg button{min-height:44px;border-radius:10px;font-size:14px;font-weight:600;color:var(--mute);padding:6px 4px;line-height:1.2}
.seg button.on{background:var(--bg);color:var(--ink);box-shadow:0 1px 4px rgba(0,0,0,.12)}
.seg button[data-v=ok].on{color:var(--ok)}.seg button[data-v=check].on{color:#a87200}.seg button[data-v=closed].on{color:var(--closed)}
.note{background:#fff5dc;color:#5c4400;border-radius:12px;padding:11px 13px;font-size:13.5px;margin:10px 0}
@media (prefers-color-scheme:dark){.note{background:#3a3220;color:#f1dca8}}
.drop{display:flex;align-items:center;gap:12px;background:var(--soft);border-radius:12px;padding:10px;cursor:pointer}
.drop img{width:64px;height:64px;object-fit:cover;border-radius:10px}
.drop span{color:var(--mute);font-size:14px}

/* Listes */
.list{margin:6px 0 0}
.item{display:grid;grid-template-columns:42px 1fr auto;gap:12px;align-items:center;width:100%;text-align:left;padding:12px 0;border-bottom:1px solid var(--line)}
.item .ic{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:var(--soft)}
.item .ic i{width:14px;height:14px;border-radius:50%;background:var(--c)}
.item .ic i.sq{border-radius:4px;background:var(--shop)}
.item b{display:block;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item small{color:var(--mute);font-size:13px}
.item em{font-style:normal;color:var(--mute);font-size:13px;white-space:nowrap}
.seg-tabs{display:flex;gap:6px;margin:6px 0 4px}
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 6px}
.stat{background:var(--soft);border-radius:14px;padding:12px}
.stat b{display:block;font-size:24px;line-height:1.1}
.stat span{font-size:12.5px;color:var(--mute)}
.prose p{margin:8px 0}.prose ol{padding-left:20px;margin:8px 0}.prose li{margin:6px 0}
.prose a{color:var(--g2)}
@media (prefers-color-scheme:dark){.prose a{color:var(--wheat)}}

/* Onglets */
.tabs{position:fixed;left:0;right:0;bottom:0;height:calc(var(--tabs) + var(--safe-b));padding-bottom:var(--safe-b);z-index:800;background:var(--bg);
  border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(4,1fr)}
.tabs button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:11.5px;color:var(--mute);font-weight:500}
.tabs svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
.tabs button.on{color:var(--g)}
@media (prefers-color-scheme:dark){.tabs button.on{color:var(--wheat)}}

/* Accueil */
.welcome{position:fixed;inset:0;z-index:2000;background:rgba(15,25,20,.55);display:grid;place-items:end center;padding:12px}
.wcard{background:var(--bg);border-radius:24px;padding:26px 22px calc(22px + var(--safe-b));max-width:520px;width:100%;max-height:92vh;overflow:auto}
.wlogo{width:56px;height:56px}
.wcard h1{font-size:30px;margin:12px 0 4px;letter-spacing:-.02em}
.lead{color:var(--mute);margin:0 0 14px;font-size:16px}
.rules{padding-left:20px;margin:0 0 20px}.rules li{margin:10px 0}

/* Marqueurs */
.pin{width:34px;height:42px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.35))}
.pin svg{width:34px;height:42px}
.shopm{width:24px;height:24px;border-radius:8px;background:var(--bg);display:grid;place-items:center;box-shadow:0 1px 4px rgba(0,0,0,.35)}
.shopm svg{width:15px;height:15px;fill:none;stroke:var(--shop);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.shopm.has{box-shadow:0 0 0 2px var(--ok),0 1px 4px rgba(0,0,0,.35)}
.contm{width:12px;height:12px;border-radius:3px;background:#6b7280;border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.4)}
.me{width:18px;height:18px;border-radius:50%;background:#2563eb;border:3px solid #fff;box-shadow:0 0 0 6px rgba(37,99,235,.2)}
.marker-cluster{background:rgba(31,77,58,.22)!important}
.marker-cluster div{background:var(--g)!important;color:#fff!important;font-weight:700;font-family:inherit!important}
.leaflet-control-attribution{font-size:10px;background:rgba(255,255,255,.75)!important}
.leaflet-bottom.leaflet-right{margin-bottom:0}
