/* Feuille de style de la console.

   Servie par l'application : le serveur du dépôt n'a pas d'accès Internet, et
   une console qui ne s'affiche qu'avec un CDN tombe le jour où on en a besoin.
   Seule la police de marque vient de l'extérieur, et elle est facultative.

   Parti pris d'affichage : l'identité du portail client DockAvenue — dégradé
   bleu ardoise, cartes arrondies, typographie douce — sans rien céder sur la
   lisibilité. Les statuts gardent un contraste franc dans les deux thèmes :
   cet écran est aussi lu debout, à côté d'un rucher.

   Thèmes : clair par défaut, sombre selon le système, et forçage manuel par
   `data-theme` sur la racine (choix mémorisé par le sélecteur de la barre). */

/* ----------------------------------------------------------------- jetons --- */
:root {
  --police: "Nunito Sans", "Mulish", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --police-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --fond: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --trait: #e2e8f0;
  --trait-doux: #edf1f6;
  --encre: #111827;
  --encre-2: #1f2937;
  --encre-douce: #4b5563;
  --encre-pale: #8593aa;

  --accent: #3d5277;
  --accent-vif: #4d6286;
  --accent-fond: #eaf0f8;
  --accent-bord: #cbd6e8;
  --focus: rgba(77, 98, 134, 0.28);

  --primaire-a: #4d6286;
  --primaire-b: #2e4260;
  --primaire-ombre: 0 8px 18px -8px rgba(46, 66, 96, 0.6);
  --heros-a: #2b3d55;
  --heros-b: #6b83a8;
  --barre-a: #2b3d55;
  --barre-b: #5d7499;

  --ok: #15803d;      --ok-fond: #e8f6ed;      --ok-bord: #bfe3cc;
  --attn: #a15c07;    --attn-fond: #fdf3e1;    --attn-bord: #f3d7a6;
  --ko: #b42318;      --ko-fond: #fdeceb;      --ko-bord: #f4c3bf;
  --info: #3d5277;    --info-fond: #eaf0f8;    --info-bord: #cbd6e8;
  --neutre: #5b6474;  --neutre-fond: #f1f4f8;  --neutre-bord: #dfe5ee;
  --ko-ligne: #fff6f5;

  --ombre: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px -14px rgba(30, 45, 70, 0.16);
  --ombre-forte: 0 2px 6px rgba(16, 24, 40, 0.05), 0 30px 60px -24px rgba(30, 45, 70, 0.3);
  --rayon: 20px;
  --rayon-moyen: 14px;
  --rayon-champ: 12px;

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #111823;
    --surface: #1a2332;
    --surface-2: #212c3e;
    --surface-3: #26334a;
    --trait: #2c3a50;
    --trait-doux: #243146;
    --encre: #e6ecf5;
    --encre-2: #d3dbe8;
    --encre-douce: #97a6bc;
    --encre-pale: #6f7f97;
    --accent: #86a0cb;
    --accent-vif: #9bb3da;
    --accent-fond: rgba(134, 160, 203, 0.14);
    --accent-bord: rgba(134, 160, 203, 0.32);
    --focus: rgba(134, 160, 203, 0.35);
    --primaire-ombre: 0 8px 20px -8px rgba(0, 0, 0, 0.7);
    --barre-a: #1b2940;
    --barre-b: #3a4f71;
    --heros-a: #22334b;
    --heros-b: #4f668c;
    --ok: #6fd69a;      --ok-fond: rgba(52, 168, 103, 0.14);   --ok-bord: rgba(111, 214, 154, 0.3);
    --attn: #f2c46b;    --attn-fond: rgba(242, 176, 64, 0.13); --attn-bord: rgba(242, 196, 107, 0.3);
    --ko: #ff9b94;      --ko-fond: rgba(240, 82, 72, 0.14);    --ko-bord: rgba(255, 155, 148, 0.32);
    --info: #a9c0e6;    --info-fond: rgba(134, 160, 203, 0.15); --info-bord: rgba(169, 192, 230, 0.3);
    --neutre: #a9b6c9;  --neutre-fond: rgba(151, 166, 188, 0.12); --neutre-bord: rgba(151, 166, 188, 0.26);
    --ko-ligne: rgba(240, 82, 72, 0.07);
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.65);
    --ombre-forte: 0 2px 6px rgba(0, 0, 0, 0.35), 0 34px 70px -28px rgba(0, 0, 0, 0.8);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397a6bc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fond: #111823;
  --surface: #1a2332;
  --surface-2: #212c3e;
  --surface-3: #26334a;
  --trait: #2c3a50;
  --trait-doux: #243146;
  --encre: #e6ecf5;
  --encre-2: #d3dbe8;
  --encre-douce: #97a6bc;
  --encre-pale: #6f7f97;
  --accent: #86a0cb;
  --accent-vif: #9bb3da;
  --accent-fond: rgba(134, 160, 203, 0.14);
  --accent-bord: rgba(134, 160, 203, 0.32);
  --focus: rgba(134, 160, 203, 0.35);
  --primaire-ombre: 0 8px 20px -8px rgba(0, 0, 0, 0.7);
  --barre-a: #1b2940;
  --barre-b: #3a4f71;
  --heros-a: #22334b;
  --heros-b: #4f668c;
  --ok: #6fd69a;      --ok-fond: rgba(52, 168, 103, 0.14);   --ok-bord: rgba(111, 214, 154, 0.3);
  --attn: #f2c46b;    --attn-fond: rgba(242, 176, 64, 0.13); --attn-bord: rgba(242, 196, 107, 0.3);
  --ko: #ff9b94;      --ko-fond: rgba(240, 82, 72, 0.14);    --ko-bord: rgba(255, 155, 148, 0.32);
  --info: #a9c0e6;    --info-fond: rgba(134, 160, 203, 0.15); --info-bord: rgba(169, 192, 230, 0.3);
  --neutre: #a9b6c9;  --neutre-fond: rgba(151, 166, 188, 0.12); --neutre-bord: rgba(151, 166, 188, 0.26);
  --ko-ligne: rgba(240, 82, 72, 0.07);
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.65);
  --ombre-forte: 0 2px 6px rgba(0, 0, 0, 0.35), 0 34px 70px -28px rgba(0, 0, 0, 0.8);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397a6bc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ------------------------------------------------------------------ socle --- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 15px/1.55 var(--police);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-vif); }

