/* ============================================================
   Carte Partagée — monde « Carnet de Terrain »
   Fond clair plein-soleil, encre sapin-noir, couleurs signal
   d'expédition. Loi d'encodage : plein = synchronisé,
   hachuré = en attente. Mono télémétrique pour codes & coordonnées.
   ============================================================ */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/fonts/archivo-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/fonts/archivo-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Spline Sans Mono';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/spline-mono-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Spline Sans Mono';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/spline-mono-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* encres & fonds */
  --ground: #F7FBF2;
  --paper: #FFFFFF;
  --ink: #0C1F1A;
  --ink-2: #41534B;
  --line: #D9E3D3;
  --line-strong: #B9C9B2;

  /* signaux d'expédition */
  --orange: #FF5A1F;
  --orange-deep: #C03A00;
  --chartreuse: #A8E10C;
  --chartreuse-deep: #5E7E00;
  --cyan: #19B7C4;
  --cyan-deep: #0C6E77;
  --amber: #FFB020;
  --danger: #D3222A;

  --sans: 'Archivo', system-ui, sans-serif;
  --mono: 'Spline Sans Mono', ui-monospace, monospace;

  --hatch-pending: repeating-linear-gradient(45deg,
      rgba(255, 255, 255, 0.65) 0 3px, rgba(255, 255, 255, 0) 3px 6px);

  --shadow-1: 0 2px 10px rgba(12, 31, 26, 0.14);
  --shadow-2: 0 10px 34px rgba(12, 31, 26, 0.22);
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --dock-h: 86px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--ground);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--chartreuse); color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.hidden { display: none !important; }

/* ---------- étiquettes-tampons (labels capitales) ---------- */
.tab-label {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   Connexion — couverture du carnet
   ============================================================ */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    url('/icons/contours.svg') center / 900px auto,
    var(--ground);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  padding: 0 0 26px;
  overflow: hidden;
}
.login-cover {
  background: var(--ink);
  color: var(--ground);
  padding: 26px 24px 22px;
  position: relative;
}
/* ligne de registre sous le sous-titre de couverture */
.login-cover .field-no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--chartreuse);
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(200, 214, 194, 0.3);
}
.login-cover h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.02;
  font-weight: 840;
  font-stretch: 118%;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.login-cover .cover-sub {
  margin: 10px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: #C8D6C2;
}
/* tranche du carnet : les trois signaux sur toute la hauteur de la carte */
.cover-stripe {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  z-index: 1;
  background: linear-gradient(180deg, var(--orange) 0 34%, var(--chartreuse) 34% 67%, var(--cyan) 67% 100%);
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px 0;
}
#login-form label { display: flex; flex-direction: column; gap: 7px; }

input[type='text'], input[type='password'], input[type='search'], textarea, select {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--ground);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-s);
  padding: 13px 14px;
  width: 100%;
  caret-color: var(--orange);
  transition: border-color 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.28);
}

.btn {
  font: inherit;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 14.5px;
  border: none;
  border-radius: var(--r-s);
  padding: 15px 20px;
  cursor: pointer;
  color: var(--ink);
  background: var(--ground);
  border: 1.5px solid var(--line-strong);
  transition: transform 0.12s var(--ease-out), background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--orange);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.btn.primary:active { background: var(--orange-deep); color: #fff; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }

.error {
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
}
.hint { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 0; }

/* ============================================================
   Structure de l'app
   ============================================================ */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- bandeau d'en-tête de carnet ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--ground);
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-t));
  z-index: 30;
  border-bottom: 3px solid var(--orange);
}
.app-title {
  font-weight: 820;
  font-stretch: 106%;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 14.5px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* tampon de synchro : plein = à jour, hachuré = en attente */
#sync-stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 5px 10px 5px 7px;
  background: transparent;
  color: var(--chartreuse);
  cursor: default;
  white-space: nowrap;
}
#sync-stamp .stamp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
#sync-stamp.pending { color: var(--amber); border-style: dashed; }
#sync-stamp.pending .stamp-dot { background: var(--amber); position: relative; overflow: hidden; }
#sync-stamp.pending .stamp-dot::after { content: ''; position: absolute; inset: 0; background: var(--hatch-pending); }
#sync-stamp.offline { color: #AEBDAA; border-style: dashed; }
#sync-stamp.syncing .stamp-dot { animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.25; } }

#btn-user {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--chartreuse);
  background: var(--chartreuse);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- carte ---------- */
#map-wrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #E4EDDC; z-index: 1; }
.leaflet-container { font-family: var(--sans); }

