/* Fournitek — comptoir de pieces.

   Une coque noire, des surfaces de travail blanches posees dessus. Le jaune
   dit OU TU ES (famille ouverte, filtre actif, etape 1, ligne survolee), le
   rouge dit LA REFERENCE CONSTRUCTEUR et les alertes. Noir + jaune, c'est le
   vocabulaire de l'atelier ; sur le blanc seul, rien ne ressortait.

   Une seule fonte, Archivo, dont l'axe de largeur sert aux titres. Le
   monospace est reserve aux codes et aux prix, qui se comparent chiffre par
   chiffre. */

/* ============================================================
   1. Jetons
   ============================================================ */

:root {
  /* surfaces claires */
  --n0:  #ffffff;
  --n5:  #fbfbfa;
  --n10: #f2f2f0;
  --n20: #e9e9e7;
  --n30: #dedddb;
  --n40: #cbcac8;
  --n50: #a3a3a1;
  --n60: #82827f;
  --n70: #58585a;
  --n80: #333336;
  --ink: #111216;

  /* coque sombre */
  --void:        #0b0c0f;
  --chrome:      #15171c;
  --chrome-up:   #1d1f25;
  --chrome-line: rgba(255, 255, 255, 0.10);
  --chrome-text: #f2f3f5;
  --chrome-soft: #9ea2ab;

  /* signal */
  --yellow:      #ffc803;
  --yellow-deep: #b58c00;
  --yellow-ink:  #7a5f00;
  --yellow-wash: #fff8d9;
  --red:         #e02a1f;
  --red-dark:    #b61f16;
  --red-wash:    #fdeceb;

  /* elevation */
  --e1: 0 1px 2px rgba(17, 18, 22, 0.05);
  --e2: 0 1px 2px rgba(17, 18, 22, 0.05), 0 10px 26px -14px rgba(17, 18, 22, 0.34);
  --e3: 0 2px 5px rgba(17, 18, 22, 0.07), 0 24px 50px -26px rgba(17, 18, 22, 0.55);
  --glow: 0 0 0 1px rgba(255, 200, 3, 0.35), 0 10px 40px -8px rgba(255, 200, 3, 0.35);

  /* rythme */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --pill: 999px;
  --row: 46px;
  --gut: 22px;
  --fast: 0.13s cubic-bezier(0.2, 0.7, 0.2, 1);
  --slow: 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);

  /* grain : donne de la matiere aux surfaces sombres */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

/* ============================================================
   2. Base
   ============================================================ */

* { box-sizing: border-box; }

/* "display" des regles de mise en page prime sur l'attribut hidden : sans
   cela le catalogue s'affiche avant meme qu'un vehicule soit ouvert. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--n10);
  font: 400 15px/1.45 Archivo, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

/* Ecran d'accueil : toute la page passe dans la coque. */
body[data-state="empty"] {
  background:
    radial-gradient(900px 520px at 50% 34%, rgba(255, 200, 3, 0.10), transparent 70%),
    radial-gradient(700px 500px at 50% 36%, rgba(255, 255, 255, 0.05), transparent 72%),
    var(--void);
  color: var(--chrome-text);
}
body[data-state="empty"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.22;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }

::selection { background: var(--yellow); color: var(--ink); }

.sprite { position: absolute; width: 0; height: 0; }

:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

kbd {
  display: inline-block;
  min-width: 19px;
  padding: 2px 5px;
  border: 1px solid var(--n30);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--n0);
  font: 500 11px/1.3 "IBM Plex Mono", monospace;
  color: var(--n70);
  text-align: center;
}
body[data-state="empty"] kbd {
  border-color: var(--chrome-line);
  background: var(--chrome-up);
  color: var(--chrome-soft);
}

.dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  vertical-align: middle;
}

/* ============================================================
   3. Boutons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--n30);
  border-radius: var(--r-sm);
  background: var(--n0);
  color: var(--n80);
  font: 500 14px/1 Archivo, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast),
              box-shadow var(--fast), transform var(--fast);
}
.btn:hover { border-color: var(--n50); color: var(--ink); box-shadow: var(--e1); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Touche jaune : le bouton qui ouvre le vehicule. Bord inferieur fonce, il
   s'enfonce au clic — une touche, pas un rectangle. */
.btn-key {
  height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd42e, var(--yellow));
  color: var(--ink);
  font: 600 15px/1 Archivo, sans-serif;
  font-stretch: 108%;
  box-shadow: 0 3px 0 var(--yellow-deep), 0 10px 24px -12px rgba(255, 200, 3, 0.9);
}
.btn-key:hover { filter: brightness(1.04); color: var(--ink); box-shadow: 0 3px 0 var(--yellow-deep), 0 14px 30px -12px rgba(255, 200, 3, 1); }
.btn-key:active { transform: translateY(3px); box-shadow: 0 0 0 var(--yellow-deep); }

.btn-dark {
  height: 50px;
  padding: 0 24px;
  border-color: var(--ink);
  background: linear-gradient(180deg, #26272d, var(--ink));
  color: var(--n0);
  font-weight: 600;
  font-stretch: 106%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--e2);
}
.btn-dark:hover { color: var(--yellow); border-color: #000; }

.btn-danger {
  border-color: var(--red-dark);
  background: linear-gradient(180deg, #e8392e, var(--red));
  color: var(--n0);
  font-weight: 600;
  font-stretch: 104%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--e1);
}
.btn-danger:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--n0); box-shadow: var(--e2); }

.btn-ghost {
  height: 34px;
  padding: 0 11px;
  border-color: transparent;
  background: transparent;
  color: var(--n70);
  font-size: 13.5px;
}
.btn-ghost:hover { border-color: var(--n30); background: var(--n0); color: var(--ink); }
.btn-icon { width: 34px; padding: 0; }

.btn[disabled] { opacity: 0.4; cursor: default; transform: none; }
.btn[disabled]:hover { filter: none; }

/* ============================================================
   4. Champs
   ============================================================ */

.field { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }

