/* Direction (2026-11-16, choisie par Aurore) : éditorial L'Onglet, comme un journal de quartier.
   Couleur : papier chaud et encre brune, un seul accent bordeaux, celui des maquettes bistro,
   pour que l'outil et les sites vendus parlent la même langue.
   Typographie : Newsreader (serif à corps optiques) pour les titres et les grands chiffres, lus
   comme une une de journal ; Source Sans 3 pour le texte et les tableaux, pour ses chiffres
   tabulaires et ses accents français nets. Repli système si les polices ne chargent pas.
   Mise en page : une colonne sur mobile, l'action courante avant l'information secondaire.
   Cartes : seules les unités qui ont une action propre reçoivent une surface délimitée. */

:root {
  color-scheme: light;
  --f-titre: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-texte: "Source Sans 3", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --page: #f6f2ea;
  --surface: #fffdf9;
  --surface-2: #efe9de;
  --ink: #1d1a17;
  --muted: #5c554c;
  --line: #a99f91;
  --line-soft: #e2dbcf;
  --accent: #7a1f2b;
  --accent-ink: #ffffff;
  --warning: #7a5000;
  --warning-bg: #fff0c7;
  --danger: #8a2525;
  --danger-bg: #fbe4e1;
  --success-bg: #dcefe5;
  --focus: #17201d;
  --radius-small: 3px;
  --radius: 7px;
  --radius-large: 14px;
  --nav-height: 66px;
}

html[data-theme="sombre"] {
  color-scheme: dark;
  --page: #16130f;
  --surface: #1f1b16;
  --surface-2: #2a251f;
  --ink: #f3ede3;
  --muted: #c4baac;
  --line: #776d60;
  --line-soft: #3a332c;
  --accent: #e6a3ab;
  --accent-ink: #2a0d12;
  --warning: #ffd27a;
  --warning-bg: #4d3610;
  --danger: #ffb3ab;
  --danger-bg: #4c2424;
  --success-bg: #1e4a37;
  --focus: #f5f2e9;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  font-family: var(--f-texte);
  font-size: 100%;
  line-height: 1.5;
}

/* Une barre fixe peut agrandir la zone d'affichage mobile qui la dimensionne (boucle à 568 px
   relevée le 2026-11-16) : on coupe tout débordement horizontal au niveau de la page. */
html,
body {
  overflow-x: clip;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a.button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 0.9rem;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}

button:hover,
a.button:hover {
  background: var(--surface-2);
}

button:active,
a.button:active {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

button.primary,
a.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

button.quiet {
  border-color: var(--line);
  background: transparent;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.6rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  padding: 0.65rem 0.72rem;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

label,
.label {
  display: block;
  margin: 0.8rem 0 0.3rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  line-height: 1.18;
  margin: 0;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--f-titre);
  font-weight: 500;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.8rem, 6vw, 2.75rem);
}

h2 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0.5rem 0 0;
}

a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -5rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem;
}

.skip-link:focus {
  top: 0.75rem;
}

[hidden] {
  display: none !important;
}

.login-layout {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: 1rem;
}

.login-panel {
  width: min(100%, 31rem);
  margin: auto;
  border-top: 7px solid var(--accent);
  background: var(--surface);
  padding: clamp(1.25rem, 5vw, 2.4rem);
}

.login-panel form {
  margin-top: 1.5rem;
}

.login-panel button {
  width: 100%;
  margin-top: 1.25rem;
}

/* Le nom en serif italique : la seule signature de marque de l'outil, sans logo inventé. */
.wordmark {
  margin: 0 0 0.2rem;
  font-family: var(--f-titre);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.1;
}

.app-layout {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1rem);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 0.75rem 1rem;
}

