/* ÉTRIER — bêta locale. Charte : design/charte-graphique.md + app/tokens.css */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--parch);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--brass-deep); }
input, select, textarea {
  font: inherit;
  /* JAMAIS sous 16 px : en dessous, iOS ZOOME la page à la mise au point du
     champ, et n'en ressort pas. Le corps de l'app est à 15,5 px selon la
     charte — les champs de saisie font exception, c'est une contrainte
     système, pas un choix typographique. */
  font-size: max(16px, 1em);
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 0; }
/* Par défaut le navigateur applique une opacité qui rend l'exemple illisible en sombre. */
::placeholder { color: var(--muted); opacity: 1; }
/* Les champs fichier gardaient le chrome système : un pavé blanc en plein
   thème sombre (vu sur « Nouvelle séance → Photos »). */
input[type="file"] { padding: 8px 9px; font-size: 16px; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700;
  margin-right: 10px; padding: 7px 13px;
  border: 1.5px solid var(--brass); border-radius: 9px;
  background: none; color: var(--brass-deep); cursor: pointer;
}

/* Une icône posée dans une ligne de texte : même hauteur, jamais de saut. */
.ico.inline { vertical-align: -2px; }
.etag, .f-chip { display: inline-flex; align-items: center; gap: 5px; }
.al-txt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acte-rappel { display: flex; align-items: center; gap: 5px; }
.plan-l1 b { display: inline-flex; align-items: center; gap: 6px; }
.seg-btn .ico, .chip .ico { vertical-align: -3px; margin-right: 5px; }


/* ═══ Comportements natifs ═══
   Trois réflexes qui séparent une application d'une page web ouverte en
   plein écran. Vérifiés sur iPhone, pas seulement dans un émulateur. */

/* L'appui long sur un bouton ou une icône ouvrait le menu contextuel d'iOS
   (« Copier », loupe de sélection) : c'est le geste le plus « site web » qui
   soit. Le texte du contenu, lui, reste sélectionnable — on peut vouloir
   copier un commentaire de séance ou un numéro SIRE. */
button, .chip, .tab, .qa, .ico-btn, .mini-btn, .fab, .horse, .seg-btn,
.cal-cell, .rbtn, .layer, .al-btn, .auj-item, .rech-item {
  -webkit-touch-callout: none;
}

/* Apple recommande 44 pt de cible tactile. Plutôt que de grossir les boutons
   — ce qui casserait la composition — on étend la zone sensible AUTOUR d'eux :
   l'œil voit 38 px, le doigt en touche 44. */
.ico-btn, .mini-btn, .top-btn { position: relative; }
.ico-btn::after, .mini-btn::after, .top-btn::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}

/* Le défilement élastique d'iOS sur le corps de page donne l'impression que
   l'app « décolle » de son cadre. Il reste actif DANS les listes, là où il
   est un repère utile de fin de contenu. */
html, body { overscroll-behavior: none; }

/* ═══ Barre supérieure ═══ */
.topbar {
  background: linear-gradient(180deg, var(--leather-lt), var(--leather-dk));
  color: var(--parch-lt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  border-bottom: 2px dashed var(--stitch);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; }
.stirrup { width: 20px; height: 23px; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: .14em;
  color: var(--brass-lt);
}
.beta-pill {
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--brass-lt); border: 1px solid rgba(216,183,106,.45);
  border-radius: 999px; padding: 2px 7px; opacity: .85;
}
.top-actions { display: flex; gap: 4px; }
.top-btn {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass-lt);
  border-radius: 50%;
}
.top-btn svg { width: 21px; height: 21px; }
.top-btn.on { background: rgba(216,183,106,.18); }
.badge-cloche {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px;
  background: #c0392b; color: #fff;
  font-size: 12px; font-weight: 800;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ═══ Vue principale ═══ */
#vue {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#vue > .agenda, #vue > .contenu { padding: 12px 14px 20px; }
.contenu { padding: 4px 14px 24px; }

/* ═══ Chips & filtres ═══ */
.filters {
  display: flex; gap: 7px; align-items: center;
  padding: 9px 12px;
  background: var(--leather);
  overflow-x: auto;
  scrollbar-width: none;
  flex: 0 0 auto;
}
.filters::-webkit-scrollbar { display: none; }
.filters.sec { background: transparent; padding: 8px 0; }
.chip {
  flex: 0 0 auto;
  font-size: 14.5px; font-weight: 600;
  color: var(--brass-lt);
  border: 1px solid rgba(216,183,106,.4);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.filters.sec .chip {
  color: var(--muted); border-color: var(--line); background: var(--parch-lt);
}
.chip.on, .filters.sec .chip.on, .chips-grp .chip.f.on {
  background: var(--brass); border-color: var(--brass); color: #fff !important;
}
.chip.seg { font-size: 15.5px; padding: 7px 16px; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.filters .sep { flex: 0 0 1px; align-self: stretch; background: rgba(216,183,106,.3); margin: 2px 3px; }

/* ═══ Carte ═══ */
.map-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--parch); }
.leaflet-container { font: inherit; }
.count-pill {
  position: absolute; z-index: 800;
  top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--leather); color: var(--brass-lt);
  font-size: 13.5px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(216,183,106,.4);
  box-shadow: 0 4px 14px rgba(44,30,18,.35);
  pointer-events: none; white-space: nowrap;
}
.mk {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--parch-lt);
  box-shadow: 0 3px 8px rgba(44,30,18,.4);
  color: #fff; font-size: 13.5px; font-weight: 800;
}
.mk.pro { border-radius: 9px; }
.mk.star::after {
  content: "★";
  position: absolute; top: -8px; right: -8px;
  font-size: 13.5px; color: var(--brass-deep);
  text-shadow: 0 0 3px var(--parch-lt), 0 0 3px var(--parch-lt);
}
.fav {
  margin-left: auto; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  color: var(--muted);
}
.fav svg { fill: none; }
.fav.on { color: var(--brass); }
.fav.on svg { fill: currentColor; }