.field-icon {
  position: absolute;
  left: 15px;
  width: 16px;
  height: 16px;
  color: var(--n50);
  pointer-events: none;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--n30);
  border-radius: var(--r-sm);
  background: var(--n0);
  color: var(--ink);
  font: 400 16px/1 Archivo, sans-serif;
  box-shadow: var(--e1);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field input::placeholder { color: var(--n50); }
.field input:focus { outline: none; border-color: var(--n70); box-shadow: var(--e2); }
.field input:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.field-sm { flex: 0 0 176px; }
.field-sm input { height: 34px; padding: 0 12px 0 32px; font-size: 13.5px; box-shadow: none; }
.field-sm .field-icon { left: 10px; width: 14px; height: 14px; }

input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); }

/* ============================================================
   5. Barre d'application
   ============================================================ */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background:
    linear-gradient(180deg, var(--chrome-up), var(--chrome)),
    var(--chrome);
  border-bottom: 2px solid var(--yellow);
  box-shadow: 0 10px 30px -22px rgba(0, 0, 0, 0.9);
  transition: padding var(--slow);
}
.appbar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.16;
}

.appbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  max-width: 1480px;
  margin: 0 auto;
  padding: 13px var(--gut);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #ffd42e, var(--yellow));
  color: var(--ink);
  font: 700 19px/1 Archivo, sans-serif;
  font-stretch: 112%;
  box-shadow: 0 2px 0 var(--yellow-deep), 0 8px 20px -10px rgba(255, 200, 3, 0.8);
}

.brand-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--chrome-text);
  font: 600 15px/1.05 Archivo, sans-serif;
  font-stretch: 112%;
  letter-spacing: -0.018em;
}
.brand-name em {
  font: 400 11px/1 Archivo, sans-serif;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--chrome-soft);
}

.plate-form { display: flex; align-items: center; gap: 12px; }

/* La plaque : point d'entree du produit, et seule piece de bravoure. */
.plate {
  display: flex;
  align-items: stretch;
  height: 50px;
  background: #fff;
  border: 2px solid #0a0b0d;
  border-radius: 7px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25), 0 12px 26px -14px rgba(0, 0, 0, 0.9);
  transition: height var(--slow), box-shadow var(--fast);
}
.plate:focus-within { box-shadow: var(--glow); }

.plate-eu, .plate-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 26px;
  padding-bottom: 5px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #1148cf, #0a3291);
  color: #fff;
  font: 700 12px/1 Archivo, sans-serif;
}
.plate-side { width: 14px; border-radius: 0 4px 4px 0; }

.plate-stars {
  width: 13px;
  height: 13px;
  margin-bottom: 5px;
  border-radius: 50%;
  border: 1.5px dotted var(--yellow);
}

.plate input {
  width: 190px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 25px/1 Archivo, sans-serif;
  font-stretch: 104%;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}
.plate input:focus { outline: none; }
.plate input::placeholder { color: #c6c6c4; font-weight: 600; }

.identity { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.identity-empty { color: var(--chrome-soft); font-size: 14px; }
.identity-empty[data-kind="error"] { color: #ff8a7a; font-weight: 500; }
.identity-name {
  color: var(--chrome-text);
  font: 600 20px/1.1 Archivo, sans-serif;
  font-stretch: 116%;
  letter-spacing: -0.02em;
}
.identity-vin {
  font: 400 12px/1.3 "IBM Plex Mono", monospace;
  color: var(--chrome-soft);
  letter-spacing: 0.03em;
}

/* --- ecran d'accueil : la plaque seule en scene --- */

body[data-state="empty"] .appbar {
  position: static;
  background: none;
  border-bottom: 0;
  box-shadow: none;
}
body[data-state="empty"] .appbar::before { display: none; }
body[data-state="empty"] .appbar-inner {
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  padding: 17vh var(--gut) 4vh;
}
body[data-state="empty"] .brand { flex-direction: column; gap: 16px; text-align: center; }
body[data-state="empty"] .brand-mark { width: 52px; height: 52px; font-size: 27px; border-radius: var(--r-lg); }
body[data-state="empty"] .brand-name { align-items: center; font-size: 19px; }
body[data-state="empty"] .brand-name em { font-size: 12px; }
body[data-state="empty"] .plate { height: 92px; }
body[data-state="empty"] .plate-eu { width: 46px; font-size: 18px; padding-bottom: 10px; }
body[data-state="empty"] .plate-side { width: 26px; }
body[data-state="empty"] .plate-stars { width: 22px; height: 22px; border-width: 2px; }
body[data-state="empty"] .plate input { width: 350px; font-size: 47px; }
body[data-state="empty"] .btn-key { height: 92px; padding: 0 30px; font-size: 17px; border-radius: 10px; }
body[data-state="empty"] .identity-empty { font-size: 16px; text-align: center; }
body[data-state="empty"] .hint-home { position: relative; z-index: 1; text-align: center; color: var(--chrome-soft); }
body[data-state="open"] .hint-home { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .appbar, .plate, .btn, .tile, .chip, .grid tbody tr { transition: none; }
}

/* ============================================================
   6. Attente
   ============================================================ */

.progress { position: relative; height: 2px; margin-bottom: -2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--ink); }
.progress[aria-hidden="false"] span { width: 26%; animation: sweep 1.05s infinite ease-in-out; }

@keyframes sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(440%); }
}

.skeleton td::after {
  content: "";
  display: block;
  height: 10px;
  width: var(--w, 70%);
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--n20), var(--n10), var(--n20));
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.skeleton td.col-price::after { margin-left: auto; }

@keyframes shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

/* Une seule entree orchestree : les lignes arrivent par vagues courtes. */
.grid tbody tr.in { animation: row-in 0.26s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .progress[aria-hidden="false"] span { width: 100%; animation: none; opacity: 0.5; }
  .skeleton td::after { animation: none; }
  .grid tbody tr.in { animation: none; }
}

/* ============================================================
   7. Ossature
   ============================================================ */

.layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px var(--gut) 48px;
}
.layout > * { min-width: 0; max-width: 100%; }

.toolbar { display: flex; flex-direction: column; gap: 8px; }
.part-form { display: flex; gap: 12px; }

