/* MARGE 3.0 — historique et bilan (maquette validée le 2026-11-23, consigne du 2026-11-25).
   Chargée par index.html et ses copies sections/ ; les blocs m3hi-* viennent
   de /m3/historique.js. Tout est sous html.m3 : sans la coquille, /archives
   et /statistiques gardent leur mise en page d'avant. */

/* ---- Largeur ----
   Ces trois pages tenaient en 760 px. Les indicateurs, la courbe et le
   tableau de la maquette prennent la largeur de l'écran ; le texte suivi
   reste en colonne de lecture. */
@media (min-width:1100px){
  html.m3 #archives, html.m3 #statistiques, html.m3 #tipsters{max-width:1120px}
  html.m3 #statistiques > :not(.m3hi-tabs):not(.m-steps):not(.m3hi-kpis):not(.m3hi-evo):not(.eyebrow):not(.page-title),
  html.m3 #tipsters > :not(.m3hi-tabs):not(.eyebrow):not(.page-title),
  html.m3 #archives > .seo-copy{max-width:760px}
}

/* ---- Onglets Archives / Bilan / Modèles ---- */
html.m3 .m3hi-tabs{display:flex; gap:4px; margin:6px 0 20px; border-bottom:1px solid var(--m3-soft); overflow-x:auto;
  scrollbar-width:none; -webkit-overflow-scrolling:touch}
html.m3 .m3hi-tabs::-webkit-scrollbar{display:none}
html.m3 .m3hi-tabs a{flex:0 0 auto; padding:11px 12px; margin-bottom:-1px; border-bottom:2px solid transparent; color:var(--m3-muted);
  font:500 13.5px var(--m3-sans); text-decoration:none; white-space:nowrap}
html.m3 .m3hi-tabs a:hover{color:var(--m3-text)}
html.m3 .m3hi-tabs a.on{color:var(--m3-text); font-weight:600; border-bottom-color:var(--m3-em)}
html.m3 .m3hi-tabs a span{margin-left:4px; font-size:11px; color:var(--m3-faint)}
html.m3 .m3hi-tabs a:focus-visible{outline:2px solid var(--m3-em); outline-offset:-2px; border-radius:6px}
.m3hi-tabs{display:none}
html.m3 .m3hi-tabs{display:flex}

/* ---- Cartes ---- */
.m3hi-kpis, .m3hi-grid, .m3hi-card{display:none}
html.m3 .m3hi-card{display:block; border:1px solid var(--m3-line); border-radius:16px; padding:18px;
  background:linear-gradient(180deg,var(--m3-panel),var(--m3-bg-1))}
html.m3 .m3hi-card[hidden]{display:none}
html.m3 .m3hi-card h3{font:700 17px/1.3 var(--m3-display); letter-spacing:-.01em; color:var(--m3-text); margin:0}
.m3hi-ch{display:flex; align-items:baseline; justify-content:space-between; gap:6px 14px; flex-wrap:wrap; margin-bottom:10px}
.m3hi-ch span{font:500 11.5px var(--m3-sans); color:var(--m3-muted)}

html.m3 .m3hi-kpis{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 16px}
.m3hi-k{display:flex; flex-direction:column; gap:6px; min-width:0; padding:16px; border:1px solid var(--m3-line); border-radius:14px;
  background:linear-gradient(180deg,var(--m3-panel),var(--m3-bg-1))}
.m3hi-kl{font:500 12px/1.35 var(--m3-sans); color:var(--m3-muted)}
.m3hi-kv{font:600 26px/1.1 var(--m3-mono); color:var(--m3-text); white-space:nowrap}
.m3hi-kv.em{color:var(--m3-em)}
.m3hi-kv.ko{color:var(--m3-loss)}
.m3hi-ks{font:400 11px/1.45 var(--m3-mono); color:var(--m3-faint); overflow-wrap:anywhere}