/* ═══ Sheets ═══ */
#sheet-host { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.sh-wrap { position: absolute; inset: 0; pointer-events: auto; }
.sh-backdrop { position: absolute; inset: 0; background: rgba(30,19,10,.45); opacity: 0; transition: opacity .2s; }
.sh-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 62vh;
  background: var(--parch-lt);
  border-radius: 18px 18px 0 0;
  border-top: 2px dashed var(--stitch);
  box-shadow: var(--shadow-sheet);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
}
.sh-panel.plein { max-height: 88vh; height: 88vh; }
.sh-wrap.on .sh-backdrop { opacity: 1; }
.sh-wrap.on .sh-panel { transform: translateY(0); }
.sh-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px 9px;
  border-bottom: 1px solid var(--line);
}
.sh-titre { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--tan); }
.sh-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--parch); color: var(--muted); font-size: 15.5px;
}
.sh-body { padding: 13px 16px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }

/* ═══ Formulaires ═══ */
.champ { display: block; margin-bottom: 12px; }
.champ-l {
  display: block;
  font-size: 13.5px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 5px;
}
.chips-grp { display: flex; flex-wrap: wrap; gap: 7px; }
.chip.f { color: var(--muted); border-color: var(--line); background: var(--field-bg); }
.aide { font-size: 13.5px; color: var(--muted); line-height: 1.45; margin: 6px 0 10px; }
.avert { font-size: 13.5px; color: #8a4a12; background: #f6e3cf; border: 1px solid #e4c39a; border-radius: 9px; padding: 7px 10px; margin: 6px 0; }
.f-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  flex: 1; text-align: center; text-decoration: none;
  font-size: 15.5px; font-weight: 700;
  padding: 11px 10px; border-radius: 11px;
  background: var(--btn-bg); color: var(--btn-ink);
}
.btn.ghost { background: none; border: 1.5px solid var(--leather); color: var(--leather); }
.btn.danger { background: #8a3324; color: #f6e3cf; }
.btn.danger.ghost { background: none; border: 1.5px solid #8a3324; color: #8a3324; }
.btn.petit { flex: 0 0 auto; font-size: 14.5px; padding: 8px 14px; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.conf-msg { font-size: 16px; line-height: 1.5; margin-bottom: 4px; }
.rangee-actions { display: flex; gap: 8px; margin: 10px 0; }

/* ═══ Fiches / cartes / fil ═══ */
.day {
  font-family: var(--font-display);
  font-weight: 600; font-size: 15.5px;
  color: var(--tan);
  margin: 14px 2px 8px;
  display: flex; align-items: center; gap: 9px;
}
.day::after { content: ""; flex: 1; border-top: 2px dashed var(--stitch); }
.entry {
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  margin-bottom: 9px;
}
.etop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.etag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 800;
  color: #fff; padding: 3px 9px;
  border-radius: 6px; letter-spacing: .02em;
}
.edur { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.etime { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.etext { font-size: 15.5px; line-height: 1.5; margin-top: 8px; }
.acte-pro { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.acte-obs { font-size: 15.5px; margin-top: 7px; }
.acte-rappel { font-size: 13.5px; margin-top: 7px; color: var(--ink); }
.acte-rappel.fait { color: var(--muted); }
.ephotos { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.ph-r { width: 31%; min-width: 88px; height: 76px; object-fit: cover; border-radius: 9px; cursor: pointer; }
.ereact {
  display: flex; align-items: center; gap: 14px;
  margin-top: 9px; padding-top: 8px;
  border-top: 1px solid var(--line);
}
.rbtn { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.rbtn.on { color: #b03a2e; }
.coms { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.com { font-size: 14.5px; background: var(--parch); border-radius: 9px; padding: 7px 10px; }
.mini-btn { font-size: 16px; opacity: .55; padding: 3px 5px; text-decoration: none; }
.mini-btn:hover { opacity: 1; }
.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  margin-bottom: 7px;
  font-size: 15.5px;
}
.row > span:first-child, .row .cr-txt { flex: 1; min-width: 0; }
.row.fin { border: 0; background: none; padding: 4px 0; margin: 0; }
.vide { text-align: center; color: var(--muted); font-size: 15.5px; padding: 22px 10px; line-height: 1.5; }

/* fiche concours/pro dans sheet */
.f-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f-tag { font-size: 12px; font-weight: 800; color: #fff; padding: 3px 9px; border-radius: 6px; }
.f-chip { font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.f-star { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--brass-deep); }
.f-star svg { fill: currentColor; }
.f-nom { font-family: var(--font-display); font-weight: 600; font-size: 18.5px; line-height: 1.25; margin-top: 8px; }
.f-lieu { font-size: 14.5px; color: var(--muted); margin-top: 3px; }
.f-dates { font-size: 15.5px; font-weight: 600; margin-top: 7px; }
.f-specs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.f-statut {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; margin-top: 8px;
}
.f-statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.f-statut.ok, .st-ok { color: var(--ok); }
.f-statut.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.f-statut.warn, .st-warn { color: #8a4a12; }
.f-statut.warn { background: #f6e3cf; border: 1px solid #e4c39a; }
.f-statut.closed, .st-closed { color: var(--closed); }
.f-statut.closed { background: #f0ddd6; border: 1px solid #dbb9ac; }
.f-statut.muted, .st-muted { color: var(--muted); }
.f-statut.muted { background: var(--parch); border: 1px solid var(--line); }

/* ═══ Sélecteur d'équidé ═══ */
.horses {
  display: flex; gap: 9px;
  padding: 12px 14px 11px;
  overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(180deg, var(--leather-dk), var(--leather-lt));
  flex: 0 0 auto;
}
.horses::-webkit-scrollbar { display: none; }
.horse {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  opacity: .55; min-width: 60px;
}
.horse.sel { opacity: 1; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(216,183,106,.35);
  font-family: var(--font-display);
  font-weight: 700; font-size: 20px; color: var(--brass-lt);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.petit { width: 38px; height: 38px; font-size: 17px; flex: 0 0 auto; }
.avatar.plus { background: transparent; border-style: dashed; color: var(--brass-lt); font-weight: 400; }
.horse.sel .avatar { border-color: var(--brass-lt); box-shadow: 0 0 0 2px rgba(216,183,106,.25); }
.avatar.moi { background: var(--brass); color: var(--btn-ink); border-color: var(--brass-lt); }
.avatar.grand { width: 64px; height: 64px; font-size: 26px; flex: 0 0 auto; }
.hname { font-size: 12.5px; font-weight: 600; color: var(--parch-lt); white-space: nowrap; }

/* Bandeau du pro : les chevaux sont regroupés par propriétaire, chaque groupe
   sous son étiquette. Le défilement reste horizontal, sur les groupes. */
.horses.par-proprio { gap: 16px; align-items: flex-start; }
.hgroupe { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.hgroupe-l {
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--brass-lt); opacity: .75;
  padding-left: 2px; white-space: nowrap;
}
.hgroupe-l2 { display: flex; gap: 9px; }
.hgroupe + .hgroupe { border-left: 1px solid rgba(216,183,106,.22); padding-left: 16px; }
.cheval-row .cr-txt { flex: 1; }

/* ═══ Segmented ═══ */
.segmented {
  display: flex; gap: 4px;
  margin: 10px 14px 2px;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  flex: 0 0 auto;
}
.seg-btn {
  flex: 1;
  font-size: 14.5px; font-weight: 700;
  color: var(--muted);
  padding: 8px 2px;
  border-radius: 9px;
}
.seg-btn.on { background: var(--leather); color: var(--brass-lt); }

/* ═══ Pension / rôle ═══ */
.pension {
  background: var(--parch-lt);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
}
.pro-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--leather); color: var(--brass-lt);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex: 0 0 auto;
}
.pension .who { flex: 1; min-width: 140px; }
.pension .l1 { font-size: 15.5px; font-weight: 700; }
.pension .l2 { font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  color: var(--ok); background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.code-inv {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700; letter-spacing: .12em;
  text-align: center;
  background: var(--parch);
  border: 2px dashed var(--stitch);
  border-radius: 12px;
  padding: 16px;
  margin: 10px 0;
}

/* ═══ Stats ═══ */
.week, .stat-ligne { display: flex; gap: 8px; padding: 12px 14px 2px; }
.stat-ligne { padding: 4px 0 8px; }
.stat {
  flex: 1;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 8px;
  text-align: center;
  outline: 1px dashed var(--stitch);
  outline-offset: -4px;
}
.stat .n { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.stat .n small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.feed { padding: 4px 14px 20px; }

/* Le journal est monté à deux endroits : pleine largeur dans l'onglet Suivi,
   et à l'intérieur de .contenu dans la fiche cheval, qui a déjà ses marges.
   On annule la double gouttière plutôt que de dupliquer le composant. */
#ch-contenu .pension { margin: 0 -14px; }
#ch-contenu .feed { padding-left: 0; padding-right: 0; }
#ch-contenu .week { padding-left: 0; padding-right: 0; }
#ch-contenu .rangee-actions[style] { padding: 0 !important; }


/* ═══ Aujourd'hui — l'écran d'ouverture ═══ */
.auj { padding-top: 16px; }
.auj-titre {
  font-family: var(--font-display);
  font-weight: 600; font-size: 26px; line-height: 1.15;
  color: var(--ink);
}
.auj-date { font-size: 13.5px; color: var(--muted); margin: 3px 0 18px; }
.auj-date::first-letter { text-transform: uppercase; }

.auj-bloc { margin-bottom: 20px; }
.auj-bloc-t {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 16px; color: var(--tan);
  padding-bottom: 7px; margin-bottom: 9px;
  border-bottom: 2px dashed var(--stitch);
}
.auj-lien {
  flex: 0 0 auto;
  font-size: 13px; font-weight: 700; color: var(--brass-deep);
  display: inline-flex; align-items: center; gap: 2px;
}

.auj-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 13px;
  margin-bottom: 7px;
  color: var(--tan);
}
.auj-item .auj-txt { flex: 1; min-width: 0; color: var(--ink); }
.auj-item .auj-txt b { font-size: 15.5px; }
.auj-item .al-sous { display: block; }
.auj-item.retard { border-color: #dbb9ac; background: #f6e8e2; }
.auj-item.proche { border-color: #e4c39a; background: #f8ecd9; }
.auj-item.fait { opacity: .55; }
.auj-item.fait .auj-txt b { text-decoration: line-through; }

/* Le fil du journal remonté : c'est une carte cliquable, pas une ligne. */
.auj-post {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(180deg, var(--accent-haut), var(--accent-bas));
  border: 1px solid var(--brass);
  border-radius: var(--r-card);
  padding: 13px 14px;
}
.auj-post-t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.auj-post p { font-size: 15.5px; line-height: 1.5; color: var(--ink); }
.auj-post-cta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 13.5px; font-weight: 700; color: var(--brass-deep); margin-top: 9px;
}

.auj-vide {
  text-align: center; padding: 34px 16px;
  background: var(--parch-lt); border: 1px dashed var(--stitch);
  border-radius: var(--r-card); color: var(--soins);
}
.auj-vide b { display: block; font-size: 17px; color: var(--ink); margin: 10px 0 5px; }
.auj-vide p { font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.auj-vide .rangee-actions { justify-content: center; margin-top: 14px; }

/* Badge d'urgence porté par l'onglet — il remplace la cloche, supprimée. */
.badge-tab {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  min-width: 16px; height: 16px;
  background: #c0392b; color: #fff;
  font-size: 11px; font-weight: 800;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ═══ Recherche globale ═══ */
.rech-fam { margin-top: 16px; }
.rech-fam-t {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px;
}
.rech-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--parch-lt); border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 12px; margin-bottom: 6px;
  color: var(--muted);
}
.rech-item .rech-txt { flex: 1; min-width: 0; color: var(--ink); }
.rech-item .rech-txt b { display: block; font-size: 15px; }

.cpt-tete { display: flex; align-items: center; gap: 11px; color: var(--ok); margin-bottom: 4px; }
.cpt-tete .cr-txt { flex: 1; color: var(--ink); }

.consentement {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.45; color: var(--muted);
  margin: 2px 0 10px;
}
.consentement input {
  width: 19px; height: 19px; margin-top: 1px; flex: 0 0 auto;
  accent-color: var(--brass);
}
.lien-discret { font-size: 13px; color: var(--muted); text-decoration: underline; }

/* FAQ : accordéon natif <details> — zéro JavaScript, clavier et lecteur
   d'écran gratuits. Le triangle par défaut est remplacé par un chevron qui
   pivote, seul artifice. */
.faq-item {
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 7px;
  overflow: hidden;
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 40px 13px 14px;
  font-size: 15.5px; font-weight: 600; color: var(--ink);
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  position: absolute; right: 15px; top: 50%;
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .18s;
}
.faq-item[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq-item p {
  padding: 0 14px 13px;
  font-size: 15px; line-height: 1.55; color: var(--muted);
}

/* ═══ Plans de soins ═══ */
.plan-card {
  display: block; width: 100%; text-align: left;
  background: var(--parch-lt);
  border: 1px solid var(--brass);
  border-radius: 13px;
  padding: 11px 13px;
  margin-bottom: 9px;
}
.plan-l1 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.progress {
  height: 7px;
  background: var(--parch);
  border-radius: 999px;
  margin: 8px 0 5px;
  overflow: hidden;
}
.progress div { height: 100%; background: var(--brass); border-radius: 999px; }
.plan-resume { font-weight: 700; font-size: 15.5px; margin: 10px 0 6px; }
.plan-liste { list-style: none; margin: 8px 0; }
.plan-liste li { font-size: 14.5px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.plan-liste li.muted { color: var(--muted); border: 0; }
.al-tache { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 15.5px; }
.al-tache input { width: auto; margin-top: 2px; }
.al-tache .fait { text-decoration: line-through; color: var(--muted); }

/* ═══ Alertes ═══ */
.al-bloc { margin-bottom: 14px; }
.al-titre {
  font-family: var(--font-display);
  font-weight: 600; font-size: 15.5px; color: var(--tan);
  margin-bottom: 7px;
}
.al-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
  margin-bottom: 7px;
}
.al-item.retard { border-color: #dbb9ac; background: #f6e8e2; }
.al-item.proche { border-color: #e4c39a; background: #f8ecd9; }
.al-txt { flex: 1; font-size: 15.5px; min-width: 0; }
.al-sous { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.al-btn {
  flex: 0 0 auto;
  font-size: 13.5px; font-weight: 700;
  background: var(--leather); color: var(--brass-lt);
  border-radius: 9px;
  padding: 7px 11px;
}
.badge {
  display: inline-block;
  font-size: 12px; font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--parch);
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: 1px;
}
.badge.retard { background: #f0ddd6; border-color: #dbb9ac; color: var(--closed); }
.badge.proche { background: #f6e3cf; border-color: #e4c39a; color: #8a4a12; }
.badge.ok-b { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }

/* ═══ Agenda ═══ */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-nav {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  font-size: 19px; color: var(--tan);
}
.cal-mois { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--tan); text-align: center; }
.cal-ics { font-size: 13.5px; font-weight: 700; color: var(--brass-deep); padding: 6px 8px; }
.cal-jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 3px; }
.cal-jours span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell {
  aspect-ratio: 1 / 1.05;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 14.5px;
}
.cal-cell.vide { background: transparent; border: 0; }
.cal-cell.auj { border-color: var(--brass); border-width: 2px; }
.cal-cell.auj .n { color: var(--brass-deep); font-weight: 800; }
.cal-cell.sel { background: var(--leather); color: var(--parch-lt); }
.pts { display: flex; gap: 2px; height: 5px; }
.pt { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.pt.evenement { background: var(--brass); }
.pt.rappel { background: var(--veto); }
.pt.plan { background: var(--complet); }
.pt.cure { background: var(--endurance); }
.pt.concours { background: var(--cso); }
.pts .plus { font-size: 11px; line-height: 5px; color: var(--muted); }
.cal-legende { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin: 9px 2px; }
.cal-legende .pt { margin-right: 3px; }
.cal-jour-titre {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--tan);
  margin: 10px 0 7px;
}
.cal-item {
  display: flex; align-items: center; gap: 9px;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
  margin-bottom: 7px;
  font-size: 15.5px;
}
.cal-item-txt { flex: 1; min-width: 0; }

/* ═══ Mesures ═══ */
.spark {
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px 7px;
  margin-bottom: 10px;
}
.spark svg { width: 100%; height: 96px; display: block; }
.spark-minmax { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.spark.vide-s { text-align: center; color: var(--muted); font-size: 14.5px; padding: 18px; }

/* ═══ Budget ═══ */
.barre-cat { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13.5px; }
.bc-l { flex: 0 0 128px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-b { flex: 1; height: 12px; background: var(--parch-lt); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bc-b div { height: 100%; background: var(--brass); border-radius: 999px; }
.bc-v { flex: 0 0 auto; font-weight: 700; font-size: 13.5px; }

/* ═══ Documents ═══ */
.docs { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.doc-thumb {
  width: 58px; height: 58px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--parch);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-plein { width: 100%; min-height: 55vh; border: 0; border-radius: 10px; object-fit: contain; }

/* ═══ Actions rapides ═══ */
.qa-cheval { margin-bottom: 14px; }
.qa-cheval .champ-l { margin-bottom: 6px; }
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.qa {
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--tan);
}
.qa span { font-size: 13.5px; font-weight: 700; color: var(--ink); }

/* ═══ Onglets ═══ */
.tabs {
  display: flex;
  align-items: stretch;
  background: var(--nav-bg);
  padding-bottom: env(safe-area-inset-bottom);
  flex: 0 0 auto;
  position: relative;
}
.tab {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px 10px;
  color: #b49c74;
  font-size: 12px; font-weight: 600;
  border-top: 3px solid transparent;
}
.tab svg { width: 20px; height: 20px; }
.tab.on { color: var(--brass-lt); border-top-color: var(--brass); }
.fab {
  flex: 0 0 58px;
  align-self: center;
  width: 52px; height: 52px;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--brass);
  color: #fff;
  font-size: 28px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(44,30,18,.45), inset 0 0 0 2px rgba(255,255,255,.18);
  transform: translateY(-10px);
}

/* ═══ Toast ═══ */
.toast {
  position: fixed; z-index: 2000;
  left: 50%; bottom: 96px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--parch-lt);
  font-size: 14.5px; font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══ Desktop ═══ */
@media (min-width: 720px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,.35); }
  #sheet-host { max-width: 480px; left: 50%; transform: translateX(-50%); right: auto; width: 100%; }
}

/* ═══ v0.3 — Onboarding ═══ */
.onboarding {
  position: fixed; inset: 0; z-index: 3000;
  background: radial-gradient(800px 400px at 50% -5%, #5a3a22, #3c2716 60%, #2a1a0f);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.ob-carte {
  background: var(--parch-lt);
  border-radius: 20px;
  border-top: 2px dashed var(--stitch);
  padding: 30px 24px 22px;
  max-width: 340px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.ob-ico { display: flex; justify-content: center; color: var(--brass-deep); }
.ob-titre { font-family: var(--font-display); font-weight: 700; font-size: 23px; margin: 12px 0 8px; color: var(--ink); }
.ob-texte { font-size: 15.5px; line-height: 1.55; color: var(--muted); }
.ob-points { display: flex; gap: 6px; justify-content: center; margin: 16px 0; }
.ob-points span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.ob-points span.on { background: var(--brass); }
.ob-btn { width: 100%; }
.ob-passer { margin-top: 10px; font-size: 13.5px; color: var(--muted); text-decoration: underline; }

/* Côté pro : rappeler à qui est le cheval qu'on est en train de consulter. */
.bandeau-proprio {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  font-size: 13.5px; color: var(--muted);
  background: var(--parch-lt);
  border-bottom: 1px solid var(--line);
}
.bandeau-proprio b { color: var(--ink); }
.bandeau-proprio svg { flex: 0 0 auto; }

/* En-tête « Mon compte » : la photo est le bouton, pas un champ à côté. */
.moi-tete { display: flex; align-items: center; gap: 14px; }
.moi-nom { flex: 1; margin-bottom: 0; }
.moi-photo { position: relative; flex: 0 0 auto; }
.moi-photo-i {
  position: absolute; right: -2px; bottom: -2px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brass); color: var(--btn-ink);
  border: 2px solid var(--parch-lt);
}

/* Choix du rôle : deux cibles pleine largeur, impossibles à rater au pouce. */
.ob-roles { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.ob-role {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: center;
  text-align: left;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--field-bg);
}
.ob-role:active { border-color: var(--brass); }
.obr-ico { grid-row: 1 / 3; display: flex; justify-content: center; color: var(--brass-deep); }
.ob-role b { font-size: 16px; color: var(--ink); }
.obr-phrase { font-size: 13.5px; line-height: 1.4; color: var(--muted); }

/* ═══ v0.3 — Recherche ═══ */
.recherche {
  width: 100%;
  margin: 4px 0 10px;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  /* 16 px minimum : voir la règle sur input/select/textarea plus haut. */
  font-size: 16px;
}
.rech-item, .conseil-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 7px;
}
.rech-ico, .conseil-ico { flex: 0 0 auto; display: flex; color: var(--tan); }
.rech-txt, .conseil-txt { display: flex; flex-direction: column; gap: 2px; font-size: 15.5px; min-width: 0; }
.moi-point {
  width: 16px; height: 16px; border-radius: 50%;
  background: #2a6fdb; border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(42,111,219,.25);
}

/* ═══ v0.3 — Journée d'écurie (rafale) ═══ */
.rafale-row {
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px;
  margin-bottom: 9px;
}
.rafale-row.faite { opacity: .55; }
.rafale-tete { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.rafale-tete .avatar { color: var(--parch-lt); }
.rafale-etat { margin-left: auto; font-size: 13.5px; font-weight: 800; color: var(--ok); }
.rafale-types, .rafale-durees { margin-bottom: 7px; }
.rafale-types .chip { font-size: 17px; padding: 5px 10px; }
.rafale-durees .chip { font-size: 13.5px; padding: 4px 10px; }
.rafale-com { margin-bottom: 8px; font-size: 14.5px; padding: 8px 10px; }
.rafale-ok { width: 100%; }

/* ═══ v0.3 — Conseils & articles ═══ */
.conseils-card {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(180deg, var(--accent-haut), var(--accent-bas));
  border: 1px solid var(--brass);
  border-radius: 13px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 15.5px;
}
.conseils-card .al-sous { display: block; margin-top: 3px; }
.article-p { font-size: 15.5px; line-height: 1.6; margin-bottom: 11px; }

/* ═══ v0.4 — Vue liste (carte ⇄ liste) ═══ */
.liste-vue {
  position: absolute; inset: 0; z-index: 1200;   /* au-dessus des contrôles Leaflet (z-index 1000) */
  background: var(--parch);
  overflow-y: auto;
  padding: 12px 14px calc(18px + env(safe-area-inset-bottom));
}
.lc-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: var(--parch-lt);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.lc-item.warn { border-color: #e4c39a; background: #f8ecd9; }
.lc-item.closed { opacity: .72; }
.lc-pastille {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14.5px; font-weight: 800;
}
.lc-pastille.pro { border-radius: 9px; }
.lc-txt { display: flex; flex-direction: column; gap: 2px; font-size: 15.5px; min-width: 0; flex: 1; }
.lc-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-statut { font-size: 12.5px; font-weight: 700; margin-top: 2px; }


/* ═══ v0.5 — Conformité vaccinale, météo, dictée ═══ */
.conformite {
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 10px;
}
.conformite summary { font-size: 15.5px; font-weight: 700; cursor: pointer; color: var(--ink); }
.conformite[open] summary { margin-bottom: 8px; }
.conf-ligne { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); }
.conf-ligne:first-of-type { border-top: 0; }
.conf-pastille {
  flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800;
  color: #fff;
}
.conf-pastille.p-ok { background: var(--ok); }
.conf-pastille.p-warn { background: #b5652a; }
.conf-pastille.p-closed { background: var(--closed); }
.conf-txt { flex: 1; font-size: 14.5px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conf-l1 { line-height: 1.35; }
.meteo-carte {
  display: flex; align-items: center; gap: 11px;
  background: linear-gradient(180deg, #eef3f8, #e4ecf4);
  border: 1px solid #cfdce8;
  border-radius: 12px;
  padding: 9px 12px;
  margin-top: 10px;
}
.meteo-ico { display: flex; color: var(--tan); }
.meteo-txt { display: flex; flex-direction: column; gap: 1px; font-size: 15.5px; }
.btn.dicte { background: #8a3324; border-color: #8a3324; color: #f6e3cf; animation: pulse-dictee 1.2s ease-in-out infinite; }
@keyframes pulse-dictee { 0%,100% { opacity: 1 } 50% { opacity: .62 } }

/* ═══ v0.6 — Vigilances locales (sécheresse, air, météo) ═══ */
.vig-carte {
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.vig-carte.grave { border-color: #dbb9ac; background: #f6e8e2; }
.vig-tete { display: flex; align-items: flex-start; gap: 10px; }
.vig-ico { flex: 0 0 auto; display: flex; color: var(--tan); }
.vig-txt { display: flex; flex-direction: column; gap: 1px; font-size: 15.5px; min-width: 0; }
.vig-liste { list-style: none; margin: 8px 0 0; }
.vig-liste li {
  font-size: 14.5px; line-height: 1.5;
  padding: 5px 0 5px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

/* ═══ v0.7 — Frise chronologique, toast annulable, dark mode ═══ */
.frise-annee {
  font-family: var(--font-display);
  font-weight: 700; font-size: 21px; color: var(--tan);
  margin: 16px 0 8px;
}
.frise-axe { position: relative; padding-left: 6px; }
.frise-axe::before {
  content: ""; position: absolute; left: 19px; top: 6px; bottom: 6px;
  width: 2px; background: var(--stitch);
}
.frise-ev { display: flex; gap: 12px; align-items: flex-start; padding: 7px 0; position: relative; }
.frise-point {
  flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--parch-lt);
  border: 2px solid var(--stitch);
  display: flex; align-items: center; justify-content: center;
  color: var(--tan); z-index: 1;
}
.frise-ev.cat-sante .frise-point { border-color: var(--soins); }
.frise-ev.cat-travail .frise-point { border-color: var(--dressage); }
.frise-ev.cat-vie .frise-point { border-color: var(--brass); }
.frise-ev.cat-mesure .frise-point { border-color: var(--endurance); }
.frise-txt { display: flex; flex-direction: column; gap: 1px; font-size: 15.5px; padding-top: 4px; min-width: 0; }
.frise-l1 i { color: var(--muted); font-size: 13.5px; font-style: normal; }

.toast.avec-action {
  display: flex; align-items: center; gap: 12px;
  pointer-events: auto;   /* sinon le bouton « Annuler » est décoratif (bug trouvé par les tests e2e) */
}
.toast-btn {
  font-size: 14.5px; font-weight: 800;
  color: var(--brass-lt);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 0;
}

/* ═══ v0.7 — Bilan annuel : histogramme 12 mois ═══ */
.bilan-mois {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 86px;
  padding: 6px 2px 0;
  background: var(--parch);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.bm-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 4px; height: 100%;
}
.bm-barre { width: 100%; max-width: 20px; background: var(--brass); border-radius: 4px 4px 2px 2px; }
.bm-col span { font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* ═══ v0.8 — Ajustements thème sombre ═══ */
:root[data-theme="sombre"] .meteo-carte { background: linear-gradient(180deg, #1c2833, #16202a); border-color: #2c3d4d; }
:root[data-theme="sombre"] .auj-item.retard,
:root[data-theme="sombre"] .al-item.retard, :root[data-theme="sombre"] .vig-carte.grave { background: #33201b; border-color: #5c3a30; }
:root[data-theme="sombre"] .al-item.proche,
:root[data-theme="sombre"] .auj-item.proche { background: #33291b; border-color: #5c4a2e; }
:root[data-theme="sombre"] #map { background: var(--parch); }
:root[data-theme="sombre"] .leaflet-tile { filter: brightness(.72) saturate(.85) contrast(1.05); }
:root[data-theme="sombre"] .doc-plein { background: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .meteo-carte { background: linear-gradient(180deg, #1c2833, #16202a); border-color: #2c3d4d; }
  :root:not([data-theme="clair"]) .auj-item.retard,
  :root:not([data-theme="clair"]) .al-item.retard,
  :root:not([data-theme="clair"]) .vig-carte.grave { background: #33201b; border-color: #5c3a30; }
  :root:not([data-theme="clair"]) .al-item.proche,
  :root:not([data-theme="clair"]) .auj-item.proche { background: #33291b; border-color: #5c4a2e; }
  :root:not([data-theme="clair"]) #map { background: var(--parch); }
  :root:not([data-theme="clair"]) .leaflet-tile { filter: brightness(.72) saturate(.85) contrast(1.05); }
  :root:not([data-theme="clair"]) .doc-plein { background: #fff; }
}

/* Lisibilité en thème sombre : les éléments qui s'appuyaient sur le cuir
   (très sombre) doivent basculer sur l'encre claire. */
:root[data-theme="sombre"] .btn.ghost { border-color: var(--brass); color: var(--brass-lt); }
:root[data-theme="sombre"] .hname { color: var(--ink); }
:root[data-theme="sombre"] .seg-btn.on { background: var(--brass); color: var(--btn-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .btn.ghost { border-color: var(--brass); color: var(--brass-lt); }
  :root:not([data-theme="clair"]) .hname { color: var(--ink); }
  :root:not([data-theme="clair"]) .seg-btn.on { background: var(--brass); color: var(--btn-ink); }
}

/* ═══ v0.9 — Sport (jour J, palmarès, demi-pension), urgences, matériel ═══ */
.jourj-card {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(180deg, var(--accent-haut), var(--accent-bas));
  border: 1px solid var(--brass);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.jj-tete { font-size: 16px; margin-bottom: 2px; }
.jj-cta { font-size: 14.5px; font-weight: 800; color: var(--brass-deep); margin-top: 7px; }
.jj-entete { margin-bottom: 12px; display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.jj-etape { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.jj-heure {
  flex: 0 0 52px;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--brass-deep);
}
.jj-txt { display: flex; flex-direction: column; gap: 1px; font-size: 15.5px; }
.jj-groupe {
  font-size: 13.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--tan); margin: 12px 0 4px;
}
.al-tache.alerte span { color: var(--closed); font-weight: 600; }
.duo-champs { display: flex; gap: 9px; }
.duo-champs .champ { flex: 1; }

.dp-semaine { display: flex; gap: 4px; margin-bottom: 8px; }
.dp-jour {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--parch-lt); border: 1px solid var(--line); border-radius: 9px; padding: 7px 2px;
}
.dp-nom { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.dp-pastille {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12.5px; font-weight: 800; flex: 0 0 auto;
}
.dp-vide { color: var(--line); font-size: 15.5px; }

.urgence-card {
  display: block; width: 100%; text-align: left;
  background: #f6e8e2; border: 1px solid #dbb9ac;
  border-radius: 13px; padding: 12px 14px; margin: 12px 0;
  font-size: 15.5px;
}
.urgence-card .al-sous { display: block; margin-top: 3px; }
.urg-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: var(--parch); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 7px;
}
.urg-ico { flex: 0 0 auto; display: flex; color: var(--closed); }
.vig-liste.danger li { color: var(--closed); }

@media (prefers-color-scheme: dark) {
}


/* ═══════════════════════════════════════════════════════════════════
   v0.11 — Passage « sensation application native »
   Audit UI/UX : les détails ci-dessous sont ce qui distingue une app
   d'un site web ouvert dans un navigateur.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Comportements tactiles natifs ── */
html {
  -webkit-tap-highlight-color: transparent;   /* plus de halo bleu au tap */
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;                  /* supprime le délai de 300 ms */
}
body {
  -webkit-user-select: none;
  user-select: none;                           /* on ne sélectionne pas l'UI par erreur… */
  overscroll-behavior-y: none;                 /* pas de pull-to-refresh intempestif */
}
/* …mais le contenu utile reste sélectionnable et copiable */
.etext, .al-sous, .article-p, .conf-msg, .aide, .com, .vig-liste li,
input, textarea, .code-inv, .plan-liste, .frise-txt, .jj-txt {
  -webkit-user-select: text;
  user-select: text;
}
#vue, .sh-body, .liste-vue { -webkit-overflow-scrolling: touch; }

/* ── 2. Retour tactile : toute cible réagit à la pression ── */
.btn, .chip, .tab, .qa, .seg-btn, .ico-btn, .mini-btn, .rbtn, .layer,
.lc-item, .rech-item, .conseil-item, .urg-item, .plan-card, .jourj-card,
.conseils-card, .urgence-card, .horse, .cal-cell, .al-btn, .rafale-ok {
  transition: transform .12s cubic-bezier(.2, 0, .2, 1),
              background-color .15s ease, opacity .15s ease, border-color .15s ease;
}
.btn:active, .qa:active, .lc-item:active, .rech-item:active, .conseil-item:active,
.urg-item:active, .plan-card:active, .jourj-card:active, .conseils-card:active,
.urgence-card:active, .al-btn:active, .rafale-ok:active {
  transform: scale(.97);
  filter: brightness(.94);
}
.chip:active, .seg-btn:active, .tab:active, .horse:active, .cal-cell:active { transform: scale(.94); }
.ico-btn:active, .mini-btn:active, .rbtn:active { transform: scale(.88); opacity: .7; }
.fab:active { transform: translateY(-10px) scale(.92); }

/* Respect du réglage système « moins d'animations » */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 3. Icônes SVG (remplacent les emojis dans l'interface) ── */
.ico { display: block; flex: 0 0 auto; }
.ico-btn {
  /* cible tactile de 44 px, visuel plus petit : la règle des 44 px sans lourdeur */
  width: 44px; height: 44px;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  border-radius: 12px;
  margin: -6px;                                /* compense visuellement le sur-dimensionnement */
}
.ico-btn:active { background: var(--line); }
.ico-btn.danger { color: var(--closed); }
.btn .ico, .chip .ico, .al-btn .ico { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.btn.icone-seule { flex: 0 0 auto; min-width: 48px; padding: 11px 14px; }
.btn.icone-seule .ico { margin: 0 auto; }

/* ── 4. Cibles tactiles conformes ── */
.mini-btn {
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; margin: -5px;
}
.rbtn { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.chip { min-height: 38px; display: inline-flex; align-items: center; }
.tab { min-height: 52px; }
.sh-close { width: 36px; height: 36px; }

/* ── 5. Transitions de navigation : continuité spatiale ── */
#vue > * { animation: vue-entre .22s cubic-bezier(.2, .7, .3, 1); }
@keyframes vue-entre {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
/* Les listes apparaissent en cascade légère (max 8 items, sinon ça traîne) */
.feed .entry:nth-child(-n+8), .liste-vue .lc-item:nth-child(-n+8) {
  animation: item-entre .26s both cubic-bezier(.2, .7, .3, 1);
}
.feed .entry:nth-child(2), .liste-vue .lc-item:nth-child(2) { animation-delay: .03s; }
.feed .entry:nth-child(3), .liste-vue .lc-item:nth-child(3) { animation-delay: .06s; }
.feed .entry:nth-child(4), .liste-vue .lc-item:nth-child(4) { animation-delay: .09s; }
.feed .entry:nth-child(5), .liste-vue .lc-item:nth-child(5) { animation-delay: .12s; }
.feed .entry:nth-child(n+6), .liste-vue .lc-item:nth-child(n+6) { animation-delay: .15s; }
@keyframes item-entre {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── 6. Sheets : poignée de saisie et ressort natif ── */
.sh-panel { transition: transform .3s cubic-bezier(.32, .72, 0, 1); }
.sh-panel::before {
  content: "";
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 4px; border-radius: 999px;
  background: var(--line);
}
.sh-head { padding-top: 18px; }
.sh-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ── 7. Safe areas : rien sous l'encoche ni la barre gestuelle ── */
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.liste-vue { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ── 8. Barre d'onglets : plus dense, libellés plus lisibles ── */
.tab { font-size: 12px; letter-spacing: .01em; gap: 3px; }
.tab svg { width: 22px; height: 22px; }
.tab.on svg { transform: scale(1.06); }

/* ── 9. Fin du glissement horizontal parasite (signalé sur iPhone) ──
   Deux causes : les <textarea> sont redimensionnables horizontalement par
   défaut (la poignée élargit le formulaire au-delà de l'écran), et les
   conteneurs scrollables autorisaient un débordement en X. */
textarea { resize: vertical; max-width: 100%; }
input, select, textarea { max-width: 100%; }
.sh-body, #vue, .liste-vue {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
.sh-panel, .sh-wrap { max-width: 100vw; overflow-x: hidden; }
/* Un mot trop long (nom de fichier, URL) ne doit jamais élargir la page */
.etext, .al-sous, .conf-txt, .lc-txt, .jj-txt, .cr-txt, .rech-txt { overflow-wrap: anywhere; }

/* ═══ v0.12 — Entraînement : exercices, programmes, distances ═══ */
.ex-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: var(--parch); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 7px;
}
.ex-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ex-l1 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; flex-wrap: wrap; }
.ex-duree { font-size: 13.5px; font-weight: 800; color: var(--brass-deep); flex: 0 0 auto; }
.prog-sem { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.prog-n {
  flex: 0 0 auto; min-width: 34px; height: 26px; padding: 0 7px;
  border-radius: 8px; background: var(--brass); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 800;
}
.prog-txt { display: flex; flex-direction: column; gap: 2px; font-size: 15.5px; min-width: 0; }
.dist-resultat {
  background: linear-gradient(180deg, var(--accent-haut), var(--accent-bas));
  border: 1px solid var(--brass);
  border-radius: 14px; padding: 16px; text-align: center; margin-bottom: 14px;
}
.dist-valeur { font-family: var(--font-display); font-weight: 700; font-size: 36px; color: var(--ink); line-height: 1.1; }
input[type="range"] { accent-color: var(--brass); padding: 0; height: 34px; }

/* ═══════════════════════════════════════════════════════════════════
   v0.13 — Échelle typographique mobile
   Audit : 98 des 130 tailles étaient sous 14 px, corps de texte à 13 px
   alors que la norme mobile est 16 px. Tout a été remonté d'un cran.
   Ces règles rattrapent les conteneurs devenus trop serrés.
   ═══════════════════════════════════════════════════════════════════ */

/* Corps de texte : la lisibilité vient autant de l'interlignage que du corps */
body { font-size: 16px; line-height: 1.5; }
.etext { line-height: 1.55; }
.al-sous { line-height: 1.45; }

/* Conteneurs à taille fixe qui doivent suivre l'agrandissement */
.badge-cloche { min-width: 18px; height: 18px; }
.mk { width: 30px; height: 30px; }
.dp-pastille { width: 24px; height: 24px; }
.conf-pastille { width: 22px; height: 22px; }
.prog-n { min-width: 38px; height: 28px; }
.pts { height: 7px; align-items: center; }
.pts .plus { font-size: 10px; line-height: 1; }
.avatar { width: 52px; height: 52px; font-size: 20px; }
.avatar.petit { width: 40px; height: 40px; font-size: 16px; }
.horse { min-width: 66px; }

/* Barre d'onglets : libellés plus lisibles, hauteur adaptée */
.tab { font-size: 11.5px; min-height: 56px; }
.tab svg { width: 23px; height: 23px; }

/* Respiration : un texte plus grand a besoin de plus d'air autour */
.entry { padding: 14px 15px; }
.row { padding: 11px 13px; }
.chip { padding: 7px 13px; }
.btn { padding: 13px 12px; }
.btn.petit { padding: 10px 15px; }
.stat { padding: 11px 8px; }
.stat .l { line-height: 1.25; }

/* Les cellules du calendrier doivent rester carrées et lisibles */
.cal-cell { font-size: 14.5px; }
.cal-jours span { font-size: 11px; }

/* Empêcher les libellés longs de casser les mises en page compactes */
.bc-l { flex: 0 0 140px; }
.jj-heure { flex: 0 0 60px; }

/* Sous-onglets : à 5 entrées, un texte lisible ne tient plus sur 375 px.
   On les rend défilables (pattern natif) plutôt que d'écraser la police. */
/* Le défilement horizontal cachait le dernier onglet (« Budget » se lisait
   « Bud… ») sans aucun indice qu'il en restait. Sur un écran étroit, mieux vaut
   deux lignes qu'un onglet invisible : on ne découvre pas ce qu'on ne voit pas. */
.segmented { flex-wrap: wrap; }
.seg-btn { flex: 1 0 auto; min-width: 28%; }
.seg-btn {
  flex: 0 0 auto;
  font-size: 14.5px;
  padding: 9px 15px;
  white-space: nowrap;
}
