/* tradeportpilot.com — styles de l'interface du pilote */

:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #202b3a;
  --muted: #536072;
  --line: #dde3ea;
  --line-strong: #c3ccd7;
  /* Bleu nuit : en-tête, navigation, titres. Bleu pétrole : actions principales et liens. */
  --navy: #142d4e;
  --navy-soft: #e8edf4;
  --primary: #006d77;
  --primary-hover: #005860;
  --primary-ink: #ffffff;
  --primary-soft: #e1f1f2;
  --ok: #17703f;
  --ok-soft: #e2f4e9;
  --warn: #8a5300;
  --warn-soft: #fdf0d5;
  --bad: #a82a22;
  --bad-soft: #fce7e5;
  --info: #1c5a9e;
  --info-soft: #e3eefb;
  --progress: #5a3fb8;
  --progress-soft: #ece8fa;
  --neutral: #465161;
  --neutral-soft: #eaedf1;
  --demo: #5f4500;
  --demo-soft: #fff3cf;
  --demo-line: #e2b33c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 45, 78, 0.06), 0 2px 6px rgba(20, 45, 78, 0.05);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}

a {
  color: var(--primary);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  color: var(--navy);
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
  outline: none;
}

h2 {
  font-size: 1.08rem;
  font-weight: 650;
}

h3 {
  font-size: 0.95rem;
  font-weight: 650;
}

code,
.pre {
  font-family: var(--mono);
  font-size: 0.86em;
}

q {
  quotes: "« " " »";
  font-style: italic;
}

:focus-visible {
  outline: 3px solid #f0a000;
  outline-offset: 2px;
}

/* Le titre reçoit le focus à chaque changement d'écran (lecteurs d'écran) : pas de cadre visible. */
h1[tabindex="-1"]:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 600;
}

/* Le contenu principal reçoit le focus après « Aller au contenu » : un repère discret, pas de cadre autour de la page. */
.main:focus {
  outline: none;
}

.main:focus-visible {
  box-shadow: inset 0 3px 0 #f0a000;
}

/* Passage laissé en anglais, tel que le moteur l'a produit. */
.original {
  font-style: italic;
}

.untranslated [lang="en"] {
  font-style: italic;
}

.untranslated__tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px dashed currentColor;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  font-style: normal;
  white-space: nowrap;
}

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

.nowrap {
  white-space: nowrap;
}

/* --- bandeau de démonstration : toujours visible ------------------------------------------------ */

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  justify-content: center;
  padding: 8px 16px;
  background: var(--demo-soft);
  border-bottom: 2px solid var(--demo-line);
  color: var(--demo);
  font-size: 0.92rem;
  text-align: center;
}

.demo-banner strong {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.86rem;
}

.demo-banner a {
  color: var(--demo);
  font-weight: 600;
}

.demo-banner[data-mode="real_only"] {
  position: static;
  padding: 5px 16px;
  background: var(--navy-soft);
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  font-size: 0.88rem;
}

.demo-banner[data-mode="real_only"] strong {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
}

.demo-banner[data-mode="real_only"] a {
  color: var(--primary);
}

/* --- en-tête et navigation ---------------------------------------------------------------------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px 24px;
  background: var(--navy);
  color: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: #d5deea;
  text-decoration: none;
  font-weight: 600;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Page active : texte blanc, fond éclairci et trait souligné (jamais la couleur seule ; aria-current pour les lecteurs). */
.nav a.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: inset 0 -3px 0 #7fd0d6;
}

.org {
  color: #d5deea;
  font-size: 0.9rem;
}

.topbar :focus-visible {
  outline-color: #ffc94d;
}

.main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.view > * + * {
  margin-top: 18px;
}

.footer {
  padding: 16px 24px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- éléments communs --------------------------------------------------------------------------- */

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumb li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--line-strong);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-start;
  justify-content: space-between;
}

.page-head h1 .badge {
  vertical-align: middle;
  font-size: 0.78rem;
}

.lead {
  margin-top: 4px;
  font-size: 1.02rem;
  color: #2f3b4a;
}

.page-head .muted {
  margin-top: 2px;
  font-size: 0.9rem;
}

