:root{
  --gap: 14px;
  --card-img-h: 260px;
  --radius: 12px;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #16a34a;
}

*{box-sizing:border-box}
body{
  margin:0;
  color:#111827;
  font:14px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  background:#fff;
  padding:0 10px 30px;
}

.toolbar{
  position:sticky; top:0; z-index:10;
  display:flex; gap:16px; align-items:center; flex-wrap:wrap;
  padding:10px 0;
  background:#fff;
  border-bottom:1px solid var(--border);
}
.toolbar .brand{ font-weight:700; margin-right:auto; }
.toolbar .lbl{ margin-right:6px; }

.btn{
  border:0;
  padding:6px 10px;
  border-radius:8px;
  cursor:pointer;
}
.btn-primary{ background:var(--brand); color:#fff; }

.panel{ margin:14px 0 26px; }
.map{
  height:520px;
  min-height:320px;
  border:1px solid var(--border);
  border-radius:10px;
}

.zones-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap:16px;
}

.zone-card{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  background:#fff;
}

.zone-title{ font-weight:700; margin:4px 0 2px; }
.zone-sub{ color:#111827; margin:0 0 8px; font-weight:600; }
.zone-img{
  width:100%;
  height:var(--card-img-h);
  object-fit:cover;
  border-radius:10px;
  display:block;
  margin-bottom:8px;
}

.muted{ color:var(--muted); }

.metrics{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:4px 10px;
  margin-top:10px;
  font-size:13px;
}

/* OPB search */
.opb-box{ position:relative; margin-top:8px; }

.opb-input{
  width:100%;
  padding:8px;
  border:1px solid var(--border);
  border-radius:8px;
  outline:none;
}

.opb-results{
  margin-top:.5rem;
  max-height:280px;
  overflow:auto;
  display:none; /* piloté par JS */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px;
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px;
  background:#fff;
}

.opb-item{
  display:flex;
  gap:8px;
  align-items:center;
  padding:6px;
  border:1px solid var(--border);
  border-radius:8px;
  cursor:pointer;
  background:#fff;
}
.opb-item:hover{ background:#f8fafc; }

.opb-result-img{
  width:56px;
  height:56px;
  object-fit:cover;
  border-radius:6px;
}
.opb-result-name{
  font-size:.9rem;
  line-height:1.2rem;
}

.opb-empty{
  color:var(--muted);
  padding:.25rem;
  font-style:italic;
}

@media (max-width: 1000px){
  .zone-img{ height:220px; }
  .map{ height:420px; }
}



/* FIX Leaflet tiles broken by global img rules */
.leaflet-container {
  position: relative;
  overflow: hidden;        /* empêche les tuiles de déborder */
}

.leaflet-container img {
  max-width: none !important;   /* IMPORTANT */
  height: auto;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  max-width: none !important;
}


#map .leaflet-tile,
#map .leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}



.pop { min-width: 240px; }
.pop-title { font-weight: 800; margin-bottom: 2px; display:flex; gap:8px; align-items:center; }
.pop-sub { margin-bottom: 8px; }
.pop-grid { display:grid; grid-template-columns: 1fr 1fr; gap:4px 10px; font-size: 13px; }
.pop-foot { margin-top: 8px; font-size: 12px; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border:1px solid var(--border); }
.badge-ok { background: #ecfdf5; border-color:#a7f3d0; }
.badge-alert { background: #fff1f2; border-color:#fecdd3; }