h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.015em; margin: 0; color: var(--encre); }
h2 { font-size: 1.08rem; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--encre); letter-spacing: -0.005em; }
p { margin: 0 0 0.75rem; }
strong { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--trait); margin: 1.5rem 0 1rem; }

.icone {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* -------------------------------------------------------------- mise en page --- */
body.avec-barre {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

main {
  padding: 2rem clamp(1rem, 3vw, 2.75rem) 3rem;
  width: 100%;
  max-width: 1400px;
  min-width: 0;
}

.entete-page { margin-bottom: 1.5rem; }
.surtitre, .marque-legende {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--encre-pale);
}

/* ------------------------------------------------------------- navigation --- */
.barre {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem 1.25rem;
  overflow: hidden auto;
  color: #fff;
  background: linear-gradient(160deg, var(--barre-a) 0%, var(--barre-b) 100%);
  isolation: isolate;
}
/* Les carrés arrondis du portail, en filigrane. */
.barre::before, .barre::after,
.connexion-heros::before, .connexion-heros::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 34px;
  pointer-events: none;
}
.barre::before { width: 220px; height: 220px; right: -90px; bottom: 70px; transform: rotate(18deg); }
.barre::after { width: 150px; height: 150px; left: -70px; bottom: -40px; transform: rotate(-12deg); background: rgba(255, 255, 255, 0.03); }