.status { min-height: 18px; padding-left: 2px; font-size: 13px; color: var(--n60); }
.status[data-kind="error"] { color: var(--red); font-weight: 500; }

.suggestions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.suggestions p { color: var(--n60); font-size: 13px; }
.suggestions ul { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }

/* ============================================================
   8. Cartes
   ============================================================ */

.card {
  background: var(--n0);
  border: 1px solid var(--n20);
  border-radius: var(--r-lg);
  box-shadow: var(--e2);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--n20);
  background: linear-gradient(180deg, var(--n0), var(--n5));
}

.card-title { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; min-width: 0; }
.card-title h2 { font-size: 18px; font-stretch: 110%; }
.card-tools { display: flex; align-items: center; gap: 10px; }

.badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font: 600 13px/1 "IBM Plex Mono", monospace;
}
.badge svg { width: 15px; height: 15px; }
.badge-neutral { background: var(--n10); color: var(--n60); }
.badge-step {
  background: linear-gradient(180deg, #ffd42e, var(--yellow));
  color: var(--ink);
  box-shadow: 0 2px 0 var(--yellow-deep);
}
.badge-step-2 {
  background: linear-gradient(180deg, #e8392e, var(--red));
  color: var(--n0);
  box-shadow: 0 2px 0 var(--red-dark);
}

.meta { color: var(--n60); font-size: 13px; }
.meta .sep { color: var(--n40); margin: 0 7px; }

.card-oem .card-title h2 { color: var(--red); }

.note {
  display: flex;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--n20);
  border-left: 3px solid var(--yellow);
  background: var(--yellow-wash);
  font-size: 13.5px;
  color: var(--n80);
}
.note[data-kind="warn"] { border-left-color: var(--red); background: var(--red-wash); color: var(--red-dark); }
.note ul { margin: 0; padding-left: 18px; }

.card-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-top: 1px solid var(--n20);
  background: var(--n5);
}

/* ============================================================
   9. Tuiles famille / sous-famille
   ============================================================ */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 10px;
  padding: 16px 18px 18px;
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--n30);
  border-radius: var(--r-md);
  background: var(--n0);
  color: var(--ink);
  font: 500 14px/1.25 Archivo, sans-serif;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast),
              transform var(--fast);
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--yellow);
  transform: scaleY(0);
  transition: transform var(--fast);
}
.tile:hover { border-color: var(--n40); box-shadow: var(--e2); transform: translateY(-1px); }
.tile:hover::before { transform: scaleY(1); }
.tile:active { transform: none; box-shadow: var(--e1); }

.tile-label { flex: 1; min-width: 0; }
.tile-sub {
  display: block;
  margin-top: 3px;
  font: 400 11.5px/1.2 Archivo, sans-serif;
  color: var(--n60);
}

.tile-count {
  flex: none;
  min-width: 25px;
  padding: 3px 7px;
  border-radius: var(--pill);
  background: var(--n10);
  font: 500 11.5px/1.3 "IBM Plex Mono", monospace;
  color: var(--n60);
  text-align: center;
}
.tile:hover .tile-count { background: var(--yellow-wash); color: var(--yellow-ink); }

.tile-chevron {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--n50);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity var(--fast), transform var(--fast);
}
.tile:hover .tile-chevron { opacity: 1; transform: none; }

.tile[aria-current="true"] {
  border-color: var(--yellow-deep);
  background: linear-gradient(180deg, #ffd42e, var(--yellow));
  font-weight: 600;
  box-shadow: 0 2px 0 var(--yellow-deep), var(--e1);
}
.tile[aria-current="true"]::before { transform: scaleY(1); background: var(--ink); }
.tile[aria-current="true"] .tile-count { background: rgba(17, 18, 22, 0.14); color: var(--ink); }
.tile[aria-current="true"] .tile-sub { color: var(--yellow-ink); }

/* ============================================================
   10. Filtres
   ============================================================ */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--n20);
  background: var(--n5);
}
.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 0 13px;
  border: 1px solid var(--n30);
  border-radius: var(--pill);
  background: var(--n0);
  color: var(--n80);
  font: 400 13px/1 Archivo, sans-serif;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast),
              box-shadow var(--fast);
}
.chip:hover { border-color: var(--n50); box-shadow: var(--e1); }

/* un libelle secondaire reste en Archivo ; seuls les nombres et les codes
   passent en chiffres alignes */
.chip b { font: 400 11.5px/1 Archivo, sans-serif; color: var(--n50); }
.chip b.num { font: 500 11.5px/1 "IBM Plex Mono", monospace; }
.chip .code { font: 500 12.5px/1 "IBM Plex Mono", monospace; }

.chip[aria-pressed="true"] {
  border-color: var(--yellow-deep);
  background: linear-gradient(180deg, #ffd42e, var(--yellow));
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 0 var(--yellow-deep);
}
.chip[aria-pressed="true"] b { color: var(--yellow-ink); }
.chip[aria-pressed="true"] .code { color: var(--ink); }

/* Le point rouge marque un equipementier favori (ou partenaire en CLI). */
.chip-partner::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}
.chip-more { border-style: dashed; color: var(--n60); }

.linky {
  border: 0;
  background: transparent;
  padding: 0;
  font: 500 13px/1 Archivo, sans-serif;
  color: var(--n80);
  text-decoration: underline;
  text-decoration-color: var(--yellow-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linky:hover { color: var(--red); text-decoration-color: var(--red); }

/* ============================================================
   11. Tableaux
   ============================================================ */

/* Le tableau defile dans son cadre : 141 references ne doivent pas repousser
   le reste de la page. */
.table-wrap { overflow: auto; max-height: 58vh; scrollbar-width: thin; }
.table-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid var(--n0);
  border-radius: var(--pill);
  background: var(--n40);
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--n50); }

.grid { width: 100%; border-collapse: separate; border-spacing: 0; }

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 40px;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--n30);
  font: 500 11.5px/1 Archivo, sans-serif;
  letter-spacing: 0.02em;
  color: var(--n60);
  text-align: left;
  white-space: nowrap;
}

