/* Meï — balisage de sentier : vert sapin, jaune des panneaux directionnels, rouge des marques GR. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(/vendor/fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/vendor/fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(/vendor/fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/vendor/fonts/barlow-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(/vendor/fonts/barlow-condensed-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/vendor/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/vendor/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  --pine: #16302B;
  --pine-2: #234740;
  --pine-3: #4A6A62;
  --mist: #E8EDE6;
  --paper: #FFFFFF;
  --line: #C9D3C6;
  --muted: #56685F;
  --blaze: #F5C400;
  --blaze-deep: #CFA300;
  --gr: #E2321F;
  --star: #DDA000;
  --tabs: calc(64px + env(safe-area-inset-bottom));
  --top: env(safe-area-inset-top);
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 17px/1.45 "Barlow", system-ui, sans-serif;
  color: var(--pine);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
#app { min-height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; }

h1, h2 { font-family: var(--cond); font-weight: 600; line-height: 1.05; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 34px; margin-bottom: 14px; }
h2 { font-size: 24px; margin: 28px 0 12px; }
p { margin: 0 0 12px; max-width: 34em; }
.muted { color: var(--muted); font-size: 16px; }
.lead { font-size: 19px; }
.error { color: #A3241A; font-weight: 600; }
.notice { background: var(--paper); border-left: 5px solid var(--blaze); padding: 10px 14px; font-size: 16px; }

/* --- Ossature */
.screen { padding-bottom: calc(var(--tabs) + 16px); min-height: 100vh; }
.view.pad, .pad { padding-left: 18px; padding-right: 18px; }
.view.pad { padding-top: calc(var(--top) + 20px); }
.vhead { display: flex; align-items: center; gap: 10px; padding-top: calc(var(--top) + 18px); margin-bottom: 12px; }
.vhead h1 { margin: 0; flex: 1; }
.view.pad .vhead { padding-top: 0; }
.vhead-actions { display: flex; gap: 8px; }
.stack { display: grid; gap: 10px; margin: 18px 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .btn { padding: 0 10px; font-size: 16px; gap: 6px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.netbar {
  position: sticky; top: 0; z-index: 900;
  padding: calc(var(--top) + 6px) 16px 7px; background: var(--pine-2); color: #fff; font-size: 15px;
}

/* --- Onglets */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: var(--tabs); padding-bottom: env(safe-area-inset-bottom);
  background: var(--pine);
}
.tab {
  position: relative; border: 0; background: none; color: #B9CBC3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 14px; font-weight: 600;
}
.tab.on { color: var(--blaze); }
.tab.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 4px; background: var(--blaze); }
.tab:focus-visible { outline-color: var(--blaze); outline-offset: -4px; }
.rec-dot { position: absolute; top: 9px; right: calc(50% - 22px); width: 10px; height: 10px; border-radius: 50%; background: var(--gr); box-shadow: 0 0 0 2px var(--pine); }