.marque { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.25rem 0.75rem; color: #fff; text-decoration: none; }
.marque:hover { color: #fff; }
.marque-nom { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.marque-produit { font-size: 0.78rem; font-weight: 600; color: rgba(255, 255, 255, 0.66); }

.barre nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.barre nav a, .barre .sortie {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.58rem 0.75rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.barre nav a:hover, .barre .sortie:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.barre nav a.actif {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 16px -10px rgba(0, 0, 0, 0.5);
}
.barre nav a.actif .icone { stroke-width: 2.1; }

.barre-pied { display: flex; flex-direction: column; gap: 0.6rem; }
.barre .marque-legende { color: rgba(255, 255, 255, 0.45); padding: 0.25rem 0.75rem 0; margin: 0; }

/* Compte connecté : qui agit, avec quel rôle. */
.compte {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.compte-nom { font-weight: 700; font-size: 0.9rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compte-role { font-size: 0.74rem; font-weight: 600; color: rgba(255, 255, 255, 0.62); }

/* Sélecteur de thème : invisible script coupé, il ne servirait à rien. */
.theme { display: none; }
.js .theme {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.theme button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.38rem 0.3rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: 600 0.76rem/1 var(--police);
  box-shadow: none;
  cursor: pointer;
}
.theme button .icone { width: 15px; height: 15px; }
.theme button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.theme button[aria-pressed="true"] { color: var(--primaire-b); background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }

/* ------------------------------------------------------------------ blocs --- */
.carte {
  background: var(--surface);
  border: 1px solid var(--trait-doux);
  border-radius: var(--rayon);
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--ombre);
}
.carte > h2:first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }

/* Un paragraphe-carte est un avis : fonction éteinte, ERP muet, résultat
   d'une action. Il se distingue d'une carte de contenu par sa teinte. */
p.carte {
  padding: 0.9rem 1.1rem;
  border-radius: var(--rayon-moyen);
  background: var(--info-fond);
  border-color: var(--info-bord);
  color: var(--encre-2);
  box-shadow: none;
}
p.carte.avis-erreur { background: var(--ko-fond); border-color: var(--ko-bord); }
p.carte.avis-erreur > strong:first-child { color: var(--ko); }

.grille { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 1.25rem; }
.grille > .carte { margin-bottom: 0; }
.carte p.valeur { font-weight: 800; color: var(--encre); margin: 0.4rem 0 0.5rem; letter-spacing: -0.02em; }

/* Compteurs du rucher : le chiffre doit se lire de loin. */
.compteurs { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.compteur {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--trait-doux);
  border-radius: 16px;
  padding: 0.9rem 1rem 0.85rem;
  box-shadow: var(--ombre);
  overflow: hidden;
}
.compteur::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--ton, var(--accent-vif));
  opacity: 0.85;
}
.compteur .valeur { font-size: 1.9rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; color: var(--encre); }
.compteur .cle { color: var(--encre-pale); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

/* --------------------------------------------------------------- tableaux --- */
/* Un tableau nu est sa propre carte ; enveloppé dans `.tableau`, c'est
   l'enveloppe qui porte la carte et fait défiler les colonnes en largeur
   réduite, sans jamais élargir la page. */
.tableau {
  background: var(--surface);
  border: 1px solid var(--trait-doux);
  border-radius: var(--rayon-moyen);
  box-shadow: var(--ombre);
  overflow-x: auto;
  margin-bottom: 1rem;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--trait-doux);
  border-radius: var(--rayon-moyen);
  box-shadow: var(--ombre);
  overflow: hidden;
  margin-bottom: 1rem;
}
.tableau > table, .carte table, .groupe-parametres table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  background: transparent;
}
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--trait-doux); vertical-align: middle; }
th {
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--encre-pale);
  white-space: nowrap;
  border-bottom-color: var(--trait);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.12s; }
tbody tr:hover td { background: var(--surface-2); }
.carte td { padding: 0.5rem 0.25rem; }
.carte td:first-child:not(.mono) { color: var(--encre-douce); }
.carte table { margin-bottom: 0.9rem; }
.carte td.mono { word-break: break-all; }
td form { margin: 0; }
td .ligne-formulaire { gap: 0.35rem 0.5rem; }
td .case { margin: 0 0.6rem 0 0; }
td button { min-height: 2.15rem; padding: 0.42rem 0.85rem; font-size: 0.84rem; border-radius: 10px; }
.tableau td.mono { white-space: nowrap; }
td.mono .note { font-family: var(--police); font-size: 0.8rem; white-space: nowrap; }
.carte tbody tr:hover td { background: transparent; }