html.m3 .m3hi-grid{display:grid; grid-template-columns:minmax(0,1.75fr) minmax(260px,1fr); gap:16px; align-items:stretch; margin:0 0 16px}
.m3hi-chart{position:relative; min-height:120px}
.m3hi-svg{display:block; max-width:100%}
.m3hi-svg .zero{stroke:var(--m3-soft); stroke-width:1; stroke-dasharray:4 4}
.m3hi-svg .gr{stroke:var(--m3-soft); stroke-width:1; stroke-dasharray:1 5; opacity:.7}
.m3hi-svg .ax{fill:var(--m3-faint); font:500 11px var(--m3-mono)}
.m3hi-svg .ln{fill:none; stroke:var(--m3-em); stroke-width:2.2; stroke-linejoin:round; stroke-linecap:round}
.m3hi-svg circle.w{fill:var(--m3-em)}
.m3hi-svg circle.l{fill:var(--m3-loss)}
.m3hi-note{font-size:11.5px; line-height:1.5; color:var(--m3-faint); margin:10px 0 0}
.m3hi-note:empty{display:none}
.m3hi-state{font-size:13.5px; line-height:1.5; color:var(--m3-muted); text-align:center; padding:36px 12px; margin:0}
html.m3 .m3hi-evo .m3hi-chart{min-height:200px}

/* ---- Filtres ---- */
html.m3 .m3hi-filt{display:flex; flex-direction:column}
html.m3 .m3hi-filt[hidden]{display:none}
.m3hi-rows{display:flex; flex-direction:column; gap:8px; margin-top:12px}
.m3hi-chips{display:flex; flex-wrap:wrap; gap:7px}
.m3hi-chip, .m3hi-sel{min-height:34px; padding:6px 12px; border-radius:999px; border:1px solid var(--m3-line); background:var(--m3-panel);
  color:var(--m3-muted); font:500 12.5px var(--m3-sans); cursor:pointer}
.m3hi-sel{max-width:100%; padding-right:8px}
.m3hi-chip:hover, .m3hi-sel:hover{color:var(--m3-text); border-color:var(--m3-line-2)}
.m3hi-chip.on, .m3hi-sel.on{color:var(--m3-em); border-color:var(--m3-line-2); background:var(--m3-em-dim)}
.m3hi-chip:focus-visible, .m3hi-sel:focus-visible, .m3hi-csv:focus-visible, .m3hi-more:focus-visible{outline:2px solid var(--m3-em); outline-offset:2px}
html.m3 .m3hi-csv{align-self:flex-start; margin-top:16px; padding:9px 14px; border-radius:10px; border:1px solid var(--m3-line-2);
  background:var(--m3-panel-2); color:var(--m3-text); font:600 13px var(--m3-sans); text-decoration:none}
html.m3 .m3hi-csv:hover{border-color:var(--m3-em)}

/* ---- Tableau ---- */
html.m3 .m3hi-tab{padding:8px 18px 14px; margin:0 0 18px}
.m3hi-count{font:500 11.5px var(--m3-mono); color:var(--m3-faint); margin:8px 0 0}
.m3hi-scroll{overflow-x:auto; -webkit-overflow-scrolling:touch}
html.m3 table.m3hi-t{width:100%; border-collapse:collapse; margin:4px 0 0; font-size:13.5px}
html.m3 .m3hi-t th{font:600 10px var(--m3-mono); letter-spacing:.1em; text-transform:uppercase; color:var(--m3-faint); text-align:left;
  padding:12px 8px; border:0; border-bottom:1px solid var(--m3-soft); white-space:nowrap}
html.m3 .m3hi-t td{padding:12px 8px; border:0; border-bottom:1px solid var(--m3-soft); vertical-align:middle; color:var(--m3-text)}
html.m3 .m3hi-t tr:last-child td{border-bottom:0}
html.m3 .m3hi-t .r{text-align:right}
html.m3 .m3hi-t td.dt{font:500 12.5px var(--m3-mono); color:var(--m3-muted); white-space:nowrap}
html.m3 .m3hi-t td.mt a, html.m3 .m3hi-t td.mt b{color:var(--m3-text); font-weight:600; text-decoration:none}
html.m3 .m3hi-t td.mt a:hover{color:var(--m3-em)}
html.m3 .m3hi-t small{display:block; margin-top:2px; font-size:11.5px; color:var(--m3-faint)}
html.m3 .m3hi-t td.od{font:600 13.5px var(--m3-mono); white-space:nowrap}
.m3hi-pill{display:inline-block; padding:3px 8px; border-radius:6px; font:700 10px var(--m3-mono); letter-spacing:.08em; text-transform:uppercase;
  white-space:nowrap}