.grid td {
  height: var(--row);
  padding: 0 15px;
  border-bottom: 1px solid var(--n20);
  vertical-align: middle;
  font-size: 14px;
}
.grid tbody tr:last-child td { border-bottom: 0; }

.grid tbody tr { transition: background var(--fast), box-shadow var(--fast); }
.grid tbody tr:hover { background: var(--yellow-wash); box-shadow: inset 3px 0 0 var(--yellow); }
.card-oem .grid tbody tr:hover { background: var(--red-wash); box-shadow: inset 3px 0 0 var(--red); }

.col-ref { width: 1%; white-space: nowrap; }
.col-sup { width: 1%; white-space: nowrap; }
.col-price { width: 1%; text-align: right; white-space: nowrap; }
.col-pos { width: 1%; text-align: right; white-space: nowrap; }
.col-label { width: 24%; }
.col-desc { color: var(--n60); font-size: 13px; }

.grid td.col-sup { font-weight: 500; font-size: 13.5px; }
.grid td.col-price { font: 500 14.5px/1 "IBM Plex Mono", monospace; color: var(--ink); }
.grid td.col-price.soft { font-weight: 400; font-size: 12.5px; color: var(--n50); }
.grid td.col-pos { font: 400 13px/1 "IBM Plex Mono", monospace; color: var(--n50); }

/* Le prix le plus bas de la liste affichee. */
.price-low {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.price-low::before {
  content: "le plus bas";
  padding: 3px 7px;
  border-radius: var(--pill);
  background: var(--yellow);
  font: 600 10px/1 Archivo, sans-serif;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* La reference se copie d'un clic : le bouton le montre au survol. */
.ref-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: -8px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: 500 13.5px/1 "IBM Plex Mono", monospace;
  color: var(--ink);
  cursor: copy;
  transition: background var(--fast), color var(--fast);
}
.ref-copy svg { width: 13px; height: 13px; opacity: 0; color: var(--n50); transition: opacity var(--fast); }
tr:hover .ref-copy svg { opacity: 1; }
.ref-copy:hover { background: var(--n10); }
.ref-copy[data-copied="true"] { background: var(--yellow); color: var(--ink); box-shadow: 0 2px 0 var(--yellow-deep); }
.ref-copy[data-copied="true"] svg { opacity: 1; color: var(--ink); }

.card-oem .ref-copy { color: var(--red); font-weight: 600; }

tr.dim td { color: var(--n50); }
tr.dim .ref-copy { color: var(--n50); font-weight: 400; }

.truncate {
  display: block;
  max-width: 48ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty { padding: 30px 18px; color: var(--n60); font-size: 14px; text-align: center; }

/* ============================================================
   11 bis. Planche du constructeur
   ============================================================ */

.drawing {
  margin: 0;
  padding: 18px;
  border-top: 1px solid var(--n20);
  background:
    linear-gradient(var(--n10) 1px, transparent 1px) 0 0 / 100% 26px,
    linear-gradient(90deg, var(--n10) 1px, transparent 1px) 0 0 / 26px 100%,
    var(--n5);
}

.drawing-stage {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--n30);
  border-radius: var(--r-md);
  background: var(--n0);
  box-shadow: var(--e2);
  overflow: hidden;
}
.drawing-stage img { display: block; width: 100%; height: auto; }

.drawing-marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Le repere de la piece retenue : un cercle rouge, comme a la main. */
.mark {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgba(224, 42, 31, 0.45));
}
.mark-soft { stroke: var(--yellow); filter: drop-shadow(0 0 5px rgba(255, 200, 3, 0.55)); }

.drawing-caption {
  max-width: 760px;
  margin: 12px auto 0;
  color: var(--n60);
  font-size: 12.5px;
  text-align: center;
}
.drawing-caption b { color: var(--red); font-weight: 600; }

/* La planche a cote du tableau.

   Dessin ferme, rien ne change : le tableau tient toute la carte. Ouvert, les
   deux se partagent la largeur, et le vendeur lit le repere sur le dessin et
   la designation sur la ligne sans faire defiler la page.

   Tout tient dans une seule regle de largeur : sous 1081px, deux colonnes ne
   valent plus rien et la carte retrouve exactement sa mise en page d'avant -
   le dessin sous le tableau, les colonnes a leur largeur naturelle. */
@media (min-width: 1081px) {
  .oem-split.is-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.82fr);
    align-items: start;
  }
  .oem-split.is-split .drawing {
    padding: 14px;
    border-top: 0;
    border-left: 1px solid var(--n20);
  }

  /* La planche garde le rapport exact de son image (`--plate-ratio`, pose par
     app.js depuis les dimensions donnees par le constructeur) : les reperes
     rouges sont des coordonnees du dessin, une image recadree les decalerait.
     Borner la hauteur par la largeur est la seule mise a l'echelle qui les
     laisse en place. */
  .oem-split.is-split .drawing-stage,
  .oem-split.is-split .drawing-caption { max-width: calc(54vh * var(--plate-ratio, 1.4)); }

  /* Sur une demi-carte, les colonnes ne tiennent plus a leur largeur
     naturelle : laissees libres, elles deborderaient du panneau et la remarque
     serait coupee au bord, sans point de suspension. Colonnes fixes : chacune
     prend sa part et ce qui depasse est coupe proprement. La designation garde
     la plus grosse - c'est le nom que le constructeur donne a la piece, et
     celui que le vendeur cherche des yeux. */
  .oem-split.is-split .grid { table-layout: fixed; }
  .oem-split.is-split .col-ref { width: 19%; }
  .oem-split.is-split .col-pos { width: 7%; }
  .oem-split.is-split .col-label { width: 45%; }
  .oem-split.is-split .col-desc { width: 22%; }
  .oem-split.is-split .grid td { overflow: hidden; }
}

/* Un clic sur le dessin lui rend toute la largeur : les reperes d'une planche
   chargee se lisent parfois en petits caracteres. */
.drawing-stage { cursor: zoom-in; }
.drawing.is-wide .drawing-stage,
.drawing.is-wide .drawing-caption { max-width: min(1180px, 100%); }
.drawing.is-wide .drawing-stage { cursor: zoom-out; }

