/* ChampiTracker — design « sous-bois »
   Contraintes terrain : cibles ≥ 56px (gants), contrastes plein soleil,
   aucune police externe (fiabilité hors ligne). */

:root {
  --bg: #F5F3EC;          /* écorce claire */
  --surface: #FFFFFF;
  --ink: #1E241C;
  --muted: #6B6F63;
  --green: #2F5D31;       /* vert forêt */
  --green-soft: #E4EDE2;
  --orange: #E4590E;      /* orange cèpe : réservé à l'enregistrement */
  --red: #B3261E;         /* amanite */
  --line: #E2DFD4;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(30, 36, 28, .12);
}
body.dark {
  --bg: #141810;          /* nuit en sous-bois */
  --surface: #1E241A;
  --ink: #ECEFE6;
  --muted: #9AA090;
  --green: #7FB56F;
  --green-soft: #26301F;
  --line: #2E3628;
  --shadow: 0 2px 10px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
/* L'attribut hidden doit toujours gagner, même contre display:flex */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font: 17px/1.45 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  overscroll-behavior: none;
}
h1 { font-size: 26px; } h2 { font-size: 22px; } h3 { font-size: 15px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--green);
  margin: 26px 0 8px; }
.muted { color: var(--muted); font-size: 15px; }
.center { text-align: center; }
.error { color: var(--red); text-align: center; min-height: 1.4em; margin-top: 10px; }

/* ---------------- Écrans ---------------- */
.screen { position: fixed; inset: 0; }
.page { display: flex; flex-direction: column;
        padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px; }
.page-body { flex: 1; overflow-y: auto; padding: 0 14px 20px; }

/* ---------------- Boutons ---------------- */
.btn {
  display: block; width: 100%; min-height: 60px;
  border: 0; border-radius: var(--radius); cursor: pointer;
  font: 700 19px/1 inherit; font-family: inherit;
  margin-top: 12px; padding: 0 18px;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--green);
  border: 2px solid var(--green); }
.btn.danger-ghost { background: transparent; color: var(--red);
  border: 2px solid var(--red); }
.btn.find {
  background: var(--orange); color: #fff; font-size: 21px;
  min-height: 68px; box-shadow: 0 4px 16px rgba(228, 89, 14, .45);
}
.btn:active { transform: scale(.98); }
.icon-btn { background: none; border: 0; font-size: 24px; cursor: pointer;
  min-width: 48px; min-height: 48px; color: var(--ink); }
.round {
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--ink);
  font-size: 22px; box-shadow: var(--shadow); cursor: pointer;
}

/* ---------------- Connexion ---------------- */
#screen-login { display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { font-size: 64px; text-align: center; }
.login-box h1 { text-align: center; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; min-height: 58px; margin-top: 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  font: inherit; padding: 0 16px;
}
textarea { padding: 14px 16px; min-height: 70px; resize: vertical; }
.search { margin: 0 14px 10px; width: calc(100% - 28px); }

/* ---------------- Carte ---------------- */
#map { position: absolute; inset: 0; }
.hud {
  position: absolute; top: calc(10px + env(safe-area-inset-top));
  left: 10px; right: 10px;
  display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center;
  background: rgba(20, 24, 16, .78); color: #fff;
  border-radius: 16px; padding: 8px 14px;
  backdrop-filter: blur(4px);
}
.hud-item { text-align: center; }
.hud-item span { font-size: 19px; font-weight: 800;
  font-variant-numeric: tabular-nums; }
.hud-item label { display: block; font-size: 11px; color: #C9CFC0;
  text-transform: uppercase; letter-spacing: .05em; }
.map-side { position: absolute; right: 12px; top: 45%;
  display: flex; flex-direction: column; gap: 12px; }
.map-actions { position: absolute; left: 14px; right: 14px;
  bottom: calc(86px + env(safe-area-inset-bottom)); }
.map-actions-row { display: flex; gap: 10px; }
.map-actions-row .btn { flex: 1; }

/* ---------------- Navigation ---------------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; min-height: 64px; border: 0; background: none; cursor: pointer;
  font: 600 12px/1.2 inherit; color: var(--muted);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
}
#tabs button span { font-size: 24px; }
#tabs button.active { color: var(--green); }

/* ---------------- Cartes de liste ---------------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px;
}
.card .title { font-size: 18px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.card-row { display: flex; align-items: center; gap: 12px; }
.card-row .grow { flex: 1; min-width: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.list-item { display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; }
.badge { padding: 3px 12px; border-radius: 20px; font-size: 13px;
  font-weight: 700; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: #FBE9E7; color: var(--orange); }
.badge.danger { background: #FDECEA; color: var(--red); }

/* ---------------- Segments / puces / stepper ---------------- */
.seg { display: flex; border: 1.5px solid var(--green); border-radius: 12px;
  overflow: hidden; }
.seg button { border: 0; background: none; color: var(--green);
  font: 600 15px inherit; padding: 8px 16px; min-height: 44px; cursor: pointer; }
.seg button.active { background: var(--green); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 24px; padding: 12px 18px;
  font: 500 16px inherit; cursor: pointer; min-height: 48px; }
.chips button.active { background: var(--green); border-color: var(--green);
  color: #fff; }
.stepper { display: flex; align-items: center; gap: 20px; margin-top: 8px; }
.stepper button { width: 60px; height: 60px; border-radius: 16px; border: 0;
  background: var(--green-soft); color: var(--green);
  font-size: 30px; font-weight: 700; cursor: pointer; }
.stepper span { flex: 1; text-align: center; font-size: 34px; font-weight: 800; }

/* ---------------- Modales ---------------- */
.modal { position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 12, 8, .55);
  display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 22px 20px
    calc(24px + env(safe-area-inset-bottom));
}
.sheet h2 { margin-bottom: 6px; }
.sheet label { display: block; margin-top: 16px; font-weight: 700;
  font-size: 15px; }
.file-btn { display: flex; align-items: center; justify-content: center; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.previews img { width: 76px; height: 76px; object-fit: cover;
  border-radius: 12px; }

/* ---------------- Divers ---------------- */
.row-toggle { display: flex; align-items: center; justify-content: space-between;
  min-height: 58px; font-size: 17px; }
.row-toggle input { width: 52px; height: 30px; margin: 0; accent-color: var(--green); }
.warning-box { margin-top: 30px; padding: 14px; border-radius: 14px;
  background: var(--green-soft); color: var(--muted); font-size: 14px;
  text-align: center; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile { background: var(--green-soft); border-radius: 14px;
  padding: 14px 10px; text-align: center; }
.stat-tile b { display: block; font-size: 24px; color: var(--green);
  font-variant-numeric: tabular-nums; }
.stat-tile small { color: var(--muted); }
.bar-track { height: 10px; border-radius: 6px; background: var(--green-soft);
  overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--green); border-radius: 6px; }
.grid-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid-photos img { width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px; }
.section-title { font-size: 17px; font-weight: 800; margin: 18px 0 8px; }

#toast { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 99;
  background: var(--ink); color: var(--bg); border-radius: 14px;
  padding: 12px 20px; font-size: 16px; max-width: 90%;
  box-shadow: var(--shadow); }

.empty { text-align: center; color: var(--muted); padding: 60px 30px;
  font-size: 17px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
