/* Journal des ventes hebdomadaire (#/rh) : prototype RH.dc.html.
   Styles propres à cet écran (refonte du prototype v73) : un fichier par écran, chargé par index.html après
   shell.css. Téléphone : @media (max-width: 767px), comme la coque ; pas de maquette téléphone : la même page, les
   tableaux défilent à l'horizontale dans leur carte.
   Repris de css/screens/pl.css (chargée sur toutes les pages) : `.pl-file*` (« Fichier des écritures », « Retour à la
   semaine »), `.pl-empty*` (carte vide), `.pl-lines` (tableau du journal déplié), `.pl-rounding` (phrase du détail).
   L'interrupteur est celui de blocs-lignes.js (styles `bl-switch`, css/screens/livraison.css). */

/* En-tête : surtitre, titre, une phrase */
.rh-screen .rh-head { margin-bottom: 24px; }
.rh-screen .rh-head .kicker { margin: 0; font-size: 14px; color: var(--fr-muted); }
.rh-screen .rh-head h1 { margin: 0; letter-spacing: -0.01em; }
.rh-screen .rh-head .lede { margin: 8px 0 0; font-size: 16px; color: var(--app-muted); }

/* Bloc du chiffre clé, interrupteur, notes */
.rh-screen .rh-block { margin-top: 20px; }
.rh-screen .rh-block .margin__hero { gap: 4px 16px; margin-bottom: 8px; }
.rh-screen .rh-block .margin__hero h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; line-height: 1.3; }
.rh-hero__note { margin: 0; font-size: 14px; color: var(--fr-muted); }
.rh-switchbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.rh-note { margin: 8px 0 0; font-size: 14px; color: var(--fr-muted); }
.rh-back { margin: 0 0 12px; }
.rh-backbar { margin-top: 20px; }
.rh-backbar .rh-back { margin: 0; }

/* Tableaux : colonnes du prototype, défilent dans leur carte */
.rh-table > .table--res { table-layout: fixed; font-size: 14px; }
.rh-table > .table--res > thead > tr > th { box-sizing: border-box; padding: 18px 16px 14px; }
.rh-table > .table--res > * > tr > th, .rh-table > .table--res > * > tr > td { white-space: nowrap; }
.rh-table > .table--res > tbody > tr.row-h > th, .rh-table > .table--res > tbody > tr.row-h > td,
.rh-table > .table--res > tfoot > tr > th, .rh-table > .table--res > tfoot > tr > td { padding: 6px 16px; }
.rh-table > .table--res > tbody > tr > td.num { font-weight: 500; }
.rh-table > .table--res > tbody > tr > td.key { font-weight: 700; }
.rh-table > .table--res > tfoot > tr > th, .rh-table > .table--res > tfoot > tr > td { border-top: 2px solid var(--app-ink); height: 56px; font-weight: 700; }
.rh-table > .table--res > tbody > tr > th .sub--block { white-space: normal; }

/* Semaine : 300 / 110 / 170 / 170 / 170 / 200 */
.rh-table--week > .table--res { min-width: 840px; }
.rh-table--week > .table--res > thead > tr > th:nth-child(1) { width: 26.8%; }
.rh-table--week > .table--res > thead > tr > th:nth-child(2) { width: 9.8%; }
.rh-table--week > .table--res > thead > tr > th:nth-child(3),
.rh-table--week > .table--res > thead > tr > th:nth-child(4),
.rh-table--week > .table--res > thead > tr > th:nth-child(5) { width: 15.2%; }
.rh-table--week > .table--res > thead > tr > th:nth-child(6) { width: 17.8%; }
.rh-table--week > .table--res > tbody > tr > td:nth-child(2) { font-weight: 400; }