/* ============================================================
   12. Toasts
   ============================================================ */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--chrome-up), var(--chrome));
  color: var(--chrome-text);
  box-shadow: var(--e3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
  animation: rise 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.toast svg { width: 16px; height: 16px; flex: none; color: var(--yellow); }
.toast span { font: 500 13px/1 "IBM Plex Mono", monospace; }
.toast[data-kind="error"] svg { color: #ff8a7a; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ============================================================
   13. Pied
   ============================================================ */

.hint { padding: 2px 2px 0; color: var(--n50); font-size: 12.5px; }

/* ============================================================
   14. Etroit
   ============================================================ */

@media (max-width: 880px) {
  :root { --gut: 14px; }
  .appbar-inner { gap: 14px; }
  .brand-name em { display: none; }
  body[data-state="empty"] .appbar-inner { padding: 10vh var(--gut) 4vh; }
  body[data-state="empty"] .plate { height: 70px; }
  body[data-state="empty"] .plate input { width: 220px; font-size: 33px; }
  body[data-state="empty"] .btn-key { height: 70px; padding: 0 22px; }
  .part-form { flex-wrap: wrap; }
  .card-head { align-items: flex-start; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding: 14px; }
  .truncate { max-width: 28ch; }
  .toasts { left: 14px; right: 14px; bottom: 14px; }
}

/* ============================================================
   Favoris equipementiers
   ============================================================ */

/* Le bouton vit dans la barre d'application : fond sombre, et cale a droite
   plutot qu'etire sur toute la largeur. */
.appbar .btn-ghost {
  border-color: var(--chrome-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--chrome-text);
}
.appbar .btn-ghost:hover { border-color: var(--yellow); background: rgba(255, 255, 255, 0.14); color: var(--n0); }

/* Le panneau est frere du conteneur principal : il porte donc lui-meme la
   gouttiere et la largeur de la mise en page. */

.favs-form { display: flex; gap: 8px; padding: 13px 18px; }

/* Onglet des prix : la meme ligne que la recherche de piece, posee dans une
   carte. Le champ garde de la place - une reference constructeur fait une
   douzaine de caracteres et doit se relire en entier avant d'etre annoncee. */
.lookup-form { display: flex; gap: 10px; padding: 14px 18px; align-items: center; }
.lookup-form .field { flex: 0 1 420px; }
.lookup-form input { text-transform: uppercase; }
/* Les capitales valent pour ce qu'on tape, pas pour l'exemple : un placeholder
   en majuscules se lit comme un cri. */
.lookup-form input::placeholder { text-transform: none; }

/* Le fournisseur ouvre la ligne : « chez qui » est la premiere question quand
   le tableau melange trois portails. */
.grid-lookup th.col-shop, .grid-lookup td.col-shop { width: 1%; white-space: nowrap; }
.grid-lookup td.col-shop { font-weight: 600; font-size: 13.5px; }
/* Ce champ filtre autant qu'il ajoute : son libelle est plus long que celui
   d'une simple saisie, et la marque qu'on tape doit rester lisible en entier. */
.favs-form .field-sm { flex: 0 1 320px; }
/* Un nom trop long est coupe par .truncate ; dans une pastille, plus court. */
.chip .truncate { max-width: 24ch; }
.meta[data-kind="warn"] { color: var(--red-dark); font-weight: 500; }
.chip-fav::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--n40);
}
.chip-fav[aria-pressed="true"]::before { background: var(--red); }

/* Une marque du catalogue livre : proposee, pas encore rencontree sur les
   vehicules de CE vendeur. Le point creux porte la difference sans legende -
   plein = croisee dans une de mes recherches, creux = simple proposition. */
.chip-cat { color: var(--n60); }
.chip-cat::before { background: transparent; box-shadow: inset 0 0 0 1px var(--n40); }
.chip-cat:hover { color: var(--ink); }
/* Dans les tableaux fournisseurs, la marque est tronquee dans un bloc
   (`.truncate`) : un point pose devant lui se retrouve **au-dessus** du nom.
   La cellule lui reserve donc sa place a gauche et il s'y pose par-dessus -
   meme procede que la pastille de reference, et pour la meme raison : un
   `display: flex` sur un `<td>` le sortirait de la mise en page du tableau.
   Les tableaux Precisio, eux, ne tronquent pas cette colonne : le point y
   reste dans le fil du texte, et cette regle-ci ne les touche pas. */
.grid td.col-sup.sup-favori { position: relative; padding-left: 28px; }
.grid td.col-sup.sup-favori .fav-dot {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}
.grid td.col-sup .fav-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}
.note .linky { margin-left: 8px; }


/* ============================================================
   Ecrans d'entree : connexion, comptes, tableau de bord
   ============================================================ */

/* --- porte d'entree : meme coque noire que l'accueil --- */
.gate-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 12vh var(--gut) 6vh;
}
.gate-brand { flex-direction: column; gap: 16px; text-align: center; }
.gate-brand .brand-mark { width: 52px; height: 52px; font-size: 27px; border-radius: var(--r-lg); }
.gate-brand .brand-name { align-items: center; font-size: 19px; }
.gate-brand .brand-name em { font-size: 12px; }

