/* Carte des outils : un atlas celeste aux couleurs de KORENN.
   Le ciel porte toute l'audace (violet nuit de la charte, constellations dorees, spheres
   qui s'allument avec l'avancement). Tout le reste, fiche et catalogue, reste discret. */

@font-face {
  font-family: "Red Hat Display";
  src: url("fonts/red-hat-display.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  /* Nuit : le theme par defaut */
  --ciel-haut: #2c1b4a;
  --ciel-bas: #150b25;
  --lueur: rgba(120, 78, 190, 0.34);
  --contour: #1a0f2b;
  --surface: rgba(34, 21, 54, 0.92);
  --surface-pleine: #221536;
  --creux: rgba(255, 255, 255, 0.06);
  --texte: #f4eddf;
  --attenue: #b5aacb;
  --filet: rgba(203, 169, 114, 0.24);
  --filet-fort: rgba(203, 169, 114, 0.5);
  --or: #cba972;
  --or-vif: #ecd4a2;
  --sur-or: #221536;
  --verrou: #ff6b78;
  --poussiere: #ffffff;

  --idee-f: #3b2d5c;      --idee-b: #9a8fc0;
  --cadree-f: #f2cf63;
  --constr-f: #f58f4e;
  --service-f: #5fe0a8;

  --v1-f: #f6d48a;  --v2-f: #b58cf0;  --v3-f: #6f9bea;
  --application-f: #6fa8ff;  --skill-f: #c58bff;  --plugin-f: #4fd1c0;  --agent-f: #ff8fc0;  --modele-f: #d8c08a;

  --police: "Red Hat Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --rayon: 14px;
  color-scheme: dark;
}

:root[data-theme="jour"] {
  --ciel-haut: #f6f4f1;
  --ciel-bas: #ebe5dc;
  --lueur: rgba(203, 169, 114, 0.22);
  --contour: #f3efe9;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-pleine: #ffffff;
  --creux: rgba(34, 21, 54, 0.05);
  --texte: #1c1426;
  --attenue: #5e566b;
  --filet: rgba(74, 47, 115, 0.16);
  --filet-fort: rgba(74, 47, 115, 0.36);
  --or: #94733a;
  --or-vif: #6f5524;
  --sur-or: #ffffff;
  --verrou: #b3261e;
  --poussiere: #4a2f73;

  --idee-f: #e7e1ef;      --idee-b: #8a7fa8;
  --cadree-f: #e3b53a;
  --constr-f: #e07a35;
  --service-f: #2f9b6c;

  --v1-f: #c9973a;  --v2-f: #7a4fc2;  --v3-f: #3b6fd4;
  --application-f: #3b6fd4;  --skill-f: #7a4fc2;  --plugin-f: #1f8a7c;  --agent-f: #b83a7b;  --modele-f: #a58a5b;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.45;
  color: var(--texte);
  background:
    radial-gradient(ellipse 70% 55% at 72% 18%, var(--lueur), transparent 70%),
    linear-gradient(180deg, var(--ciel-haut), var(--ciel-bas));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- commandes de base ---------- */

button {
  background: var(--creux);
  border: 1px solid var(--filet);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover { border-color: var(--filet-fort); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--or);
  outline-offset: 2px;
}
button:disabled { opacity: 0.5; cursor: progress; }

button.principal { background: var(--or); border-color: var(--or); color: var(--sur-or); }
button.principal:hover { background: var(--or-vif); border-color: var(--or-vif); }
button.danger { color: var(--verrou); border-color: var(--verrou); background: transparent; }
button.texte { background: none; border: 0; padding: 0.2rem 0; color: var(--attenue); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }

button.rond {
  width: 2.25rem; height: 2.25rem; padding: 0; flex: none;
  display: inline-grid; place-items: center; font-size: 1.25rem; line-height: 1;
}
button.rond.petit { width: 1.7rem; height: 1.7rem; font-size: 1rem; border-color: transparent; background: none; color: var(--attenue); }
button.rond.petit:hover { color: var(--verrou); border-color: var(--filet); }

input[type="text"], textarea, select {
  width: 100%; min-width: 0;
  background: var(--creux);
  border: 1px solid var(--filet);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}
textarea { resize: none; overflow: hidden; line-height: 1.4; display: block; }
select { cursor: pointer; }
::placeholder { color: var(--attenue); opacity: 0.8; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--or); flex: none; margin: 0; }

.segments { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.segments button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.38rem 0.8rem; }
.segments button[aria-pressed="true"] { background: var(--or); border-color: var(--or); color: var(--sur-or); }

.discret { color: var(--attenue); font-size: 0.84rem; }
.erreur { color: var(--verrou); font-weight: 600; font-size: 0.9rem; }

/* ---------- petites spheres et reperes ---------- */

.astre-mini {
  --c: var(--idee-f);
  width: 0.85rem; height: 0.85rem; border-radius: 50%; flex: none; display: inline-block;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 46%), var(--c);
  box-shadow: 0 0 9px -1px var(--c);
}
.astre-mini.eteinte { background: var(--idee-f); box-shadow: none; outline: 1px dashed var(--idee-b); outline-offset: -1px; }
.astre-mini.verrou { background: none; box-shadow: none; border: 2px solid var(--verrou); }