.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow-1) !important; border-radius: var(--r-s) !important; overflow: hidden; }
.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  font-size: 19px;
  color: var(--ink) !important;
  background: var(--paper) !important;
  border-bottom: 1px solid var(--line) !important;
}
.leaflet-control-attribution { font-size: 12px; background: rgba(247, 251, 242, 0.85) !important; color: var(--ink-2) !important; }
.leaflet-control-attribution a { color: var(--cyan-deep) !important; }

/* popup « marquer ce lieu » */
.leaflet-popup-content-wrapper {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-2);
}
.leaflet-popup-content { margin: 10px 12px; font-family: var(--sans); }
.leaflet-popup-tip { background: var(--ink); }
.mark-here { display: flex; flex-direction: column; gap: 8px; min-width: 185px; }
.mark-here .coords {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.mark-here button {
  font: inherit;
  font-weight: 760;
  font-size: 13.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--orange);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-s);
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}

/* ---------- marqueurs-tampons numérotés ---------- */
.obs-pin {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c, var(--cyan));
  border: 2.5px solid var(--paper);
  box-shadow: 0 3px 9px rgba(12, 31, 26, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
}
.obs-pin::before {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 11px;
  height: 11px;
  background: inherit;
  border-right: 2.5px solid var(--paper);
  border-bottom: 2.5px solid var(--paper);
  transform: translateX(-50%) rotate(45deg);
  border-bottom-right-radius: 3px;
  z-index: -1;
}
.obs-pin .no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--t, #fff);
  z-index: 1;
}
.obs-pin.pending::after {
  content: '';
  position: absolute;
  inset: -2.5px;
  border-radius: 50%;
  background: var(--hatch-pending);
  border: 2.5px dashed var(--paper);
}
.obs-pin.stamp-in { animation: stamp-in 0.45s var(--ease-out); }
@keyframes stamp-in {
  0% { transform: scale(2.1); opacity: 0; }
  60% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1); }
}

/* ma position : chartreuse, halo respirant */
.me-dot {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--chartreuse);
  border: 3px solid var(--ink);
  box-shadow: 0 2px 8px rgba(12, 31, 26, 0.4);
}
.me-dot::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid var(--chartreuse);
  opacity: 0.8;
  animation: me-pulse 2.4s var(--ease-out) infinite;
}
/* position simulée (GPS indisponible) : pointillés, pas de pulsation */
.me-dot.manual { border-style: dashed; }
.me-dot.manual::after { animation: none; border-style: dashed; transform: scale(0.8); opacity: 0.7; }
@keyframes me-pulse {
  0% { transform: scale(0.55); opacity: 0.9; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* ---------- couche lieux d'intérêt ---------- */
.map-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background 0.15s, color 0.15s, transform 0.12s var(--ease-out);
}
.map-toggle:active { transform: scale(0.95); }
.map-toggle.active { background: var(--cyan-deep); border-color: var(--cyan-deep); color: var(--ground); }

/* barre de chargement de la zone (indéterminée) */
.map-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  z-index: 16;
  background: var(--ink);
  box-shadow: 0 2px 6px rgba(12, 31, 26, 0.35);
  overflow: hidden;
}
.map-loader::after {
  content: '';
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  width: 38%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--chartreuse), var(--cyan));
  animation: loader-sweep 1.1s var(--ease-out) infinite;
}
@keyframes loader-sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(380%); }
}

/* marqueur de lieu : carré à aperçu photo, contour = pas encore à vous ;
   étoiles au-dessus = popularité (vues Wikipédia) */
.poi-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  height: 100%;
}

/* titre du lieu, révélé sous le carré agrandi au survol */
.poi-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 36px) scale(0.92);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--ground);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.3;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-1);
  transition: opacity 0.15s, transform 0.18s var(--ease-out);
  z-index: 2;
}
.poi-wrap:hover .poi-name {
  opacity: 1;
  transform: translate(-50%, 36px) scale(1);
}
.poi-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--paper);
  border: 1.5px solid var(--cyan-deep);
  border-radius: 999px;
  padding: 1px 4px;
  color: var(--amber);
  box-shadow: 0 1px 4px rgba(12, 31, 26, 0.25);
  transition: transform 0.18s var(--ease-out);
}
.poi-sq {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--paper);
  border: 2px solid var(--cyan-deep);
  box-shadow: 0 2px 7px rgba(12, 31, 26, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-deep);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s;
}
.poi-sq img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* survol : le carré s'agrandit fortement et passe au premier plan */
.poi-wrap:hover .poi-sq {
  transform: scale(2.6);
  border-width: 1.5px;
  border-radius: 5px;
  box-shadow: 0 10px 26px rgba(12, 31, 26, 0.5);
}
.poi-wrap:hover .poi-stars { transform: translateY(-34px); }
.leaflet-marker-icon:hover { z-index: 10000 !important; }