.gate-plate { height: 64px; pointer-events: none; }
.gate-plate .plate-eu { width: 34px; font-size: 15px; padding-bottom: 8px; }
.gate-plate .plate-side { width: 20px; }
.gate-plate-text {
  display: grid;
  place-items: center;
  padding: 0 22px;
  color: var(--ink);
  font: 700 34px/1 Archivo, sans-serif;
  font-stretch: 104%;
  letter-spacing: 0.06em;
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 380px);
  padding: 26px;
  border: 1px solid var(--chrome-line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--chrome-up), var(--chrome));
  box-shadow: var(--e3);
}
.gate-title { margin-bottom: 6px; color: var(--chrome-text); font-size: 20px; font-stretch: 110%; }
.gate-label { margin-top: 8px; color: var(--chrome-soft); font-size: 12.5px; letter-spacing: 0.02em; }
.gate-label.dark { display: flex; flex-direction: column; gap: 6px; color: var(--n70); margin-top: 0; }
.gate-go { width: 100%; margin-top: 18px; }
.gate-error { margin-top: 12px; color: #ff8a7a; font-size: 13.5px; font-weight: 500; }
.gate-hint { color: var(--chrome-soft); font-size: 12.5px; }

.field-plain input { padding-left: 16px; }
.gate .field input { background: var(--void); border-color: var(--chrome-line); color: var(--chrome-text); }
.gate .field input:focus { border-color: var(--yellow); }

/* --- barre : onglets et compte --- */
.tabs { display: flex; align-items: center; gap: 4px; }
.tab {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--chrome-soft);
  font: 500 14px/1 Archivo, sans-serif;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast);
}
.tab:hover:not([disabled]) { color: var(--chrome-text); }
.tab[aria-current="page"] { color: var(--chrome-text); border-bottom-color: var(--yellow); }
.tab[disabled] { opacity: 0.35; cursor: default; }
.userbar { display: flex; align-items: center; gap: 6px; margin-left: auto; }
body[data-state="empty"] .tabs { justify-content: center; }
body[data-state="empty"] .userbar { margin-left: 0; align-self: center; }

.flash-wrap { max-width: 1480px; margin: 0 auto; padding: 0 var(--gut); }
.flash { min-height: 0; padding-top: 12px; font-size: 13.5px; color: var(--n70); }
.flash:empty { display: none; }
.flash[data-kind="error"] { color: var(--red); font-weight: 500; }

/* actions proposees sous un message d'echec */
.actions { display: block; }
.actions:empty { display: none; }
.actions-row { display: inline-flex; gap: 8px; margin-top: 8px; margin-left: 8px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.actions-row .btn-ghost, .flash .btn-ghost { border-color: var(--n40); background: var(--n0); color: var(--ink); }
body[data-state="empty"] .actions-row .btn-ghost { border-color: var(--chrome-line); background: rgba(255, 255, 255, 0.08); color: var(--chrome-text); }
body[data-state="empty"] .actions-row { justify-content: center; margin-left: 0; display: flex; }

/* --- cartes de saisie --- */
.cred-form, .admin-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 18px; }
.cred-form .gate-label { flex: 1 1 220px; }
.cred-form .btn { height: 42px; }
.form-msg { flex: 1 0 100%; min-height: 18px; font-size: 13.5px; color: var(--n60); }
.form-msg[data-kind="error"] { color: var(--red); font-weight: 500; }
.form-msg[data-kind="ok"] { color: #1c7c3a; font-weight: 500; }
.admin-form .field { flex: 1 1 220px; }
.admin-form .field input { height: 42px; }
select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--n30);
  border-radius: var(--r-sm);
  background: var(--n0);
  color: var(--ink);
  font: 400 14px/1 Archivo, sans-serif;
}

.secret { padding: 16px 18px; border-top: 1px solid var(--n20); background: var(--yellow-wash); }
.secret-title { font-weight: 600; font-size: 13.5px; }
.secret-line { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.secret code { font: 600 22px/1 "IBM Plex Mono", monospace; letter-spacing: 0.04em; user-select: all; }
.secret-warn { color: var(--red-dark); font-size: 13px; }

.col-actions { text-align: right; white-space: nowrap; }
.grid td.col-actions { text-align: right; }
.col-num { text-align: right; width: 1%; white-space: nowrap; }
.grid td.col-num { font: 500 14px/1 "IBM Plex Mono", monospace; text-align: right; }
.grid tr.total td { font-weight: 600; background: var(--n5); }
.mono { font: 400 13px/1 "IBM Plex Mono", monospace; white-space: nowrap; }

/* --- tableau de bord --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; border-right: 1px solid var(--n20); }
.stat:last-child { border-right: 0; }
.stat-value { font: 600 34px/1 "IBM Plex Mono", monospace; color: var(--ink); }
.stat-label { color: var(--n60); font-size: 13px; }
.stat-sub { color: var(--n50); font-size: 12px; }

.pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: var(--pill);
  background: var(--n10);
  color: var(--n70);
  font: 500 12px/1 Archivo, sans-serif;
}
.pill[data-status="resolved"] { background: var(--yellow); color: var(--ink); }
.pill[data-status="needs-oem"] { background: var(--red-wash); color: var(--red-dark); }
.hist-row { cursor: pointer; }
.hist-detail td { padding: 0; height: auto; background: var(--n5); }
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; padding: 16px 18px; }
.detail-block h3 { margin-bottom: 8px; font-size: 13px; color: var(--n70); }
.detail-block .note { margin-bottom: 10px; border: 0; border-left: 3px solid var(--yellow); }
.detail-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-refs code { padding: 4px 8px; border-radius: 4px; background: var(--n0); border: 1px solid var(--n20); font: 500 12.5px/1 "IBM Plex Mono", monospace; }
.empty-note { padding: 28px; text-align: center; color: var(--n60); }
#account-welcome { border: 1px solid var(--n20); border-left: 3px solid var(--yellow); border-radius: var(--r-md); }
.meta[data-kind="warn"] { color: var(--red-dark); }

@media (max-width: 880px) {
  .tabs { order: 5; flex: 1 0 100%; overflow-x: auto; }
  .userbar { margin-left: auto; }
  .gate-plate-text { font-size: 26px; padding: 0 14px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--n20); }
}

/* Telephone. Le palier de 880 px suffit a une tablette - un iPad en portrait
   tient tout - mais pas a un telephone : la page sortait de 27 px sur un
   ecran de 390 et de 57 px sur un de 360, ce qui donne un glissement lateral
   de toute l'interface. Deux rangees en etaient responsables, et elles ont
   chacune leur raison.

   Mesure, pas coup d'oeil : `scrollWidth` contre `clientWidth`, a 360 et a
   390, avant et apres. */
@media (max-width: 480px) {
  /* La plaque et son bouton tenaient sur une ligne de 403 px. On ne retrecit
     pas la plaque davantage - c'est elle qu'on tape au comptoir, et elle est
     deja a 220 px - donc le bouton passe dessous. */
  .plate-form { flex-wrap: wrap; justify-content: center; }
  /* La plaque garde sa taille propre et se centre. Lui donner la largeur de
     la ligne (`width: 100%`) la faisait au contraire ressortir de l'ecran :
     sa largeur se calculait alors sur un parent qui se dimensionne lui-meme
     sur son contenu. Mesure a l'appui, dans les deux sens. */
  .plate { max-width: 100%; }
  body[data-state="empty"] .plate input { width: min(100%, 220px); }

  /* La rangee d'onglets defile deja (`overflow-x: auto` au-dessus), mais un
     element flex garde par defaut la largeur de son contenu : il poussait la
     page au lieu de defiler. `min-width: 0` lui rend le droit de retrecir. */
  .tabs { min-width: 0; max-width: 100%; }

  /* Les raccourcis clavier n'ont pas de clavier a annoncer sur un telephone,
     et cette ligne-la etait la plus longue de l'ecran. */
  .hint { display: none; }
}

.grid th.col-actions, .grid th.col-num { text-align: right; }

#cred-cards { display: flex; flex-direction: column; gap: 18px; }
#account-locked { border: 1px solid var(--n20); border-left: 3px solid var(--red); border-radius: var(--r-md); }
.tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.top-col { padding: 16px 22px; border-right: 1px solid var(--n20); }
.top-col:last-child { border-right: 0; }
.top-col h3 { margin-bottom: 10px; font-size: 13px; color: var(--n70); }
.rank { margin: 0; padding: 0; list-style: none; counter-reset: rang; }
.rank-row, .rank-empty { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--n20); font-size: 14px; }
.rank-row:last-child { border-bottom: 0; }
.rank-row::before { counter-increment: rang; content: counter(rang); width: 18px; color: var(--n50); font: 500 12px/1 "IBM Plex Mono", monospace; }
.rank-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rank-count { font: 600 14px/1 "IBM Plex Mono", monospace; }
.rank-empty { color: var(--n60); border-bottom: 0; }
[aria-pressed="true"].btn-sm { background: var(--yellow); border-color: var(--yellow-deep); color: var(--ink); }
@media (max-width: 880px) { .top-col { border-right: 0; border-bottom: 1px solid var(--n20); } }