.niv-idee { --c: var(--idee-f); }
.niv-cadree { --c: var(--cadree-f); }
.niv-construction { --c: var(--constr-f); }
.niv-service { --c: var(--service-f); }
.vag-0 { --c: var(--idee-f); }
.vag-1 { --c: var(--v1-f); }
.vag-2 { --c: var(--v2-f); }
.vag-3 { --c: var(--v3-f); }
.for-aucune { --c: var(--idee-f); }
.for-application { --c: var(--application-f); }
.for-skill { --c: var(--skill-f); }
.for-plugin { --c: var(--plugin-f); }
.for-agent { --c: var(--agent-f); }
.for-modele { --c: var(--modele-f); }

.pastille.trait { width: 1.5rem; height: 0; flex: none; display: inline-block; border-top: 2px solid currentColor; }
.pastille.trait.envisage { border-top-style: dotted; opacity: 0.7; }
.pastille.trait.manuel { border-top-style: dashed; }
.pastille.trait.auto { border-top-width: 3px; }

.repere { width: 0.95rem; height: 0.95rem; flex: none; display: inline-block; border-radius: 50%; }
.repere.arc { border: 2px solid var(--texte); border-left-color: var(--filet-fort); border-bottom-color: var(--filet-fort); }
.repere.lune { background: var(--or-vif); width: 0.55rem; height: 0.55rem; margin: 0 0.2rem; }
.repere.verrou { border: 2px solid var(--verrou); }

.marque {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap;
}
.marque.verrou { color: var(--verrou); }
.marque.couverte { color: var(--or-vif); }
.marque.incertain { color: var(--attenue); }

.barre-prog { height: 5px; border-radius: 3px; background: var(--creux); overflow: hidden; flex: 1; min-width: 2.5rem; }
.barre-prog i { display: block; height: 100%; background: var(--service-f); border-radius: 3px; }

/* ---------- bandeau ---------- */

.bandeau {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1.25rem;
  padding: calc(0.6rem + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 0.6rem max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--filet);
  position: relative; z-index: 3;
}
.bandeau h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.bandeau-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-wrap: wrap; }