.vide {
  color: var(--encre-douce);
  font-style: normal;
  padding: 1rem 1.2rem;
  border: 1.5px dashed var(--trait);
  border-radius: var(--rayon-moyen);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.carte .vide { border: 0; padding: 0.25rem 0; background: none; }

/* Le casier incomplet doit sauter aux yeux : c'est une commande arrêtée. */
tr.incomplet td, tbody tr.incomplet:hover td { background: var(--ko-ligne); }
tr.incomplet td:first-child { box-shadow: inset 3px 0 0 var(--ko); }

/* ---------------------------------------------------------------- statuts --- */
.etiquette {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.16rem 0.6rem 0.16rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--ton, var(--info));
  background: var(--ton-fond, var(--info-fond));
  border: 1px solid var(--ton-bord, var(--info-bord));
}
.etiquette::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.s-libre { --ton: var(--neutre); --ton-fond: var(--neutre-fond); --ton-bord: var(--neutre-bord); }
.s-affecte { --ton: var(--info); --ton-fond: var(--info-fond); --ton-bord: var(--info-bord); }
.s-en_cours_eclatement, .s-en_emballage { --ton: var(--attn); --ton-fond: var(--attn-fond); --ton-bord: var(--attn-bord); }
.s-pret, .s-termine { --ton: var(--ok); --ton-fond: var(--ok-fond); --ton-bord: var(--ok-bord); }
.s-incomplet, .s-bloque { --ton: var(--ko); --ton-fond: var(--ko-fond); --ton-bord: var(--ko-bord); }

/* ------------------------------------------------------------ formulaires --- */
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit;
  color: var(--encre);
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-champ);
  background: var(--surface-2);
  max-width: 100%;
  min-height: 2.5rem;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
textarea { line-height: 1.45; resize: vertical; }
select {
  appearance: none;
  padding-right: 2.2rem;
  background: var(--surface-2) var(--chevron) no-repeat right 0.7rem center / 16px;
  cursor: pointer;
}
input::placeholder, textarea::placeholder { color: var(--encre-pale); }
input[type=text]:hover, input[type=password]:hover, input[type=number]:hover, input[type=date]:hover, select:hover, textarea:hover { border-color: var(--accent-bord); }
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, input[type=date]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-vif);
  background-color: var(--surface);
  box-shadow: 0 0 0 4px var(--focus);
}
input[type=checkbox] { accent-color: var(--accent-vif); width: 1rem; height: 1rem; }
input[type=file] { font: inherit; color: var(--encre-douce); max-width: 100%; }
input[type=file]::file-selector-button {
  font: 600 0.88rem var(--police);
  margin-right: 0.7rem;
  padding: 0.66rem 0.95rem;
  border: 1px solid var(--trait);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--encre-2);
  cursor: pointer;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: 700 0.9rem/1.2 var(--police);
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-champ);
  background: var(--surface);
  color: var(--encre-2);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, filter 0.15s;
  white-space: nowrap;
}
button:hover { background: var(--surface-3); border-color: var(--accent-bord); }
button:active { transform: translateY(1px); }
button.principal {
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--primaire-a) 0%, var(--primaire-b) 100%);
  box-shadow: var(--primaire-ombre), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
button.principal:hover { filter: brightness(1.1); transform: translateY(-1px); }
button.principal:active { transform: translateY(0); }
button.danger { color: var(--ko); border-color: var(--ko-bord); background: var(--surface); }
button.danger:hover { background: var(--ko-fond); border-color: var(--ko); }

.ligne-formulaire { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
label { display: block; font-size: 0.84rem; font-weight: 600; color: var(--encre-douce); margin-bottom: 0.35rem; }
label > input[type=text], label > input[type=number] { display: block; margin-top: 0.35rem; }
.ligne-formulaire > div > input[type=checkbox] { display: block; width: 1.25rem; height: 1.25rem; margin: 0.75rem 0; }
.ligne-formulaire > div > .case { min-height: 2.5rem; margin-bottom: 0; }

/* Formulaire tenu dans une carte (test d'un code-barres) : champ et bouton
   sur la même ligne tant que la largeur le permet. */
form.carte { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
form.carte > label { margin: 0; flex: 0 1 26rem; }
form.carte > label > input { width: 100%; }

.message, .alerte {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--rayon-moyen);
  margin-bottom: 1.25rem;
  font-weight: 600;
}
.message::before, .alerte::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  background: currentColor;
  -webkit-mask: var(--pictogramme) center / contain no-repeat;
  mask: var(--pictogramme) center / contain no-repeat;
}
.message {
  color: var(--ok);
  background: var(--ok-fond);
  border: 1px solid var(--ok-bord);
  --pictogramme: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.5 2.7 2.7L16 9.8'/%3E%3C/svg%3E");
}
.alerte {
  color: var(--ko);
  background: var(--ko-fond);
  border: 1px solid var(--ko-bord);
  --pictogramme: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E");
}
.note { color: var(--encre-douce); font-size: 0.88rem; }