.pill-temp { margin-left: 6px; }

/* --- Etape 4 : prix et disponibilite chez le fournisseur -------------------
   Rien de neuf dans le vocabulaire visuel : memes cartes, meme tableau, memes
   boutons que les trois etapes d'avant. Le seul ecart est le badge, sombre la
   ou les autres sont jaune et rouge - il faut bien distinguer quatre etapes.
   Le gros chiffre de la carte est le prix client : c'est celui que le vendeur
   lit a voix haute au telephone, tout le reste l'explique. */

.badge-step-4 {
  background: linear-gradient(180deg, var(--n80), var(--ink));
  color: var(--n0);
  box-shadow: 0 2px 0 #000;
}

/* La case de remise vit dans l'entete de la carte : c'est le seul chiffre que
   le vendeur tape, il doit rester sous les yeux pendant qu'il lit le tableau. */
.shop-rate {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 13px/1 Archivo, sans-serif;
  color: var(--n70);
  white-space: nowrap;
}
.shop-rate-field { position: relative; flex: 0 0 auto; }
.shop-rate-field input {
  width: 98px;
  height: 38px;
  padding: 0 30px 0 12px;
  font: 600 16px/1 "IBM Plex Mono", monospace;
  text-align: right;
  box-shadow: none;
}
/* Les fleches du champ numerique se superposeraient au « % » : le vendeur tape
   son chiffre, il ne l'incremente pas un par un. */
.shop-rate-field input { appearance: textfield; -moz-appearance: textfield; }
.shop-rate-field input::-webkit-outer-spin-button,
.shop-rate-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.shop-rate-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font: 500 14px/1 "IBM Plex Mono", monospace;
  color: var(--n50);
  pointer-events: none;
}

/* Le bouton de fin de ligne, dans le tableau des equivalences. */
.grid th.col-go, .grid td.col-go { width: 1%; padding-left: 6px; text-align: right; }
.shop-go { white-space: nowrap; }

/* Deux chiffres empiles : le montant, et sous lui ce qui l'explique. */
.grid td .amount { display: block; font: 500 14.5px/1.15 "IBM Plex Mono", monospace; color: var(--ink); }
.grid td .amount-sub { display: block; margin-top: 3px; font-size: 11.5px; color: var(--n50); }

/* Les colonnes de chiffres ne se coupent pas : « 132.60 TTC » sur deux lignes
   se lit mal, et « remise 60 % » coupee se lit faux. La designation, elle, se
   laisse tronquer - c'est un libelle, pas un montant. */
.grid-shop td.col-tarif, .grid-shop td.col-achat,
.grid-shop td.col-client, .grid-shop td.col-marge,
.grid-shop th.col-tarif, .grid-shop th.col-achat,
.grid-shop th.col-client, .grid-shop th.col-marge { white-space: nowrap; }
#shop-table .col-desc .truncate { max-width: 26ch; }
#lookup-table .col-desc .truncate { max-width: 20ch; }

/* Chaque fournisseur a son vocabulaire de dispo, et ils n'ont pas la meme
   longueur : « En agence » tient en un mot, « Lundi 16/11/26 apres-midi » est
   une date de livraison. On la laisse passer a la ligne plutot que de la
   couper - une date tronquee ne vaut rien - et la colonne cesse de pousser
   « Ma marge » hors du tableau. */
.grid-shop td.col-dispo .dispo { white-space: normal; max-width: 15ch; }

