:root {
  /* Biotech-premium palette — matches agrivision.re (light theme) */
  --bone: #fafbf7;
  --paper: #f3f5ec;
  --warm: #edefe4;
  --moss-50: #e8f0e5;
  --moss-100: #c8d9c0;
  --moss-300: #7ea679;
  --moss-500: #3f7a42;
  --moss-600: #2f5c33;
  --moss-800: #1a3c1d;
  --gold: #c9a24b;
  --ink: #0a1410;

  /* App aliases (consumed across the whole UI) — remapped onto the biotech palette so the
     dark→light switch flows everywhere that uses var(--bg/panel/text/...). */
  --bg: #fafbf7; /* app background (bone) */
  --panel: #f3f5ec; /* sidebar + cards (paper) */
  --panel2: #edefe4; /* nested panels (warm) */
  --border: rgba(10, 20, 16, 0.12);
  --text: #0a1410; /* ink */
  --muted: #5a6b62; /* ink-3 */
  --accent: #2f5c33; /* moss-600 — primary green */
  --on-accent: #fafbf7; /* readable text/icon on the green accent */
  --warn: #c9a24b; /* gold */
  --bad: #ae4545; /* danger */
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Soft biotech wash — moss tint rising from the bottom into bone, like agrivision.re */
  background:
    radial-gradient(ellipse 100% 70% at 50% 100%, var(--moss-50), transparent 70%),
    var(--bg);
  color: var(--text);
}
#app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  height: 100dvh;
}
#side {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}
#map {
  height: 100%;
}
/* On-map "Recadrer" button (Leaflet control) — appears when the view drifts from the
   auto-fit of the selected parcels. */
.recadrer-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.recadrer-btn:hover {
  filter: brightness(1.08);
}

/* Pulsing "you are here" GPS marker (divIcon). A solid green dot with an expanding ring so it's
   easy to spot on the map, including outdoors on a phone. */
.gps-marker {
  position: relative;
}
.gps-marker .gps-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: #4ade80;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}
.gps-marker .gps-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.45);
  animation: gps-pulse 1.8s ease-out infinite;
}
@keyframes gps-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(3.4);
    opacity: 0;
  }
}

/* On-map "Me localiser" button — sits top-right, in the Recadrer / Aérien cluster. */
.map-locate-btn {
  display: block;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.map-locate-btn:hover {
  filter: brightness(1.15);
}
.map-locate-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* On-map "Aérien" (Ortho IGN) toggle — sits top-right next to Recadrer. Off = subtle, On = green. */
.map-ortho-btn {
  display: block;
  margin-bottom: 8px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.map-ortho-btn.on {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.map-ortho-btn:hover {
  filter: brightness(1.05);
}

/* On-map parcel detail sheet — slides in from the right edge of the map, vertically
   centered to clear the top-right control cluster (compass / layers / recadrer). */
#parcel-sheet {
  position: fixed;
  top: 50%;
  right: 12px;
  width: 290px;
  max-width: calc(100vw - 24px);
  max-height: 72vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 14px;
  /* Above Leaflet controls (~1000) so the top-right cluster (compass/recadrer/ortho) doesn't cover
     the sheet's close button — but BELOW the mobile tools drawer (#side, 1100) so an open
     full-screen drawer hides the sheet rather than letting it poke through. */
  z-index: 1050;
  transform: translate(120%, -50%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}
#parcel-sheet.open {
  transform: translate(0, -50%);
  opacity: 1;
  pointer-events: auto;
}
#parcel-sheet .psheet-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
#parcel-sheet .psheet-row > span:last-child {
  color: var(--text);
  text-align: right;
}
#drawer-handle {
  display: none;
}

/* ===== Speech mic button — pulses red while recording ===== */
#chat-mic.recording {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.6);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(248, 113, 113, 0);
  }
}

/* ===== Camera capture button (prominent green) ===== */
button.primary-capture {
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 8px;
  flex: 1;
}

/* ===== FAB (floating action button) — hidden on desktop ===== */
#fab {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 999;
  transition: transform 0.15s;
}
#fab:active {
  transform: scale(0.92);
}

