/* ============================================================
   Scalon V2 — Report stylesheet (add-on)
   Loaded AFTER assets/v2.css on rapport-*.html pages.
   Defines dense report-specific components :
   cover, TOC, KPI grids, charts, tables, scorecards, verbatim cards,
   heatmaps, scatter plots, methodology box.
   ============================================================ */

:root {
  --report-max: 1100px;
  --pos: #16A34A;
  --neg: var(--accent);
  --mixed: #D97706;
}

/* ── Cover / hero du rapport ────────────────── */
.r-cover {
  padding: 80px 0 56px;
  border-bottom: 1px solid var(--line);
}
.r-cover .label { color: var(--accent); margin-bottom: 28px; }
.r-cover h1 {
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin-bottom: 24px;
  max-width: 22ch;
}
.r-cover .r-sub {
  font-size: 18px;
  color: var(--fg-muted);
  max-width: 56ch;
  margin: 0 0 40px;
}
.r-client {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 600px;
  margin-bottom: 40px;
}
.r-client-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.r-client-name { font-weight: 600; color: var(--ink); display: block; }
.r-client-desc {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
  display: block;
}

/* Big stats strip */
.r-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 32px 0 0;
  margin-top: 32px;
  border-top: 1px solid var(--line);
}
.r-stat-v {
  display: block;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.r-stat-l {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.4;
}

/* Cover meta line (date, run id, periphery) */
.r-meta {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
  display: flex; flex-wrap: wrap; gap: 8px 16px;
}

/* ── Section headings (rapports) ─────────────── */
.r-section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}
.r-section--first {
  border-top: 0;
  padding-top: 56px;
}
.r-section--soft { background: var(--bg-soft); }
.r-section-head {
  margin-bottom: 40px;
  max-width: 64ch;
}
.r-section-num {
  display: inline-block;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.r-section-num b {
  color: var(--accent);
  font-weight: 500;
  margin-right: 4px;
}
.r-section h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.15;
}
.r-section-lead {
  font-size: 16px;
  color: var(--fg-muted);
  max-width: 56ch;
  margin: 0;
}

/* ── KPI grid (synthèse) ────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.kpi {
  padding: 22px 24px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.kpi-v {
  display: block;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.kpi-v.is-accent { color: var(--accent); }
.kpi-l {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.4;
}

/* ── Bar chart top themes ────────────────────── */
.chart-themes {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 26px;
}
.chart-themes h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin-bottom: 22px;
  font-weight: 500;
}
.chart-row {
  display: grid;
  grid-template-columns: 28ch 1fr 60px 90px;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.chart-row:last-child { border-bottom: 0; }
.chart-name { color: var(--ink); }
.chart-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  background: var(--accent);
  display: block;
}
.chart-bar-fill.is-pos { background: var(--pos); }
.chart-bar-fill.is-mixed { background: var(--mixed); }
.chart-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.chart-tone {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: right;
}
.chart-tone.is-neg { color: var(--accent); }
.chart-tone.is-pos { color: var(--pos); }
.chart-tone.is-mixed { color: var(--mixed); }