/* Jour : 300 / 190 / 190 / 200 / 220 / 44 */
.rh-table--day > .table--res { min-width: 840px; }
.rh-table--day > .table--res > thead > tr > th:nth-child(1) { width: 26.2%; }
.rh-table--day > .table--res > thead > tr > th:nth-child(2),
.rh-table--day > .table--res > thead > tr > th:nth-child(3) { width: 16.6%; }
.rh-table--day > .table--res > thead > tr > th:nth-child(4) { width: 17.5%; }
.rh-table--day > .table--res > thead > tr > th:nth-child(5) { width: 19.2%; }
.rh-table--day > .table--res > thead > tr > th.res-toggle-cell { width: 3.9%; }
.rh-table--day > .table--res > * > tr > th.res-toggle-cell,
.rh-table--day > .table--res > * > tr.row-h > td.res-toggle-cell { padding: 0 10px 0 0; }
.rh-table--day > .table--res > tbody > tr.row-x.is-open > th,
.rh-table--day > .table--res > tbody > tr.row-x.is-open > td { background: var(--bl-soft, #F8FAF5); }
.rh-table--day > .table--res > tbody > tr.res-detail > td { padding: 14px 20px 18px; border-top: 1px dashed var(--app-line); background: var(--bl-soft, #F8FAF5); }
.rh-table--day .res-detail__body { gap: 10px; left: 20px; min-width: min(100%, calc(100cqw - 40px)); }

/* Par jour : 1,6 / 1 / 1 / 1, sans ligne Total */
.rh-screen .rh-byday { margin-top: 24px; }
.rh-screen .rh-byday h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.rh-table--days { margin-top: 0; }
.rh-table--days > .table--res { min-width: 640px; }
.rh-table--days > .table--res > thead > tr > th { padding: 16px 16px 12px; }
.rh-table--days > .table--res > thead > tr > th:nth-child(1) { width: 34.8%; }
.rh-table--days > .table--res > tbody > tr.row-h { height: auto; }
.rh-table--days > .table--res > tbody > tr.row-h > th, .rh-table--days > .table--res > tbody > tr.row-h > td { padding: 12px 16px; }
.rh-table--days > .table--res > tbody > tr > td.num { font-weight: 400; }
.rh-table--days > .table--res > tbody > tr > td.key { font-weight: 700; }
.rh-day { color: var(--fr-brand); font-weight: 700; text-decoration: underline; }
.rh-day:hover { color: color-mix(in srgb, var(--fr-brand) 80%, #000); }

/* Journal déplié d'un restaurant : 1 / 2,6 / 1,2 / 1,2 ; la ligne « Contrôle » en gras sur fond jaune pâle */
.rh-lines > .table--res > thead > tr > th:nth-child(1) { width: 16.7%; }
.rh-lines > .table--res > thead > tr > th:nth-child(2) { width: 43.3%; }
.rh-lines > .table--res > tbody > tr.rh-ctl > th, .rh-lines > .table--res > tbody > tr.rh-ctl > td { background: #FFF8E6; }
.rh-lines > .table--res > tbody > tr.rh-ctl > td:nth-child(2) { font-weight: 700; }

@media (max-width: 767px) {
  .rh-screen .rh-head { margin-bottom: 20px; }
  /* les tableaux gardent leurs colonnes et défilent dans leur carte (pas de colonnes repliées) */
  .rh-table > .table--res > thead > tr > th { padding: 18px 16px 14px; white-space: nowrap; }
  .rh-table--days > .table--res > thead > tr > th { padding: 16px 16px 12px; }
  .rh-table > .table--res > tbody > tr.row-h > th, .rh-table > .table--res > tbody > tr.row-h > td,
  .rh-table > .table--res > tfoot > tr > th, .rh-table > .table--res > tfoot > tr > td { padding: 6px 16px; }
  .rh-table--days > .table--res > tbody > tr.row-h > th, .rh-table--days > .table--res > tbody > tr.row-h > td { padding: 12px 16px; }
  .rh-table--day > .table--res > * > tr > th.res-toggle-cell,
  .rh-table--day > .table--res > * > tr.row-h > td.res-toggle-cell { width: 3.9%; padding: 0 10px 0 0; }
  .rh-table--day .res-toggle { width: 34px; height: 34px; border: 1px solid var(--app-line); background: var(--app-surface); }
  .rh-table > .table--res .badge { white-space: nowrap; }
  .rh-table--day > .table--res > tbody > tr.res-detail > td { padding: 14px 16px 18px; }
  .rh-table--day .res-detail__body { left: 16px; min-width: min(100%, calc(100cqw - 32px)); }

  /* Semaine et « Par jour » (audit EC-7) : une carte par restaurant (par jour), chaque chiffre sous son nom, deux par
     ligne ; l'écart de caisse se voit sans faire glisser le tableau (avant : 840 px de colonnes dans 326, seuls
     « Restaurant » et « Jours » à l'écran). Le nom vient de la colonne (`data-label`, resultats-ui.js). */
  .rh-table--week, .rh-table--days { overflow: visible; }
  :is(.rh-table--week, .rh-table--days) > .table--res { display: block; min-width: 0; }
  :is(.rh-table--week, .rh-table--days) > .table--res > thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; }
  :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) { display: block; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px; height: auto; padding: 14px 16px; border-top: 1px solid var(--app-line); }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > tbody > tr:first-child { border-top: 0; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) > tr > :is(th, td) { display: block; height: auto;
    padding: 0; border: 0; text-align: left; white-space: normal; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) > tr > th { grid-column: 1 / -1; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) > tr > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--app-muted); }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > :is(tbody, tfoot) > tr > td:empty { display: none; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > tbody > tr > td.key { font-size: 16px; }
  .rh-screen :is(.rh-table--week, .rh-table--days) > .table--res > tfoot > tr { border-top: 2px solid var(--app-ink); }
}
