/* Rapport de statistiques (lien partagé et PDF) et règles d'impression.
   À l'impression : fond blanc, textes foncés, couleurs conservées, format A4, rien d'autre que le rapport. */

.share-page { max-width: 1000px; margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-10); }
.share-bar { display: flex; justify-content: flex-end; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.share-bar .btn-ghost { margin-right: auto; }
.rapport { display: flex; flex-direction: column; gap: var(--s-4); }
.rp-head { display: flex; align-items: center; gap: var(--s-3); }
.rp-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.rp-head p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.rp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.rp-kpis .rp-kpi:last-child { grid-column: span 2; }
@media (min-width: 760px) { .rp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } .rp-kpis .rp-kpi:last-child { grid-column: auto; } }
/* Sans le cash collecté (10/10/2026) : quatre cases, deux par deux sur iPhone, quatre de front au-delà. */
.rp-kpis.k4 .rp-kpi:last-child { grid-column: auto; }
@media (min-width: 760px) { .rp-kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rp-kpi, .rp-chart, .rp-table { background: var(--card); border-radius: var(--r-card); padding: var(--s-4); box-shadow: var(--shadow); }
.rp-kpi { display: flex; flex-direction: column; gap: 4px; }
.rp-kpi span { font-size: 13px; color: var(--text-2); }
.rp-kpi strong { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.rp-kpi small { font-size: 12px; color: var(--text-3); }
.rp-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
@media (min-width: 760px) { .rp-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rp-chart h2 { margin: 0 0 var(--s-3); font-size: 15px; font-weight: 600; }
.rp-table { overflow-x: auto; padding: var(--s-4) 0; } /* pas de marge de côté : voir .rp-table dans screens.css */
.stat-table tr.subtotal td { font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--line-strong); }
/* Rapport qui nomme les entreprises (lien version 3) : titre de tableau, ligne d'entreprise, période sous le nom. */
.rp-th { margin: 0 var(--s-4) var(--s-3); font-size: 15px; font-weight: 600; }
.stat-table tr.group td { text-align: left; font-weight: 650; color: var(--text); padding-top: var(--s-4); border-bottom: 1px solid var(--line-strong); }
.rp-co small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--text-3); }
@media (max-width: 759px) { .rp-co small { white-space: normal; max-width: 150px; } } /* les chiffres restent à l'écran */
/* Notes de contexte (schéma 24) : carte orange, mise en avant sous les chiffres clés du rapport ; mêmes cartes dans
   Statistiques. Mois concernés : barres orange (légende `.flag-legend`) et point orange devant le mois du tableau. */
.note-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-card); background: var(--amber-soft); }
.note-h { display: flex; align-items: flex-start; gap: var(--s-3); }
.note-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--amber); color: #FFFFFF; }
.note-hd { flex: 1; min-width: 0; }
.note-t { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.3; color: var(--text); text-wrap: balance; }
.note-p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.note-x { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.note-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.note-fig { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-radius: 12px; background: var(--card); }
.note-fig span { font-size: 12px; color: var(--text-2); }
.note-fig strong { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.note-fig:first-child strong { color: var(--amber); }
.note-fig small { font-size: 12px; color: var(--text-3); }
.note-card .btn-ghost { margin: -4px -6px 0 0; }
.rapport .note-card { padding: var(--s-5); }
.rapport .note-t { font-size: 18px; }
.bar-chart .bar.flag { fill: var(--amber); opacity: 1; }
.bar-chart.has-active .bar.flag { fill: var(--amber); opacity: 0.8; }
.bar-chart.has-active .bar.flag.on { opacity: 1; }
.flag-legend { display: flex; align-items: center; gap: 6px; margin: var(--s-2) 0 0; font-size: 12px; color: var(--text-2); }
.flag-legend i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--amber); }
.stat-table tr.noted td:first-child::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--amber); vertical-align: 1px; }
/* Filtres du destinataire (05/10/2026) : entreprise, année, mois, en tête de page ; une couleur par entreprise. */
.rp-filters { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
.rp-f { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.rp-fl { flex: none; width: 84px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.rp-f .chips { flex: 1; min-width: 0; flex-wrap: wrap; overflow: visible; } /* tout visible : un destinataire ne devine pas qu'une rangée défile */
@media (max-width: 599px) { .rp-f { flex-direction: column; align-items: stretch; gap: 4px; } .rp-fl { width: auto; } }
.rp-chart h2 span { font-weight: 400; color: var(--text-3); }
.rp-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.rp-legend .caption { margin: 0; }
.rp-co small.rp-info { color: var(--text-2); }
.rp-coinfo { margin: 0; font-size: 14px; color: var(--text-2); }
.rp-coinfo strong { color: var(--text); font-weight: 650; }
.rp-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; }
.mb .mb-bar { transition: opacity 0.15s; }
.mb.has-active .mb-bar.dim, .mb .bar-value.dim { opacity: 0.3; }
.mb-band { fill: var(--amber-soft); }
.mb-labels { display: grid; margin-top: var(--s-2); font-size: 12px; color: var(--text-3); }
.mb-labels span { display: flex; justify-content: center; white-space: nowrap; }
.mb-labels span.on { color: var(--text); font-weight: 700; }
@media (max-width: 599px) { .mb-labels { font-size: 10.5px; } }
.mb .bar-hits button { border-radius: 8px; }
@media (hover: hover) { .mb .bar-hits button:hover { background: var(--fill); } }
.mb-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.mb-legend span { display: inline-flex; align-items: center; gap: 7px; }
.mb-legend i { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.mb-legend .mb-legend-note i { border-radius: 3px; background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber); }

.print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  :root {
    color-scheme: light;
    --bg: #FFFFFF; --card: #FFFFFF; --card-2: #F1F4F9;
    --line: rgba(15, 23, 42, 0.1); --line-strong: rgba(15, 23, 42, 0.2);
    --text: #0B1220; --text-2: #4B5772; --text-3: #6B7890;
    --fill: rgba(15, 23, 42, 0.06); --fill-2: rgba(15, 23, 42, 0.12);
    --accent-bg: #5B4BE8; --shadow: none;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #FFFFFF !important; }
  body.printing > *:not(.print-root) { display: none !important; }
  body.printing .print-root { display: block; }
  .share-bar, .rp-filters, .rp-legend .caption, .bar-hits { display: none !important; }
  .share-page { padding: 0; max-width: none; }
  .rapport { gap: 12px; }
  .rp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .rp-kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rp-kpis .rp-kpi:last-child { grid-column: auto; }
  .rp-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-kpi, .rp-chart, .rp-table { border: 1px solid #E3E7EF; box-shadow: none; break-inside: avoid; }
  .note-card { --amber: #C77F00; --amber-soft: #FDF3E1; break-inside: avoid; }
  .rp-kpi { padding: 12px 14px; }
  .rp-kpi span { font-size: 12px; white-space: nowrap; }
  .rp-kpi strong { font-size: 20px; }
  .rp-table { overflow: visible; }
  .stat-table th:first-child, .stat-table td:first-child { position: static; }
  .stat-table tr { break-inside: avoid; }
  .bar-value { display: block !important; }
}