/* ── Category card (A/B/C/D) ─────────────────── */
.cat {
  margin-top: 32px;
  padding: 32px 36px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.cat-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cat-badge {
  display: inline-flex;
  align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cat-badge b { color: var(--accent); font-weight: 600; }
.cat h3 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  flex: 1;
  min-width: 280px;
}
.cat-stats {
  display: flex; gap: 24px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cat-stat-v {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.cat-stat-l {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-left: 6px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.cat-lead {
  font-size: 15px;
  color: var(--fg-muted);
  margin: 0 0 4px;
  max-width: 66ch;
}
.cat-angle {
  background: var(--bg-soft);
  border-left: 2px solid var(--accent);
  padding: 14px 18px;
  margin: 18px 0 24px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
}
.cat-angle b { color: var(--accent); font-weight: 500; }

/* ── Data table (dense) ───────────────────────── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-top: 8px;
}
.tbl th {
  text-align: left;
  font-family: var(--font);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 500;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
.tbl td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
  line-height: 1.4;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--bg-soft); }
.tbl .rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  text-align: right;
  width: 32px;
}
.tbl .score {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tbl .nb { font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); text-align: right; font-variant-numeric: tabular-nums; }
.tbl .name b { color: var(--ink); font-weight: 500; }
.tbl .name span { color: var(--fg-muted); font-size: 12px; display: block; margin-top: 2px; }
.tbl .themes {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.tbl .themes b { color: var(--ink); font-weight: 500; }
.tbl .themes .count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}
.tbl .themes .star { color: var(--accent); }
.tbl .verbatim {
  font-size: 12px;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.45;
}

.tbl-wrap { overflow-x: auto; }
.tbl-meta {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  text-align: right;
}

/* ── Status badges ───────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.badge.is-alert { background: var(--accent-soft); color: var(--accent); }
.badge.is-model { background: #DCFCE7; color: #166534; }
.badge.is-stable { background: var(--bg-canvas); color: var(--fg-muted); }
.badge.is-dormant { background: var(--bg-soft); color: var(--fg-faint); }

/* ── Verbatim card ───────────────────────────── */
.verbatim-card {
  padding: 24px 28px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
}
.verbatim-card .vc-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: lowercase;
}
.verbatim-card .vc-tone-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.verbatim-card .vc-tone-dot.is-pos { background: var(--pos); }
.verbatim-card .vc-tone-dot.is-neg { background: var(--accent); }
.verbatim-card .vc-tone-dot.is-mixed { background: var(--mixed); }
.verbatim-card .vc-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  margin-left: auto;
}
.verbatim-card .vc-quote {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 12px;
  font-weight: 400;
}
.verbatim-card .vc-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
}

.verbatims-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Comparison row (forces / faiblesses Veille) ── */
.cmp-row {
  display: grid;
  grid-template-columns: 24ch 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cmp-row:last-child { border-bottom: 0; }
.cmp-row-name {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.cmp-row-ratio {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
  display: block;
}
.cmp-bars {
  display: flex; flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cmp-bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 38px;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
}
.cmp-bar-row.is-you { color: var(--ink); font-weight: 500; }
.cmp-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.cmp-bar-fill { height: 100%; background: var(--fg-faint); display: block; }
.cmp-bar-row.is-you .cmp-bar-fill { background: var(--accent); }
.cmp-bar-val { font-variant-numeric: tabular-nums; text-align: right; }
.cmp-verbatim {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-left: 2px solid var(--line);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
}
.cmp-verbatim-meta {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  margin-top: 6px;
  display: block;
}

/* ── Trend row (Réseau) ──────────────────────── */
.trend-row {
  display: grid;
  grid-template-columns: 18ch 60px 1fr 80px;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.trend-row:last-child { border-bottom: 0; }
.trend-name { color: var(--ink); }
.trend-tone {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}
.trend-tone.is-pos { color: var(--pos); background: #DCFCE7; }
.trend-tone.is-neg { color: var(--accent); background: var(--accent-soft); }
.trend-tone.is-mixed { color: var(--mixed); background: #FEF3C7; }
.trend-delta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.trend-delta.is-pos { color: var(--pos); }
.trend-delta.is-neg { color: var(--accent); }
.trend-total {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-align: right;
}

/* ── Scatter plot (Réseau, status matrix) ────── */
.scatter {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 40px 40px;
  margin-top: 24px;
}
.scatter-svg { width: 100%; height: 360px; display: block; }
.scatter-legend {
  display: flex; gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.scatter-leg-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Radar (Veille) ──────────────────────────── */
.radar-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  margin-top: 24px;
}
.radar-svg { width: 100%; height: 360px; display: block; }
.radar-legend ul { margin: 0; padding: 0; list-style: none; }
.radar-legend li {
  display: flex; align-items: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--line);
}
.radar-legend li:last-child { border-bottom: 0; }
.radar-legend li b { color: var(--ink); font-weight: 500; }
.radar-legend .swatch {
  width: 16px; height: 3px;
  border-radius: 2px;
  margin-right: 12px;
}

/* ── Heatmap (Veille géo) ─────────────────────── */
.heat-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.heat-tbl th,
.heat-tbl td {
  text-align: center;
  padding: 9px 8px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.heat-tbl th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 500;
  background: var(--bg-soft);
}
.heat-tbl th:first-child,
.heat-tbl td:first-child {
  text-align: left;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 13px;
  background: var(--bg);
}
.heat-tbl td.is-strong-pos { background: #BBF7D0; color: #14532D; }
.heat-tbl td.is-pos { background: #DCFCE7; color: #166534; }
.heat-tbl td.is-neutral { background: var(--bg-soft); color: var(--fg-muted); }
.heat-tbl td.is-neg { background: #FEE2E2; color: #991B1B; }
.heat-tbl td.is-strong-neg { background: #FECACA; color: #7F1D1D; }
.heat-tbl td.is-you { font-weight: 600; }

/* ── Insights (callouts) ─────────────────────── */
.insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}
.insight {
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.insight.is-pos { border-color: #BBF7D0; }
.insight.is-neg { border-color: var(--accent-soft); }
.insight-head {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: 500;
}
.insight.is-pos .insight-head { color: var(--pos); }
.insight.is-neg .insight-head { color: var(--accent); }
.insight.is-mixed .insight-head { color: var(--mixed); }
.insight p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
}

/* ── Site alert / model card (Réseau) ────────── */
.site-card {
  padding: 24px 28px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}
.site-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.site-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.site-city {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.site-signal {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 10px;
}
.site-signal b { color: var(--ink); font-weight: 500; }
.site-quote {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.site-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 24px;
}
.site-cols h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

/* ── Export box ──────────────────────────────── */
.export-box {
  padding: 32px 36px;
  background: var(--bg-canvas);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 24px;
}
.export-box h3 {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 500;
}
.export-box p {
  font-size: 14.5px;
  color: var(--fg-muted);
  margin: 0 0 18px;
  max-width: 60ch;
}
.export-cols {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
  background: var(--bg);
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  line-height: 1.6;
  margin-bottom: 20px;
  overflow-x: auto;
}
.export-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Methodology box ─────────────────────────── */
.methodo {
  margin-top: 48px;
  padding: 32px 36px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.methodo h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0 0 16px;
  font-weight: 500;
}
.methodo p {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  margin: 0 0 12px;
  max-width: 70ch;
}
.methodo .methodo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 32px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.methodo .methodo-grid b { color: var(--ink); font-weight: 500; margin-right: 8px; }

/* (TOC supprimé — chaque section est désormais full-width centrée via .wrap) */

/* ── Responsive ──────────────────────────────── */
@media (max-width: 960px) {
  .r-stats, .kpi-grid { grid-template-columns: 1fr 1fr; }
  .insights { grid-template-columns: 1fr; }
  .verbatims-grid, .site-cols, .radar-wrap, .cmp-row { grid-template-columns: 1fr; }
  .cmp-row { padding: 14px 0; }
  .chart-row {
    grid-template-columns: 1fr 60px 80px;
    gap: 10px;
  }
  .chart-row .chart-bar { display: none; }
  .cat { padding: 24px 24px; }
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding: 10px 8px; }
}
@media (max-width: 560px) {
  .r-stats, .kpi-grid { grid-template-columns: 1fr; }
  .heat-tbl { font-size: 10px; }
  .r-cover { padding: 56px 0 40px; }
  .r-section { padding: 56px 0; }
}