.user-line {
  color: var(--muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.header-actions button {
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}

.app-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: var(--nav-height);
  display: grid;
  grid-auto-flow: column;
  /* minmax(0, 1fr) : six onglets admin tiennent dans 375 px au lieu d'élargir la page. */
  grid-auto-columns: minmax(0, 1fr);
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.35rem max(0.35rem, env(safe-area-inset-right)) calc(0.35rem + env(safe-area-inset-bottom)) max(0.35rem, env(safe-area-inset-left));
}

.app-nav button {
  min-width: 0;
  border-color: transparent;
  border-radius: var(--radius-small);
  background: transparent;
  padding: 0.35rem 0.25rem;
  font-size: clamp(0.7rem, 2.8vw, 0.85rem);
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  min-height: 44px;
}

/* Page courante : fond papier plus soutenu et graisse, sans couleur d'état (le vert reste aux statuts). */
.app-nav button[aria-current="page"] {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
}

main {
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.page-head p {
  max-width: 64ch;
  color: var(--muted);
}

.toolbar,
.button-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
}

.filters > * {
  flex: 1 1 9rem;
}

.button-row {
  margin-top: 1rem;
}

.button-row > * {
  flex: 0 1 auto;
}

/* Action secondaire : un lien souligné plutôt qu'un bouton encadré de plus. Une seule action
   par ligne porte le poids d'un bouton plein (hiérarchie, règle « un point focal »). */
.lien-action {
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0 0.35rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}
.lien-action:hover { background: none; text-decoration-color: var(--accent); }
.lien-action.danger { color: var(--danger); text-decoration-color: currentColor; }
.liens-action { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: center; margin-top: 0.75rem; }

.section-stack {
  display: grid;
  gap: 1.5rem;
}

.section-block {
  min-width: 0;
}

.section-block > h2 {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.5rem;
  margin-bottom: 0.65rem;
}

/* Listes éditoriales : des lignes séparées par un filet, pas une pile de cartes identiques. */
.data-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 0.9rem 1rem;
  container-type: inline-size;
}

.data-row {
  display: grid;
  gap: 0.4rem 1rem;
  min-width: 0;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.data-row h3 { font-size: 1.02rem; }
.data-row p { margin: 0.15rem 0 0; }
@media (min-width: 40rem) {
  .data-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .data-row > .button-row, .data-row > .liens-action { margin-top: 0; justify-content: flex-end; }
}

.data-row .row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.row-meta,
.muted {
  color: var(--muted);
}

.row-meta {
  font-size: 0.9rem;
}

/* Statut en texte, comme une mention de journal : en cours en gris, acquis en encre et gras,
   refus en rouge. Pas de pastilles colorées partout. */
.status {
  width: fit-content;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  white-space: nowrap;
}
.status.warning { color: var(--ink); font-style: normal; }
.status.success { color: var(--ink); font-style: normal; font-weight: 700; }
.status.danger { color: var(--danger); font-style: normal; }

.notice {
  border: 1px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
  padding: 0.75rem;
}

.resource-note {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.65rem;
  font-weight: 700;
}

.facts {
  display: grid;
  grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1.3fr);
  gap: 0.35rem 0.8rem;
  margin: 1rem 0;
}

.facts dt {
  color: var(--muted);
  font-weight: 700;
}

.facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline {
  margin: 0;
  padding: 0 0 0 1.15rem;
}

.timeline li {
  margin-bottom: 0.85rem;
  padding-left: 0.35rem;
}

.progress-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

/* Étapes en ligne de texte, séparées par un point : franchies en encre, à venir en gris. */
.progress-step {
  color: var(--muted);
  font-size: 0.85rem;
}
.progress-step + .progress-step::before {
  content: "·";
  margin-right: 0.35rem;
  color: var(--line);
}
.progress-step.done { color: var(--ink); font-weight: 600; }

.money-total {
  border-top: 4px solid var(--accent);
  background: var(--surface);
  padding: 1rem;
}

.money-total strong {
  display: block;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
}

.mockup-board {
  display: grid;
  gap: 1rem;
}

.mockup-frame {
  width: 100%;
  min-height: 26rem;
  border: 1px solid var(--line);
  background: #ffffff;
}

/* File de maquettes : une liste de lignes ; la maquette ouverte est en gras sur fond papier soutenu. */
.mockup-thumbs {
  display: grid;
  gap: 0;
  align-content: start;
  border-top: 1px solid var(--line);
}

.mockup-thumb {
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
  padding: 0.6rem 0.5rem;
  text-align: left;
  font-weight: 400;
}

.mockup-thumb.active {
  background: var(--surface-2);
  font-weight: 700;
}

/* Message de chargement : une ligne discrète, pas un encadré. */
.state-message { padding: 1rem 0; color: var(--muted); }

/* État vide : une phrase qui dit pourquoi et quoi faire, sans cadre pointillé. */
.empty-state { padding: 0.5rem 0 0.25rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; }
.empty-state p { margin: 0.2rem 0 0; color: var(--muted); }
.error-state {
  border: 1px solid var(--danger);
  background: var(--surface);
  padding: 1rem;
}

.error-state,
.form-message:not(:empty) {
  color: var(--danger);
}

.loading-inline {
  color: var(--muted);
}