.grid-shop td { height: auto; padding-top: 9px; padding-bottom: 9px; }
.grid-shop td.col-client .amount { font-size: 17px; font-weight: 600; }
.grid-shop td.col-marge .amount { color: #1c7c3a; }
.grid-shop td.col-marge[data-kind="error"] .amount { color: var(--red); }
.grid-shop td.col-marge[data-kind="error"] .amount-sub { color: var(--red); }
.grid-shop tbody tr.dim { background: var(--n5); }
.grid-shop tbody tr.dim .amount { color: var(--n60); }

/* Celle qu'on a demandee, et celles que le fournisseur propose a la place.
   Pas un troisieme feu tricolore : la colonne dispo tient deja le vert, le
   bleu et le gris, et le jaune est aux filtres. C'est une hierarchie - la
   bonne reference est pleine, l'equivalence est un contour. */
.ref-tag {
  display: inline-block;
  margin: 3px 0 0;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 10px/1.5 Archivo, sans-serif;
  letter-spacing: 0.01em;
  /* « exacte » et « equivalence » n'ont pas la meme longueur, mais la meme
     fonction : deux boites de tailles differentes se lisent comme deux
     choses differentes. Le mot le plus long fixe la largeur des deux. */
  min-width: 86px;
  text-align: center;
}
.ref-exacte { background: var(--ink); color: var(--n0); }
.ref-equiv { color: var(--n60); border-color: var(--n30); }

/* Collee au texte, la pastille se decale a chaque longueur de reference -
   et encore au survol, quand le bouton de copie apparait. On lui reserve
   donc une place fixe au bord droit de la cellule : une seule verticale a
   parcourir des yeux.

   La premiere version mettait `display: flex` sur le `<td>` lui-meme. Un
   `<td>` en flex **n'est plus une cellule de tableau** : il sort de la mise
   en page, son `width: 1%` cesse de vouloir dire « la colonne se serre sur
   son contenu » pour devenir 1% de la table, et le `border-bottom` de
   `.grid td` se dessine sous la boite retrecie - c'est le petit trait qui
   apparaissait sous chaque reference. La cellule reste donc une cellule,
   et la pastille se place par-dessus.

   La reserve a droite vaut la pastille (86) plus l'ecart au texte (12) plus
   le padding de la cellule (15) : rien ne peut se chevaucher, et comme une
   colonne de tableau a la meme largeur sur toutes ses lignes, les pastilles
   tombent sur la meme verticale. Seules les cellules qui en portent une
   changent ; les tableaux OEM et planches gardent leur mise en page. */
.col-ref.ref-marquee { position: relative; padding-right: 113px; }
.ref-marquee .ref-tag {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

/* La pastille reprend le mot du fournisseur, pas une couleur devinee :
   « En agence » et « En agence virtuelle » ne s'annoncent pas pareil. */
.dispo {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font: 500 11.5px/1.35 Archivo, sans-serif;
  white-space: nowrap;
}
.dispo-ok { background: #e6f4ea; color: #15632e; }
/* Disponible, mais pas depuis le depot qui sert ce compte : plateforme,
   groupe, fournisseur. Les portails la distinguent de leur stock, l'ecran
   aussi - sinon le vendeur annonce « demain » sur une piece qui vient
   d'ailleurs. */
.dispo-loin { background: #e8f0fe; color: #1a4b8c; }
.dispo-ko { background: var(--n10); color: var(--n60); }
/* Ni le vert du rayon, ni le gris du refus : ils l'ont, il faut les appeler.
   Le meme orange que leur propre pastille. */
.dispo-demande { background: #fdf0e0; color: #8a4b00; }

/* « D'ou ca part ? » : un lien discret sous la pastille, et la liste qu'il
   ouvre. Le vendeur ne le voit que sur ce qui ne sort pas de son rayon -
   ailleurs la ligne dit deja tout, et un bouton de plus serait du bruit. */
.lien-dispo {
  display: block;
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: #1a4b8c;
  font: 500 11px/1.4 Archivo, sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.lien-dispo:hover { color: #0f3568; }
.lien-dispo[disabled] { color: var(--n60); cursor: default; text-decoration: none; }

.sources { margin: 4px 0 0; padding: 0; list-style: none; }
/* Une pastille verte ou rouge par agence. Sans elle, la liste alignait des
   noms d'agences en gris identique : impossible de voir laquelle a la piece,
   d'autant que leur fenetre n'ecrit un etat que sur celles qui ne l'ont pas.
   Le nom, lui, reste lisible des deux cotes - c'est l'agence que le vendeur
   cherche, qu'elle serve ou non. */
.source {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  font: 400 11px/1.35 Archivo, sans-serif;
  color: var(--n80);
  padding: 3px 0 3px 15px;
}
.source::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1e8e3e;
}
.source-ko::before { background: var(--red); }
/* Le message qui remplace la liste quand ils ne repondent rien : une phrase,
   pas une agence - une pastille rouge dirait « celle-la n'a pas la piece ». */
.source-muette { padding-left: 0; color: var(--n60); }
.source-muette::before { display: none; }
.source + .source { border-top: 1px solid var(--n10); }
.source-nom { font-weight: 600; }
/* Le stock au bord droit, sur la ligne du nom : une seule verticale de
   chiffres a parcourir, meme quand les noms d'agences n'ont pas la meme
   longueur. L'etat reste force en premiere colonne, sinon il remonterait a
   la place du chiffre sur les agences qui n'en ont pas. */
.source-stock { font-weight: 700; text-align: right; }
.source-etat { grid-column: 1; color: #15632e; }
.source-ko .source-etat { color: var(--red-dark); }

/* La bascule vers ce que le fournisseur propose a la place. */
.grid-shop td.shop-split {
  height: 34px;
  background: var(--n10);
  font: 500 11.5px/1 Archivo, sans-serif;
  letter-spacing: 0.02em;
  color: var(--n60);
  text-transform: none;
}
.grid-shop tbody tr.shop-split-row:hover { background: var(--n10); box-shadow: none; }

/* Note d'une carte d'identifiants facultative. Toute la largeur : le
   formulaire est une rangee souple, et une note laissee en element de rangee
   pousserait les champs les uns sous les autres. */
.cred-form .cred-hint {
  flex: 1 0 100%;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--n60);
}

/* Entete de colonne presente pour les lecteurs d'ecran, invisible a l'oeil. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* La colonne du bouton prend sa place sur la description, qui est la seule a
   pouvoir en ceder : un bouton qu'il faut aller chercher en faisant defiler le
   tableau ne sert a rien au comptoir. Le texte complet reste au survol. */
#equiv-table .col-desc .truncate { max-width: 30ch; }