/* ===== Mobile (≤768px): sidebar becomes a bottom drawer with snap points ===== */
@media (max-width: 768px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  #map {
    height: 100%;
    min-height: 0;
  }
  #side {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 92vh;
    max-height: 92vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 8px 14px 16px;
    /* Default: peek (just the handle visible) */
    transform: translateY(calc(100% - 50px));
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    /* Above Leaflet controls (~1000) so the layer/zoom control sits behind the drawer. */
    z-index: 1100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Three snap points */
  #side.peek {
    transform: translateY(calc(100% - 50px));
  }
  #side.half {
    transform: translateY(50%);
  }
  #side.full {
    transform: translateY(0);
  }
  #side.open {
    transform: translateY(0);
  } /* legacy */

  #drawer-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 8px;
    cursor: grab;
    user-select: none;
    position: sticky;
    top: -8px;
    background: var(--panel);
    z-index: 1;
    touch-action: none;
  }
  #drawer-handle:active {
    cursor: grabbing;
  }
  #drawer-handle::before {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    background: var(--muted);
    border-radius: 3px;
    margin: 0 auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 6px;
  }
  #drawer-title {
    margin-top: 14px;
    font-weight: 700;
    font-size: 13px;
  }
  #drawer-chevron {
    margin-top: 14px;
    font-size: 14px;
    color: var(--muted);
  }

  /* FAB visible on mobile */
  #fab {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Bigger touch targets */
  button,
  .chip {
    min-height: 40px;
  }
  button {
    padding: 10px 14px;
  }
  .chip {
    padding: 8px 12px;
    font-size: 13px;
  }
  input[type="text"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
    padding: 12px 10px;
  }

  /* Photo card upgrades */
  .photo-card {
    padding: 10px;
    gap: 12px;
  }
  .photo-card .photo-slot {
    width: 128px;
  }
  .photo-card img {
    width: 128px;
    height: 128px;
  }
  .photo-card .meta {
    font-size: 12px;
  }
  .photo-card .meta button {
    font-size: 12px;
    padding: 6px 10px;
    min-height: 34px;
  }
  .photo-card .del {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  /* Map controls — smaller on mobile */
  .sun-compass {
    width: 56px;
    height: 56px;
  }
  .sun-compass .card {
    font-size: 8px;
  }
  .sun-meta {
    font-size: 9px;
    padding: 1px 4px;
  }
  .lock-hint {
    font-size: 11px;
    padding: 5px 8px;
  }
  .select-hint {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Title bar */
  h1 {
    font-size: 14px;
    margin-bottom: 8px;
  }
  h2 {
    font-size: 11px;
    margin: 12px 0 6px;
  }

  /* Chat actions: wrap nicely on small screens */
  .chat-action {
    font-size: 12px;
    padding: 8px 12px;
    min-height: 36px;
  }
  .chat-msg {
    max-width: 88%;
    font-size: 13px;
  }
}

/* On very small phones, hide the moon glyph in the compass to save space */
@media (max-width: 480px) {
  .sun-compass .moon {
    display: none;
  }
}

/* ===== Leaner UX: collapsible advanced sections ===== */
/* Sections that are advanced/optional collapse by default to reduce noise for new users. */
.advanced > summary {
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  /* Keep the inter-section spacing as PADDING (clickable), not margin (dead zone) — so a click
     anywhere on the title block, including the gap above the text, toggles the section. */
  margin: 4px 0 4px;
  list-style: none;
  display: block;
  width: 100%;
  padding: 12px 6px 8px;
  border-radius: 6px;
}
.advanced > summary::-webkit-details-marker {
  display: none;
}
.advanced > summary::before {
  content: "▸ ";
  display: inline-block;
  width: 12px;
  color: var(--muted);
  transition: transform 0.15s;
}
.advanced[open] > summary::before {
  content: "▾ ";
}
.advanced > summary:hover {
  color: var(--text);
}
h1 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--moss-800);
  margin: 0 0 12px;
  letter-spacing: 0.2px;
}
h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--moss-600);
  margin: 16px 0 6px;
}
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
input[type="file"] {
  color: var(--muted);
  font-size: 12px;
}
button {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row > * {
  flex: 1;
}
.row > button {
  flex: 0 0 auto;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  cursor: pointer;
  user-select: none;
}
.chip.on {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
#status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 16px;
}
#parcel-info {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  margin-top: 8px;
  display: none;
}
#parcel-info dt {
  color: var(--muted);
}
#parcel-info dd {
  margin: 0 0 6px;
  font-weight: 600;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.cell {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.cell .k {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.cell .v {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}
.cell.full {
  grid-column: 1 / -1;
}
.bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.bar > div {
  height: 100%;
  background: var(--accent);
}
.bar.warn > div {
  background: var(--warn);
}
.bar.bad > div {
  background: var(--bad);
}
details {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
}
details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  /* Full-width click target — toggle on a click anywhere on the row, not just the text. */
  display: block;
  width: 100%;
}
pre {
  font-size: 11px;
  overflow-x: auto;
  color: var(--muted);
}
a {
  color: var(--accent);
}
.small {
  font-size: 11px;
  color: var(--muted);
}
.sun-compass {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(15, 20, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  /* The disc is intentionally dark (a night-sky backdrop for ☀/🌙); its text must be LIGHT, not
     the theme's near-black --text/--muted (light theme) — otherwise it's dark-on-dark + unreadable. */
  color: #eef2e9;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.sun-compass .card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(238, 242, 233, 0.72);
  font-weight: 600;
  font-size: 9px;
}
.sun-compass .card.n {
  top: 2px;
}
.sun-compass .card.s {
  bottom: 2px;
}
.sun-compass .card.e {
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  left: auto;
}
.sun-compass .card.w {
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
}
.sun-compass .sun,
.sun-compass .moon {
  position: absolute;
  font-size: 16px;
  transform: translate(-50%, -50%);
  transition:
    top 0.4s,
    left 0.4s;
}
.sun-compass .sun {
  text-shadow: 0 0 4px rgba(251, 191, 36, 0.7);
}
.sun-compass .moon {
  font-size: 14px;
  text-shadow: 0 0 4px rgba(180, 200, 230, 0.6);
}
.sun-compass .below {
  opacity: 0.5;
  filter: grayscale(0.5);
}
.sun-meta {
  margin-top: 4px;
  font-size: 10px;
  color: #eef2e9; /* light text on the dark meta chip (see .sun-compass note) */
  background: rgba(15, 20, 25, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
}
.photo-card {
  display: flex;
  gap: 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}
.photo-card .photo-slot {
  flex: 0 0 auto;
  width: 96px;
  align-self: stretch;
}
.photo-card img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.photo-card .meta {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.photo-card .meta button {
  font-size: 10px;
  padding: 2px 6px;
  margin-top: 2px;
}
.photo-card .del {
  background: var(--bad);
  color: #fff;
  border: none;
  border-radius: 3px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  font-weight: 700;
}
.photo-pin {
  background: rgba(74, 222, 128, 0.9);
  border: 2px solid #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.photo-pin.no-dir {
  background: rgba(251, 191, 36, 0.95);
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.35),
    0 1px 4px rgba(0, 0, 0, 0.4);
  animation: pulse-pin 2s ease-in-out infinite;
}
@keyframes pulse-pin {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(251, 191, 36, 0.35),
      0 1px 4px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 6px rgba(251, 191, 36, 0.55),
      0 1px 4px rgba(0, 0, 0, 0.4);
  }
}
.map-placing {
  cursor: crosshair !important;
}
/* Prominent "the app is waiting for a map click" banner (photo place / aim modes). */
#map-wait-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--moss-800);
  color: var(--bone);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 8px 10px 8px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  max-width: calc(100% - 24px);
  animation: map-wait-pulse 1.6s ease-in-out infinite;
}
#map-wait-banner button {
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
@keyframes map-wait-pulse {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(201, 162, 75, 0.5);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(201, 162, 75, 0);
  }
}
.lock-hint {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 6px 5px 10px;
  font-size: 12px;
  font-weight: 600;
  /* Inline display is set in JS (none/flex); these only apply when shown. */
  gap: 8px;
  align-items: center;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
/* Lock slider switch — 🔓 (left) ↔ 🔒 (right); the knob slides to the active side. Used both on
   the map (lock-hint) and in the side panel (#lock-parcels). The end icons stay put; only the
   knob moves, so the direction of travel reads as lock (→) / unlock (←). */
.lock-switch {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  cursor: pointer;
  user-select: none;
  transition:
    background 0.18s,
    border-color 0.18s;
}
.lock-switch[aria-checked="true"] {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 18%, transparent);
}
.lock-switch-icon {
  font-size: 12px;
  line-height: 1;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.18s;
}
.lock-switch[aria-checked="false"] .lock-switch-icon.right {
  opacity: 0.35;
}
.lock-switch[aria-checked="true"] .lock-switch-icon.left {
  opacity: 0.35;
}
.lock-switch-knob {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition:
    left 0.18s ease,
    background 0.18s;
}
.lock-switch[aria-checked="true"] .lock-switch-knob {
  left: calc(100% - 22px);
  background: var(--warn);
}
.lock-switch:hover {
  filter: brightness(1.06);
}
/* Side-panel lock group: a small "Parcelles" label next to the slider. */
.lock-switch-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.lock-hint.locked {
  border-color: var(--warn);
  color: var(--warn);
}
.lock-hint.unlocked {
  border-color: var(--accent);
  color: var(--accent);
}
/* Blink the lock badge 2–3× when a click is ignored because parcels are locked, so the user
   clearly sees their click was intentionally refused. */