dialog {
  width: min(calc(100% - 1.4rem), 39rem);
  max-height: calc(100dvh - 1.4rem);
  border: 1px solid var(--ink);
  border-radius: var(--radius-large);
  background: var(--surface);
  color: var(--ink);
  padding: 1rem;
  box-shadow: 0 12px 36px rgb(0 0 0 / 0.28);
  overflow-y: auto;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.58);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.65rem;
}

#dialogue-contenu {
  padding-top: 0.6rem;
}

.email-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  background: var(--page);
  padding: 0.8rem;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 0.8rem);
  left: 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0.8rem 1rem;
}

/* Bloc prioritaire : un cadre plein, sans bande colorée décorative sur le côté. */
.priority-block {
  margin-bottom: 1.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1rem 1.1rem 0.5rem;
}

/* Surtitre en italique serif, la voix de la marque, pas en capitales espacées. */
.eyebrow {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-family: var(--f-titre);
  font-size: 1rem;
  font-style: italic;
}

.segmented {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.2rem;
}

.segmented button {
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.kpi-grid {
  display: grid;
  /* 4 cartes : 1, 2 ou 4 colonnes, jamais 3 + 1 orpheline */
  grid-template-columns: repeat(var(--kpi-colonnes, 1), minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 34rem) { .kpi-grid { --kpi-colonnes: 2; } }
@media (min-width: 40rem) { .kpi-grid:has(> :nth-child(3):last-child) { --kpi-colonnes: 3; } }
@media (min-width: 75rem) { .kpi-grid { --kpi-colonnes: 4; } .kpi-grid:has(> :nth-child(3):last-child) { --kpi-colonnes: 3; } }

.kpi-card,
.dashboard-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  min-height: 10.5rem;
  padding: 1rem;
}

.kpi-card > span:first-child {
  color: var(--muted);
  font-size: 0.88rem;
}

.kpi-card strong {
  margin: 0.35rem 0 0.15rem;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-card small {
  color: var(--muted);
}

.variance {
  width: fit-content;
  margin-top: auto;
  padding-top: 0.8rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.variance.up {
  color: var(--accent);
}

.variance.down,
.bad-value,
.sample-warning {
  color: var(--danger) !important;
}

.variance.neutral {
  color: var(--muted);
}

.dashboard-card {
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
}

.card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.switch-control input {
  width: 2.8rem;
  min-height: 1.55rem;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0.15rem;
}

.switch-control input::before {
  content: "";
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease;
}

.switch-control input:checked {
  background: var(--danger-bg);
}

.switch-control input:checked::before {
  background: var(--danger);
  transform: translateX(1.15rem);
}

/* position: relative garde dans le cadre les étiquettes masquées (position absolue) des
   champs du tableau ; sans elle, elles agrandissaient la page sur mobile. */
.table-scroll {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}

.dashboard-table th,
.dashboard-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 0.65rem 0.55rem;
  text-align: left;
  vertical-align: middle;
}

.dashboard-table thead th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  white-space: normal;
}

.dashboard-table .numeric,
.cell-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-value {
  display: block;
  font-weight: 800;
}

.total-row {
  background: var(--surface-2);
}

.alert-dot {
  display: inline-block;
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--danger);
}

.mini-bar {
  position: relative;
  display: block;
  width: 6.2rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.mini-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  opacity: 0.72;
}

.mini-bar strong {
  position: relative;
  z-index: 1;
  display: block;
  padding-right: 0.25rem;
  color: var(--ink);
  font-size: 0.7rem;
  line-height: 1.15rem;
  text-align: right;
}

.hours-form {
  display: grid;
  grid-template-columns: 5.2rem auto;
  gap: 0.3rem;
  align-items: center;
}

.hours-form input,
.hours-form button {
  min-height: 34px;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
}