.compteurs { display: flex; gap: 0.35rem 1.1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--attenue); min-width: 0; }
.compteur { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.compteur b { color: var(--texte); font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.compteur.alerte b { color: var(--verrou); }

.etat-sync { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 500; color: var(--attenue); }
.etat-sync i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--attenue); }
.etat-sync[data-etat="ok"] i { background: var(--service-f); }
.etat-sync[data-etat="cours"] i { background: var(--or); animation: battre 0.9s ease-in-out infinite; }
.etat-sync[data-etat="sans-code"] { color: var(--or-vif); border-color: var(--filet-fort); }
.etat-sync[data-etat="sans-code"] i { background: var(--or); }
.etat-sync[data-etat="erreur"] i, .etat-sync[data-etat="hors-ligne"] i { background: var(--verrou); }
.etat-sync span { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes battre { 50% { opacity: 0.25; } }

.maj {
  display: flex; align-items: center; justify-content: center; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.5rem 16px; background: var(--or); color: var(--sur-or); font-weight: 600; z-index: 3;
}
.maj button { background: var(--sur-or); color: var(--or-vif); border-color: transparent; }

/* ---------- le ciel ---------- */

main { flex: 1; min-height: 0; position: relative; }
#vue-ciel { position: absolute; inset: 0; overflow: hidden; }

#ciel { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#ciel.glisse { cursor: grabbing; }

.ciel-vide {
  display: none; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: min(30rem, calc(100% - 32px)); text-align: center; color: var(--attenue); font-size: 1.05rem; pointer-events: none;
}
#ciel.vide ~ .ciel-vide { display: block; }

.poussiere circle { fill: var(--poussiere); }
:root[data-theme="jour"] .poussiere { opacity: 0.35; }

.lien, .chevron, .anneau-verrou, .prog-piste, .prog-arc, .selection, .lien-fantome, .astre .corps, .lune, .poignee-plus {
  vector-effect: non-scaling-stroke;
}

.lien { stroke: var(--or); fill: none; stroke-linecap: round; }
.lien.statut-envisage { stroke-width: 1.5; stroke-dasharray: 1 7; opacity: 0.6; }
.lien.statut-manuel { stroke-width: 1.8; stroke-dasharray: 9 6; opacity: 0.85; }
.lien.statut-auto { stroke-width: 2.8; stroke: var(--or-vif); }
.chevron { fill: none; stroke: var(--or); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.chevron.statut-envisage { opacity: 0.55; }
.chevron.statut-auto { stroke: var(--or-vif); stroke-width: 2.6; opacity: 1; }
.lien.choisi, .chevron.choisi { stroke: var(--texte); opacity: 1; stroke-width: 3; }
.lien-zone { stroke: transparent; stroke-width: 24; vector-effect: non-scaling-stroke; cursor: pointer; fill: none; }

.lien-texte {
  font-family: var(--police); font-size: calc(var(--fs, 24px) * 0.8); font-weight: 500;
  fill: var(--or-vif); text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--contour); stroke-width: calc(var(--fs, 24px) * 0.3); stroke-linejoin: round;
}

/* La couleur --c vient des classes niv-, vag- et for- definies plus haut : ne pas la
   redefinir ici, la regle la plus basse du fichier l'emporterait. */
.astre { cursor: pointer; }
.astre:focus { outline: none; }
.astre .corps { fill: var(--c, var(--idee-f)); }
.astre .halo { fill: var(--c, var(--idee-f)); opacity: 0.5; pointer-events: none; }
.astre.niv-cadree .halo { opacity: 0.3; }
.astre.niv-construction .halo { opacity: 0.45; }
.astre.niv-service .halo { opacity: 0.7; }
:root[data-theme="jour"] .astre .halo { opacity: 0.28; }
.astre .ombre, .astre .reflet { pointer-events: none; }
.astre.eteinte .corps { fill: var(--idee-f); stroke: var(--idee-b); stroke-width: 1.4; stroke-dasharray: 4 4; }
.astre.eteinte .reflet { opacity: 0.3; }
:root[data-theme="jour"] .astre .ombre { opacity: 0.45; }

.astre .nom {
  font-family: var(--police); font-size: var(--fs, 24px); font-weight: 600;
  fill: var(--texte); text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--contour); stroke-width: calc(var(--fs, 24px) * 0.3); stroke-linejoin: round;
}
.astre.eteinte .nom { fill: var(--attenue); }
.astre.choisi .nom { fill: var(--or-vif); }

.prog-piste { fill: none; stroke: var(--filet-fort); stroke-width: 2; }
.prog-arc { fill: none; stroke: var(--texte); stroke-width: 2.6; stroke-linecap: round; }
.anneau-verrou { fill: none; stroke: var(--verrou); stroke-width: 2.4; }
.lune { fill: var(--or-vif); stroke: var(--contour); stroke-width: 2; }
.selection { fill: none; stroke: var(--or); stroke-width: 1.4; stroke-dasharray: 2 5; }
.astre:focus-visible .corps { stroke: var(--or); stroke-width: 3; stroke-dasharray: none; }

.poignee { cursor: crosshair; }
.poignee-fond { fill: var(--or); }
.poignee:hover .poignee-fond { fill: var(--or-vif); }
.poignee-plus { stroke: var(--sur-or); stroke-width: 2.2; stroke-linecap: round; fill: none; }

.lien-fantome { stroke: var(--or-vif); stroke-width: 2; stroke-dasharray: 5 5; fill: none; }
.astre-fantome { fill: var(--or); opacity: 0.35; }

#ciel.focalise .lien, #ciel.focalise .chevron { opacity: 0.1; }
#ciel.focalise .lien.actif, #ciel.focalise .chevron.actif { opacity: 1; }
#ciel.focalise .lien-texte { opacity: 0.12; }
#ciel.focalise .lien-texte.actif { opacity: 1; }
#ciel .astre { transition: opacity 0.15s ease; }
#ciel .astre.estompe { opacity: 0.28; }