/* fiche lieu d'intérêt */
.poi-gallery {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 14px 0 4px;
  scrollbar-width: none;
}
.poi-gallery::-webkit-scrollbar { display: none; }
.poi-gallery img {
  height: 170px;
  max-width: 85%;
  border-radius: var(--r-s);
  border: 1.5px solid var(--line-strong);
  object-fit: cover;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.poi-gallery:empty { display: none; }
.poi-desc {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  margin: 12px 0 4px;
  white-space: pre-line;
}
.poi-source { font-size: 12.5px; color: var(--ink-2); margin: 8px 0 4px; }
.poi-source a { color: var(--cyan-deep); text-underline-offset: 3px; }
.poi-empty-img {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 540;
  padding: 14px 0 0;
}

/* première utilisation */
#first-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-2);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 560;
  max-width: 86%;
  display: flex;
  gap: 10px;
  align-items: center;
}
#first-hint .swatch {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

/* ---------- dock au pouce ---------- */
#dock {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: var(--paper);
  border-top: 1.5px solid var(--line);
  z-index: 30;
}
.dock-btn {
  width: 60px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--ground);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0 7px;
  transition: transform 0.12s var(--ease-out);
}
.dock-btn:active { transform: scale(0.94); }
.dock-btn .dock-label {
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}
#dock-observe {
  flex: 1;
  border: 2px solid var(--ink);
  border-radius: var(--r-m);
  background: var(--orange);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(255, 90, 31, 0.42);
  transition: transform 0.12s var(--ease-out), background 0.15s;
}
#dock-observe:active { transform: scale(0.97); background: var(--orange-deep); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-h) + 18px + var(--safe-b));
  background: var(--ink);
  color: var(--ground);
  border-radius: var(--r-s);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 560;
  z-index: 55;
  max-width: 86vw;
  box-shadow: var(--shadow-2);
}

/* ============================================================
   Feuilles du bas
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(12, 31, 26, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  background: var(--paper);
  border-radius: var(--r-l) var(--r-l) 0 0;
  border: 2px solid var(--ink);
  border-bottom: none;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.32s var(--ease-out);
}
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0.4; } }
.sheet-grip {
  flex-shrink: 0;
  padding: 10px 0 2px;
  display: flex;
  justify-content: center;
  cursor: grab;
}
.sheet-grip::before {
  content: '';
  width: 48px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-strong);
}
.sheet-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 13px;
  border-bottom: 1.5px solid var(--line);
}
.sheet-head .obs-code {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--orange-deep);
  background: rgba(255, 90, 31, 0.1);
  border: 1.5px solid var(--orange);
  border-radius: 7px;
  padding: 4px 9px;
  white-space: nowrap;
}
.sheet-head h2 {
  margin: 0;
  flex: 1;
  font-size: 18px;
  font-weight: 800;
  font-stretch: 104%;
  letter-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-close {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--ground);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-body { overflow-y: auto; padding: 4px 18px 20px; }

/* sections réglées à en-têtes */
.field-section { border-bottom: 1.5px solid var(--line); padding: 15px 0 17px; }
.field-section:last-of-type { border-bottom: none; }
.field-section > .tab-label { display: block; margin-bottom: 9px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }

#point-name {
  font-size: 19px;
  font-weight: 700;
  padding: 12px 14px;
}

/* télémétrie */
.telemetry {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.75;
  color: var(--ink-2);
  background: var(--ground);
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  padding: 11px 14px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 16px;
}
.telemetry b { color: var(--ink); font-weight: 600; }

/* photos — planches */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 9px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-s);
  overflow: hidden;
  border: 1.5px solid var(--line-strong);
  background: var(--ground);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb.pending { border-style: dashed; border-color: var(--amber); }
.photo-thumb.pending::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255, 176, 32, 0.38) 0 5px, transparent 5px 10px);
  pointer-events: none;
}
.photo-thumb.pending::before {
  content: 'EN ATTENTE';
  position: absolute;
  bottom: 5px;
  left: 5px;
  z-index: 1;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--amber);
  border-radius: 5px;
  padding: 2px 6px;
}
.photo-thumb .del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.photo-add {
  aspect-ratio: 1;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-s);
  background: var(--ground);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}