.lock-hint.flash {
  animation: lock-flash 0.9s ease both;
}
@keyframes lock-flash {
  0%,
  40%,
  80% {
    transform: scale(1);
    background: var(--warn);
    color: var(--ink);
    border-color: var(--warn);
    box-shadow: 0 0 0 4px rgba(201, 162, 75, 0.4);
  }
  20%,
  60%,
  100% {
    transform: scale(1.12);
    box-shadow: 0 0 0 0 rgba(201, 162, 75, 0);
  }
}
.select-hint {
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.5);
  animation: pulse-hint 1.8s ease-in-out infinite;
  cursor: default;
  user-select: none;
  /* Purely informational → never intercept taps. Combined with the topleft-corner z-index lift
     below, the hint reads ON TOP of the topright "Aérien" button (which otherwise covers it on a
     narrow phone) while taps still pass through to whatever sits underneath. */
  pointer-events: none;
}
/* Lift the topleft control corner (which hosts the select-hint) above the topright corner, so the
   "Cliquez une parcelle" call-to-action is never hidden behind the 🛰️ Aérien button where they
   overlap on small screens. */
.leaflet-top.leaflet-left {
  z-index: 1001;
}
@keyframes pulse-hint {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.5);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.85);
  }
}
.parcel-empty {
  background: var(--panel2);
  border: 2px dashed var(--accent);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
}
.parcel-empty .big {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}
.parcel-empty .lead {
  font-weight: 600;
  color: var(--accent);
}
.chat-msg {
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
  max-width: 92%;
  white-space: pre-wrap;
}
.chat-msg.user {
  background: var(--accent);
  color: var(--on-accent);
  align-self: flex-end;
}
.chat-msg.assistant {
  background: var(--panel);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.chat-msg.system {
  background: transparent;
  color: var(--muted);
  font-style: italic;
  font-size: 11px;
  align-self: center;
}
.chat-action {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-action:hover {
  background: var(--accent);
  color: var(--on-accent);
}
.chat-typing {
  color: var(--muted);
  font-style: italic;
  padding: 4px 10px;
}
.vigicrues-chip {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.vigicrues-chip:hover {
  background: var(--panel2);
  border-color: var(--accent);
  color: var(--accent);
}
.event-card {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel2);
  font-size: 11px;
}
.event-card a {
  text-decoration: none;
}
.event-card a:hover {
  text-decoration: underline;
}
.parcel-emoji-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  user-select: none;
}
.parcel-emoji {
  font-size: 22px;
  line-height: 28px;
  text-align: center;
  text-shadow:
    0 0 3px #000,
    0 0 6px #000;
  pointer-events: none;
  user-select: none;
}
.parcel-bio {
  font-size: 14px;
  line-height: 18px;
  background: rgba(74, 222, 128, 0.92);
  color: #062014;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #0a0e13;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 20, 25, 0.78);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  backdrop-filter: blur(2px);
}
#loading-overlay.show {
  display: flex;
}
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* Small inline variant for "loading…" rows (grid empty-state, chat typing indicator). */
.spinner.sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  flex: none;
}
#loading-bar {
  width: 280px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}
#loading-bar.show {
  display: block;
}
#loading-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease;
}
.disease {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
}
.disease .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.disease .name {
  font-weight: 600;
  font-size: 13px;
}
.disease .sci {
  font-style: italic;
  font-size: 10px;
  color: var(--muted);
}
.disease .row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
}
.disease .row2 .k {
  color: var(--muted);
}
.disease .tx {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
}
.disease .tx h4 {
  margin: 0 0 4px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.disease .tx ul {
  margin: 0;
  padding-left: 14px;
}
.disease .tx li {
  margin-bottom: 3px;
}