.m3hi-pill.w{color:var(--m3-em); background:var(--m3-em-dim)}
.m3hi-pill.l{color:var(--m3-loss); background:rgba(255,107,107,.12)}
.m3hi-pill.v{color:var(--m3-warn); background:rgba(242,184,75,.12)}
html.m3[data-theme="light"] .m3hi-pill.l{color:#B42318}
html.m3[data-theme="light"] .m3hi-pill.v{color:#8A5A00}
html.m3 .m3hi-more{display:block; width:100%; margin:12px 0 0; padding:11px 14px; border-radius:10px; border:1px solid var(--m3-line);
  background:var(--m3-panel-2); color:var(--m3-text); font:600 13px var(--m3-sans); cursor:pointer}

/* L'ancienne liste et ses filtres laissent la place au tableau ; le portefeuille
   d'avant, à la courbe du bilan. Ils restent dans la page (gel SEO). */
html.m3 #archives.m3hi-on > .arc-filters,
html.m3 #archives.m3hi-on > #arc-count,
html.m3 #archives.m3hi-on > #arc-list,
html.m3 #statistiques.m3hi-on #portfolio-card{display:none !important}

/* ---- Les quatre étapes de la méthode, en ligne ---- */
html.m3 #statistiques > .m-steps{grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 16px}
html.m3 #statistiques .m-step{border-color:var(--m3-line); border-radius:14px; padding:16px; background:linear-gradient(180deg,var(--m3-panel),var(--m3-bg-1))}
html.m3 #statistiques .m-step-no{color:var(--m3-em); font-family:var(--m3-mono)}
html.m3 #statistiques .m-step h4{font:600 15px/1.3 var(--m3-display); margin:0 0 6px}
html.m3 #statistiques .m3hi-evo{margin:0 0 18px}

/* ---- Largeurs intermédiaires et téléphone ---- */
@media (max-width:1099.98px){
  html.m3 .m3hi-kpis, html.m3 #statistiques > .m-steps{grid-template-columns:repeat(2,minmax(0,1fr))}
  html.m3 .m3hi-grid{grid-template-columns:1fr}
}
@media (max-width:640px){
  html.m3 .m3hi-kpis{gap:8px}
  .m3hi-k{padding:12px}
  .m3hi-kv{font-size:21px}
  html.m3 .m3hi-card{padding:14px}
  html.m3 .m3hi-tab{padding:4px 12px 12px}
  /* Le tableau devient une liste : match et pronostic à gauche, cote et
     verdict à droite, date au-dessus. */
  html.m3 .m3hi-t thead{display:none}
  html.m3 .m3hi-t, html.m3 .m3hi-t tbody{display:block}
  html.m3 .m3hi-t tr{display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"dt rs" "mt od" "pk od";
    column-gap:12px; row-gap:2px; padding:12px 0; border-bottom:1px solid var(--m3-soft)}
  html.m3 .m3hi-t tr:last-child{border-bottom:0}
  html.m3 .m3hi-t td{display:block; padding:0; border:0}
  html.m3 .m3hi-t td.dt{grid-area:dt; font-size:11.5px}
  html.m3 .m3hi-t td.mt{grid-area:mt}
  html.m3 .m3hi-t td.pk{grid-area:pk; font-size:13px; color:var(--m3-muted)}
  html.m3 .m3hi-t td.od{grid-area:od; align-self:center}
  html.m3 .m3hi-t td.rs{grid-area:rs}
}
@media (max-width:359px){
  html.m3 .m3hi-kpis, html.m3 #statistiques > .m-steps{grid-template-columns:1fr}
}

/* Périmètre et méthode du bilan affiché (lib/bilanHistorique.js) : le taux de
   « Notre lecture » et celui du modèle Cotes se côtoient, chacun dit le sien. */
.m3hi-scope{display:none}
html.m3 .m3hi-scope{display:block; margin:0 0 10px; font:500 12px/1.5 var(--m3-sans); color:var(--m3-muted)}
html.m3 .m3hi-scope[hidden]{display:none}
html.m3 .m3hi-kv.insuf{font-size:15px; line-height:1.3; color:var(--m3-muted)}