code, .mono { font-family: var(--police-mono); font-size: 0.86em; }
code {
  padding: 0.08em 0.4em;
  border-radius: 6px;
  background: var(--accent-fond);
  color: var(--accent);
  overflow-wrap: anywhere;
}
td.mono { color: var(--encre-2); }

/* ---------------------------------------------------------- page connexion --- */
body.page-connexion {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}
.connexion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  max-width: 880px;
  min-height: 480px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--ombre-forte);
  overflow: hidden;
}
.connexion-heros {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem;
  color: #fff;
  background: linear-gradient(135deg, var(--heros-a) 0%, var(--heros-b) 100%);
}
.connexion-heros::before { width: 260px; height: 260px; right: -80px; top: -70px; transform: rotate(16deg); }
.connexion-heros::after { width: 200px; height: 200px; left: -60px; bottom: -70px; transform: rotate(-14deg); background: rgba(255, 255, 255, 0.04); }
.connexion-heros .marque-legende { color: rgba(255, 255, 255, 0.6); }
.heros-titre { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 0.75rem; }
.heros-texte { max-width: 30ch; color: rgba(255, 255, 255, 0.82); font-size: 1rem; margin: 0; }

.connexion-formulaire { padding: 3rem 2.75rem; display: flex; flex-direction: column; justify-content: center; }
.connexion-formulaire h1 { font-size: 1.6rem; margin-bottom: 0.35rem; }
.connexion-formulaire > .note:first-of-type { margin-bottom: 1.75rem; }
.connexion-formulaire hr { margin: 1.75rem 0 1rem; }
.connexion-formulaire > .note:last-child { margin: 0; font-size: 0.82rem; }
.champ-icone { position: relative; margin-bottom: 1.1rem; }
.champ-icone > .icone { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--encre-pale); pointer-events: none; }
.champ-icone > input { width: 100%; padding-left: 2.6rem; min-height: 2.9rem; }
.connexion button.principal { width: 100%; min-height: 2.9rem; font-size: 0.95rem; }
.connexion button.principal .icone { width: 17px; height: 17px; stroke-width: 2.2; }

/* ------------------------------------------------------------- paramètres --- */
/* L'écran par lequel le client ouvrira ses modules au fil du déploiement : il
   doit rendre évident ce qui est standard, ce qui a été changé, et par qui. */
.groupe-parametres {
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--trait-doux);
  border-radius: var(--rayon-moyen);
  box-shadow: var(--ombre);
  overflow: hidden;
}
.groupe-parametres > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 0.95rem 1.2rem;
  transition: background-color 0.15s;
}
.groupe-parametres > summary::-webkit-details-marker { display: none; }
.groupe-parametres > summary::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.25rem;
  border-right: 2px solid var(--encre-pale);
  border-bottom: 2px solid var(--encre-pale);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.groupe-parametres[open] > summary::before { transform: rotate(45deg); }
.groupe-parametres > summary:hover { background: var(--surface-2); }
.groupe-parametres[open] > summary { border-bottom: 1px solid var(--trait-doux); }
.groupe-parametres .tableau { border: 0; border-radius: 0; box-shadow: none; margin: 0; background: transparent; }
.groupe-intro { margin: 0; padding: 0.85rem 1.2rem; background: var(--surface-2); border-bottom: 1px solid var(--trait-doux); }
.parametre-cle { font-family: var(--police-mono); font-size: 0.78rem; color: var(--encre-pale); display: block; margin-top: 0.1rem; }
.parametre-aide { color: var(--encre-douce); font-size: 0.86rem; margin-top: 0.35rem; max-width: 60ch; }
tr.personnalise td:first-child { box-shadow: inset 3px 0 0 var(--accent-vif); }
.badge-modifie, .compte-fonctions {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-fond);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.compte-fonctions { font-size: 0.8rem; }
.groupe-parametres td { vertical-align: top; }
.groupe-parametres td form { flex-wrap: nowrap; align-items: center; }
/* Un bouton par rangée : en dégradé plein, la colonne entière crierait. Le
   dégradé ne revient qu'au survol, sur le réglage qu'on s'apprête à écrire. */
