/* stats-panels.css — Stats : souvenirs, objectifs, bilan, compagnons, qualité */

/* ============================================================
   STATS : SOUVENIRS, OBJECTIFS, BILAN, COMPAGNON, QUALITÉ
   ============================================================ */
.st-kpi-actions { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; flex-wrap: wrap; }
.st-kpi-actions .st-last { flex: 1 1 220px; margin-bottom: 0; }
.st-bilan-btn { flex: 0 0 auto; font-size: .8rem; font-weight: 700; color: var(--white); background: var(--pink-700); border: none; border-radius: 12px; padding: 9px 14px; cursor: pointer; }

.sv-card { border-color: var(--pink-200); background: linear-gradient(180deg, var(--pink-50) 0, var(--white) 60px); }
.sv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sv-head .st-link { margin-top: 0; font-size: .72rem; }
.sv-group + .sv-group { margin-top: 10px; }
.sv-year { font-size: .82rem; margin-bottom: 4px; }
.sv-item { border: 1px solid var(--color-border); border-radius: 10px; padding: 7px 9px; background: var(--white); margin-top: 6px; }
.sv-main { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; width: 100%; text-align: left; background: none; border: none; padding: 0; cursor: pointer; font-size: .84rem; color: var(--slate-900); }
.sv-name { font-weight: 700; }
.sv-meta { font-size: .74rem; color: var(--color-muted); margin-top: 2px; }
.sv-meta:empty { display: none; }
.sv-photos { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.sv-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; }

.og-list { display: flex; flex-direction: column; gap: 10px; }
.og-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.og-label { font-size: .82rem; font-weight: 700; color: var(--slate-900); }
.og-pace { font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.og-pace--done { background: var(--green-100); color: var(--green-800); }
.og-pace--ahead { background: var(--sky-100); color: var(--sky-800); }
.og-pace--late { background: var(--amber-100); color: var(--amber-800); }
.og-bar { position: relative; height: 10px; border-radius: 999px; background: var(--slate-100); margin: 5px 0 3px; overflow: visible; }
.og-fill { height: 100%; border-radius: 999px; background: var(--pink-700); transition: width .4s ease; }
.og-goal.done .og-fill { background: var(--green-600); }
.og-mark { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--slate-900); opacity: .55; transform: translateX(-1px); }
.og-foot { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: .76rem; color: var(--slate-700); }
.og-note { flex-basis: 100%; }
.og-edit-list { display: flex; flex-direction: column; gap: 6px; }
.og-edit-list .st-merge-row > span { font-size: .8rem; }
.st-merge-form [hidden] { display: none; }

.st-comp-search { width: 100%; margin: 4px 0 8px; font-size: .85rem; }
.st-comp-list, .st-comp-all { list-style: none; margin: 0; padding: 0; }
.st-comp-list li button, .st-comp-all li button {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  font-size: .8rem; color: var(--slate-900); background: var(--white); border: 1px solid var(--mist-50);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
}
.st-comp-list li button .st-muted, .st-comp-all li button .st-muted { margin-left: auto; }
.st-comp-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.st-comp-type { font-size: .76rem; border: 1px solid color-mix(in srgb, var(--chip-color) 35%, var(--white)); color: var(--chip-color); border-radius: 999px; padding: 3px 10px; background: color-mix(in srgb, var(--chip-color) 8%, var(--white)); }
.st-comp-years { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding-bottom: 2px; }
.st-comp-year { display: flex; flex-direction: column; align-items: center; min-width: 26px; font-size: .66rem; color: var(--slate-700); }
.st-comp-year-bar { height: 54px; width: 14px; display: flex; align-items: flex-end; background: var(--slate-100); border-radius: 4px; overflow: hidden; }
.st-comp-year-bar > div { width: 100%; background: var(--pink-700); }
.st-comp-year small { color: var(--color-muted); }
@media (hover: hover) {
  .st-comp-list li button:hover, .st-comp-all li button:hover { background: var(--slate-100); }
  .st-bilan-btn:hover { background: var(--pink-800); }
}