/* Le seul mouvement non demande : les astres s'allument a l'ouverture. */
#ciel.eveil .astre-in, .astre.neuve .astre-in {
  animation: naitre 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.astre.neuve .astre-in { animation-delay: 0ms; }
#ciel.eveil .liens, #ciel.eveil .textes-liens { animation: paraitre 0.9s ease 0.55s both; }
@keyframes naitre { from { opacity: 0; } to { opacity: 1; } }
@keyframes paraitre { from { opacity: 0; } to { opacity: 1; } }

/* ---------- commandes du ciel ---------- */

.lentille, .commandes, .rafale { position: absolute; z-index: 2; }

.lentille {
  left: max(14px, env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  max-width: min(21rem, calc(100% - 28px));
  background: var(--surface); border: 1px solid var(--filet); border-radius: var(--rayon);
  padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start;
  backdrop-filter: blur(8px);
}
.legende { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.8rem; }
.legende li { display: inline-flex; align-items: center; gap: 0.4rem; }
.legende.reperes-legende { flex-direction: column; gap: 0.25rem; color: var(--attenue); border-top: 1px solid var(--filet); padding-top: 0.5rem; width: 100%; }

.commandes {
  right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem;
}
.creer {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--or); border-color: var(--or); color: var(--sur-or);
  padding: 0.7rem 1.15rem 0.7rem 0.95rem; font-size: 0.95rem; font-weight: 700;
  box-shadow: 0 6px 22px -6px var(--or);
}
.creer:hover { background: var(--or-vif); border-color: var(--or-vif); }
.zoom { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--filet); border-radius: 999px; overflow: hidden; backdrop-filter: blur(8px); }
.zoom button { border: 0; border-radius: 0; background: none; width: 2.5rem; height: 2.4rem; padding: 0; display: grid; place-items: center; }
.zoom button:hover { background: var(--creux); }
.zoom button + button { border-top: 1px solid var(--filet); }

.rafale {
  top: 14px; left: 50%; transform: translateX(-50%);
  width: min(34rem, calc(100% - 28px));
  background: var(--surface-pleine); border: 1px solid var(--or); border-radius: var(--rayon);
  padding: 0.65rem; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem; align-items: center;
  box-shadow: 0 14px 40px -14px rgba(0, 0, 0, 0.6);
}
.rafale input { font-size: 1.05rem; font-weight: 600; padding: 0.6rem 0.8rem; }
.rafale-contexte { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; }
.puce { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--creux); border: 1px solid var(--filet-fort); border-radius: 999px; padding: 0.1rem 0.25rem 0.1rem 0.65rem; font-size: 0.82rem; font-weight: 600; }
.puce button { border: 0; background: none; padding: 0 0.35rem; font-size: 1rem; line-height: 1; }

/* ---------- fiche ---------- */

.fiche {
  position: absolute; z-index: 4; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--surface); border-left: 1px solid var(--filet);
  backdrop-filter: blur(14px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 1rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 1.1rem;
}

.fiche-tete { display: flex; align-items: flex-start; gap: 0.6rem; }
.fiche-titre { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem; }
.fiche-titre .astre-mini { width: 1.1rem; height: 1.1rem; }
.titre-champ {
  font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em;
  background: none !important; border-color: transparent !important; padding: 0.2rem 0.3rem !important; border-radius: 8px;
}
.titre-champ:hover { border-color: var(--filet) !important; }
.titre-champ:focus { border-color: var(--filet-fort) !important; background: var(--creux) !important; }

.fiche-titre.lien { flex-wrap: wrap; gap: 0.3rem 0.5rem; font-size: 1.05rem; font-weight: 800; }
.fiche-titre.lien .vers { color: var(--attenue); font-weight: 500; font-size: 0.9rem; }
.lien-bout { background: none; border-color: var(--filet); font-size: 1rem; font-weight: 800; padding: 0.25rem 0.7rem; text-align: left; }

.reperes { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; color: var(--attenue); font-size: 0.84rem; margin-top: -0.5rem; }

.groupe { display: flex; flex-direction: column; gap: 0.55rem; }
.groupe h3 { font-size: 0.82rem; font-weight: 700; color: var(--attenue); }