.groupe-parametres td button.principal {
  color: var(--accent);
  background: var(--accent-fond);
  border-color: var(--accent-bord);
  box-shadow: none;
}
.groupe-parametres td button.principal:hover {
  color: #fff;
  filter: none;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primaire-a) 0%, var(--primaire-b) 100%);
  box-shadow: var(--primaire-ombre);
}
.groupe-parametres td form textarea { flex: 1 1 auto; min-width: 12rem; }

/* Cases à cocher des rôles d'une table. En ligne : deux ou trois cases se
   comparent d'un coup d'œil là où une par ligne allongerait chaque rangée. */
.case {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0.9rem 0.3rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--encre-2);
  white-space: nowrap;
  cursor: pointer;
}
.case input { margin: 0; }

/* Changement de rôles pas encore chargé par la station. Discret mais visible :
   c'est l'absence de ce signal qui faisait croire que la console ne marchait
   pas. Pas de `.alerte` ici — sa marge d'un rem déformerait la rangée. */
.attente {
  color: var(--ko);
  background: var(--ko-fond);
  border: 1px solid var(--ko-bord);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.5rem;
  font-size: 0.84rem;
  font-weight: 600;
}

/* --------------------------------------------------------------- étroit --- */
@media (max-width: 900px) {
  body.avec-barre { display: block; }
  .barre {
    position: sticky;
    z-index: 10;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "marque pied" "nav nav";
    gap: 0.6rem 0.75rem;
    padding: 0.75rem 1rem 0.6rem;
    overflow: hidden;
  }
  .barre::before, .barre::after { display: none; }
  .marque { grid-area: marque; padding: 0; }
  .marque-nom { font-size: 1.15rem; }
  .marque-produit { font-size: 0.7rem; }
  .barre nav {
    grid-area: nav;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -1rem;
    padding: 0 1rem 0.15rem;
  }
  .barre nav::-webkit-scrollbar { display: none; }
  .barre nav a { padding: 0.45rem 0.7rem; font-size: 0.88rem; gap: 0.45rem; }
  .barre nav a .icone { width: 16px; height: 16px; }
  .barre-pied { grid-area: pied; flex-direction: row; align-items: center; gap: 0.4rem; }
  .barre-pied .marque-legende { display: none; }
  .theme button span, .barre .sortie span { display: none; }
  .theme button { padding: 0.38rem 0.45rem; }
  .barre .sortie { padding: 0.5rem; }
  main { padding-top: 1.5rem; }
  h1 { font-size: 1.45rem; }
}

@media (max-width: 720px) {
  .connexion { grid-template-columns: 1fr; min-height: 0; }
  .connexion-heros { padding: 1.75rem 1.75rem 1.5rem; gap: 1.25rem; }
  .heros-titre { font-size: 1.8rem; margin-bottom: 0.4rem; }
  .connexion-formulaire { padding: 2rem 1.75rem; }
}

@media (max-width: 640px) {
  main { padding-left: 1rem; padding-right: 1rem; }
  .compteurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { display: block; overflow-x: auto; }
  .tableau > table, .carte table { display: table; }
  /* Réglages en fiches empilées : trois colonnes ne tiennent pas sur un
     téléphone, et faire défiler un formulaire en largeur cache son bouton. */
  .groupe-parametres thead { display: none; }
  .groupe-parametres table, .groupe-parametres tbody, .groupe-parametres tr, .groupe-parametres td { display: block; width: 100%; }
  .groupe-parametres tr { padding: 0.55rem 0; border-bottom: 1px solid var(--trait-doux); }
  .groupe-parametres tr:last-child { border-bottom: 0; }
  .groupe-parametres td { padding: 0.3rem 1rem; border: 0; }
  .groupe-parametres td form { flex-wrap: wrap; }
  .ligne-formulaire > div, .ligne-formulaire > div > input, .ligne-formulaire > div > select { width: 100%; }
}

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

/* ---- Statistiques ------------------------------------------------------- */
.filtres-stats .ligne-formulaire + .ligne-formulaire { margin-top: 0.75rem; }
.filtres-stats label select, .filtres-stats label input { display: block; margin-top: 0.35rem; }
.compteur .valeur small { font-size: 0.9rem; font-weight: 700; color: var(--encre-pale); }
table.stats td.nombre, table.stats th.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stats td:first-child { min-width: 11rem; }
.jauge { display: block; height: 4px; margin-top: 0.35rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.jauge > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-vif), var(--accent)); }