.footnote {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card > *:not(:first-child) {
  margin-top: 12px;
}

.card__title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions--inline {
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--small {
  padding: 5px 10px;
  font-size: 0.88rem;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn--danger {
  color: var(--bad);
  border-color: #e3b5b1;
}

.btn--danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: var(--bad);
}

.btn.is-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.tag-off {
  padding: 1px 7px;
  border: 1px dashed currentColor;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--primary {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.badge--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge--bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.badge--info {
  background: var(--info-soft);
  color: var(--info);
}

.badge--progress {
  background: var(--progress-soft);
  color: var(--progress);
}

.badge--muted {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.badge--local,
.badge--off {
  background: transparent;
  color: var(--demo);
  box-shadow: inset 0 0 0 1px var(--demo-line);
  border-radius: 6px;
}

.notice {
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 4px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.94rem;
}

.notice--demo,
.notice--off {
  border-left-color: var(--demo-line);
  background: var(--demo-soft);
  color: var(--demo);
}

.notice--big {
  padding: 14px 18px;
  font-size: 1rem;
}

.notice--bad {
  border-left-color: var(--bad);
  background: var(--bad-soft);
  color: #6f1b16;
}

.notice--warn {
  border-left-color: #d08a00;
  background: var(--warn-soft);
  color: #5f3900;
}

.notice--info {
  border-left-color: var(--info);
  background: var(--info-soft);
  color: #123e6e;
}

/* Confirmation : vert, toujours avec son texte. */
.notice--ok {
  border-left-color: var(--ok);
  background: var(--ok-soft);
  color: #0f4a2a;
}

/* Note de lecture : sur fond blanc, sans couleur d'alerte. */
.notice--note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  background: var(--surface);
  color: var(--ink);
}

.notice > * + * {
  margin-top: 6px;
}

.empty {
  padding: 32px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: var(--muted);
}

.empty > *:not(:first-child) {
  margin-top: 10px;
}

.empty__title {
  color: var(--ink);
  font-weight: 650;
  font-size: 1.05rem;
}

.dl {
  display: grid;
  grid-template-columns: minmax(150px, 240px) 1fr;
  gap: 8px 20px;
  margin: 0;
}

.dl dt {
  color: var(--muted);
}

.dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.list {
  margin: 0;
  padding-left: 20px;
}

.list li + li {
  margin-top: 6px;
}

.details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

/* Section secondaire : codes, versions de règles, textes d'origine du moteur. Repliée par défaut. */
.details--tech {
  padding: 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--ink);
  font-size: 0.9rem;
}

.details--tech summary {
  color: var(--muted);
}

.details--tech > *:not(summary),
.details__body > * {
  margin-top: 10px;
}

.tech-line,
.details--tech code,
.details--tech .table td {
  overflow-wrap: anywhere;
}

.plain {
  margin: 0;
  padding-left: 16px;
}

/* Étiquette de nature d'une ligne du score : jamais la couleur seule, toujours un texte. */
.tagline {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
}

.tagline--not_required {
  background: var(--info-soft);
  color: var(--info);
}

.tagline--neutral {
  background: var(--progress-soft);
  color: var(--progress);
}

.tagline--missing {
  background: var(--warn-soft);
  color: var(--warn);
}

.tagline--conflict,
.tagline--penalty,
.tagline--none {
  background: var(--bad-soft);
  color: var(--bad);
}

.legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.93rem;
}

.legend li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.legend li > span:last-child {
  flex: 1 1 260px;
}

/* Portée d'un statut de vérification, placée à côté du badge. */
.scope {
  max-width: 92ch;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid #d08a00;
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.93rem;
}

.page-head .scope {
  margin-top: 10px;
}

.scope > * + * {
  margin-top: 4px;
}

.scope__limit {
  color: #5f3900;
  font-weight: 650;
}

.page-head__main {
  flex: 1 1 520px;
  min-width: 0;
}

.pre {
  margin: 10px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: #f1f4f7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.grid-3 ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* --- tableaux ------------------------------------------------------------------------------------ */

.table-wrap {
  position: relative; /* garde dans la zone de défilement les textes masqués des colonnes */
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card .table-wrap {
  box-shadow: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: #f0f3f7;
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 650;
}

.table tbody th {
  font-weight: 600;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #fafbfc;
}

.col-action {
  text-align: right !important;
  white-space: nowrap;
}

.cell-main {
  font-weight: 600;
}

.cell-sub {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 46ch;
}

/* Nom de la colonne, affiché au-dessus de la valeur quand les lignes deviennent des fiches (petits écrans, plus bas).
   Sans « content », ce pseudo-élément n'existe pas : en mode tableau, rien ne s'affiche. */
.table td[data-label]::before {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Listes principales (tableau de bord, classement) : la première cellule porte le titre de la ligne. */
.table--list tbody th {
  font-weight: 400;
}

.table--list th,
.table--list td {
  overflow-wrap: break-word;
}

.table--list .badge {
  white-space: normal;
}

/* Tableau de bord : largeurs fixées pour que les sept colonnes tiennent sans défilement, actions comprises.
   La colonne « Demande » prend la place restante. */
.table--requests {
  table-layout: fixed;
}

.table--requests thead .c-status {
  width: 160px;
}

.table--requests thead .c-progress {
  width: 118px;
}

.table--requests thead .c-qty {
  width: 100px;
}

.table--requests thead .c-dest {
  width: 190px;
}

.table--requests thead .c-date {
  width: 118px;
}

.table--requests thead .c-action {
  width: 124px;
}

.table--requests .steps-mini {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.table--requests .ref {
  display: inline-block;
  margin-bottom: 2px;
}

.table--ranking .c-points {
  min-width: 220px;
}

/* Sur grand écran, le nom du fournisseur et son statut tiennent chacun sur une ligne. */
@media (min-width: 1240px) {
  .table--ranking .c-name {
    min-width: 250px;
  }

  .table--ranking .badge {
    white-space: nowrap;
  }
}

.ref {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.row-local {
  background: #fffaf0;
}

.row-hover {
  cursor: default;
}

.row-out {
  background: #fbf4f3;
}

/* --- tableau de bord ---------------------------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.tiles--static {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tiles--static {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tile:hover {
  border-color: var(--primary);
}

.tile.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: var(--primary-soft);
}

.tile--static {
  cursor: default;
}

.tile--static:hover {
  border-color: var(--line);
}

.tile__value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.tile__title {
  font-weight: 650;
}

.tile__hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.toolbar .input {
  width: min(320px, 100%);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.steps-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.steps-mini__track {
  display: inline-flex;
  gap: 2px;
}

.steps-mini__dot {
  width: 7px;
  height: 14px;
  border-radius: 2px;
  background: var(--neutral-soft);
}

.steps-mini__dot.is-succeeded {
  background: var(--primary);
}

.steps-mini__dot.is-failed {
  background: var(--bad);
}

.steps-mini__text {
  color: var(--muted);
  font-size: 0.84rem;
}

/* --- formulaire ---------------------------------------------------------------------------------- */

.form > * + * {
  margin-top: 18px;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 14px 20px;
}

.field__head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 4px;
}

.field label {
  font-weight: 600;
}

.field__hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.field__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
}

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.input--area {
  resize: vertical;
  min-height: 110px;
}

.inline {
  display: flex;
  gap: 8px;
}

.inline > * {
  min-width: 0;
}

/* --- demande ------------------------------------------------------------------------------------ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  padding: 9px 16px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.tab--link {
  margin-left: auto;
  color: var(--primary);
}

.tab-panel > * + * {
  margin-top: 18px;
}

.source-text {
  padding: 14px 16px;
  border-radius: 8px;
  background: #f7f9fb;
  font-size: 1.08rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

mark.span {
  padding: 2px 1px;
  border-bottom: 2px solid var(--primary);
  background: var(--primary-soft);
  color: inherit;
  transition: background 0.12s;
}

mark.span--flagged {
  background: var(--warn-soft);
  border-bottom-color: #d08a00;
}

mark.span.is-active {
  background: #ffd76a;
  border-bottom-color: #b37a00;
}

.stepper {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper__item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.stepper__item + .stepper__item::before {
  content: "";
  position: absolute;
  left: 16px;
  top: -10px;
  height: 20px;
  border-left: 2px solid var(--line-strong);
}

.stepper__index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--neutral-soft);
  color: var(--muted);
  font-weight: 700;
  z-index: 1;
}

.stepper__item.is-succeeded .stepper__index {
  background: var(--primary);
  color: var(--primary-ink);
}

.stepper__item.is-failed .stepper__index {
  background: var(--bad);
  color: #fff;
}

.stepper__item.is-not_reached .stepper__title {
  color: var(--muted);
}

.stepper__title {
  font-weight: 600;
}

.stepper__meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 12px;
}

.supplier-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.supplier-card > *:not(:first-child) {
  margin-top: 8px;
}

.supplier-card .dl {
  grid-template-columns: 1fr;
  gap: 2px;
  font-size: 0.9rem;
}

.supplier-card .dl dd {
  margin-bottom: 6px;
}

/* --- résultats ----------------------------------------------------------------------------------- */

.rank {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center !important;
  width: 56px;
}

.score-cell {
  min-width: 150px;
}

.score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
}

.bar__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.bar--hero {
  height: 12px;
}

.score-hero {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.score-hero__value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.score-hero__value span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.weights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weight {
  display: inline-flex;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.dims {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 14px;
}

.dim {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dim__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.dim__points {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dim__list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.92rem;
}

.dim__list li + li {
  margin-top: 5px;
}

.dim__list li.is-missing {
  color: var(--warn);
}

.dim__list li.is-conflict,
.summary__list li.is-conflict {
  color: var(--bad);
  font-weight: 600;
}

/* Synthèse en tête de fiche fournisseur : trois blocs courts avant le détail. */
.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
}

.summary__block > * + * {
  margin-top: 8px;
}

.summary__lead {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary__list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.93rem;
}

.summary__list li + li {
  margin-top: 5px;
}

.summary__list li.is-limit {
  color: #5f3900;
}

@media (max-width: 900px) {
  .summary {
    grid-template-columns: 1fr;
  }
}

/* Les trois cas de la notation, dans « Comment lire ce classement ». */
.cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
}

.case {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.case > * + * {
  margin-top: 6px;
}

.case__example {
  color: var(--muted);
  font-size: 0.88rem;
}

.claim {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}

.claim > *:not(:first-child) {
  margin-top: 10px;
}

.claim summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  cursor: pointer;
}

.claim__title {
  flex: 1 1 260px;
}

.evref {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
}

.evref:hover {
  border-color: var(--primary);
}

tr.is-flash > * {
  background: #ffe9a8 !important;
  transition: background 0.3s;
}

/* --- fenêtre d'explication et message bref ------------------------------------------------------- */

.dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 22px 24px;
  border: 1px solid var(--line-strong);
  border-top: 5px solid var(--demo-line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(22, 32, 44, 0.3);
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(22, 32, 44, 0.45);
}

.dialog > *:not(:first-child) {
  margin-top: 12px;
}

.dialog__mode {
  color: var(--demo);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dialog__backend {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--neutral-soft);
  font-size: 0.92rem;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 30px rgba(22, 32, 44, 0.3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 720px) {
  .main {
    padding: 16px 12px 40px;
  }

  /* Bandeau compact mais toujours visible : le détail reste dans « En savoir plus ». */
  .demo-banner {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .demo-banner span {
    display: none;
  }

  .topbar {
    padding: 10px 12px;
    gap: 6px 12px;
  }

  .org {
    margin-left: auto;
    font-size: 0.8rem;
  }

  .nav {
    order: 3;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .nav a {
    padding: 6px 10px;
    white-space: nowrap;
  }

  .page-head .actions,
  .page-head > .btn {
    width: 100%;
  }

  .dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .dl dd {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.35rem;
  }
}

/* --- petits écrans : les lignes des tableaux deviennent des fiches --------------------------------
   Une seule structure HTML (le tableau, avec ses rôles ARIA) : seule la présentation change. L'en-tête reste
   lisible par les lecteurs d'écran ; le nom de chaque colonne s'affiche au-dessus de sa valeur. La taille du
   texte n'est pas réduite et aucun défilement horizontal n'est nécessaire pour atteindre une action. */

/* Tableau de bord et classement : fiches dès que les colonnes ne tiennent plus côte à côte. */
@media (max-width: 1100px) {
  .table-wrap--list {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .table--list {
    display: block;
  }

  .table--list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table--list tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: 12px;
  }

  .table--list tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 14px;
    align-content: start;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .table--list tbody tr.row-local {
    background: #fffaf0;
  }

  .table--list tbody tr.row-out {
    background: #fbf4f3;
  }

  .table--list tbody th,
  .table--list tbody td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left !important;
  }

  .table--list td[data-label]::before {
    content: attr(data-label);
    content: attr(data-label) / "";
  }

  .table--list .c-main,
  .table--list .c-name,
  .table--list .c-verif,
  .table--list .c-points,
  .table--list .c-date,
  .table--list .c-action {
    grid-column: 1 / -1;
  }

  /* Classement : le nom du fournisseur sert de titre à la fiche. */
  .table--ranking .c-name {
    order: -1;
    font-size: 1.02rem;
  }

  .table--list .c-action {
    align-self: end;
    white-space: normal;
  }

  .table--list .c-action .btn {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
  }

  .table--requests .steps-mini {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
}

/* Autres tableaux (détail d'une demande, contrôles, preuves) : une ligne = un bloc, sans défilement horizontal. */
@media (max-width: 960px) {
  .table-wrap:not(.table-wrap--list) {
    overflow-x: visible;
  }

  .table:not(.table--list),
  .table:not(.table--list) tbody {
    display: block;
  }

  .table:not(.table--list) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table:not(.table--list) tbody tr {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .table:not(.table--list) tbody tr:last-child {
    border-bottom: 0;
  }

  .table:not(.table--list) tbody th,
  .table:not(.table--list) tbody td {
    display: block;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .table:not(.table--list) tbody tr > * + * {
    margin-top: 8px;
  }

  .table:not(.table--list) td[data-label]::before {
    content: attr(data-label);
    content: attr(data-label) / "";
  }

  .evref {
    padding: 4px 10px;
    font-size: 0.9rem;
  }
}

tr.is-flash {
  outline: 3px solid #f0a000;
  outline-offset: -3px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