.hours-form small {
  grid-column: 1 / -1;
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-base { stroke: var(--line); stroke-width: 1; }
.chart-bar.agreements { fill: var(--accent); }
.chart-bar.sales { fill: var(--ink); }
.chart-value, .chart-week { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.chart-grid line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.chart-grid text,
.trend-chart > text {
  fill: var(--muted);
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* Deux séries, deux traits distincts (plein bordeaux, tireté encre) : lisibles sans la couleur. */
.chart-line.sales {
  stroke: var(--ink);
  stroke-dasharray: 6 4;
  stroke-width: 1.5;
}

.chart-legend {
  display: flex;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 1rem;
  margin-right: 0.3rem;
  border-top: 3px solid var(--accent);
  vertical-align: middle;
}

.chart-legend span:last-child::before {
  border-top-style: dashed;
  border-top-width: 2px;
}

.ranking-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 2rem minmax(7rem, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.rank {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank-bar {
  grid-column: 2 / -1;
  height: 0.42rem;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.rank-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.variant-badge {
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}

.sample-warning {
  display: block;
  max-width: 11rem;
  margin-top: 0.3rem;
  white-space: normal;
}

.funnel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.7rem;
}

.funnel-cards > div {
  border-left: 3px solid var(--accent);
  background: var(--page);
  padding: 0.7rem;
}

.funnel-cards > div > span,
.funnel-cards > div > strong {
  display: block;
}

.funnel-cards > div > span {
  min-height: 2.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.funnel-cards > div > strong {
  font-size: 1.45rem;
}

.script-variant {
  margin-bottom: 0.7rem;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 0.75rem;
}

.script-variant.assigned {
  border-color: var(--accent);
  border-left-width: 4px;
}

.script-variant summary {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  cursor: pointer;
  font-weight: 800;
}

@container (max-width: 28rem) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem;
  }

  .facts dd {
    margin-bottom: 0.65rem;
    overflow-wrap: break-word;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 60rem) {
  .app-layout {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    padding-bottom: 0;
  }

  .app-header {
    grid-column: 1 / -1;
    padding-inline: 1.5rem;
  }

  .app-nav {
    position: sticky;
    top: 0;
    right: auto;
    bottom: auto;
    left: auto;
    align-self: start;
    min-height: calc(100dvh - 5rem);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-top: 0;
    border-right: 1px solid var(--line);
    padding: 1rem 0.65rem;
  }

  .app-nav button {
    justify-content: flex-start;
    min-height: 48px;
    padding-inline: 0.75rem;
    font-size: 0.92rem;
  }

  main {
    width: 100%;
    padding: 2rem clamp(1.4rem, 4vw, 3rem) 3rem;
  }

  .page-head {
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
  }

  .section-stack.two-columns {
    grid-template-columns: minmax(17.5rem, 1.15fr) minmax(17.5rem, 0.85fr);
    align-items: start;
  }

  .data-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .data-row > .row-head {
    grid-column: 1 / -1;
  }

  .toast {
    right: 1.2rem;
    bottom: 1.2rem;
    left: auto;
    width: min(28rem, calc(100% - 2.4rem));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(17.5rem, 0.75fr);
  }
}

@media (min-width: 68rem) {
  .app-layout {
    grid-template-columns: 14rem minmax(0, 1fr);
  }

  .mockup-board {
    grid-template-columns: minmax(14rem, 0.35fr) minmax(0, 1fr);
  }

  .mockup-thumbs {
    display: flex;
    flex-direction: column;
    grid-column: 1;
  }

  .mockup-frame-wrap {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* ---------- Tableau de bord admin (direction éditoriale L'Onglet) ----------
   Point focal : le verdict du test, en grand chiffre serif comme une une de journal.
   Motif : un filet fin sous chaque titre de section, rien d'autre comme ornement.
   Accent bordeaux réservé à la jauge du test et aux dépassements de seuil. */
.tb-demo {
  margin: 0 0 1.25rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.92rem;
}
.tb-tete {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 2px solid var(--ink);
}
.tb-une {
  display: grid;
  gap: 2rem;
  padding: 2rem 0 1.75rem;
  border-bottom: 1px solid var(--line-soft);
}
.tb-surtitre {
  font-family: var(--f-titre);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.tb-chiffre {
  margin: 0.25rem 0 0;
  font-family: var(--f-titre);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  line-height: 1.1;
}
.tb-chiffre span {
  display: block;
  font-size: clamp(4.5rem, 16vw, 7.5rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
}
.tb-phrase {
  max-width: 40rem;
  margin: 1rem 0 0;
  font-size: 1.08rem;
  text-wrap: pretty;
}
.tb-jauge {
  height: 4px;
  max-width: 40rem;
  margin: 1.1rem 0 0;
  background: var(--line-soft);
}
.tb-jauge i { display: block; height: 100%; background: var(--accent); }
.tb-faits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin: 1.25rem 0 0;
}
.tb-faits dt, .tb-periode dt { color: var(--muted); font-size: 0.85rem; }
.tb-faits dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-alerte { color: var(--danger); font-weight: 700; }
.tb-afaire h2,
.tb-bloc h2 {
  padding-bottom: 0.45rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--ink);
  font-size: 1.3rem;
}
.tb-afaire ul { list-style: none; margin: 0; padding: 0; }
.tb-afaire li + li { border-top: 1px solid var(--line-soft); }
.tb-lien {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.tb-lien:hover { text-decoration-color: var(--accent); }
.tb-calme { margin: 0; color: var(--muted); }
.tb-periode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.tb-periode dd { display: flex; flex-direction: column; margin: 0.1rem 0 0; }
.tb-chiffre, .tb-periode strong, .tb-etape-nombre { font-variant-numeric: lining-nums tabular-nums; }
.tb-periode strong { font-family: var(--f-titre); font-size: 1.6rem; font-weight: 500; line-height: 1.1; }
.tb-periode span { color: var(--muted); font-size: 0.85rem; }
.tb-bloc { padding: 2rem 0 0.5rem; }
.tb-note { margin: 0 0 1rem; color: var(--muted); font-size: 0.92rem; }
.tb-bloc .tb-note:last-child { margin: 1rem 0 0; }
.tb-entonnoir {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
.tb-entonnoir li { display: flex; flex-direction: column; }
.tb-etape-nombre { font-family: var(--f-titre); font-size: 2.2rem; font-weight: 500; line-height: 1; }
.tb-etape-libelle { font-weight: 600; }
.tb-etape-taux { color: var(--muted); font-size: 0.82rem; }
.tb-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tb-table th, .tb-table td { padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--line-soft); text-align: right; vertical-align: middle; white-space: nowrap; }
.tb-table thead th { color: var(--muted); font-size: 0.82rem; font-weight: 600; border-bottom-color: var(--line); }
.tb-table th[scope="row"], .tb-table thead th:first-child { text-align: left; font-weight: 600; }
.tb-table th[scope="row"] { color: var(--ink); }
.tb-brut { color: var(--muted); font-size: 0.85rem; }
.tb-table .hours-form { display: inline-flex; gap: 0.4rem; align-items: center; }
.tb-table .hours-form input { width: 5.5rem; min-height: 40px; text-align: right; }
.tb-table .hours-form button { min-height: 40px; }
.tb-legende { display: flex; gap: 1.25rem; margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); }
.tb-legende span::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; vertical-align: -0.05rem; background: var(--accent); }
.tb-legende .tb-l-ventes::before { background: var(--ink); }
@media (min-width: 48rem) {
  .tb-periode { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tb-entonnoir { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
  .tb-une { grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 3rem; }
}
.tb-une.tb-une-simple { grid-template-columns: minmax(0, 1fr); }
.tb-chiffre span { overflow-wrap: anywhere; }
@media (min-width: 48rem) { .tb-entonnoir-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 47.99rem) { .chart-value, .chart-week { font-size: 22px; } }
/* Suivi : un tableau qui se lit en ligne, actions en liens, une seule action pleine (payer). */
.suivi-filtre { max-width: 22rem; margin-bottom: 0.75rem; }
.suivi-table th[scope="row"] { white-space: normal; min-width: 11rem; }
.suivi-table td, .suivi-table th { text-align: left; }
.suivi-actions { display: flex; gap: 0 0.5rem; align-items: center; justify-content: flex-end; }
.suivi-actions .primary { min-height: 40px; padding-inline: 0.8rem; }
/* Dans une demi-colonne, les actions passent sous le nom du commerce plutôt que de le tasser. */
@media (min-width: 40rem) {
  .two-columns .data-row { grid-template-columns: minmax(0, 1fr); }
  .two-columns .data-row > .liens-action, .two-columns .data-row > .button-row { justify-content: flex-start; }
}
.suivi-table th, .suivi-table td { padding-right: 0.6rem; }
/* Suivi sur téléphone : chaque commerce devient un bloc ; les actions restent visibles sans défilement latéral. */
@media (max-width: 47.99rem) {
  .suivi-table, .suivi-table tbody, .suivi-table tr, .suivi-table th, .suivi-table td { display: block; }
  .suivi-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .suivi-table tr { padding: 0.8rem 0; border-bottom: 1px solid var(--line-soft); }
  .suivi-table tr[hidden] { display: none; }
  .suivi-table th, .suivi-table td { border: 0; padding: 0.1rem 0; white-space: normal; }
  .suivi-table td[data-label]:empty { display: none; }
  .suivi-table td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); font-size: 0.85rem; }
  .suivi-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 0.3rem; }
}