/* ---- Bilan de l'année ---- */
.bilan-backdrop { position: fixed; inset: 0; z-index: 700; background: var(--slate-900); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.bilan-actions {
  position: sticky; top: 0; z-index: 1; display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  padding: 8px 10px; background: rgba(15,23,42,.92); backdrop-filter: blur(6px);
}
.bilan-actions select, .bilan-actions button { font-size: .8rem; border-radius: 999px; padding: 6px 12px; border: 1px solid var(--slate-700); background: var(--slate-800); color: var(--slate-50); cursor: pointer; }
.bilan-actions select { margin-right: auto; }
.bilan-close { width: 34px; height: 34px; padding: 0 !important; }
.bilan-page { max-width: 760px; margin: 0 auto 24px; background: var(--white); color: var(--slate-900); border-radius: 16px; overflow: hidden; }
.bl-hero { padding: 26px 20px 22px; background: linear-gradient(135deg, var(--navy-700), var(--pink-700)); color: var(--white); text-align: center; }
.bl-hero h1 { font-size: 1.9rem; font-weight: 900; margin: 6px 0; }
.bl-hero-sub { font-size: .82rem; opacity: .85; }
.bl-empty { padding: 30px 20px; text-align: center; color: var(--color-muted); }
.bl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 16px; }
.bl-tile { background: var(--slate-50); border: 1px solid var(--color-border); border-radius: 12px; padding: 10px; text-align: center; }
.bl-tile-v { font-size: 1.6rem; font-weight: 900; color: var(--pink-700); font-variant-numeric: tabular-nums; }
.bl-tile-l { font-size: .76rem; font-weight: 600; color: var(--slate-700); }
.bl-tile-d { font-size: .66rem; color: var(--color-muted); }
.bl-section { padding: 4px 16px 14px; break-inside: avoid; }
.bl-section h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--color-muted); margin: 6px 0 8px; }
.bl-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.bl-act { border-left: 4px solid var(--act); background: var(--slate-50); border-radius: 8px; padding: 8px 10px; }
.bl-act-head { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.bl-act-head span { margin-left: auto; font-size: .78rem; color: var(--slate-700); }
.bl-act-extra { font-size: .74rem; color: var(--color-muted); margin-top: 3px; }
.bl-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; }
.bl-month { display: flex; flex-direction: column; align-items: center; font-size: .66rem; color: var(--slate-700); }
.bl-month-bar { height: 70px; width: 100%; max-width: 26px; display: flex; align-items: flex-end; background: var(--slate-100); border-radius: 5px; overflow: hidden; }
.bl-month-bar > div { width: 100%; background: var(--slate-400); }
.bl-month.best .bl-month-bar > div { background: var(--pink-700); }
.bl-month-n { font-weight: 700; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.bl-month-l { color: var(--color-muted); }
.bl-note { font-size: .76rem; color: var(--slate-700); margin-top: 8px; }
.bl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.bl-rank { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.bl-rank li { display: flex; align-items: center; gap: 8px; font-size: .84rem; padding: 5px 0; border-top: 1px solid var(--color-border); counter-increment: rank; }
.bl-rank li::before { content: counter(rank); width: 20px; height: 20px; border-radius: 50%; background: var(--pink-100); color: var(--pink-700); font-size: .7rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bl-rank li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bl-chip { font-size: .76rem; border-radius: 999px; padding: 3px 10px; background: var(--slate-50); border: 1px solid var(--color-border); border-left: 4px solid var(--act); }
.bl-goals { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.bl-goals li { padding: 4px 0; }
.bl-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bl-photos figure { margin: 0; position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--slate-200); }
.bl-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-photos figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: .6rem; color: var(--white); padding: 10px 6px 4px; background: linear-gradient(transparent, rgba(0,0,0,.65)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-foot { text-align: center; font-size: .68rem; color: var(--color-light); padding: 12px 16px 18px; }

@media print {
  html:has(body.bilan-printing), body.bilan-printing { overflow: visible !important; height: auto !important; background: var(--white) !important; }
  body.bilan-printing > *:not(.bilan-backdrop) { display: none !important; }
  body.bilan-printing .bilan-backdrop { position: static; background: var(--white); overflow: visible; }
  body.bilan-printing .bilan-actions { display: none; }
  body.bilan-printing .bilan-page { max-width: none; margin: 0; border-radius: 0; }
  body.bilan-printing .bl-hero, body.bilan-printing .bl-month-bar > div, body.bilan-printing .bl-rank li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Champ date JJ/MM/AAAA + calendrier natif caché */
.date-field { position: relative; display: flex; gap: 8px; align-items: center; }
.form-field .date-field .date-text { flex: 1; min-width: 0; width: auto; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.form-field .date-field .date-text.invalid { border-color: var(--red-500); }
.date-pick { flex-shrink: 0; width: 42px; height: 40px; border: 1.5px solid var(--color-border); border-radius: 8px; background: var(--white); font-size: 1.1rem; cursor: pointer; }
.date-pick:active { background: var(--slate-100); }
.date-native { position: absolute; right: 0; bottom: 0; width: 42px; height: 40px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.date-error { font-size: .72rem; color: var(--red-600); margin-top: 4px; }
.date-error[hidden] { display: none; }

/* Carte de saisie GPS : bandeau « centré sur le lieu de la fiche » */
.map-pick-place {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%);
  z-index: 1000; max-width: calc(100% - 80px); font-size: .76rem; font-weight: 600; color: var(--slate-900);
  background: rgba(255,255,255,.95); border: 1px solid var(--color-border); border-radius: 999px;
  padding: 6px 12px; box-shadow: var(--shadow-sm); text-align: center; pointer-events: none;
}
.map-pick-place[hidden] { display: none; }

/* Historique : météo et débit du jour sur les sorties, comparaison sur la fiche canyon */
.outing-cond:empty { display: none; }
.outing-cond { display: flex; flex-direction: column; gap: 1px; color: var(--slate-600); }
.outing-cond-eau { color: var(--cyan-700); }
.cond-hist-sum { font-size: .78rem; color: var(--slate-700); margin: 2px 0 8px; line-height: 1.45; }
.cond-gauge { position: relative; height: 14px; border-radius: 999px; background: var(--slate-100); margin: 4px 6px 2px; }
.cond-gauge-range { position: absolute; top: 3px; height: 8px; border-radius: 999px; background: var(--cyan-200); }
.cond-gauge-dot { position: absolute; top: 4px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--cyan-700); }
.cond-gauge-now { position: absolute; top: -3px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--pink-700); box-shadow: 0 0 0 2px var(--white); }
.cond-gauge-scale { display: flex; justify-content: space-between; font-size: .66rem; color: var(--color-muted); margin: 0 2px 6px; }