/* --- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 16px; border-radius: 12px;
  border: 1.5px solid #AFBDB3; background: var(--paper); color: var(--pine);
  font-weight: 600; font-size: 17px; text-decoration: none; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; }
.btn.primary { background: var(--blaze); border-color: var(--blaze-deep); }
.btn.danger { background: var(--gr); border-color: #B8281A; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger-text { color: #A3241A; }
.btn.wide { width: 100%; }
.btn.huge { min-height: 62px; font-size: 21px; border-radius: 14px; }
.btn.sm { min-height: 42px; padding: 0 12px; font-size: 16px; }
.btn.icon { width: 42px; padding: 0; }
.ico { flex: none; }

/* --- Formulaires */
.form { display: grid; gap: 4px; margin-top: 8px; }
.field { margin: 0 0 18px; }
.f-label { font-weight: 600; margin-bottom: 8px; }
.f-hint { font-size: 14px; color: var(--muted); margin-top: 6px; }
.input, .select {
  width: 100%; min-height: 50px; padding: 11px 13px; font-size: 17px;
  background: var(--paper); border: 1.5px solid #AFBDB3; border-radius: 10px;
}
textarea.input { resize: vertical; line-height: 1.4; }
.select { width: 100%; flex: 1 1 0; min-width: 0; appearance: none; padding-right: 34px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%2316302B' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; }
.input:focus, .select:focus { outline: 3px solid var(--blaze); outline-offset: 0; border-color: var(--pine); }
.mini { display: grid; gap: 4px; font-size: 15px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 8px;
  border: 1.5px solid #AFBDB3; background: var(--paper); font-weight: 500; font-size: 16px;
}
.chip.on { background: var(--pine); border-color: var(--pine); color: #fff; }
.chip .dot { width: 14px; height: 8px; border-radius: 1.5px; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }

.toggles { display: grid; margin: 4px 0 18px; border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.t-text { flex: 1; display: grid; }
.t-text small { color: var(--muted); font-size: 14px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.t-track { flex: none; width: 52px; height: 32px; border-radius: 16px; background: #C3CEC0; position: relative; transition: background .15s; }
.t-track span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(22,48,43,.35); transition: transform .15s; }
.toggle input:checked + .t-track { background: var(--pine); }
.toggle input:checked + .t-track span { transform: translateX(20px); }
.toggle input:focus-visible + .t-track { outline: 3px solid var(--pine); outline-offset: 2px; }
.context { margin-top: 0; }

.stars { display: inline-flex; color: #CBD4C8; line-height: 1; }
.stars .on { color: var(--star); }
.stars.s { font-size: 15px; gap: 1px; }
.stars.m { font-size: 20px; gap: 2px; }
.stars.l { gap: 4px; }
.stars.l button { border: 0; background: none; font-size: 38px; padding: 2px; color: #CBD4C8; line-height: 1; }
.stars.l button.on { color: var(--star); }

/* --- Balises de catégorie : petits rectangles peints sur l'écorce */
.blazes { display: inline-flex; gap: 5px; vertical-align: middle; }
.blazes i { display: block; width: 15px; height: 8px; border-radius: 1.5px; background: var(--c); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(22,48,43,.18); }
.blazes.big i { width: 22px; height: 12px; }

/* --- Cartes */
.mapwrap { position: relative; background: #DCE3D9; }
.mapwrap .map { position: absolute; inset: 0; }
.mapwrap.full { position: fixed; inset: 0; bottom: var(--tabs); }
.mapwrap.medium { height: 42vh; min-height: 240px; }
.mapwrap.list-map { height: calc(100vh - 290px); min-height: 320px; margin-top: 4px; }
.leaflet-container { font: inherit; background: #DCE3D9; }
.leaflet-control-attribution { font-size: 11px; }
.map-layer {
  position: absolute; z-index: 500; top: calc(var(--top) + 12px); right: 12px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 10px; background: var(--paper); font-size: 15px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(22,48,43,.25);
}
.detail-map .map-layer, .finish .map-layer { top: calc(var(--top) + 12px); }
.map-recenter {
  position: fixed; z-index: 600; right: 12px; top: calc(var(--top) + 62px);
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--paper);
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(22,48,43,.25);
}
.pin span {
  display: block; width: 24px; height: 24px; margin: 2px 0 0 1px; background: var(--c);
  border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: -1px 2px 5px rgba(22,48,43,.4);
}
.detail-map { position: relative; }
.back-btn {
  position: absolute; z-index: 500; top: calc(var(--top) + 12px); left: 12px;
  width: 44px; min-height: 44px; padding: 0; box-shadow: 0 2px 8px rgba(22,48,43,.25); border: 0;
}

/* --- Enregistrement */
.dock {
  position: fixed; z-index: 700; left: 12px; right: 12px; bottom: calc(var(--tabs) + 12px);
  background: var(--paper); border-radius: 18px; padding: 16px;
  box-shadow: 0 8px 28px rgba(22,48,43,.28);
}
.dock-hint { font-size: 15px; color: var(--muted); margin: 12px 2px 0; }
.dock-walk { font-weight: 600; margin-bottom: 6px; }
.readout { display: grid; grid-template-columns: 1.3fr 1fr 1fr; align-items: end; }
.ro { display: grid; padding: 0 10px; border-left: 1px solid var(--line); }
.ro:first-child { padding-left: 0; border-left: 0; }
.ro .v { font: 600 26px/1 var(--cond); font-variant-numeric: tabular-nums; }
.ro.main .v { font-size: 44px; }
.ro .k { font-size: 14px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gps { font-size: 14px; color: var(--muted); margin: 12px 0; }
.gps.warn { color: #A3241A; font-weight: 600; }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.controls .btn { padding: 0 6px; font-size: 16px; }

.pocket {
  position: fixed; inset: 0; z-index: 2000; background: #000; color: #4B4B4B;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.pocket.holding { color: #9A9A9A; }
.p-clock { font: 600 84px/1 var(--cond); font-variant-numeric: tabular-nums; }
.p-dist { font: 500 34px/1 var(--cond); }
.p-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 40px); font-size: 15px; }

/* --- Fiches */
.finish .pad, .detail .pad, .add .pad { padding-top: 20px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 4px 0 14px; background: var(--paper); border-radius: 12px; padding: 12px 0; }
.facts > div { display: grid; padding: 0 14px; border-left: 1px solid var(--line); }
.facts > div:first-child { border-left: 0; }
.facts .v { font: 600 26px/1.05 var(--cond); font-variant-numeric: tabular-nums; }
.facts .k { font-size: 14px; color: var(--muted); }
.d-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.d-title h1 { margin-bottom: 6px; }
.d-cats { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 14px; }
.d-last { font-size: 16px; }
.tags { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { border: 1.5px solid #AFBDB3; border-radius: 6px; padding: 3px 10px; font-size: 15px; background: var(--paper); }
.notes { white-space: pre-line; background: var(--paper); padding: 12px 14px; border-radius: 10px; }
.outings { list-style: none; padding: 0; margin: 0; background: var(--paper); border-radius: 12px; }
.outings li { display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 10px 14px; border-top: 1px solid var(--line); }
.outings li:first-child { border-top: 0; }
.outings span { display: grid; }
.outings small { color: var(--muted); font-size: 15px; }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 14px;
  border: 1.5px solid #AFBDB3; border-radius: 12px; background: var(--paper); font-weight: 600; text-align: left;
}
.pick span:not(.blazes) { flex: 1; }
.pick.on { border-color: var(--pine); box-shadow: inset 0 0 0 1.5px var(--pine); }
.file { position: relative; overflow: hidden; margin: 6px 0 18px; }
.file input { position: absolute; inset: 0; opacity: 0; }

/* --- Liste des balades */
.filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 14px; }
.filters > * { min-width: 0; }
.search { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 12px; background: var(--paper); border: 1.5px solid #AFBDB3; border-radius: 10px; }
.search input { flex: 1; border: 0; background: none; font-size: 17px; min-width: 0; padding: 10px 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--blaze); border-color: var(--pine); }
.seg { display: inline-flex; border: 1.5px solid #AFBDB3; border-radius: 10px; overflow: hidden; background: var(--paper); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; min-height: 46px; padding: 0 12px; font-weight: 600; font-size: 15px; }
.seg button.on { background: var(--pine); color: #fff; }
.wlist { list-style: none; margin: 0; padding: 0; background: var(--paper); border-top: 1px solid var(--line); }
.wlist li { border-bottom: 1px solid var(--line); }
.wrow { display: flex; width: 100%; gap: 12px; padding: 14px 18px; border: 0; background: none; text-align: left; align-items: center; }
.wr-main { flex: 1; display: grid; gap: 1px; min-width: 0; }
.wr-name { font-size: 19px; font-weight: 600; line-height: 1.2; }
.wr-sub { font-size: 15px; color: var(--muted); }
.wr-side { display: grid; justify-items: end; gap: 8px; flex: none; }
.empty { padding-top: 20px; }

/* --- On va où ? : poteau et panneaux directionnels */
.where h1 { margin-bottom: 18px; }
.signpost { position: relative; padding: 8px 0 18px 18px; margin: 4px 0 18px; filter: drop-shadow(0 3px 4px rgba(22,48,43,.28)); }
.post { position: absolute; left: 4px; top: -6px; bottom: 0; width: 12px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, #5B4A3A, #7A6450 45%, #5B4A3A); }
.plate {
  position: relative; display: grid; gap: 4px; width: 88%; margin: 0 0 12px -8px; padding: 12px 40px 13px 26px;
  border: 0; background: var(--blaze); color: var(--pine); text-align: left;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 50%, calc(100% - 26px) 100%, 0 100%);
}
.plate::before { content: ""; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: rgba(22,48,43,.45); }
.plate.big { width: calc(100% + 8px); padding: 18px 46px 18px 28px; margin-bottom: 14px; }
.p-name { font: 700 23px/1.05 var(--cond); }
.plate.big .p-name { font-size: 34px; }
.p-meta { display: flex; align-items: center; gap: 10px; }
.p-meta .blazes i { box-shadow: 0 0 0 1.5px var(--blaze), 0 0 0 2.5px rgba(22,48,43,.35); }
.p-meta .stars span { color: rgba(22,48,43,.25); }
.p-meta .stars .on { color: var(--pine); }
.p-why { font-size: 15px; line-height: 1.3; }
.plate.big .p-why { font-size: 17px; }
.plate:focus-visible { outline: none; background: #FFD83A; }

.sticky-cta { position: sticky; bottom: calc(var(--tabs) + 10px); padding-top: 10px; margin-top: 6px; z-index: 5; }
.sticky-cta .btn { box-shadow: 0 6px 18px rgba(22,48,43,.25); }

/* --- Connexion */
.login { min-height: 100vh; padding: calc(var(--top) + 64px) 22px 40px; background: var(--pine); color: #fff; }
.login .form { background: var(--paper); color: var(--pine); border-radius: 18px; padding: 20px 18px 18px; margin-top: 30px; }
.login-mark { display: grid; gap: 5px; width: 64px; margin-bottom: 22px; }
.login-mark i { display: block; height: 16px; border-radius: 2px; background: #fff; }
.login-mark i + i { background: var(--blaze); }
.login-title { font: 700 72px/0.9 var(--cond); margin: 0 0 8px; }
.login-sub { font-size: 19px; color: #CFE0D8; }

.big-figure { font: 600 36px/1 var(--cond); margin-bottom: 6px; }

/* --- Feuilles et messages */
.sheet-bg { position: fixed; inset: 0; z-index: 1500; background: rgba(10,24,21,.45); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 85vh; overflow: auto; background: var(--mist); border-radius: 20px 20px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 26px; }
.toasts { position: fixed; z-index: 3000; left: 12px; right: 12px; bottom: calc(var(--tabs) + 14px); display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--pine); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 640px) {
  .screen > .view.pad, .screen > .view > .pad, .filters { max-width: 620px; margin-left: auto; margin-right: auto; }
  .dock { max-width: 560px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Fond « Relief » : l'ombrage assombrit le plan au lieu de le recouvrir */
.leaflet-layer.hillshade { mix-blend-mode: multiply; }

/* --- Historique, maison, modification */
.seg.wide { display: flex; width: 100%; margin-bottom: 14px; }
.seg.wide button { flex: 1; justify-content: center; }
.history .chips { margin-bottom: 10px; }
.h-total { font-size: 16px; color: var(--muted); margin: 4px 0 6px; }
.h-month h2 { margin: 22px 0 2px; }
.h-sum { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.h-day { flex: none; width: 42px; display: grid; justify-items: center; line-height: 1; color: var(--muted); font-size: 13px; }
.h-day strong { font: 600 26px/1 var(--cond); color: var(--pine); margin-top: 2px; }
.d-drive { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.o-actions { display: flex !important; flex-direction: row; gap: 2px; }
.trim { display: grid; gap: 14px; margin-bottom: 4px; }
.range { display: grid; gap: 6px; font-weight: 600; }
.range span { display: flex; justify-content: space-between; }
.range strong { color: #A3241A; font-weight: 600; }
.range input[type=range] { width: 100%; height: 32px; accent-color: var(--pine); }
.mapwrap.mini-map { height: 140px; border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.mapwrap.pick-map { height: 50vh; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.stack.tight { margin: 8px 0 0; gap: 8px; }
.pick small { flex: none; font-weight: 500; }
.edit h2 { margin-top: 26px; }
.notice .btn { margin-top: 6px; padding-left: 0; }

/* --- Dessin d'un tracé à la main */
.draw { display: grid; gap: 4px; margin-bottom: 14px; }
.draw .toggles, .draw .toggle { margin: 0; }
.draw .toggle { border-top: 1px solid var(--line); }
.draw-dist { margin: 8px 0 4px; font-size: 17px; }
.draw-dist strong { font: 600 26px/1 var(--cond); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.row3 .btn { padding: 0 6px; font-size: 15px; min-height: 52px; line-height: 1.15; }
.add .leaflet-container, .edit .leaflet-container { cursor: crosshair; }
