/* stats.css — Onglet Stats : tuiles, graphiques, participants */

/* =============================================
   ONGLET STATS
   ============================================= */
.stats-view { padding: 12px 12px 28px; max-width: 720px; margin: 0 auto; }
.st-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.st-year {
  align-self: flex-start; font-size: .85rem; font-weight: 700; color: var(--slate-900);
  padding: 7px 34px 7px 12px; border-radius: 10px; border: 1px solid var(--color-border); background-color: var(--white);
}
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-chip {
  font-size: .78rem; font-weight: 600; color: var(--slate-700); background: var(--white);
  border: 1px solid var(--color-border); border-radius: 999px; padding: 5px 11px; cursor: pointer;
}
.st-chip.active { color: var(--white); background: var(--chip-color); border-color: var(--chip-color); }

.st-empty {
  text-align: center; color: var(--color-muted); font-size: .9rem; line-height: 1.6;
  background: var(--white); border-radius: var(--radius); padding: 32px 16px;
}

.st-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.st-tiles--sm { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-bottom: 12px; }
.st-tile {
  background: var(--white); border: 1px solid var(--color-border); border-radius: 12px; padding: 10px 12px;
  min-width: 0;
}
.st-card .st-tile { background: var(--slate-50); }
.st-tile-value { font-size: 1.45rem; font-weight: 800; color: var(--slate-900); line-height: 1.15; font-variant-numeric: tabular-nums; }
.st-tile-label { font-size: .75rem; font-weight: 600; color: var(--slate-600); margin-top: 2px; }
.st-tile-detail { font-size: .68rem; color: var(--color-muted); margin-top: 3px; overflow-wrap: anywhere; }

.st-last {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; width: 100%; text-align: left;
  font-size: .8rem; color: var(--slate-700); background: var(--white); border: 1px solid var(--color-border);
  border-radius: 12px; padding: 9px 12px; margin-bottom: 12px; cursor: pointer;
}
.st-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.st-muted { color: var(--color-muted); font-size: .75rem; }

.st-card {
  background: var(--white); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 14px 14px 12px; margin-bottom: 12px;
}
.st-title { display: flex; align-items: center; gap: 6px; font-size: .95rem; font-weight: 800; color: var(--slate-900); margin: 0 0 4px; }
.st-sub { font-size: .72rem; color: var(--color-muted); margin: 0 0 10px; }
.st-title + .st-legend, .st-title + .st-chart, .st-title + .st-tiles, .st-title + .st-split { margin-top: 10px; }
.st-subtitle { font-size: .78rem; font-weight: 700; color: var(--slate-600); margin: 4px 0 6px; }
.st-note { font-size: .7rem; color: var(--color-muted); margin: 8px 0 0; }

.st-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .72rem; color: var(--slate-600); margin-bottom: 8px; }
.st-legend span { display: inline-flex; align-items: center; gap: 5px; }
.st-legend i, .st-split-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Colonnes empilées */
.st-chart { position: relative; height: 170px; margin: 0 0 4px 26px; }
.st-grid { position: absolute; inset: 0 0 20px 0; pointer-events: none; }
.st-grid-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--mist-50); }
.st-grid-line span {
  position: absolute; right: calc(100% + 6px); top: -7px; font-size: .62rem; color: var(--color-light);
  font-variant-numeric: tabular-nums;
}
.st-cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.st-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  cursor: default; outline: none; border-radius: 6px;
}
.st-col-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.st-col-stack {
  position: relative; width: 70%; max-width: 24px; display: flex; flex-direction: column-reverse; gap: 2px;
  min-height: 3px;
}
.st-col-stack .st-seg:last-child { border-radius: 4px 4px 0 0; }
.st-col-stack .st-seg { min-height: 2px; }
.st-col-val {
  position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  font-size: .65rem; font-weight: 700; color: var(--slate-700); white-space: nowrap;
}
.st-col-label {
  height: 20px; line-height: 20px; font-size: .62rem; color: var(--color-muted); white-space: nowrap;
}
.st-col.st-hover, .st-col:focus-visible { background: var(--slate-100); }

.st-table { margin-top: 6px; font-size: .72rem; color: var(--slate-600); }
.st-table summary { cursor: pointer; color: var(--blue-600); font-weight: 600; }
.st-table table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.st-table th, .st-table td { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--slate-100); }
.st-table th:first-child { text-align: left; }