.photo-add:active { border-color: var(--orange); color: var(--orange-deep); }

.sheet-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px calc(16px + var(--safe-b));
  border-top: 1.5px solid var(--line);
  background: var(--ground);
  border-radius: 0 0 0 0;
}
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn.danger { flex: 0 0 auto; }

/* ---------- liste des observations ---------- */
.list-tools { display: flex; flex-direction: column; gap: 10px; padding: 12px 18px; border-bottom: 1.5px solid var(--line); }
.cat-filter { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cat-filter::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 680;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 7px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s;
}
.chip .chip-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--ink-2)); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--ground); }

.obs-list { list-style: none; margin: 0; padding: 4px 10px 18px; overflow-y: auto; }
.obs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--line);
  padding: 13px 8px;
  cursor: pointer;
}
.obs-item:active { background: var(--ground); }
.obs-item .obs-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c, var(--cyan));
  border: 2px solid var(--paper);
  box-shadow: 0 1px 5px rgba(12, 31, 26, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--t, #fff);
  position: relative;
}
.obs-item .obs-dot.pending::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--hatch-pending);
  border: 2px dashed var(--paper);
}
.obs-item .obs-dot .no { position: relative; z-index: 1; }
.obs-item .obs-main { flex: 1; min-width: 0; }
.obs-item .obs-name {
  display: block;
  font-weight: 700;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obs-item .obs-sub {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 540;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.obs-item .obs-code-mini {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
}
.list-empty {
  text-align: center;
  color: var(--ink-2);
  padding: 44px 24px;
  font-size: 15px;
  font-weight: 540;
  line-height: 1.55;
}
.list-empty .big { font-size: 34px; display: block; margin-bottom: 10px; }

/* ---------- menu utilisateur ---------- */
.menu-list { display: flex; flex-direction: column; padding: 8px 18px 18px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font: inherit;
  font-size: 15.5px;
  font-weight: 640;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--line);
  padding: 16px 6px;
  cursor: pointer;
  text-align: left;
}
.menu-item:last-child { border-bottom: none; }
.menu-item.danger { color: var(--danger); }
.menu-item svg { flex-shrink: 0; }
.menu-id {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 6px;
  border-bottom: 1.5px solid var(--line);
}
.menu-id .avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--chartreuse);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-id .who { font-weight: 760; font-size: 16.5px; }
.menu-id .role { font-size: 12.5px; color: var(--ink-2); font-weight: 540; margin-top: 1px; }

/* ---------- catégories ---------- */
#cat-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; border-bottom: 1.5px solid var(--line); }
#cat-form .field-row select { flex: 1; }
.color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: var(--c);
  transition: transform 0.12s var(--ease-out);
}
.color-dot.selected { border-color: var(--ink); transform: scale(1.14); }
.cat-list { list-style: none; margin: 0; padding: 6px 18px 20px; overflow-y: auto; }
.cat-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 4px;
  border-bottom: 1.5px solid var(--line);
  font-size: 15px;
  font-weight: 620;
}
.cat-list li.sub { margin-left: 30px; font-weight: 540; }
.cat-swatch { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; }
.cat-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list .count { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.cat-list .del {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 7px;
  display: flex;
}
.cat-empty { color: var(--ink-2); font-size: 14px; text-align: center; padding: 26px 20px; }

/* ---------- visionneuse photo ---------- */
#photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(12, 31, 26, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#photo-viewer img {
  max-width: 100%;
  max-height: calc(100% - 40px);
  border-radius: var(--r-s);
  border: 2px solid var(--ground);
}
#photo-viewer .btn-close { position: absolute; top: calc(16px + var(--safe-t)); right: 16px; }

/* ---------- desktop : les feuilles deviennent un panneau latéral,
   la carte reste visible et utilisable ---------- */
@media (min-width: 768px) {
  #dock { justify-content: center; }
  #dock-observe { flex: 0 0 340px; }
  .sheet-backdrop {
    /* démarre sous le bandeau : le tampon de synchro reste toujours visible */
    inset: calc(66px + var(--safe-t)) 0 0 0;
    background: rgba(12, 31, 26, 0.12);
    align-items: stretch;
    justify-content: flex-end;
    padding: 18px;
  }
  .sheet {
    max-width: 440px;
    max-height: 100%;
    border-radius: var(--r-l);
    border-bottom: 2px solid var(--ink);
    animation: panel-in 0.32s var(--ease-out);
  }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 18px; }
  @keyframes panel-in { from { transform: translateX(48px); opacity: 0.4; } }
}

/* ---------- mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
