/* ==========================================================================
   NDRI REPORT LAB — couche "Report" commune aux 5 tableaux de bord.
   Prefixe .rl- uniquement : aucun risque de collision avec le CSS des pages.
   S'appuie sur les variables deja definies par chaque page, avec repli sombre.
   ========================================================================== */
.rl-overlay,
.rl-overlay *,
.rl-overlay *::before,
.rl-overlay *::after { box-sizing: border-box; }

.rl-overlay {
  --rl-bg: var(--bg2, var(--bg-app, #070b14));
  --rl-panel: var(--panel2, var(--panel, #101624));
  --rl-panel-2: var(--bg-rail, var(--bg2, #0b1220));
  --rl-line: var(--line, var(--border, rgba(120, 160, 220, .18)));
  --rl-line-soft: var(--line-soft, rgba(120, 160, 220, .08));
  --rl-text: var(--txt, var(--t-hi, #e9effc));
  --rl-muted: var(--txt2, var(--t, #8fa3c4));
  --rl-faint: var(--muted, var(--t-mut, #64748f));
  --rl-accent: var(--cyan, #22d3ee);
  --rl-gold: var(--gold, var(--amber, #fbbf24));
  --rl-green: var(--green, #34d399);
  --rl-red: var(--red, #f87171);
  --rl-blue: var(--blue, #60a5fa);
  --rl-purple: var(--violet, var(--purple, #a78bfa));
  --rl-radius: 14px;
  --rl-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 5, 12, .72);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  color: var(--rl-text);
  font-family: var(--rl-font);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.rl-overlay.rl-show { display: flex; }
body.rl-open { overflow: hidden !important; }

:root[data-theme="light"] .rl-overlay,
html[data-theme="light"] .rl-overlay,
.rl-overlay.rl-light {
  --rl-bg: #eef2f9;
  --rl-panel: #ffffff;
  --rl-panel-2: #f8fafc;
  --rl-line: rgba(30, 41, 59, .16);
  --rl-line-soft: rgba(30, 41, 59, .08);
  --rl-text: #0f172a;
  --rl-muted: #475569;
  --rl-faint: #64748b;
  background: rgba(226, 232, 240, .78);
  color-scheme: light;
}

.rl-shell {
  width: min(1180px, 100%);
  max-height: min(94vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rl-line);
  border-radius: var(--rl-radius);
  background:
    radial-gradient(900px 400px at 8% -12%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(251, 191, 36, .07), transparent 55%),
    var(--rl-bg);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03) inset;
}

.rl-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rl-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
}
.rl-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rl-brand .rl-dot {
  width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%;
  background: var(--rl-accent); box-shadow: 0 0 12px 3px rgba(34, 211, 238, .45);
  animation: rl-pulse 2s infinite;
}
@keyframes rl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.rl-brand h1 {
  margin: 0; font-size: 15px; line-height: 1.15; letter-spacing: .13em;
  text-transform: uppercase; font-weight: 800; color: var(--rl-text);
}
.rl-brand h1 span { color: var(--rl-accent); }
.rl-brand p {
  margin: 3px 0 0; font-size: 10.5px; color: var(--rl-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw;
}
.rl-head-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.rl-btn {
  appearance: none; border: 1px solid var(--rl-line); border-radius: 7px;
  background: var(--rl-panel-2); color: var(--rl-muted);
  padding: 7px 10px; font: 600 10.5px/1 var(--rl-font); letter-spacing: .04em;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.rl-btn:hover { border-color: var(--rl-accent); color: var(--rl-text); }
.rl-btn.rl-primary {
  background: var(--rl-accent); border-color: var(--rl-accent); color: #00131a;
  font-weight: 800; padding: 9px 16px;
}
.rl-btn.rl-primary:hover { filter: brightness(1.08); color: #00131a; }
.rl-btn.rl-close { font-size: 16px; line-height: 1; padding: 7px 10px; }
.rl-lang { display: flex; border: 1px solid var(--rl-line); border-radius: 7px; overflow: hidden; }
.rl-lang button {
  appearance: none; border: 0; background: transparent; color: var(--rl-faint);
  padding: 7px 8px; font: 700 10px/1 var(--rl-font); cursor: pointer;
}
.rl-lang button.rl-on { background: var(--rl-accent); color: #00131a; }

.rl-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px 24px; }
.rl-body::-webkit-scrollbar { width: 9px; }
.rl-body::-webkit-scrollbar-thumb { background: var(--rl-line); border-radius: 9px; }

.rl-context {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--rl-line-soft);
  border-radius: 9px; background: rgba(255, 255, 255, .018); color: var(--rl-muted);
  font-size: 11px;
}
.rl-context b { color: var(--rl-text); font-weight: 700; }
.rl-context .rl-pill {
  display: inline-block; margin-left: 4px; padding: 2px 7px; border-radius: 999px;
  background: rgba(34, 211, 238, .10); border: 1px solid rgba(34, 211, 238, .25);
  color: var(--rl-accent); font-size: 9px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase;
}

.rl-panel {
  border: 1px solid var(--rl-line); border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 60%), var(--rl-panel);
  margin-bottom: 14px; overflow: hidden;
}
.rl-panel-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 13px 15px 10px; border-bottom: 1px solid var(--rl-line-soft);
}
.rl-panel-h h2 {
  margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 800; color: var(--rl-text);
}
.rl-panel-h h2 span { color: var(--rl-accent); }
.rl-panel-h small { color: var(--rl-faint); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rl-panel-b { padding: 14px 15px 16px; }
.rl-method { padding: 11px 14px; color: var(--rl-faint); font-size: 10.5px; line-height: 1.65; }
.rl-method code { color: var(--rl-accent); font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 10px; }

.rl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 13px; }
.rl-kpi {
  padding: 10px 11px; border: 1px solid var(--rl-line); border-radius: 9px;
  background: var(--rl-panel-2); min-width: 0;
}
.rl-kpi .v {
  font-size: 20px; font-weight: 800; line-height: 1.05; color: var(--rl-accent);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rl-kpi .l {
  margin-top: 4px; font-size: 9px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--rl-faint); line-height: 1.25;
}
.rl-kpi .s { margin-top: 3px; font-size: 10px; color: var(--rl-muted); line-height: 1.3; }
.rl-kpi.rl-good .v { color: var(--rl-green); }
.rl-kpi.rl-warn .v { color: var(--rl-gold); }
.rl-kpi.rl-bad .v { color: var(--rl-red); }

.rl-compare-grid {
  display: grid; grid-template-columns: 1fr 34px 1fr auto; gap: 9px; align-items: end;
}
.rl-period {
  border: 1px solid var(--rl-line); border-radius: 9px; padding: 10px 11px;
  background: var(--rl-panel-2);
}
.rl-period .rl-period-t {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 7px; font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--rl-faint); font-weight: 800;
}
.rl-period .rl-period-t b { color: var(--rl-accent); font-size: 10px; }
.rl-period.rl-b .rl-period-t b { color: var(--rl-gold); }
.rl-period .rl-inputs { display: flex; align-items: center; gap: 6px; }
.rl-period select {
  appearance: none; width: 100%; min-width: 0; border: 1px solid var(--rl-line);
  border-radius: 6px; background: var(--rl-bg); color: var(--rl-text);
  padding: 7px 7px; font: 600 12px/1.2 var(--rl-font); cursor: pointer;
}
.rl-period .rl-sep { color: var(--rl-faint); font-size: 10px; }
.rl-arrow { align-self: center; text-align: center; color: var(--rl-faint); font-size: 15px; }
.rl-compare-actions { display: flex; align-items: center; gap: 6px; }
.rl-compare-note { margin-top: 8px; font-size: 10px; color: var(--rl-faint); }

.rl-result { margin-top: 13px; }
.rl-result:empty { display: none; }
.rl-narrative {
  border-left: 3px solid var(--rl-accent); padding: 8px 12px; margin-bottom: 11px;
  background: rgba(34, 211, 238, .06); border-radius: 0 7px 7px 0;
  font-size: 12px; line-height: 1.55; color: var(--rl-text);
}
.rl-narrative b { color: var(--rl-accent); }

.rl-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rl-table th {
  text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--rl-line);
  color: var(--rl-faint); font-size: 9px; letter-spacing: .09em; text-transform: uppercase;
  font-weight: 800; white-space: nowrap;
}
.rl-table th:first-child, .rl-table td:first-child { text-align: left; }
.rl-table td {
  padding: 7px 8px; border-bottom: 1px solid var(--rl-line-soft);
  color: var(--rl-text); text-align: right; font-variant-numeric: tabular-nums;
}
.rl-table tr:last-child td { border-bottom: 0; }
.rl-table .rl-metric { color: var(--rl-muted); font-weight: 600; }
.rl-table .rl-hint { display: block; font-size: 9.5px; color: var(--rl-faint); font-weight: 400; margin-top: 2px; }
.rl-delta {
  display: inline-block; min-width: 58px; padding: 2px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 800; text-align: center;
}
.rl-delta.rl-up { background: rgba(52, 211, 153, .12); color: var(--rl-green); }
.rl-delta.rl-down { background: rgba(248, 113, 113, .12); color: var(--rl-red); }
.rl-delta.rl-flat { background: rgba(148, 163, 184, .12); color: var(--rl-muted); }
.rl-delta.rl-new { background: rgba(34, 211, 238, .13); color: var(--rl-accent); }
.rl-delta.rl-neutral { background: rgba(251, 191, 36, .11); color: var(--rl-gold); }

.rl-movers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.rl-mover {
  border: 1px solid var(--rl-line); border-radius: 9px; background: var(--rl-panel-2);
  padding: 10px 11px; min-width: 0;
}
.rl-mover h3 {
  margin: 0 0 7px; font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--rl-faint); font-weight: 800;
}
.rl-mover-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; margin-top: 5px; }
.rl-mover-row .n { color: var(--rl-faint); font-size: 9px; text-align: right; }
.rl-mover-row .lab { font-size: 10.5px; color: var(--rl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-mover-row .val { font-size: 10px; color: var(--rl-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.rl-mover-row .bar { grid-column: 2 / 4; height: 3px; border-radius: 3px; background: var(--rl-line-soft); overflow: hidden; }
.rl-mover-row .bar i { display: block; height: 100%; border-radius: 3px; background: var(--rl-accent); }
.rl-mover-row:nth-child(2) .bar i { background: var(--rl-gold); }
.rl-mover-row:nth-child(3) .bar i { background: var(--rl-blue); }

.rl-findings { display: flex; flex-direction: column; gap: 7px; }
.rl-finding {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 11px; border: 1px solid var(--rl-line-soft); border-left-width: 3px;
  border-radius: 0 8px 8px 0; background: rgba(255, 255, 255, .012);
}
.rl-finding .rl-flag {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 999px;
  font-size: 8.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap; margin-top: 1px;
}
.rl-finding .rl-text { font-size: 12px; line-height: 1.5; color: var(--rl-text); }
.rl-finding.is-attention { border-left-color: var(--rl-red); }
.rl-finding.is-attention .rl-flag { background: rgba(248, 113, 113, .13); color: var(--rl-red); }
.rl-finding.is-info { border-left-color: var(--rl-gold); }
.rl-finding.is-info .rl-flag { background: rgba(251, 191, 36, .13); color: var(--rl-gold); }
.rl-finding.is-good { border-left-color: var(--rl-green); }
.rl-finding.is-good .rl-flag { background: rgba(52, 211, 153, .13); color: var(--rl-green); }
.rl-empty { padding: 18px; text-align: center; color: var(--rl-faint); font-size: 11.5px; }

/* --------------------------------------------------------------------------
   Panneau 03 — signaux caches (renderSignals).
   Une tuile par signal : valeur a gauche, libelle + phrase a droite.
   La couleur vient du tag : blind, asym, conc, repeat, cover, inco, tail,
   accel — chaque famille a sa teinte, la bordure gauche porte le sens.
   -------------------------------------------------------------------------- */
.rl-signals { display: flex; flex-direction: column; gap: 8px; }
.rl-signals:empty { display: none; }
.rl-signal {
  --rl-tag: var(--rl-accent);
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 2px 12px;
  align-items: start;
  padding: 11px 13px;
  border: 1px solid var(--rl-line-soft);
  border-left: 3px solid var(--rl-tag);
  border-radius: 0 9px 9px 0;
  background: rgba(255, 255, 255, .012);
}
.rl-signal-v {
  grid-column: 1;
  font-size: 17px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em;
  color: var(--rl-tag); font-variant-numeric: tabular-nums;
  text-align: right; padding-top: 1px;
  overflow-wrap: anywhere;
}
.rl-signal-b { grid-column: 2; min-width: 0; }
.rl-signal-t {
  display: block; font-size: 9.5px; line-height: 1.3; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase; color: var(--rl-tag);
}
.rl-signal-b p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; color: var(--rl-muted); }
.rl-signal[data-signal="blind"] { --rl-tag: var(--rl-red); }
.rl-signal[data-signal="inco"] { --rl-tag: var(--rl-gold); }
.rl-signal[data-signal="asym"] { --rl-tag: var(--rl-blue); }
.rl-signal[data-signal="conc"] { --rl-tag: var(--rl-purple); }
.rl-signal[data-signal="repeat"] { --rl-tag: var(--rl-accent); }
.rl-signal[data-signal="cover"] { --rl-tag: var(--rl-faint); }
.rl-signal[data-signal="tail"] { --rl-tag: #fb923c; }
.rl-signal[data-signal="accel"] { --rl-tag: var(--rl-green); }
.rl-signals-panel .rl-panel-h h2 small { max-width: 78ch; }

.rl-period.rl-a { border-color: rgba(34, 211, 238, .30); }
.rl-period.rl-b { border-color: rgba(251, 191, 36, .26); }

.rl-launch-fixed {
  position: fixed; right: 16px; bottom: 18px; z-index: 2147482000;
  border: 1px solid #22d3ee; background: #071018; color: #22d3ee;
  border-radius: 999px; padding: 10px 14px; font: 800 11px/1 'Segoe UI', system-ui, sans-serif;
  letter-spacing: .08em; cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.rl-nav-link { display: inline-flex !important; align-items: center; gap: 4px; }
.rl-title-btn {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 4px;
  border: 1px solid var(--border, var(--line, rgba(120, 160, 220, .2)));
  border-radius: 3px; background: var(--bg-chrome, #0d121c); color: var(--t, #a9b8d4);
  padding: 5px 9px; font: 600 10px/1 'Inter', 'Segoe UI', system-ui, sans-serif;
  letter-spacing: .04em; cursor: pointer; white-space: nowrap;
}
.rl-title-btn:hover, .rl-title-btn.rl-on { border-color: var(--cyan, #22d3ee); color: var(--cyan, #22d3ee); }
.rl-title-btn.rl-on { background: rgba(34, 211, 238, .10); }

@media (max-width: 760px) {
  .rl-overlay { padding: 0; }
  .rl-shell { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; border: 0; }
  .rl-head { padding: 10px 12px; flex-wrap: wrap; }
  .rl-brand p { max-width: 80vw; }
  .rl-head-actions { width: 100%; justify-content: flex-end; }
  .rl-body { padding: 11px 12px 22px; }
  .rl-context { flex-direction: column; align-items: flex-start; }
  .rl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rl-compare-grid { grid-template-columns: 1fr; }
  .rl-arrow { display: none; }
  .rl-compare-actions { justify-content: stretch; }
  .rl-compare-actions .rl-btn { width: 100%; }
  .rl-movers { grid-template-columns: 1fr; }
  .rl-signals { gap: 6px; }
  .rl-signal { grid-template-columns: 1fr; gap: 4px; padding: 10px 11px; }
  .rl-signal-v { text-align: left; font-size: 16px; }
  .rl-panel-h { flex-direction: column; gap: 2px; }
  .rl-table { font-size: 10.5px; }
  .rl-table th, .rl-table td { padding: 5px 5px; }
}

@media print {
  body.rl-printing > *:not(#rl-overlay):not(#rl-app) { display: none !important; }
  body.rl-printing #rl-app { display: block !important; }
  body.rl-printing #rl-overlay {
    position: static !important; display: block !important; padding: 0 !important;
    background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    color: #111 !important;
  }
  body.rl-printing .rl-shell {
    width: 100% !important; max-height: none !important; height: auto !important;
    border: 0 !important; box-shadow: none !important; background: #fff !important;
  }
  body.rl-printing .rl-head-actions, body.rl-printing .rl-compare-grid,
  body.rl-printing .rl-context .rl-pill { display: none !important; }
  body.rl-printing .rl-body { overflow: visible !important; }
  body.rl-printing .rl-panel, body.rl-printing .rl-kpi, body.rl-printing .rl-mover,
  body.rl-printing .rl-signal {
    background: #fff !important; border-color: #ddd !important;
  }
  body.rl-printing .rl-signal-t, body.rl-printing .rl-signal-v { color: #111 !important; }
  body.rl-printing .rl-panel { break-inside: avoid; }
  body.rl-printing .rl-signal { break-inside: avoid; }
}