/* Barre segmentée */
.st-split { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.st-split-seg { min-width: 3px; cursor: default; outline: none; }
.st-split-seg.st-hover, .st-split-seg:focus-visible { filter: brightness(1.15); }
.st-split-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: .78rem; color: var(--slate-700); }
.st-split-legend li { display: flex; align-items: center; gap: 6px; }
.st-split-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Barres horizontales */
.st-hbars { display: flex; flex-direction: column; gap: 4px; }
.st-hbar {
  display: grid; grid-template-columns: minmax(44px, 34%) 1fr; align-items: center; gap: 8px;
  padding: 2px 4px; border-radius: 6px; outline: none;
}
.st-hbar.clickable { cursor: pointer; }
.st-hbar.st-hover, .st-hbar:focus-visible { background: var(--slate-100); }
.st-hbar-label { font-size: .75rem; color: var(--slate-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-hbar-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.st-hbar-fill { display: flex; gap: 2px; height: 14px; min-width: 3px; }
.st-hbar-fill .st-seg { height: 100%; min-width: 2px; }
.st-hbar-fill .st-seg:last-child { border-radius: 0 4px 4px 0; }
.st-hbar-val { font-size: .7rem; font-weight: 700; color: var(--slate-700); font-variant-numeric: tabular-nums; }
.st-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .st-two { grid-template-columns: 1fr; } }

.st-tip {
  position: fixed; z-index: 700; max-width: 240px; pointer-events: none;
  background: var(--slate-900); color: var(--white); font-size: .74rem; line-height: 1.45; white-space: pre-line;
  padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg);
}
.st-tip[hidden] { display: none; }
@media (hover: hover) {
  .st-chip:hover:not(.active) { background: var(--slate-50); }
  .st-last:hover { background: var(--slate-50); }
}
.st-hbars--wide { gap: 6px; }
.st-hbars--wide .st-hbar { grid-template-columns: 1fr; gap: 2px; }
.st-hbars--wide .st-hbar-label { white-space: normal; overflow-wrap: anywhere; }

/* Courbes de progression */
.st-svg { display: block; width: 100%; height: auto; margin: 2px 0 2px; overflow: visible; }
.st-svg-grid { stroke: var(--mist-50); stroke-width: 1; }
.st-svg-axis { font-size: 9px; fill: var(--slate-400); font-variant-numeric: tabular-nums; }
.st-svg-hit { fill: transparent; outline: none; cursor: default; }
.st-svg-hit.st-hover, .st-svg-hit:focus-visible { fill: var(--slate-100); }
.st-svg-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.st-svg-dot { stroke: var(--white); stroke-width: 2; pointer-events: none; }
.st-svg-end { font-size: 10px; font-weight: 700; fill: var(--slate-700); pointer-events: none; }
.st-legend-line { height: 3px !important; width: 14px !important; border-radius: 2px !important; }
.st-svg + .st-table { margin-bottom: 12px; }

/* Participants d'une sortie */
.pt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pt-empty { font-size: .78rem; color: var(--color-light); }
.pt-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--slate-900);
  background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 999px; padding: 3px 4px 3px 10px;
}
.pt-chip.me { background: var(--cyan-50); border-color: var(--cyan-200); }
.pt-chip small { font-weight: 500; color: var(--color-muted); }
.pt-chip button {
  width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent;
  color: var(--slate-500); font-size: .7rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.pt-chip button:active { background: var(--slate-200); }
.pt-input-row { display: flex; gap: 6px; }
.pt-input-row input { flex: 1; min-width: 0; }
.pt-add-btn {
  width: 40px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--blue-200); background: var(--blue-50);
  color: var(--blue-600); font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.pt-suggest { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pt-suggest:empty { display: none; }
.pt-suggest-chip {
  font-size: .74rem; color: var(--blue-600); background: var(--white); border: 1px dashed var(--blue-300);
  border-radius: 999px; padding: 3px 9px; cursor: pointer;
}
.pt-suggest-chip:active { background: var(--blue-50); }
.pt-note[hidden] { display: none; }
.pt-note { font-size: .72rem; color: var(--amber-800); background: var(--amber-50); border: 1px solid var(--amber-200); border-radius: 8px; padding: 5px 9px; margin-top: 8px; }
.outing-card-people { color: var(--slate-700); }
@media (hover: hover) { .pt-suggest-chip:hover { background: var(--blue-50); } }

/* Stats : compagnons & à faire */
.st-link {
  margin-top: 8px; font-size: .75rem; color: var(--blue-600); background: none; border: none; padding: 2px 0; cursor: pointer;
}
.st-todo { display: flex; flex-direction: column; gap: 6px; }
.st-todo-group { border: 1px solid var(--color-border); border-radius: 10px; background: var(--slate-50); }
.st-todo-group summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; font-size: .82rem; color: var(--slate-700); cursor: pointer; list-style: none;
}
.st-todo-group summary::-webkit-details-marker { display: none; }
.st-todo-group summary::before { content: '▸'; color: var(--color-muted); margin-right: 2px; }
.st-todo-group[open] summary::before { content: '▾'; }
.st-todo-group summary span { flex: 1; min-width: 0; }
.st-todo-group summary strong { font-variant-numeric: tabular-nums; }
.st-todo-group ul { list-style: none; margin: 0; padding: 0 6px 6px; }
.st-todo-group 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; margin-top: 4px; cursor: pointer;
}
.st-todo-group li button .st-muted { margin-left: auto; }
@media (hover: hover) { .st-todo-group li button:hover { background: var(--slate-100); } }

