/* MVR Viewer Web — thème et mise en page.
   Identité : jaune #FFC400 (remplissage) + encre #7A5600 (texte SUR jaune,
   jamais de blanc sur jaune), gris/blanc/noir par petites touches. */

:root {
  --bg: #161616;
  --panel: #1f1f1f;
  --panel-2: #262626;
  --border: #2e2e2e;
  --text: #ececec;
  --muted: #a8a8a8;
  --yellow: #FFC400;
  --ink: #7A5600;
  --yellow-veil: rgba(255, 196, 0, 0.16);
  --red: #e5484d;
  --green: #46a758;
  --hover: rgba(255, 255, 255, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 8px;
  --header-h: 52px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
kbd {
  font: 11px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  margin-left: 6px;
}

/* ------------------------------------------------------------ mise en page */
.app {
  display: grid;
  height: 100vh;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header header"
    "nav nav"
    "main aside"
    "footer footer";
}
.app.aside-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
.app.aside-collapsed .app-aside { display: none; }
.app-header { grid-area: header; }
.app-nav { grid-area: nav; }
.app-main { grid-area: main; }
.app-aside { grid-area: aside; }
.app-footer { grid-area: footer; }

@media (max-width: 1023px) {
  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(60vh, auto) auto auto;
    grid-template-areas: "header" "nav" "main" "aside" "footer";
  }
  .app.aside-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app-main { height: 70vh; }
  .app-aside { border-left: 0; border-top: 1px solid var(--border); max-height: none; }
  /* Aucune section (accueil, projet fermé : une section n'existe que si sa donnée existe, §3.5) : pas de bande vide
     entre la vue et la ligne d'état. (Ordinateur : la colonne reste, vide — sa largeur ne change pas sous la vue.) */
  .app-aside:not(:has(> .aside-section:not([hidden]))) { display: none; }
  .app-footer { position: sticky; bottom: 0; }
}

/* ------------------------------------------------------------------ header */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.app-title { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: 0.01em; }
.file-info { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-counters { white-space: nowrap; }

/* ----------------------------------------------------------------- boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #2e2e2e; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-ghost { background: transparent; }
.btn-primary {
  background: var(--yellow);
  color: var(--ink);
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover { background: #ffcd2e; }
.btn-primary kbd, .tab[aria-selected="true"] kbd { color: var(--ink); border-color: rgba(122, 86, 0, 0.4); }

/* -------------------------------------------------------------------- nav */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; }
.app-nav { min-width: 0; }
.aside-toggle { flex: none; }
.tab {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab[aria-selected="true"] { background: var(--yellow); color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------- main */
.app-main { position: relative; overflow: hidden; background: var(--bg); min-height: 0; }
.panel { position: absolute; inset: 0; }
.panel[hidden] { display: none; }
.panel-scroll { overflow: auto; padding: 16px; }
.panel-view { background: #1e1e1e; }
.scene-canvas, .scene-labels { position: absolute; inset: 0; }
.scene-canvas > canvas { display: block; width: 100% !important; height: 100% !important; }
.scene-labels, .scene-labels * { pointer-events: none; }
.scene-labels { overflow: hidden; }
/* Barre d'outils de la vue : UNE rangée (src/ui/toolbarFit.js) — resserrée (`is-compact`), puis
   défilante si la place manque encore ; jamais de commande retirée. Au-dessus des bandeaux de mode. */
.scene-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-wrap: nowrap; gap: 8px; z-index: 6; max-width: calc(100% - 24px); overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scene-tools::-webkit-scrollbar { display: none; }
.scene-tools[hidden] { display: none; }
.scene-tools > * { flex: none; }
.scene-tools.is-compact { gap: 4px; }
.scene-tools.is-compact .btn-small { padding: 4px 8px; }
.scene-tools.is-compact kbd { display: none; } /* raccourcis : dans les infobulles et l'aide « ? » */
.scene-tools .btn-ghost { background: var(--panel-2); } /* « ? » lisible sur le plan blanc */
/* Focus clavier dans les deux rangées défilantes (onglets, barre de la vue) : l'anneau extérieur était rogné en haut et
   en bas par leur `overflow` (il ne restait que deux arcs) — il passe À L'INTÉRIEUR du bouton, à l'encre sur un bouton
   jaune (onglet choisi, bascule enfoncée, bouton principal) où un anneau jaune ne se verrait pas (tranche E, reprise). */
.tabs :focus-visible, .scene-tools :focus-visible { outline-offset: -2px; }
.tabs .tab[aria-selected="true"]:focus-visible, .scene-tools .btn.toggle[aria-pressed="true"]:focus-visible,
.scene-tools .btn-primary:focus-visible { outline-color: var(--ink); }
@media (max-width: 760px) {
  .scene-tools { top: 8px; left: 8px; right: 8px; max-width: none; }
  .tab kbd { display: none; } /* téléphone : pas de clavier, plus d'onglets visibles dans la rangée */
}
/* Bandeaux de mode : juste SOUS la barre (`--tools-bottom` suit son bas), jamais dessus. */
.panel-view { --tools-bottom: 52px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 32px;
  color: var(--muted);
}
.scene-empty { position: absolute; inset: 0; z-index: 1; }
.empty-state[hidden] { display: none; }
.empty-title { color: var(--text); font-size: 16px; font-weight: 600; margin: 0; }
.empty-hint { margin: 0 0 8px; }
/* Accueil vide : « Choisir un fichier… », « Projets partagés… », « Essayer avec un exemple » — à la ligne, centrés,
   quand la rangée ne tient plus (téléphone). */
.scene-empty > .row { flex-wrap: wrap; justify-content: center; }

/* Scène factice (?mock=1) */
.mock-scene { position: absolute; inset: 0; padding: 24px; overflow: auto; color: var(--muted); }
.mock-scene h2 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.mock-scene p { margin: 4px 0; }
.mock-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mock-chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; }
.mock-chip.is-selected { background: var(--yellow); color: var(--ink); border-color: transparent; }
.mock-flash { position: absolute; left: 24px; bottom: 24px; padding: 6px 12px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ aside */
.app-aside {
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 8px 16px 16px;
}
.aside-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.aside-section:last-child { border-bottom: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-actions { display: flex; gap: 4px; }
.section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.row { display: flex; align-items: center; gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
select, input[type="search"], input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  min-width: 0;
}
input[type="search"] { width: 100%; }
input[type="checkbox"] { accent-color: var(--yellow); width: 15px; height: 15px; margin: 0; }

.layer-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: auto; }
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.layer-row:hover { background: var(--hover); }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-count { font-size: 12px; }

.search-hint { margin: 6px 0 0; font-size: 12px; min-height: 1.2em; }

.details { display: flex; flex-direction: column; gap: 6px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; }
.detail-label { flex: 0 0 auto; }
.detail-value { text-align: right; overflow-wrap: anywhere; }
.detail-row--block { flex-direction: column; gap: 2px; }
.detail-row--block .detail-value { text-align: left; }

/* --------------------------------------------- fiche de sélection (SPEC-menus-web §3.6, src/ui/selectionCard.js)
   Une fiche, deux hôtes : la section « Sélection » du panneau latéral (ordinateur) ou le bas de la vue (tablette,
   téléphone, panneau replié) — au-dessus de la mention du satellite, de la barre du PDF et du bas VISIBLE de la vue
   (mêmes variables que la barre d'affectation), jamais sur la barre d'outils. */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.selection-card { display: flex; flex-direction: column; gap: 8px; color: var(--text); min-width: 0; }
.selection-card[hidden], .selection-card.is-suppressed { display: none; }
.selection-card.is-scene {
  --sc-bottom: max(16px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 12px), calc(var(--pdf-bar-top, 0px) + 8px));
  position: absolute; left: 0; right: 0; margin: 0 auto; width: min(560px, calc(100% - 24px)); bottom: var(--sc-bottom);
  max-height: min(45%, calc(100% - var(--tools-bottom, 52px) - 8px - var(--sc-bottom))); overflow-y: auto; overscroll-behavior: contain;
  z-index: 5; box-sizing: border-box; padding: 10px 12px 12px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.selection-card.is-scene.is-compact {
  --sc-bottom: max(8px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 4px), calc(var(--pdf-bar-top, 0px) + 8px));
  width: max-content; max-width: calc(100% - 16px); max-height: calc(100% - var(--tools-bottom, 52px) - 8px - var(--sc-bottom));
  overflow: hidden; gap: 4px; padding: 6px 8px; border-radius: 12px;
}
.sc-head { display: flex; align-items: flex-start; gap: 8px; }
.sc-title { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.sc-close { flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; margin: -4px -4px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.sc-close:hover { background: var(--hover); color: var(--text); }
.sc-info { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 13px; }
.sc-info .sc-line { margin: 0; overflow-wrap: anywhere; }
.sc-chips { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; }
.sc-chips > *, .sc-row > :not(.sc-title) { flex: none; }
.selection-card .btn.is-flipped { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.selection-card.chips-tight .sc-chip, .selection-card.chips-tight .sc-scope-chip, .selection-card.chips-tight .sc-details-btn { padding: 3px 7px; font-size: 12px; }
/* Encore plus serrés (iOS ChipSize.tiny) avant tout passage à la ligne : les 4 jetons tiennent sur une ligne dans le
   panneau latéral (≈ 267 px), en français aussi ; fiche compacte : la rangée garde le titre entier plus longtemps. */
.selection-card.chips-tighter .sc-chips, .selection-card.chips-tighter .sc-row { gap: 4px; }
.selection-card.chips-tighter .sc-chip, .selection-card.chips-tighter .sc-scope-chip, .selection-card.chips-tighter .sc-details-btn { padding: 2px 5px; }
.selection-card.chips-wrap .sc-chips, .selection-card.chips-wrap .sc-row { flex-wrap: wrap; }
.sc-scope { min-width: 0; }
.sc-scope-seg { display: flex; width: max-content; }
.sc-scope-seg .seg-btn { white-space: nowrap; padding: 4px 12px; font-size: 13px; }
.seg-btn[aria-checked="true"] { background: var(--yellow); color: var(--ink); font-weight: 600; }
.sc-scope .sc-scope-chip-wrap { display: none; }
.selection-card.scope-narrow .sc-scope-seg { display: none; }
.selection-card.scope-narrow .sc-scope .sc-scope-chip-wrap { display: inline-flex; }
.sc-applies { margin: 0; }
.sc-details-btn { align-self: flex-start; }
.sc-details-btn .sc-chev { color: var(--muted); }
.sc-fold { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.sc-fold-rows { padding-top: 4px; }
.sc-fold .dmx-sheet, .sc-unfold .dmx-sheet { margin-top: 2px; }
/* Fiche compacte : une rangée (titre court · jetons · portée · Détails · croix) ; « Détails » déplie au-dessus. */
.sc-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; }
.sc-row > .sc-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sc-row .sc-close { margin: 0; }
.sc-row .sc-chips { flex: none; }
/* Deux rangées : la fiche compacte reste au plus le QUART de la vue (≈ 263 px de haut sur un téléphone de 667 × 375 en
   paysage → 65 px ; 59 px ici) — marges, écart entre les rangées et croix resserrés. */
.selection-card.two-rows .sc-row { flex-wrap: wrap; row-gap: 2px; }
.selection-card.is-scene.is-compact.two-rows { padding-top: 4px; padding-bottom: 4px; }
.selection-card.is-compact.two-rows .sc-close { width: 24px; height: 24px; }
.selection-card.two-rows .sc-row > .sc-title { flex-basis: calc(100% - 40px); order: -2; }
.selection-card.two-rows .sc-row > .sc-close { order: -1; margin-left: auto; }
.sc-unfold { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 6px 0; border-bottom: 1px solid var(--border); }
.sc-info-line { margin: 0; color: var(--muted); font-size: 12px; }
.selection-card.sc-multi .selection-list { max-height: 24vh; }
.selection-section .selection-card.is-aside { gap: 8px; }

/* ----------------------------------------------------------------- footer */
.app-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  min-height: 34px;
}
.progress { flex: 0 0 220px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress[hidden] { display: none; }
.progress .bar { height: 100%; width: 0; background: var(--yellow); transition: width 0.15s; }
.progress.indeterminate .bar { width: 40%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.status { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.status.is-error { color: var(--red); }

/* ---------------------------------------------------------- glisser-déposer */
.drop-overlay {
  display: none;
  position: fixed;
  inset: 8px;
  z-index: 100;
  border: 3px dashed var(--yellow);
  border-radius: 14px;
  background: rgba(22, 22, 22, 0.7);
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 20px;
  font-weight: 600;
}
.drop-overlay span { background: var(--yellow); color: var(--ink); padding: 10px 20px; border-radius: 999px; }
.app.is-dropping .drop-overlay { display: flex; }

/* ------------------------------------------------------------------ patch */
.patch-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.patch-filter { flex: 1; max-width: 420px; }
.patch-count { flex: 1; }
/* Largeur naturelle (jamais de retour à la ligne) : le panneau défile en
   largeur si besoin, les lignes restent denses comme sur iOS. */
.patch-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; }
.patch-table th {
  position: sticky;
  top: -16px; /* compense le padding du panneau défilant */
  z-index: 1;
  background: var(--panel);
  text-align: left;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.th-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.th-btn:hover { color: var(--text); }
th.is-sorted .th-btn { color: var(--text); }
.sort-ind { font-size: 9px; min-width: 9px; }
.patch-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.patch-table tbody tr { cursor: pointer; }
.patch-table tbody tr:hover { background: var(--hover); }
.patch-table tbody tr.is-selected { background: var(--yellow-veil); box-shadow: inset 3px 0 0 var(--yellow); }
.patch-empty { margin: 16px 0; }

/* ---------------------------------------------------------------- univers */
.universes { display: flex; flex-direction: column; gap: 20px; }
.universes-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-conflict { background: var(--red); color: #fff; }
.tag-ok { background: rgba(70, 167, 88, 0.2); color: #8fd694; }
.universe-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.universe-title { margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dmx-grid { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 2px; }
.dmx-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 14px;
  border-radius: 2px;
  background: #292929;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 10px/1 var(--mono);
  color: var(--text);
}
.dmx-cell.shade-a { background: #5c5c5c; }
.dmx-cell.shade-b { background: #3e3e3e; }
.dmx-cell.is-unknown { background: repeating-linear-gradient(45deg, #5c5c5c 0 3px, #2a2a2a 3px 6px); }
.dmx-cell.is-conflict { background: var(--red); color: #fff; }
.dmx-cell.is-start { box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.7); }
.dmx-cell[data-uuid] { cursor: pointer; }
.dmx-cell.is-selected { background: var(--yellow); color: var(--ink); }
.dmx-cell.is-selected.is-conflict { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--red); }
.dmx-id { overflow: hidden; text-overflow: clip; white-space: nowrap; padding: 0 1px; }
/* Numéro de canal au survol : un voile sombre avec le numéro. */
.dmx-cell:hover::after {
  content: attr(data-ch);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 9px;
  font-weight: 500;
}

/* ================================================================== phase A */
/* Un attribut hidden l'emporte sur tout display: flex/grid des composants ci-dessous. */
[hidden] { display: none !important; }
/* ------------------------------------------------------------ en-tête cloud */
.account-btn { margin-left: auto; }
.account-btn.is-signed-in { color: var(--text); }
.sync-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(70, 167, 88, 0.2);
  color: #8fd694;
  white-space: nowrap;
}
.sync-badge[hidden] { display: none; }
.sync-badge.is-syncing, .sync-badge.is-uploading, .sync-badge.is-downloading { background: var(--yellow-veil); color: var(--yellow); }
.sync-badge.is-error { background: rgba(229, 72, 77, 0.2); color: #f19a9a; }

.version-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--yellow);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.version-banner[hidden] { display: none; }
.version-banner .banner-text { flex: 1; min-width: 0; }
.version-banner .btn-primary { background: var(--ink); color: var(--yellow); }
.version-banner .btn-ghost { color: var(--ink); border-color: rgba(122, 86, 0, 0.4); }
.app { grid-template-rows: auto auto auto minmax(0, 1fr) auto; grid-template-areas: "header header" "banner banner" "nav nav" "main aside" "footer footer"; }
.version-banner { grid-area: banner; }
@media (max-width: 1023px) {
  .app { grid-template-rows: auto auto auto minmax(60vh, auto) auto auto; grid-template-areas: "header" "banner" "nav" "main" "aside" "footer"; }
}

/* ------------------------------------------------------------------ modales */
.modal-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  outline: none;
}
.modal.is-busy { opacity: 0.8; cursor: progress; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.modal-title { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { padding: 4px 10px; }
/* Fenêtre de consultation (openModal({ done })) : « Terminé » à droite du titre, en-tête gardé visible quand la
   fenêtre défile (SPEC-menus-web §6 D23, iOS `.mvrSheet`). */
.modal.has-done .modal-head { position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 8px; }
.modal-done { flex: none; font-weight: 600; }
.modal-body { padding: 12px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-body p { margin: 0; }
.modal-lead { font-size: 15px; font-weight: 600; }
.modal-note { margin: 0; font-size: 13px; color: var(--muted); min-height: 0; }
.modal-note:empty { display: none; }
.modal-note.is-error { color: var(--red); }
.modal-list { margin: 0; padding-left: 18px; color: var(--text); }
.modal-list li { margin: 2px 0; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.modal-section { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.modal-section.danger { border: 1px solid rgba(229, 72, 77, 0.4); border-radius: var(--radius); padding: 10px; }
.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-progress { flex: none; width: 100%; }
.small { font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .modal input[type="password"], .modal input[type="email"], .modal input[type="text"], .modal input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
  min-width: 0;
}
.btn-danger { background: var(--red); color: #fff; border-color: transparent; }
.btn-danger:hover { background: #f05a5f; }
.btn-danger-text { color: #f19a9a; }
.btn.toggle[aria-pressed="true"] { background: var(--yellow); color: var(--ink); border-color: transparent; font-weight: 600; }
/* Bascule PRINCIPALE (« Calibrer en 3 points (guidé)… » tant que la scène n'est pas calibrée) : déjà
   jaune au repos, comme l'état enfoncé ordinaire → enfoncée, elle prend un liseré d'encre intérieur. */
.btn.btn-primary.toggle[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.btn:disabled { opacity: 0.55; cursor: default; }
.row.wrap { flex-wrap: wrap; }

/* projets */
.project-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.project-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); }
.project-row.is-current { border-color: var(--yellow); }
.project-main { display: flex; flex-direction: column; min-width: 0; }
.project-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-input { width: 140px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 16px; }
/* Anglais : l'exemple s'écrit tel quel (« e.g. K7M2QX ») — en capitales espacées, il débordait du champ
   (« E.G. K7M2Q… »). Seul le code saisi passe en capitales espacées. Le français (« EX. K7M2QX ») tient :
   inchangé. */
html:lang(en) .code-input::placeholder { text-transform: none; letter-spacing: normal; }
.share-box { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--yellow); border-radius: var(--radius); }
.share-box[hidden] { display: none; }
.share-code { font-size: 28px; font-weight: 700; letter-spacing: 0.18em; color: var(--yellow); }
.share-box input[readonly] { flex: 1; min-width: 0; font-size: 12px; }

/* ------------------------------------------------------------- édition patch */
.patch-table .td-actions, .patch-table .th-actions { width: 1%; text-align: right; }
.patch-table tbody tr.is-editing { background: var(--yellow-veil); cursor: default; }
.patch-table tbody tr.is-editing:hover { background: var(--yellow-veil); }
.patch-table tbody tr.is-editing td { white-space: normal; padding: 10px; }
.row-editor { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
/* Le tableau est souvent plus large que le panneau (défilement horizontal) : l'éditeur de
   ligne reste dans la partie VISIBLE — ses boutons (« Type custom… », « Remplacer le
   modèle… ») passent à la ligne au lieu de sortir à droite. */
.patch { container-type: inline-size; }
.patch-table tbody tr.is-editing td > .row-editor { position: sticky; left: 10px; max-width: calc(100cqw - 20px); }
/* idem pour l'avertissement (chevauchement, fin d'univers) et l'erreur : ils passent à la ligne dans la partie visible */
.patch-table tbody tr.is-editing td > .edit-warn,
.patch-table tbody tr.is-editing td > .edit-error { position: sticky; left: 10px; max-width: min(640px, calc(100cqw - 20px)); white-space: normal; }
.field-inline { display: flex; flex-direction: column; gap: 3px; }
.field-inline > span { font-size: 11px; color: var(--muted); }
.field-inline.grow { flex: 1; min-width: 160px; }
.field-inline input, .field-inline select { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); }
.edit-id { width: 72px; }
.edit-u, .edit-c { width: 80px; }
.edit-name { width: 100%; }
.row-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-warn { margin: 8px 0 0; font-size: 12px; color: var(--yellow); }
.edit-error { margin: 8px 0 0; font-size: 12px; color: var(--red); }
.edit-warn[hidden], .edit-error[hidden] { display: none; }

/* ---------------------------------------------------------------- historique */
.history { display: flex; flex-direction: column; gap: 10px; }
.history-table td { vertical-align: top; }
.history-table .history-target { font-weight: 600; }
.history-table s { text-decoration-color: var(--muted); }
.history-table strong { color: var(--yellow); }
.history-actions { text-align: right; }
.history-failure { color: var(--red); font-size: 13px; }
.history-failure[hidden] { display: none; }

/* ================================================================== phase B : câblage */
.orange { color: #fb8c00; }
/* Surcharge : seul le TEXTE de charge passe en rouge (titre et projecteurs inchangés, iOS). */
.circuit-load.is-over, .phase-load.is-over, .phase-total.is-over, .core-note.is-over { color: #e53935; }
.circuit.is-over { box-shadow: inset 3px 0 0 #e53935; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon-small { width: 14px; height: 14px; color: var(--muted); }
.icon-big { width: 40px; height: 40px; color: var(--muted); }
.icon-btn { padding: 4px 8px; }
.color-square { display: inline-block; border-radius: 3px; flex: none; border: 1px solid rgba(0, 0, 0, 0.35); }

/* écran */
.cabling { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.cabling-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cabling-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cabling-body { display: flex; flex-direction: column; gap: 14px; }
.cabling-loading { margin: 0; font-size: 13px; }
.cabling-empty { padding: 48px 16px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--panel); }
.seg-btn { padding: 5px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] { background: var(--yellow); color: var(--ink); font-weight: 600; }

/* menus */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 200px; padding: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; }
.cabling-actions .menu-wrap:last-child .menu { left: auto; right: 0; }
.menu-item { text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; white-space: nowrap; }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { color: var(--muted); cursor: default; }
.menu-item.is-danger { color: #f19a9a; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }

/* bandeau récapitulatif */
.cabling-banner { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); font-size: 13px; }
.banner-item { display: inline-flex; align-items: center; gap: 8px; }
.banner-glyph { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--muted); }

/* carte distributeur */
.dist-card { --dist: #737373; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dist-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.dist-name { margin: 0; font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-sub { font-size: 12px; }
.dist-total { font-weight: 600; }
.dist-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.phase-group { border-top: 1px solid var(--border); }
.phase-group:first-of-type { border-top: 0; }
.phase-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px; background: color-mix(in srgb, var(--dist) 6%, transparent); }
.phase-tag { color: var(--dist); font-weight: 700; }
.circuit { padding: 8px 14px 10px; border-top: 1px solid var(--border); }
.phase-group .circuit:first-of-type { border-top: 0; }
.circuit-head { display: flex; align-items: center; gap: 8px; }
.circuit .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dist); flex: none; }
.circuit-title { font-weight: 600; flex: 1; }
.circuit-load { font-weight: 600; }
.core-note { margin: 4px 0 0 16px; font-size: 12px; }
.fx-list { list-style: none; margin: 6px 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.fx-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.fx-row:hover { background: var(--hover); }
.fx-empty { padding: 3px 6px; font-size: 13px; }
.fx-id { flex: none; }
.fx-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.fx-patch { font-size: 12px; }
.fx-right { flex: none; }
.fx-remove { color: #f19a9a; padding: 0 8px; font-size: 16px; line-height: 1.2; }
/* Actions d'un circuit / départ, ordre iOS sur UNE ligne : libellés longs, sinon courts — décidé LIGNE PAR
   LIGNE (fitActionRows, iOS ViewThatFits) ; en courts, passage à la ligne permis si même eux ne tiennent pas. */
.circuit-actions { display: flex; flex-wrap: nowrap; gap: 6px; margin: 8px 0 0 16px; }
.circuit-actions > .btn { flex: none; white-space: nowrap; }
.act-btn { display: inline-flex; align-items: center; gap: 5px; }
.act-btn .icon { width: 15px; height: 15px; flex: none; }
.act-btn .lbl-short, .circuit-actions.is-short .act-btn .lbl-long { display: none; }
.circuit-actions.is-short .act-btn .lbl-short { display: inline; }
.circuit-actions.is-short { flex-wrap: wrap; }
/* Retour du plan : la voie travaillée est surlignée UNE fois (jaune d'identité à 30 %, 1,8 s, puis fondu). */
.circuit, .dist-head, .phase-head, .banner-item { transition: background-color 0.6s ease; }
.is-return-flash { background-color: color-mix(in srgb, var(--yellow) 30%, transparent) !important; transition: none; }
.tag-warn { background: rgba(251, 140, 0, 0.18); color: #fb8c00; }

/* feuilles */
.modal-cabling .field-number .row { gap: 8px; }
.modal-cabling input[type="number"] { width: 120px; }
.modal-cabling .field-note { display: block; }
.modal-cabling .modal-section h3 { margin: 0; }
.modal-danger { margin-left: auto; }
.phase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.phase-cell { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.color-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--panel); }
.color-picker input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.modal-assign { width: min(640px, 100%); }
.assign-filter { width: 100%; }
.assign-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.assign-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.assign-row:hover { background: var(--hover); }
.assign-row.is-elsewhere { opacity: 0.5; }
.assign-id { flex: none; }
.assign-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.assign-patch { flex: none; font-size: 12px; }
.assign-away { flex: none; font-size: 12px; }
.assign-here { flex: none; }
.assign-right { flex: none; }
.assign-count { margin-left: auto; }

/* onglet Puissances */
.types-head { margin: 0; }
.types-list { display: flex; flex-direction: column; gap: 4px; }
.type-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main conf vote" "status status status"; align-items: center; gap: 4px 16px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.type-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.type-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-conf { grid-area: conf; font-size: 13px; white-space: nowrap; }
.type-vote { grid-area: vote; display: flex; align-items: center; gap: 6px; }
.type-status { grid-area: status; min-height: 0; }
.type-status:empty { display: none; }
.watts-input { width: 90px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); }
.types-foot { margin: 4px 0 0; }
/* téléphone : le nom du type prend toute la ligne, la confiance et le vote passent dessous */
@media (max-width: 700px) {
  .type-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main main" "conf vote" "status status"; gap: 6px 10px; }
  .type-conf { white-space: normal; min-width: 0; }
  .watts-input { width: 72px; }
}

/* panneau latéral : plan / légende */
.plan-section .row { justify-content: space-between; }
.legend { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.legend-title { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Câblage sur le plan : BARRE d'affectation en bas de la vue Plan (iOS PlanView assignPanel,
   SPEC-cablage-plan §4) — au-dessus de la mention de la source et de la barre du PDF du plan
   (src/ui/viewInsets.js) ; vue basse (< 450 px) : contre le bas. Toujours au-dessus du bas VISIBLE de
   la vue (--view-clip-bottom : téléphone, vue sous le bord de l'écran et sous la ligne d'état collée en
   bas). Non déplaçable sur le web. */
.assign-bar { position: absolute; left: 0; right: 0; margin: 0 auto; width: min(420px, calc(100% - 24px)); bottom: max(16px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 12px), calc(var(--pdf-bar-top, 0px) + 8px)); z-index: 5; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; padding: 10px 12px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); color: var(--text); }
.assign-bar[hidden] { display: none; }
.assign-bar.is-compact { bottom: max(8px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 4px), calc(var(--pdf-bar-top, 0px) + 8px)); }
.assign-bar.is-refused { animation: assign-refused 0.35s ease; }
@keyframes assign-refused { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.assign-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.assign-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.assign-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-close { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--muted); cursor: pointer; }
.assign-close:hover { color: var(--text); }
.assign-close .icon { width: 14px; height: 14px; }
.assign-line { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 22px; }
/* La charge tient TOUJOURS sur une ligne : c'est le compte qui rétrécit (jusqu'à 75 %, cablingPlan.js). */
.assign-load { display: inline-flex; align-items: center; gap: 5px; flex: none; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.assign-bar.is-over .assign-load { color: #e53935; }
.assign-load .icon { width: 16px; height: 16px; }
.assign-unknown { display: inline-grid; place-items: center; width: 16px; height: 16px; box-sizing: border-box; border: 1.5px solid #fb8c00; border-radius: 50%; color: #fb8c00; font-size: 10px; font-weight: 700; line-height: 1; }
.assign-pending { width: 14px; height: 14px; box-sizing: border-box; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: assign-spin 0.8s linear infinite; }
@keyframes assign-spin { to { transform: rotate(360deg); } }
.assign-missing { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: #fb8c00; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assign-count { flex: 1 1 auto; min-width: 0; display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.assign-count-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.assign-phase { flex: none; font-weight: 700; }
.assign-tools { display: flex; align-items: center; gap: 10px; }
.assign-round { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.07); color: var(--text); cursor: pointer; }
.assign-round:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); }
.assign-round:disabled { opacity: 0.35; cursor: default; }
.assign-round.is-active { background: var(--yellow); color: #000; } /* cadre armé : jaune d'identité, symbole noir */
.assign-round .icon { width: 20px; height: 20px; }
.assign-spacer { flex: 1; }
.assign-done { flex: none; }

/* Assistant de calibration GPS en 3 points (src/ui/threePointCalibration.js) : panneau en BAS de la vue
   Plan, à la place de la barre d'affectation (modes exclusifs), même règle de placement (au-dessus du bas
   VISIBLE, de la mention de la source et de la barre du PDF) ; jamais plein écran : sa hauteur est
   bornée à la vue sous la barre d'outils, son contenu défile. Vue basse (< 450 px) : contre le bas,
   textes secondaires et réglage du pas masqués (panelModel). Non déplaçable sur le web. */
.cal3-panel { position: absolute; left: 0; right: 0; margin: 0 auto; width: min(340px, calc(100% - 24px)); bottom: max(16px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 12px), calc(var(--pdf-bar-top, 0px) + 8px)); max-height: calc(100% - var(--tools-bottom, 52px) - 8px - max(16px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 12px), calc(var(--pdf-bar-top, 0px) + 8px))); overflow-y: auto; overscroll-behavior: contain; z-index: 5; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; padding: 10px 12px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); color: var(--text); }
.cal3-panel[hidden] { display: none; }
.cal3-panel.is-compact { bottom: max(8px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 4px), calc(var(--pdf-bar-top, 0px) + 8px)); max-height: calc(100% - var(--tools-bottom, 52px) - 8px - max(8px, calc(var(--view-clip-bottom, 0px) + 8px), calc(var(--sat-attr-h, 0px) + 4px), calc(var(--pdf-bar-top, 0px) + 8px))); gap: 4px; padding: 8px 10px 10px; }
.cal3-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cal3-icon { width: 18px; height: 18px; flex: none; color: var(--yellow); }
.cal3-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal3-status { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.cal3-dots { display: inline-flex; gap: 4px; flex: none; }
.cal3-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25); background: rgba(168, 168, 168, 0.2); }
.cal3-dot.is-done { background: var(--yellow); }
.cal3-dot.is-current { background: rgba(255, 196, 0, 0.35); }
.cal3-dot.is-discarded { background: rgba(168, 168, 168, 0.45); }
.cal3-step { color: var(--muted); white-space: nowrap; }
.cal3-spacer { flex: 1; min-width: 4px; }
.cal3-gps { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal3-gps.is-good { color: #46a758; }
.cal3-gps.is-fair { color: #fb8c00; }
.cal3-gps.is-poor, .cal3-gps.is-denied { color: var(--red); }
.cal3-gps.is-waiting { color: var(--muted); font-weight: 400; }
.cal3-gps-icon { width: 13px; height: 13px; }
.cal3-spinner { width: 12px; height: 12px; flex: none; box-sizing: border-box; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: assign-spin 0.8s linear infinite; }
.cal3-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal3-text { margin: 0; font-size: 13px; line-height: 1.4; }
.cal3-text.is-bodyStrong { font-weight: 600; }
.cal3-text.is-caption { font-size: 12px; color: var(--muted); }
.cal3-text.is-title { font-size: 17px; font-weight: 700; }
.cal3-text.is-value { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal3-text.is-valueStrong { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal3-panel .cal3-text.is-title + .cal3-text.is-value { color: var(--text); font-weight: 600; }
.cal3-text.is-warning { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: #fb8c00; }
.cal3-text.is-success { display: flex; gap: 6px; align-items: center; font-weight: 600; color: #46a758; }
.cal3-warn, .cal3-ok { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.cal3-waiting { display: flex; align-items: center; gap: 6px; }
.cal3-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cal3-progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.cal3-progress > span { display: block; height: 100%; width: 0; background: var(--yellow); transition: width 0.4s linear; }
.cal3-stepper { display: flex; align-items: center; gap: 8px; }
.cal3-stepper-btns { display: inline-flex; gap: 4px; }
.cal3-stepper-btns .btn { min-width: 32px; justify-content: center; }
.cal3-step-value { white-space: nowrap; color: var(--text); }
.cal3-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.cal3-actions .btn { width: 100%; justify-content: center; }
.cal3-panel.is-compact .cal3-actions { flex-direction: row; }
.cal3-panel.is-compact .cal3-actions .btn { flex: 1 1 0; min-width: 0; }

/* Mise à l'échelle du plan de repère (src/ui/refPlanCalibrate.js) : bandeau sur la vue */
.assign-banner { position: absolute; top: var(--tools-bottom, 52px); left: 12px; right: 12px; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: rgba(31, 31, 31, 0.94); border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.assign-banner[hidden] { display: none; }
.assign-banner .assign-exit .icon { width: 18px; height: 18px; }
.assign-text { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Écran étroit : bandeau sur plusieurs lignes, texte ENTIER (la règle vient après la règle de base). */
@media (max-width: 1023px) {
  .assign-banner { flex-wrap: wrap; border-radius: 12px; row-gap: 6px; }
  .assign-text { flex-basis: 100%; white-space: normal; order: -1; } /* texte d'abord, actions dessous */
}
.scene-rect { box-sizing: border-box; }

/* ================================================================== outils (SPEC-tools §C) */
.scene-tools .menu-wrap .menu { left: auto; right: 0; } /* repli : posé en position fixe par placeToolbarMenu */
.menu-item.is-checked { font-weight: 600; }
/* bannière de mode (mesure / cadre / masquer / solo), sous la barre d'outils */
.tool-banner { position: absolute; top: var(--tools-bottom, 52px); left: 12px; z-index: 4; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 6px 10px; background: rgba(31, 31, 31, 0.94); border: 1px solid var(--yellow); border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.tool-banner[hidden] { display: none; }
.tool-banner-icon { font-size: 15px; }
.tool-banner-text { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-banner-actions { display: inline-flex; gap: 6px; }
@media (max-width: 1023px) { .tool-banner { flex-wrap: wrap; border-radius: 12px; } .tool-banner-text { white-space: normal; } }
/* mesure : marqueurs à taille écran constante (CSS2D) et cote */
.mvr-measure-marker { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--yellow); background: transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.mvr-measure-marker.is-snapped { background: var(--yellow); }
.mvr-measure-text { font: 600 13px/1.2 var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--yellow); color: var(--ink); white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
/* calques : pastille de couleur ; classes */
.layer-color { width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; cursor: pointer; flex: none; }
.layer-color::-webkit-color-swatch-wrapper { padding: 0; }
.layer-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.layer-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.layer-color.has-override { box-shadow: 0 0 0 2px var(--yellow); }
.class-count { display: block; margin: -4px 0 6px; }
.class-count:empty { display: none; }
.class-empty p { margin: 2px 0; }
.labels-summary { display: block; margin: 4px 0 6px; }
/* recherche : liste de résultats */
.search-results { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.search-results:empty { display: none; }
.search-result { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.search-result:hover { background: var(--hover); }
.search-result.is-selected { background: var(--yellow-veil); }
.search-result .search-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-check { color: var(--yellow); font-weight: 700; }
/* sélection multiple */
.selection-list { margin: 0; padding-left: 22px; max-height: 32vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.selection-list li { display: flex; align-items: center; border-radius: 6px; cursor: pointer; }
/* Ligne cliquable ET atteignable au clavier (bouton plein largeur, apparence de la ligne d'avant). */
.selection-list .selection-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.selection-list .selection-pick:focus-visible { outline-offset: -2px; }
.selection-list li:hover { background: var(--hover); }
.selection-list li.is-current { background: var(--yellow-veil); }
.selection-list .selection-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* éléments masqués, raccourcis */
.hidden-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.hidden-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.hidden-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcuts { border-collapse: collapse; width: 100%; }
.shortcuts td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.shortcuts kbd { margin-left: 0; white-space: nowrap; }
/* réglage des étiquettes */
.label-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.label-field { display: flex; align-items: flex-start; gap: 8px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
/* Section de la colonne (≈ 270 px, 2 colonnes) : un libellé long passe à la ligne au lieu d'être coupé en plein
   mot (« N° de projecteu », « Position Z (haut ») — l'ellipse d'un conteneur flex ne s'applique pas à son texte. */
.label-field > input { flex: none; margin-top: 2px; }
.label-field > span { min-width: 0; overflow-wrap: break-word; }
.label-field:hover { background: var(--hover); }
.label-detached { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.label-slider { display: grid; grid-template-columns: 70px minmax(0, 1fr) 60px; align-items: center; gap: 10px; }
.label-slider input[type="range"] { accent-color: var(--yellow); width: 100%; }
/* patch séquentiel */
.seq-list { margin: 0; padding-left: 24px; max-height: 30vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.seq-list li { display: flex; gap: 10px; align-items: baseline; }
.seq-list .seq-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-row input { width: 160px; }
/* Modes « Nom (n canaux) » (textes iOS, tranche E) : la liste prend la largeur de son plus long choix, sans manger le
   libellé — à 160 px, « Mode 1 (49 channels) » était coupé à toutes les largeurs. */
.field-row select { width: auto; min-width: 160px; max-width: 70%; }
/* Pro (§E) */
.pro-features li { margin: 4px 0; }
.pro-status { display: flex; align-items: center; gap: 8px; margin: 0; }
.pro-seal { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 12px; }
/* Abonnement (SPEC-abonnement §4.4, §5.7) : état en échec de paiement, où gérer l'abonnement, avertissement de suppression. */
.pro-status.is-warn { color: var(--red); }
.pro-manage { display: flex; flex-direction: column; gap: 4px; }
.pro-manage[hidden], .pro-delete-warning[hidden] { display: none; }
.pro-manage p { margin: 0; }
.pro-delete-warning { display: flex; flex-direction: column; gap: 6px; }
.pro-delete-warning > .modal-note:first-child { color: var(--text); } /* la boutique continue de facturer : lisible, pas en gris */
.account-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; padding: 14px 16px; max-width: 520px; text-align: left; background: var(--yellow-veil); border-radius: 12px; color: var(--text); }
.account-card[hidden] { display: none; }
.account-card-title { margin: 0; font-weight: 600; font-size: 15px; }
.account-card-text { margin: 0; font-size: 13px; color: var(--muted); }
/* univers : inspecteur de canal, légende, cellule de début */
.dmx-cell.is-start { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9); }
.dmx-cell.is-selected { box-shadow: inset 0 0 0 2px var(--yellow); }
.dmx-inspector { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.dmx-inspector-head { display: flex; align-items: center; gap: 10px; }
.dmx-inspector-row { display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
.dmx-inspector-row .dmx-edit { margin-left: auto; align-self: center; }
.dmx-legend { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.dmx-legend-title { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dmx-legend-row { display: grid; grid-template-columns: 12px 90px minmax(0, 1fr) 80px 90px; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.dmx-legend-row:hover { background: var(--hover); }
.dmx-legend-row.is-selected { background: var(--yellow-veil); }
.dmx-legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.dmx-legend-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Écran étroit : les colonnes fixes (N°, plage, nombre de canaux) ne laissaient plus rien au nom
   (largeur 1 px sur téléphone) → nom et mode passent sur leur propre ligne, sous le N°. */
@media (max-width: 600px) {
  .dmx-legend-row { grid-template-columns: 12px 72px minmax(0, 1fr) auto; row-gap: 0; }
  .dmx-legend-name { grid-column: 2 / -1; grid-row: 2; }
}

/* ================================================================== lots C1 + C2 : plan de repère */
.refplan-body { display: flex; flex-direction: column; gap: 10px; }
.refplan-name { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refplan-info { display: flex; flex-direction: column; gap: 2px; }
.refplan-info p { margin: 0; }
.refplan-warn { color: #fb8c00; }
.refplan-group { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.refplan-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.refplan-layers { max-height: 28vh; }
.refplan-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1px solid rgba(255, 255, 255, 0.25); }
.refplan-row { display: flex; flex-direction: column; gap: 2px; }
.refplan-row-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.refplan-value { font-size: 12px; }
.refplan-row-ctl { display: flex; align-items: center; gap: 6px; }
.refplan-row-ctl input[type="range"] { flex: 1; min-width: 0; accent-color: var(--yellow); margin: 0; }
.refplan-num { width: 84px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; color: var(--text); font-size: 12px; }
.refplan-reset { padding: 2px 7px; }
.refplan-details summary { cursor: pointer; }
.refplan-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.refplan-visible { font-size: 13px; }
.refplan-calib-banner { background: rgba(31, 31, 31, 0.96); }
.refplan-calib-icon { font-size: 15px; }
.modal-refplan-scale { width: min(460px, 100%); }

/* ================================================================== lots C3 + C4 : objets 3D importés, exports */
.models-list { display: flex; flex-direction: column; gap: 2px; max-height: 24vh; overflow: auto; }
.models-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit; font-size: 13px; }
.models-row:hover { background: var(--hover); }
.models-row.is-selected { border-color: var(--yellow); background: var(--yellow-veil); }
.models-radio { color: var(--muted); flex: none; }
.models-row.is-selected .models-radio { color: var(--yellow); }
.models-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.models-eye { flex: none; font-size: 12px; color: var(--muted); }
.models-eye.is-hidden { color: #fb8c00; }
.models-toggles { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.models-loading { margin: 0; color: var(--yellow); }
.models-note { margin: 0; }
.modal-model-formats { width: min(520px, 100%); }
.empty-formats { max-width: 560px; }
/* Centrée par marges auto (pas left:50% + translate : sa largeur serait bornée à la MOITIÉ de la vue,
   d'où 3 lignes et plus sur téléphone). Largeur : 240 px laissés libres de chaque côté quand la vue
   le permet (barre d'échelle et pilule « Zoomez… » en bas à gauche), au moins 360 px, jamais plus que
   la vue. Posée au-dessus de la barre d'échelle (libellé vers H − 40 : 46 px) et de la mention de
   la source du fond satellite (--sat-attr-h, src/ui/viewInsets.js), qu'elle ne cache plus. Coins de 22 px (pas une
   pilule à 999 px) : sur une ligne elle reste une pilule, sur deux ou trois (tablette, téléphone en paysage) les bouts
   arrondis ne rognent plus le début et la fin du texte. */
.pdf-mode-bar { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: max(46px, calc(14px + var(--sat-attr-h, 0px))); z-index: 4; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: min(calc(100% - 24px), max(360px, calc(100% - 480px))); box-sizing: border-box; padding: 6px 10px; background: rgba(31, 31, 31, 0.96); border: 1px solid var(--yellow); border-radius: 22px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.pdf-mode-bar[hidden] { display: none; }
.pdf-mode-text { font-weight: 600; font-size: 13px; min-width: 0; text-align: center; text-wrap: balance; }
@media (max-width: 700px) { .pdf-mode-bar { border-radius: 12px; } .pdf-mode-text { flex-basis: 100%; text-align: center; } }
.modal-pdf-page { width: min(480px, 100%); }
.modal-pdf-pages { width: min(620px, 100%); }
.pdf-pages-actions .pdf-pages-generate { flex: 1 1 auto; justify-content: center; } /* principale, seule en bas (iOS PrimaryButton) */
.pdf-thumb-large { display: block; max-width: 100%; max-height: 220px; margin: 0 auto 10px; border: 1px solid var(--border); border-radius: 6px; background: #111; }
.pdf-pages { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow: auto; }
.pdf-page-row { display: flex; align-items: center; gap: 10px; }
.pdf-thumb { width: 96px; height: 64px; object-fit: contain; flex: none; border: 1px solid var(--border); border-radius: 4px; background: #111; }
.pdf-page-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pdf-page-main input { width: 100%; }
.pdf-page-actions { display: flex; gap: 4px; flex: none; }
.pdf-pages :focus-visible { outline-offset: -2px; } /* liste défilante : l'anneau extérieur de la dernière ligne était rogné */
/* Téléphone : le nom de la vue garde sa largeur (il tombait à 5 lettres à 375 px) ; les actions passent dessous. */
@media (max-width: 520px) {
  .pdf-page-row { flex-wrap: wrap; row-gap: 4px; }
  .pdf-thumb { width: 64px; height: 44px; }
  .pdf-page-main { min-width: 150px; }
  .pdf-page-actions { margin-left: auto; }
}
/* (En-tête étroit, ≤ 859 px : deux rangées — section « vrai menu » en fin de fichier.) */

/* ================================================================== lots D1 + D3 : projecteurs custom, GDTF, position */
.missing-gdtf-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid #fb8c00; border-radius: var(--radius); background: var(--panel-2); }
.missing-gdtf-note p { margin: 0; flex: 1; min-width: 0; }
.modal-gdtf-share { width: min(520px, 100%); }
.geo-section .geo-actions .btn { text-align: left; }
/* Menus « … » en bout de ligne dans une fenêtre (« Modèles de projecteurs », « Type personnalisé ») :
   ouverts vers la GAUCHE (sinon rognés par le bord droit de la fenêtre), et vers le HAUT pour les
   deux dernières lignes d'une liste (sinon rognés par le bas de la fenêtre défilante : sous la
   liste, il ne reste que la note de pied). */
.ftype-row .menu-wrap .menu, .cft-row .menu-wrap .menu { left: auto; right: 0; }
.ftypes-list > .ftype-row:last-child .menu-wrap .menu,
.ftypes-list > .ftype-row:nth-last-child(2):not(:first-child) .menu-wrap .menu,
.cft-lib > .cft-row:last-child .menu-wrap .menu,
.cft-lib > .cft-row:nth-last-child(2):not(:first-child) .menu-wrap .menu { top: auto; bottom: calc(100% + 4px); }
/* En-tête chargé (état, compte connecté, pastille de synchro, ~1000 px ; téléphone) : les compteurs s'abrègent
   d'abord (…), puis l'état, puis le nom du fichier, au lieu de déborder sur le bouton du compte ; la
   pastille « Synchronisé » reste entière. L'ORDRE tient aux facteurs de rétrécissement, séparés d'un million
   (compteurs 10¹², état 10⁶, nom 1) : flex retire la place en proportion facteur × largeur, donc avec des
   facteurs proches (100 / 50 / 1) le nom perdait aussi une fraction de pixel dès le premier manque — assez
   pour l'ellipse (« mock.m… » à 1024 px, compteurs encore lisibles). Ici, tant que les compteurs ont de la
   largeur, l'état et le nom perdent moins d'un millième de pixel (arrondi à zéro) ; compteurs à zéro, l'état
   prend le relais, puis le nom seul (un nom très long s'abrège donc, et la pastille reste à l'écran). Facteurs
   ≥ 1 : en dessous, flex ne distribue qu'une partie du manque et le nom ne rétrécirait plus assez. */
.file-info { overflow: hidden; }
.file-name { flex: 0 1 auto; min-width: 0; }
.file-counters { flex: 0 1e12 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-info .sync-badge { flex: none; }

/* ================================================================== rangement des menus, tranche A (SPEC-menus-web.md) */
/* Bouton « Compte & réglages » de l'en-tête : icône personne + libellé fixe ; pastille verte si connecté. */
.account-btn { gap: 8px; }
.account-glyph { position: relative; display: inline-flex; flex: none; color: var(--muted); }
.account-btn:hover .account-glyph, .account-btn.is-signed-in .account-glyph { color: var(--text); }
.account-dot { position: absolute; right: -2px; bottom: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--panel); display: none; }
.account-btn.is-signed-in .account-dot { display: block; }
/* Téléphone : icône seule (le nom accessible reste « Compte & réglages »). */
@media (max-width: 700px) {
  .account-btn { padding: 7px 9px; }
  .account-label { display: none; }
}

/* Panneau latéral : sections repliables (src/ui/asidePanels.js). Le titre devient un bouton (texte et
   gabarit du titre inchangés), chevron dessiné en CSS ; repliée, seule la tête reste. */
.section-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-align: left; }
.section-toggle:hover { color: var(--text); }
.section-toggle::after { content: ""; flex: none; width: 5px; height: 5px; margin-top: -3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform 0.15s; }
.aside-section.is-collapsed .section-toggle::after { margin-top: 0; transform: rotate(-45deg); }
.aside-section.is-collapsed > :not(.section-head) { display: none !important; }
.aside-section.is-collapsed .section-label { margin-bottom: 0; }
.aside-section.is-collapsed { padding-bottom: 8px; }
/* Section révélée par un menu ou un import : surlignée 1,2 s (jaune d'identité), puis fondu. */
.aside-section { transition: background-color 0.6s, box-shadow 0.6s; }
.aside-section.is-reveal-flash { background-color: color-mix(in srgb, var(--yellow) 22%, transparent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--yellow) 22%, transparent); transition: none; border-radius: 4px; }

/* Fenêtre « Compte & réglages » : sections Compte, MVR Viewer Pro, Services. */
.account-danger { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
.account-danger > .btn { align-self: flex-start; }
.service-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.service-row:hover { background: #2e2e2e; }
.service-name { flex: 1; min-width: 0; font-weight: 600; }
.service-value { color: var(--muted); font-size: 13px; }
.service-value.is-on { color: #8fd694; }
.service-chevron { color: var(--muted); font-size: 18px; line-height: 1; }
/* Fenêtre « Partager le projet » / section « Fichier ouvert » de « Projets ». */
.modal-share-project { width: min(560px, 100%); }
.share-file-status { overflow-wrap: anywhere; }
.share-status { display: flex; flex-direction: column; gap: 8px; }

/* ================================================================== rangement des menus, tranche B (SPEC-menus-web.md §3.5) */
/* En-tête de section avec une action longue (« Importer un plan (DXF, image, PDF)… ») : l'action passe
   sous le titre plutôt que d'écraser le titre sur deux lignes ou de déborder de la colonne. */
.section-head { flex-wrap: wrap; row-gap: 6px; }
.section-head > .section-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.section-head > .section-actions > .btn { max-width: 100%; white-space: normal; text-align: left; }
/* Calques | Classes : sélecteur segmenté en première ligne (seulement si le fichier déclare des classes). */
.layers-tabs { display: flex; width: 100%; box-sizing: border-box; margin: 0 0 8px; }
.layers-tabs .seg-btn { flex: 1 1 0; }
.seg-btn[aria-pressed="true"] { background: var(--yellow); color: var(--ink); font-weight: 600; }
/* Réglage des étiquettes (section) : groupes titrés, côté par défaut en 2 × 2, curseurs « titre · valeur »
   au-dessus du curseur (la colonne fait ~270 px). */
.label-settings { display: flex; flex-direction: column; gap: 12px; }
.label-settings-group { display: flex; flex-direction: column; gap: 6px; }
.label-settings-group + .label-settings-group { padding-top: 10px; border-top: 1px solid var(--border); }
.label-settings-group[hidden] { display: none; }
.label-settings-sub { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.label-settings-minor { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.label-settings .label-fields-reset { align-self: flex-start; }
.label-settings .label-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; border-radius: 12px; }
.label-settings .label-side .seg-btn { border-radius: 9px; padding: 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-settings .label-slider { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name value" "range range"; gap: 2px 8px; }
.label-settings .label-slider > span:first-child { grid-area: name; font-size: 13px; color: var(--muted); }
.label-settings .label-slider > input { grid-area: range; }
.label-settings .label-slider > .label-slider-value { grid-area: value; font-size: 12px; }
.label-settings p.muted { margin: 0; }

/* ================================================================== rangement des menus, tranche C (SPEC-menus-web.md §3.1-§3.4) */
/* Rangée des onglets : les onglets à gauche (défilants), puis — calés à droite, jamais emportés par le
   défilement des onglets — FR | EN (≥ 860 px) et « Panneau latéral » (le menu ⋯ est devenu le menu principal, §11). */
.app-nav .tabs { margin-right: auto; }
/* État de l'en-tête (§3.1.1) : calques / classes masqués, « Modèles GDTF en cours… » — après les compteurs ;
   s'abrège après eux, ne pousse jamais le bouton du compte. */
.file-state { flex: 0 1e6 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-state[hidden] { display: none !important; }
.file-state-gdtf { display: inline-flex; align-items: center; gap: 6px; color: var(--yellow); }
/* Conteneur flex (indicateur + texte) : l'ellipse se pose sur le TEXTE (posée sur le conteneur, elle ne s'affiche pas
   et le texte était coupé net quand l'état s'abrège). */
.file-state-gdtf > span:not(.file-state-spinner) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-state-spinner { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: mvr-spin 0.8s linear infinite; align-self: center; }
@keyframes mvr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .file-state-spinner { animation: none; border-right-color: currentColor; opacity: 0.6; } }
/* Barre de la vue : la pastille « Vue » en tête (≤ 760 px la rangée commence à gauche : elle est visible au chargement). */
.view-pill { font-weight: 600; }
/* Modèles importés : « Importer un autre modèle… » sous la liste. */
.models-import-row { margin: 2px 0 4px; }
/* Téléphone (≤ 520 px) : l'en-tête tient sur DEUX rangées (§3.11) — commandes (logo, « Ouvrir un .mvr », « Projets »,
   FR | EN, compte en icône), puis le fichier ; marges et espacements resserrés (sans « Exporter ▾ » ni « Projecteurs ▾ »,
   il ne manquait que ~45 px). */
@media (max-width: 520px) {
  .app-header { padding: 8px 10px; gap: 8px 6px; }
  .app-header .menu-btn { padding: 7px 11px; }
  .app-header .lang-switch button { min-width: 30px; padding: 6px 7px; }
}
/* Barre resserrée (`is-compact`) : neuf commandes depuis la tranche C (pastille « Vue » et « Multi » en plus) — boutons
   un peu plus serrés pour tenir sans défiler dans la vue d'un écran de 1024 px panneau latéral ouvert (~700 px). */
.scene-tools.is-compact .btn-small { padding: 4px 6px; }

/* ================================================================== vrai menu (SPEC-menus-web.md §11, 2026-10-23) */
/* Le menu ⋯ « Plus d'options » devient le MENU PRINCIPAL de l'en-tête, visible et nommé. Ordinateur (≥ 1024 px) : barre
   de menus (Projet · Patch & câblage · Plan & décor · Position GPS… · Partager & exporter) SOUS le nom du fichier, à
   droite du logo — l'en-tête reste UNE bande : logo | (fichier / menus) | compte. Le fichier garde toute la largeur de
   sa ligne (il en avait moins à côté de « Ouvrir un .mvr » et « Projets », passés dans « Projet »). Plus étroit : bouton
   « Menu » (☰ + libellé) à droite du logo, qui ouvre les mêmes familles en sections. */
.compact-menu { flex: none; }
.menu-btn-content { display: inline-flex; align-items: center; gap: 7px; }
.menu-btn-content svg { flex: none; }
.compact-main-menu { width: min(340px, calc(100vw - 16px)); }
/* Seuil SANS TROU : « pas (max-width: 1023px) » plutôt que « (min-width: 1024px) ». Une largeur à virgule (1023,5 px :
   Windows à 125 % ou 150 %, zoom du navigateur à 90 % ou 110 %) ne remplissait aucune des deux règles — barre de menus ET
   bouton « Menu » affichés, fichier écrasé à 0 px. Le reste de la feuille ne teste que `max-width: 1023px` : même bascule. */
@media not all and (max-width: 1023px) {
  .app-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 1px;
    padding: 6px 16px 5px;
  }
  .app-header > .app-title { grid-column: 1; grid-row: 1 / span 2; }
  .app-header > .file-info { grid-column: 2; grid-row: 1; padding-left: 1px; }
  .app-header > .main-menubar { grid-column: 2; grid-row: 2; margin-left: -8px; justify-self: start; max-width: calc(100% + 8px); }
  .app-header > .lang-switch { grid-column: 3; grid-row: 1 / span 2; }
  .app-header > .account-btn { grid-column: 4; grid-row: 1 / span 2; margin-left: 0; }
  .app-header > .compact-menu { display: none; }
}
@media (max-width: 1023px) {
  .app-header > .main-menubar { display: none; }
}
/* ≤ 859 px (FR | EN dans l'en-tête) : deux rangées, jamais trois — logo, « Menu », puis FR | EN et le compte calés à
   droite ; le fichier sur sa propre rangée (l'état y reste et s'abrège avec les compteurs, §3.1.1). */
@media (max-width: 859px) {
  .app-header { flex-wrap: wrap; row-gap: 8px; gap: 8px 10px; }
  .app-header .file-info { order: 10; flex-basis: 100%; }
}

/* --------------------------------------------- pages légales (src/ui/legalLinks.js, mise en vente C3) */
/* Accueil : pied de page discret EN BAS de l'état vide (sa marge haute automatique) ; le contenu reste centré
   au-dessus (marge basse automatique du ::before, src/ui/recentProjects.js). Contenu plus haut que la vue
   (téléphone, vue à 70vh) : l'accueil défile, le pied vient en dernier. */
.scene-empty { padding-bottom: 16px; }
/* Cible d'au moins 24 px de haut par lien (WCAG 2.2, 2.5.8 « taille de la cible ») à TOUTE largeur : les liens
   passent à la ligne dès que la rangée ne tient plus (téléphone, mais aussi vers 560 px), et deux lignes de
   17 px à 2 px d'écart se touchaient au doigt. Même police de 12 px : le pied reste discret. */
.legal-footer { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 8px; font-size: 12px; color: var(--muted); }
.legal-footer a { display: inline-flex; align-items: center; min-height: 24px; color: var(--muted); text-decoration: none; }
.legal-footer a:hover, .legal-footer a:focus-visible { color: var(--text); text-decoration: underline; }
.legal-sep { opacity: 0.6; }
/* Téléphone : les liens passent à la ligne — sans séparateur (un « · » en début de ligne), plus d'écart. */
@media (max-width: 520px) {
  .legal-footer { gap: 2px 14px; }
  .legal-sep { display: none; }
}
/* « Compte & réglages › À propos » : une liste de liens (nouvel onglet ↗), puis la version du site. */
.about-links { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.about-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel-2); color: var(--text); text-decoration: none; }
.about-row + .about-row { border-top: 1px solid var(--border); }
.about-row:hover { background: #2e2e2e; }
.about-row:focus-visible { outline-offset: -2px; }
.about-name { flex: 1; min-width: 0; }
.about-chevron { color: var(--muted); }
.about-version { margin: 0; }
/* Sous « Créer le compte » : conditions d'utilisation et politique de confidentialité. */
.signup-terms { margin: 0; }
.signup-terms[hidden] { display: none; }
.signup-terms a { color: var(--yellow); text-decoration: underline; text-underline-offset: 2px; }