.progression { display: flex; align-items: center; gap: 0.7rem; font-size: 0.82rem; color: var(--attenue); }
.fonctions { display: flex; flex-direction: column; gap: 0.35rem; }
.fonctions:empty { display: none; }
.fonction { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: start; }
.fonction > input { margin-top: 0.55rem; }
.fonction-texte { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.fonction textarea { padding: 0.4rem 0.6rem; }
.propose { font-size: 0.7rem; color: var(--attenue); padding-left: 0.6rem; }

.bascule { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.9rem; cursor: pointer; }
.bascule input { margin-top: 0.12rem; }

.liens-fiche { display: flex; flex-direction: column; }
.lien-fiche {
  display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: 0 0.6rem; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--filet); border-radius: 0; padding: 0.5rem 0.2rem; font-weight: 500;
}
.lien-fiche:hover { background: var(--creux); }
.lien-fiche .sens { color: var(--attenue); font-size: 0.8rem; align-self: center; }
.lien-fiche .autre { font-weight: 700; }
.lien-fiche .sous { grid-column: 2; color: var(--attenue); font-size: 0.78rem; }

.pied { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }

/* ---------- catalogue ---------- */

#vue-catalogue { position: absolute; inset: 0; overflow-y: auto; }
.catalogue {
  max-width: 1100px; margin: 0 auto;
  padding: 1.25rem max(16px, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 0.6rem;
}
.vague-titre { font-size: 1.2rem; font-weight: 800; margin-top: 1rem; display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.vague-titre span { font-size: 0.84rem; font-weight: 500; color: var(--attenue); }
.vague-liste { background: var(--surface); border: 1px solid var(--filet); border-radius: var(--rayon); overflow: hidden; }

.ligne-brique {
  display: grid; align-items: center; gap: 0.4rem 1rem; cursor: pointer;
  grid-template-columns: minmax(12rem, 2.2fr) minmax(6.5rem, 0.9fr) minmax(7rem, 1fr) 5.5rem minmax(7rem, 0.9fr) minmax(9rem, 1.2fr);
  padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--filet);
}
.ligne-brique:last-child { border-bottom: 0; }
.ligne-brique:hover { background: var(--creux); }
.ligne-brique.choisi { box-shadow: inset 3px 0 0 var(--or); background: var(--creux); }
.lb-nom { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; min-width: 0; }
.lb-nom .nom { font-weight: 700; }
.lb-niveau, .lb-alimente { font-size: 0.84rem; color: var(--attenue); }
.lb-prog { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--attenue); font-variant-numeric: tabular-nums; }
.ligne-brique select { padding: 0.3rem 0.5rem; font-size: 0.84rem; }
.vide { color: var(--attenue); text-align: center; padding: 3rem 1rem; }

body.fiche-ouverte .catalogue { margin-right: 420px; }

/* ---------- dialogue et messages ---------- */

.voile {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 5, 20, 0.62); backdrop-filter: blur(3px);
}
.dialogue {
  width: min(28rem, 100%); max-height: 100%; overflow-y: auto;
  background: var(--surface-pleine); border: 1px solid var(--filet-fort); border-radius: 18px;
  padding: 1.4rem; display: flex; flex-direction: column; gap: 0.85rem;
}
.dialogue h2 { font-size: 1.35rem; font-weight: 800; }
.dialogue h3 { font-size: 0.82rem; font-weight: 700; color: var(--attenue); margin-top: 0.4rem; }
.dialogue form.code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.dialogue form.code input { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.18em; text-align: center; }
.dialogue form.code input:placeholder-shown { font-size: 0.95rem; font-weight: 500; letter-spacing: normal; }
.rangee { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.toast {
  position: fixed; z-index: 12; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 32px);
  background: var(--texte); color: var(--contour); font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1.1rem; border-radius: 999px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

/* ---------- petits ecrans ---------- */

@media (max-width: 899px) {
  .bandeau { gap: 0.45rem 0.8rem; }
  .bandeau h1 { font-size: 1.05rem; }
  .compteurs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 1rem; }
  .etat-sync span { max-width: 7.5rem; }

  .fiche {
    top: auto; left: 0; width: 100%; max-height: 64%;
    border-left: 0; border-top: 1px solid var(--filet-fort); border-radius: 18px 18px 0 0;
  }
  body.fiche-ouverte .lentille, body.fiche-ouverte .commandes { display: none; }
  body.rafale-ouverte .lentille { display: none; }
  .creer span { display: none; }
  .creer { padding: 0.85rem; }
  .lentille { max-width: calc(100% - 5.5rem); }

  body.fiche-ouverte .catalogue { margin-right: auto; padding-bottom: 66vh; }
  .ligne-brique { grid-template-columns: minmax(0, 1fr) auto; }
  .lb-nom { grid-column: 1 / -1; }
  .lb-alimente:empty, .lb-vague:empty { display: none; }
}

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