/* Navigation entre fiches (en-tête de la fiche) */
.detail-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  margin-top: 12px;
}
.detail-nav:empty { display: none; }
.detail-nav-btn {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 36px;
  font-size: .78rem; font-weight: 600; color: var(--white);
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
  touch-action: manipulation;
}
.detail-nav-btn:active { background: rgba(255,255,255,.24); }
.detail-nav-btn.disabled { visibility: hidden; }
.detail-nav-prev { justify-self: start; max-width: 100%; }
.detail-nav-next { justify-self: end; max-width: 100%; }
.detail-nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.detail-nav-arrow { font-size: 1.25rem; line-height: 1; flex-shrink: 0; margin-top: -2px; }
.detail-nav-pos {
  font-size: .72rem; font-weight: 700; color: rgba(255,255,255,.8); white-space: nowrap;
  text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2;
}
.detail-nav-filter { display: block; font-size: .62rem; font-weight: 600; color: rgba(255,255,255,.6); }
@media (hover: hover) { .detail-nav-btn:hover { background: rgba(255,255,255,.2); } }

@keyframes detailSlideNext { from { opacity: .4; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes detailSlidePrev { from { opacity: .4; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
#main-content.detail-slide-next > :not(.detail-hero) { animation: detailSlideNext .22s ease-out; }
#main-content.detail-slide-prev > :not(.detail-hero) { animation: detailSlidePrev .22s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #main-content.detail-slide-next > *, #main-content.detail-slide-prev > * { animation: none; }
}

/* Swipe entre fiches : le contenu (sous l'en-tête) suit le doigt */
#main-content.detail-swiping > :not(.detail-hero) {
  transform: translateX(var(--swipe-x, 0)); transition: none;
}
#main-content.detail-swipe-release > :not(.detail-hero) { transition: transform .2s ease-out; transform: none; }
.detail-nav-btn.swipe-ready { background: rgba(255,255,255,.34); border-color: rgba(255,255,255,.6); }

/* Fusion des participants */
.st-comp-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.st-comp-actions .st-link { margin-top: 0; }
.st-merge-open {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--pink-700);
  background: var(--pink-50); border: 1px solid var(--pink-200); border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.st-badge { background: var(--pink-700); color: var(--white); font-size: .66rem; font-weight: 800; border-radius: 999px; padding: 1px 6px; }
.st-merge-backdrop {
  position: fixed; inset: 0; z-index: 660; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.st-merge-card {
  width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: var(--white);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px 16px 16px;
}
.st-merge-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.st-merge-head h3 { font-size: 1rem; margin: 0; }
.st-merge-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--slate-100); cursor: pointer; }
.st-merge-done {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px;
  font-size: .78rem; color: var(--green-900); background: var(--green-50); border: 1px solid var(--green-200); border-radius: 10px;
  padding: 8px 10px; margin: 6px 0 10px;
}
.st-merge-done button { font-size: .75rem; font-weight: 700; color: var(--red-700); background: var(--white); border: 1px solid var(--red-200); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.st-merge-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.st-merge-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 8px;
  border: 1px solid var(--color-border); border-radius: 10px; padding: 7px 9px; background: var(--slate-50);
}
.st-merge-pair { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.st-merge-keep { font-size: .7rem; color: var(--color-muted); }
.st-merge-or { font-size: .7rem; color: var(--color-light); }
.st-merge-name {
  font-size: .8rem; font-weight: 600; color: var(--slate-900); background: var(--white); border: 1px solid var(--slate-300);
  border-radius: 999px; padding: 4px 10px; cursor: pointer;
}
.st-merge-name small { color: var(--color-muted); font-weight: 600; margin-left: 2px; }
.st-merge-name:active { background: var(--green-100); border-color: var(--green-300); }
.st-merge-ignore { font-size: .7rem; color: var(--color-muted); background: none; border: none; cursor: pointer; padding: 2px 4px; text-decoration: underline; }
.st-merge-manual-title { margin-top: 14px; }
.st-merge-form { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; }
.st-merge-form label { font-size: .78rem; color: var(--slate-600); }
.st-merge-form select, .st-merge-form input { min-width: 0; font-size: .85rem; }
.st-merge-form .st-sub, .st-merge-apply { grid-column: 1 / -1; }
.st-merge-form .st-sub { margin: 0; }
.st-merge-apply {
  justify-self: start; font-size: .82rem; font-weight: 700; color: var(--white); background: var(--pink-700);
  border: none; border-radius: 10px; padding: 8px 16px; cursor: pointer;
}
.st-merge-apply:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) {
  .st-merge-name:hover { background: var(--green-50); border-color: var(--green-300); }
  .st-merge-open:hover { background: var(--pink-100); }
}
.rl-name[hidden] { display: none; }
