/* Parcours — banc d'essai de parcours web.
   Tout est clair et calme : la seule chose qui attire l'œil, c'est l'état des parcours — le point
   de la barre latérale, la mini-bande de la fiche du site, les verdicts, les captures. Le bleu de Prusse ne sert
   qu'à ce qui se clique ; le vert, le rouge et l'ambre sont réservés aux verdicts. */

:root {
  /* Base */
  --page: #f4f5f7;
  --rail-fond: #fafafb;
  --panneau: #ffffff;
  --panneau-2: #f7f8fa;
  --survol: #eef0f3;
  --trait: #e4e7ec;
  --trait-fort: #cdd3dc;
  --texte: #18202b;
  --sourdine: #5f6979;
  --discret: #8a93a3;
  --ardoise: #18202b;
  --brume: var(--page);

  /* Accent : tout ce qui se clique, et rien d'autre */
  --signal: #1d4e89;
  --signal-fonce: #163c6a;
  --signal-voile: #eaf0f8;

  /* Verdicts : réservés au sens */
  --vert: #17805a;
  --vert-voile: #e7f4ee;
  --rouge: #c23048;
  --rouge-voile: #fcedef;
  --ambre: #a85a06;
  --ambre-voile: #fcf1e3;

  --rayon: 6px;
  --rayon-lg: 10px;
  --ombre: 0 1px 2px rgba(24, 32, 43, .05);
  --ombre-haute: 0 24px 56px -20px rgba(24, 32, 43, .38);

  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Les chiffres et les petites données : la police de l'interface, à chasse fixe pour les chiffres. */
  --data: var(--sans);
  /* Le code — sélecteurs, variables, cron, adresses brutes — et lui seul. */
  --code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --mono: var(--code);

  --rail-largeur: 268px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--texte);
  background: var(--page);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -.012em; margin: 0; }
.code, .mono { font-family: var(--code); font-size: 12.5px; }

::selection { background: var(--signal); color: #fff; }

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

/* ================================================================== */
/* Le châssis : la barre latérale à gauche, le travail à droite        */
/* ================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--rail-largeur) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- Barre latérale ---------- */

.rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--rail-fond); border-right: 1px solid var(--trait);
}

.rail-marque { display: flex; flex-direction: column; gap: 1px; padding: 18px 20px 14px; }
.wordmark-name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; color: var(--texte); white-space: nowrap; }
.wordmark-sub { font-size: 12px; color: var(--sourdine); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rail-filtre { padding: 0 12px 8px; }
.rail-filtre input { width: 100%; height: 32px; font-size: 13px; }

.rail-nav { flex: 1; overflow-y: auto; padding: 4px 8px 18px; }
.rail-section + .rail-section { margin-top: 18px; }
.rail-section-tete { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 10px; }
.rail-section-titre { font-size: 12.5px; font-weight: 600; color: var(--sourdine); letter-spacing: 0; }
.rail-section-lien {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
}
.rail-section-lien:hover { color: var(--texte); }
/* Un tunnel qui tourne : le titre de la section le dit, où qu'on soit. */
.rail-section-lien[data-state="en_cours"] { color: var(--signal); }

.rail-plus {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px;
  background: none; color: var(--sourdine); cursor: pointer;
  font-family: var(--sans); font-size: 17px; line-height: 1;
}
.rail-plus:hover { background: var(--survol); color: var(--texte); }

.rail-arbre, .rail-parcours { list-style: none; margin: 0; padding: 0; }
.rail-site { margin-top: 1px; }
.rail-site-tete { display: flex; align-items: center; gap: 0; border-radius: var(--rayon); }
.rail-plier {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 22px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--discret);
}
.rail-plier::before {
  content: ""; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease;
}
.rail-plier[aria-expanded="true"]::before { transform: rotate(45deg) translate(-1px, -1px); }
.rail-plier:hover { color: var(--texte); }
.rail-site-nom {
  flex: 1; min-width: 0; padding: 5px 6px; border: 0; border-radius: 5px; background: none;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--texte); text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail-site-nom:hover { background: var(--survol); }
.rail-site-nom[aria-current="page"] { color: var(--signal); }
.rail-plus-site { opacity: 0; width: 22px; height: 22px; font-size: 15px; }
.rail-site-tete:hover .rail-plus-site, .rail-plus-site:focus-visible { opacity: 1; }

/* Un trait de rappel relie les parcours à leur site. */
.rail-parcours { margin: 1px 0 6px 10px; padding-left: 8px; border-left: 1px solid var(--trait); }

.rail-lien-item {
  display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 9px;
  width: 100%; padding: 6px 8px; border: 0; border-radius: var(--rayon); background: none;
  font: inherit; font-size: 13px; color: var(--texte); text-align: left; cursor: pointer;
}
.rail-lien-item:hover { background: var(--survol); }
.rail-lien-item[aria-current="page"] { background: var(--signal-voile); color: var(--signal-fonce); font-weight: 600; }
.rail-nom { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Le point : le dernier verdict, partout le même code. */
.rail-point { width: 8px; height: 8px; border-radius: 50%; background: var(--trait-fort); }
[data-status="succes"] > .rail-point, [data-last="succes"] > .rail-point { background: var(--vert); }
[data-status="echec"] > .rail-point, [data-status="erreur"] > .rail-point,
[data-last="echec"] > .rail-point, [data-last="erreur"] > .rail-point { background: var(--rouge); }
[data-status="en_cours"] > .rail-point, [data-last="en_cours"] > .rail-point {
  background: var(--signal); box-shadow: 0 0 0 3px var(--signal-voile); animation: battement 1.4s ease-in-out infinite;
}
@keyframes battement { 50% { box-shadow: 0 0 0 5px rgba(29, 78, 137, .12); } }

/* La mini-bande : la même lecture que la grande, en réduction. Vers le haut, réussi ; vers le
   bas, en échec ; un tiret gris, pas encore de passage. */
.rail-bande { display: inline-flex; align-items: center; gap: 1.5px; height: 16px; }
.rail-trait { width: 3px; height: 3px; border-radius: 1px; background: var(--trait); }
.rail-trait[data-status="succes"] { height: 7px; background: var(--vert); transform: translateY(-3px); }
.rail-trait[data-status="echec"], .rail-trait[data-status="erreur"] { height: 7px; background: var(--rouge); transform: translateY(3px); }
.rail-trait[data-status="en_cours"] { height: 7px; background: var(--signal); }

.rail-vide { font-size: 12.5px; color: var(--discret); padding: 3px 10px 6px; }

.rail-pied { display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 14px; border-top: 1px solid var(--trait); }
.rail-etat { display: flex; align-items: center; gap: 8px; padding: 2px 8px 6px; font-size: 12px; color: var(--sourdine); }
.rail-etat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--trait-fort); flex: 0 0 auto; }
.rail-etat[data-state="pret"]::before { background: var(--vert); }
.rail-etat[data-state="absent"] { color: var(--rouge); }
.rail-etat[data-state="absent"]::before { background: var(--rouge); }
.rail-lien {
  padding: 6px 8px; border: 0; border-radius: var(--rayon); background: none;
  font: inherit; font-size: 13px; color: var(--texte); text-align: left; cursor: pointer;
}
.rail-lien:hover { background: var(--survol); }
.rail-compte { display: flex; align-items: center; gap: 6px; }
.rail-email { flex: 1; min-width: 0; color: var(--sourdine); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-sortie {
  flex: 0 0 auto; padding: 4px 10px; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--panneau); font: inherit; font-size: 12.5px; color: var(--sourdine); cursor: pointer;
}
.rail-sortie:hover { color: var(--texte); border-color: var(--trait-fort); }

.rail-voile { display: none; }
.rail-bouton { display: none; }

/* ---------- La zone de travail ---------- */

.desk { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage-head {
  padding: 16px 32px 0; background: var(--panneau);
  border-bottom: 1px solid var(--trait); flex: 0 0 auto;
}
.views { flex: 1; overflow-y: auto; padding: 26px 32px 64px; min-height: 0; }
.view { max-width: 1320px; }

.stage-haut { display: flex; align-items: center; gap: 10px; min-height: 18px; }
.crumb { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--sourdine); }
.crumb button {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--sourdine);
}
.crumb button:hover { color: var(--signal); text-decoration: underline; text-underline-offset: 3px; }
.crumb .sep { color: var(--trait-fort); }

.stage-title { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.stage-titre-bloc { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.title-static { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.title-input {
  font-family: var(--sans); font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3;
  width: 100%; max-width: 720px; height: auto; padding: 2px 8px; margin-left: -9px;
  border: 1px solid transparent; border-radius: var(--rayon); background: none; color: var(--texte);
}
.title-input:hover { border-color: var(--trait); }
.title-input:focus { border-color: var(--signal); background: var(--panneau); box-shadow: 0 0 0 3px var(--signal-voile); }

.stage-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; padding-top: 2px; }

.stage-bas { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.steps-head-tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; padding-bottom: 9px; }

.tabs { display: flex; gap: 26px; }
.tab {
  border: 0; background: none; cursor: pointer; position: relative;
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--sourdine);
  padding: 8px 0 12px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--texte); }
.tab[aria-selected="true"] { color: var(--texte); font-weight: 600; border-bottom-color: var(--signal); }
.tab:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 3px; }
.tab-count {
  font-size: 11.5px; font-weight: 500; color: var(--sourdine); margin-left: 6px;
  background: var(--survol); border-radius: 999px; padding: 1px 7px;
}

/* ---------- Champs ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-grow { flex: 1; min-width: 240px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--sourdine); }
.field-hint { font-size: 12px; color: var(--sourdine); line-height: 1.45; }
.hint { font-size: 13px; color: var(--sourdine); margin: 10px 0 0; max-width: 76ch; line-height: 1.55; }

input, select, textarea {
  font-family: var(--sans); font-size: 13.5px; color: var(--texte);
  background: var(--panneau); border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  padding: 7px 10px; min-width: 0; height: 36px;
}
textarea { height: auto; }
input.code, select.code, input.mono:not([type="number"]) { font-family: var(--code); font-size: 12.5px; }
input:hover, select:hover { border-color: #b3bcc9; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-voile);
}
input::placeholder { color: var(--discret); }
input:disabled, select:disabled { background: var(--panneau-2); color: var(--discret); cursor: not-allowed; }
input[readonly] { background: var(--panneau-2); color: var(--sourdine); }
input[readonly]:focus { border-color: var(--trait-fort); box-shadow: none; }
select {
  appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--sourdine) 50%), linear-gradient(135deg, var(--sourdine) 50%, transparent 50%);
  background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type="checkbox"] { height: auto; accent-color: var(--signal); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.tog { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--sourdine); }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 500; color: var(--texte);
  background: var(--panneau); border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  padding: 0 14px; height: 36px; cursor: pointer; white-space: nowrap;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.btn:hover { border-color: #b3bcc9; background: var(--panneau-2); }
.btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { background: var(--panneau); border-color: var(--trait-fort); }

.btn-solid { background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600; }
/* Le texte d'un bouton plein est blanc : lui rendre le fond clair du survol l'effacerait.
   L'opacite du :disabled suffit a dire qu'il ne repond plus. */
.btn-solid:disabled:hover { background: var(--signal); border-color: var(--signal); }
.btn-solid:hover { background: var(--signal-fonce); border-color: var(--signal-fonce); }
.btn-danger { color: var(--rouge); border-color: #efc9d0; }
.btn-danger:hover { background: var(--rouge-voile); border-color: var(--rouge); }
.btn-mini { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-quiet { border-color: transparent; background: none; padding: 0 4px; }
.btn-quiet:hover { background: none; border-color: transparent; color: var(--signal); text-decoration: underline; text-underline-offset: 3px; }
.btn-toggle[aria-pressed="true"] { border-color: var(--signal); color: var(--signal); background: var(--signal-voile); }

/* ---------- Piste : visible seulement quand un passage tourne ---------- */

.track { padding: 12px 26px 14px; background: var(--panneau); border-bottom: 1px solid var(--trait); flex: 0 0 auto; }
.track-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.track-title { font-size: 12px; font-weight: 600; color: var(--texte); }
.track-state { font-family: var(--data); font-size: 12.5px; color: var(--sourdine); }
.track[data-state="succes"] .track-state { color: var(--vert); }
.track[data-state="echec"] .track-state, .track[data-state="erreur"] .track-state { color: var(--rouge); }
.track[data-state="en_cours"] .track-state { color: var(--signal); }
.track-body { position: relative; }
.track-rail { position: absolute; left: 0; right: 0; top: 27px; height: 2px; background: var(--trait); }
.track-fill { height: 100%; background: var(--signal); transition: width .25s ease; }
.lamps { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; position: relative; }
.lamp { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.lamp-num { font-family: var(--data); font-size: 11px; color: var(--sourdine); }
.lamp-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--panneau); border: 2px solid var(--trait-fort); }
.lamp[data-status="ok"] .lamp-dot { background: var(--vert); border-color: var(--vert); }
.lamp[data-status="echec"] .lamp-dot { background: var(--rouge); border-color: var(--rouge); }
.lamp[data-status="ignoree"] .lamp-dot { background: var(--ambre); border-color: var(--ambre); }
.lamp[data-status="en_cours"] .lamp-dot { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-voile); }
.lamp[data-status="ok"] .lamp-num { color: var(--vert); }
.lamp[data-status="echec"] .lamp-num { color: var(--rouge); }
.track-empty { font-size: 12.5px; color: var(--sourdine); padding: 4px 0 2px; }

/* La chaîne : le cran au-dessus de la piste — quel parcours, plutôt que quelle étape. */
.track-tunnel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.track-tunnel-nom {
  font-size: 12px; font-weight: 600; color: var(--signal);
  background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--sans);
}
.track-tunnel-nom:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Le tunnel tourne alors qu'on regarde ailleurs : la flèche invite à le rejoindre. */
.track-tunnel-nom[data-ailleurs="true"]::before { content: "↳ "; color: var(--sourdine); }

.chain { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.chain-link {
  display: inline-flex; align-items: baseline; gap: 6px;
  border: 1px solid var(--trait); border-radius: 999px; padding: 2px 10px;
  font-size: 11.5px; color: var(--sourdine); background: var(--panneau-2);
}
.chain-link[data-act="passage"] { cursor: pointer; }
.chain-link[data-act="passage"]:hover { border-color: var(--trait-fort); }
.chain-link:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.chain-num { font-family: var(--data); font-size: 11px; }
.chain-link[data-status="succes"] { border-color: #bfe3d5; background: var(--vert-voile); color: var(--vert); }
.chain-link[data-status="echec"], .chain-link[data-status="erreur"] {
  border-color: #f0c6ce; background: var(--rouge-voile); color: var(--rouge);
}
.chain-link[data-status="en_cours"] {
  border-color: var(--signal); background: var(--signal-voile); color: var(--signal); font-weight: 600;
}

/* ---------- Verdict du dernier passage, sous le titre ---------- */

.steps-last { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--sourdine); }
.last-point { width: 8px; height: 8px; border-radius: 50%; background: var(--trait-fort); }
.steps-last[data-status="succes"] .last-point { background: var(--vert); }
.steps-last[data-status="echec"] .last-point, .steps-last[data-status="erreur"] .last-point { background: var(--rouge); }
.steps-last[data-status="en_cours"] .last-point { background: var(--signal); }
.last-verdict { font-weight: 600; color: var(--texte); }
.steps-last[data-status="succes"] .last-verdict { color: var(--vert); }
.steps-last[data-status="echec"] .last-verdict, .steps-last[data-status="erreur"] .last-verdict { color: var(--rouge); }
.last-lien {
  border: 0; background: none; padding: 0; margin-left: 4px; cursor: pointer;
  font: inherit; font-weight: 500; color: var(--signal);
}
.last-lien:hover { text-decoration: underline; text-underline-offset: 3px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--trait); }

/* ---------- Titres de section ---------- */

.section-title {
  font-size: 15px; font-weight: 600; color: var(--texte);
  margin: 34px 0 12px; letter-spacing: -.012em;
}
.view > .section-title:first-child { margin-top: 2px; }

.empty {
  font-size: 13.5px; color: var(--sourdine); background: var(--panneau);
  border: 1px dashed var(--trait-fort); border-radius: var(--rayon-lg); padding: 20px;
}

/* ---------- Fiche d'un site ---------- */

.url-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }

.site-scenarios, .site-vars, .comptes, .runs, .steps { list-style: none; margin: 0; padding: 0; }

.site-scenarios {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg); overflow: hidden;
}
.site-scenarios > li + li { border-top: 1px solid var(--trait); }
.site-scenarios > li.empty { border: 0; border-radius: 0; }
.site-scenario {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
  width: 100%; padding: 13px 18px; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.site-scenario:hover { background: var(--panneau-2); }
.site-scenario:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.site-scenario-corps { min-width: 0; }
.site-scenario-nom { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-scenario-meta { display: block; margin-top: 1px; font-size: 12.5px; color: var(--sourdine); }
.site-scenario-etat { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; line-height: 1.4; }
.site-scenario-verdict { font-weight: 600; color: var(--sourdine); }
.site-scenario[data-last="succes"] .site-scenario-verdict { color: var(--vert); }
.site-scenario[data-last="echec"] .site-scenario-verdict, .site-scenario[data-last="erreur"] .site-scenario-verdict { color: var(--rouge); }
.site-scenario[data-last="en_cours"] .site-scenario-verdict { color: var(--signal); }
.site-scenario-quand { color: var(--discret); }

.site-var {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 10px 12px; margin-bottom: 8px;
}
.site-var-row { display: flex; align-items: center; gap: 9px; }
.site-var-name {
  font-family: var(--data); font-size: 13px; color: var(--signal);
  background: var(--signal-voile); border-radius: 5px; padding: 3px 7px; white-space: nowrap;
}
.site-var-value { flex: 1; min-width: 120px; }
.site-var-meta { display: block; margin-top: 5px; font-family: var(--data); font-size: 11.5px; color: var(--sourdine); }
.var-new { display: flex; gap: 9px; align-items: center; margin-top: 10px; }
.var-new #varName { width: 190px; }
.var-new #varValue { flex: 1; min-width: 120px; }

/* ---------- Tunnels : des parcours joués à la chaîne ---------- */

.tunnels, .tunnel-maillons { list-style: none; margin: 0; padding: 0; }

.tunnel {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 12px 14px; margin-bottom: 8px; border-left: 3px solid var(--trait-fort);
}
.tunnel[data-last="succes"] { border-left-color: var(--vert); }
.tunnel[data-last="echec"], .tunnel[data-last="erreur"] { border-left-color: var(--rouge); }
.tunnel[data-encours="true"] { border-left-color: var(--signal); background: var(--signal-voile); }
.tunnel-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tunnel-tete .btn-quiet { padding: 0; font-size: 14px; font-weight: 500; height: auto; }
.tunnel-meta { display: block; margin-top: 3px; font-family: var(--data); font-size: 12px; color: var(--sourdine); }
.tunnel-suite {
  display: block; margin-top: 6px; font-size: 12px; color: var(--sourdine);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Un maillon : son rang commande, le site le situe, les outils restent à droite. */
.tunnel-maillon {
  display: flex; align-items: center; gap: 12px;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid var(--trait-fort);
}
.tunnel-maillon[data-last="succes"] { border-left-color: var(--vert); }
.tunnel-maillon[data-last="echec"], .tunnel-maillon[data-last="erreur"] { border-left-color: var(--rouge); }
.tunnel-maillon-rang { font-family: var(--data); font-size: 13px; color: var(--sourdine); flex: 0 0 auto; }
.tunnel-maillon-corps { min-width: 0; flex: 1; }
.tunnel-maillon-corps .btn-quiet { padding: 0; font-size: 14px; font-weight: 500; height: auto; }
.tunnel-maillon-site { display: block; font-family: var(--data); font-size: 11.5px; color: var(--sourdine); }
.tunnel-maillon-outils { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }

.tunnel-ajout { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.tunnel-ajout .field-grow { flex: 1; min-width: 220px; }

/* ================================================================== */
/* La planche : le parcours écran par écran                            */
/* ================================================================== */

/* Quatre colonnes, comme une ligne de tableau : la poignée, l'écran, sa capture, puis les
   actions qui s'enchaînent de gauche à droite. */
.story-head, .story-row {
  display: grid;
  grid-template-columns: 14px minmax(150px, 210px) clamp(130px, 13vw, 190px) minmax(0, 1fr);
  gap: 18px;
}
.story-head {
  padding: 0 0 10px 10px; align-items: end;
  border-bottom: 1px solid var(--trait-fort);
}
.story-head-col:first-child { grid-column: 2 / span 2; }
.story-head-title { display: block; font-size: 12.5px; font-weight: 600; color: var(--texte); }
.story-head-note { display: block; font-size: 11.5px; color: var(--sourdine); }

.story { list-style: none; margin: 0; padding: 0; }

/* L'épine : un trait continu à gauche, coloré par le verdict de chaque interaction. Le
   parcours se lit comme un tracé, du premier écran au dernier. */
.story-row {
  align-items: start; position: relative;
  padding: 16px 0 16px 10px;
  border-bottom: 1px solid var(--trait);
}
.story-row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--trait-fort);
}
.story-row[data-status="ok"]::before { background: var(--vert); }
.story-row[data-status="echec"]::before { background: var(--rouge); }
.story-row[data-status="ignoree"]::before { background: var(--ambre); }
.story-row[data-status="en_cours"]::before { background: var(--signal); }
.story-row:first-child::before { border-radius: 3px 3px 0 0; }
.story-row:last-child::before { border-radius: 0 0 3px 3px; }
.story-row:last-child { border-bottom: 0; }

/* La poignée : six points, discrets tant qu'on ne survole pas la ligne. */
.story-grip {
  align-self: stretch; min-height: 34px; width: 14px; cursor: grab; border-radius: 4px;
  background-image: radial-gradient(circle, var(--sourdine) 1.1px, transparent 1.4px);
  background-size: 6px 6px; background-position: 1px 0;
  background-repeat: repeat; opacity: .25; transition: opacity .12s ease;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% 18px no-repeat;
          mask: linear-gradient(#000 0 0) top / 100% 18px no-repeat;
}
.story-row:hover .story-grip { opacity: .8; }
.story-grip:active { cursor: grabbing; }

/* Ce qu'on tient s'efface ; là où ça tomberait, un trait franc. */
.en-glisse { opacity: .4; }
.story-row.depot-avant { box-shadow: inset 0 3px 0 var(--signal); }
.story-row.depot-apres { box-shadow: inset 0 -3px 0 var(--signal); }
.story-action.depot-avant { box-shadow: -5px 0 0 -1px var(--signal); }
.story-action.depot-apres { box-shadow: 5px 0 0 -1px var(--signal); }

.story-inter-tete { display: flex; align-items: center; gap: 6px; }
.story-inter-tete .story-inter-name { flex: 1 1 auto; min-width: 0; }
.story-inter-info {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 16px; height: 16px;
  border: 1px solid var(--trait-fort); border-radius: 50%; cursor: help;
  font-family: Georgia, serif; font-style: italic; font-size: 10.5px; line-height: 1; color: var(--sourdine);
}
.story-inter-info:hover { border-color: var(--signal); color: var(--signal); }

.story-inter-name {
  display: block; width: 100%; font-family: var(--sans);
  font-size: 14.5px; font-weight: 500; letter-spacing: -.01em;
  line-height: 1.35; overflow-wrap: anywhere; color: var(--texte);
}
/* Le nom de l'écran s'édite sur place : sans bordure tant qu'on ne le survole pas. */
input.story-inter-name {
  height: auto; padding: 3px 7px; margin-left: -8px;
  background: none; border: 1px solid transparent; border-radius: var(--rayon);
}
input.story-inter-name:hover { border-color: var(--trait); background: var(--panneau); }
input.story-inter-name:focus { border-color: var(--signal); background: var(--panneau); }
input.story-inter-name::placeholder { color: var(--texte); opacity: .75; }
.story-inter-meta {
  display: block; margin-top: 6px; line-height: 1.6;
  font-family: var(--data); font-size: 11.5px; color: var(--sourdine);
}
.story-inter-meta[data-alerte="true"] { color: var(--rouge); }

/* La capture est le contenu : elle prend la lumière, tout le reste est en retrait. */
.story-shot, .story-shot-vide { aspect-ratio: 16 / 9; border-radius: var(--rayon); overflow: hidden; }
.story-shot {
  padding: 0; width: 100%; display: block; cursor: pointer;
  background: var(--panneau); border: 1px solid var(--trait);
  box-shadow: var(--ombre); transition: box-shadow .15s ease, transform .15s ease;
}
.story-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.story-shot:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(16,24,38,.08), 0 16px 32px -14px rgba(16,24,38,.4); }
.story-shot:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.story-shot[data-status="echec"] { border-color: #eebfc7; }
/* Mobile et tablette : la capture se tient en hauteur, à ses vraies proportions (--ratio,
   posé par le script une fois l'image lue ; 412 / 839, celles du Pixel 7, en attendant). */
.story-shot[data-format="portrait"], .story-shot-vide[data-format="portrait"] {
  aspect-ratio: var(--ratio, 412 / 839); width: 112px; height: auto; justify-self: center;
}
.story-shot-vide {
  display: grid; place-items: center;
  border: 1px solid var(--trait); background: var(--panneau-2); color: var(--trait-fort);
}

/* Les actions se suivent comme une phrase : de gauche à droite, à la ligne quand la place
   manque, une flèche entre chacune. Même largeur partout : l'œil compare d'une ligne à l'autre. */
.story-actions { display: flex; flex-wrap: wrap; align-items: stretch; row-gap: 8px; }
.story-pas { display: flex; align-items: stretch; }
.story-action {
  display: flex; flex-direction: column; gap: 3px;
  flex: 0 0 196px; width: 196px; min-width: 0; text-align: left; cursor: pointer;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 9px 11px; font-family: var(--sans); font-size: 13px; color: var(--texte);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.story-action-tete { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.story-action-num { font-family: var(--data); font-size: 11.5px; color: var(--trait-fort); margin-top: 2px; }
/* Ce que l'étape vise, ce qu'elle vérifie, ce qu'elle a répondu : trois lignes discrètes,
   pour lire une action sans ouvrir sa fenêtre. */
.story-action-cible, .story-action-verif, .story-action-erreur {
  font-family: var(--data); font-size: 11.5px; line-height: 1.5;
  padding-left: 23px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story-action-cible { color: var(--sourdine); }
.story-action-verif { color: var(--signal); opacity: .85; }
.story-action-erreur { color: var(--rouge); }
.story-action:hover { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-voile); }
.story-action:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.story-action[data-status="echec"] { border-left: 3px solid var(--rouge); }
.story-action[data-status="ok"] { border-left: 3px solid var(--vert); }
.story-action[data-status="ignoree"] { border-left: 3px solid var(--ambre); }
.story-action[data-status="en_cours"] { border-left: 3px solid var(--signal); }
.story-ico { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: var(--sourdine); }
.story-action-text {
  line-height: 1.4; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.story-badge {
  margin-left: auto; padding-left: 8px; white-space: nowrap;
  font-family: var(--data); font-size: 11.5px; color: var(--vert);
}
.story-badge[data-status="echec"] { color: var(--rouge); }
.story-badge[data-status="ignoree"] { color: var(--ambre); }
.story-badge[data-status="jamais"], .story-badge[data-status="en_attente"] { color: var(--sourdine); }

/* La flèche entre deux actions est aussi le point d'insertion : elle devient « + » au survol. */
.story-insert {
  flex: 0 0 auto; align-self: center; width: 22px; height: 22px; margin: 0 2px; padding: 0; line-height: 1;
  border: 1px solid transparent; border-radius: 50%; background: none;
  font-family: var(--sans); font-size: 11px; color: var(--trait-fort); cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.story-insert::before { content: "▶"; }
.story-insert:hover, .story-insert:focus-visible {
  color: var(--signal); border-color: var(--signal); background: var(--signal-voile);
}
.story-insert:hover::before, .story-insert:focus-visible::before { content: "+"; font-size: 14px; }
.story-insert:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }

/* L'appareil simulé, dans l'en-tête : une pastille qui mène au réglage. */
.btn-appareil {
  border-radius: 999px; height: 30px; padding: 0 12px; font-size: 12.5px;
  color: var(--sourdine); background: var(--panneau-2); border-color: var(--trait);
}
.btn-appareil:hover { color: var(--signal); border-color: var(--signal); }

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

/* ---------- Réglages d'un parcours ou d'un tunnel ---------- */

.view-reglages { max-width: 1060px; }
.reglage-groupe {
  display: grid; grid-template-columns: minmax(190px, 280px) minmax(0, 1fr); gap: 32px;
  padding: 26px 0; border-top: 1px solid var(--trait);
}
.reglage-groupe:first-child { border-top: 0; padding-top: 2px; }
.reglage-titre { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.reglage-note { font-size: 13px; color: var(--sourdine); margin: 0; line-height: 1.55; }
.reglage-champs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; align-content: start;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg); padding: 18px 20px;
}
.reglage-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field-wide { grid-column: 1 / -1; }
.panel {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg);
  padding: 16px 18px; margin-top: 32px;
}

/* ---------- Fenêtre d'étape ---------- */

.stepDialog {
  border: 0; border-radius: var(--rayon-lg); padding: 0;
  width: 560px; max-width: 94vw;
  background: var(--panneau); color: var(--texte); box-shadow: var(--ombre-haute);
}
.stepDialog::backdrop { background: rgba(16, 24, 38, .55); }
.step-dialog-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--trait);
}
.step-dialog-head h3 { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.step-dialog-head .btn { margin-left: auto; }
.step-dialog-body {
  display: grid; gap: 15px; padding: 18px; align-content: start;
  max-height: 64vh; overflow-y: auto;
}
.step-dialog-adv { border-top: 1px solid var(--trait); padding-top: 13px; }
.step-dialog-adv > summary {
  cursor: pointer; font-size: 12.5px; color: var(--sourdine); list-style: none;
  display: flex; align-items: center; gap: 7px;
}
.step-dialog-adv > summary::-webkit-details-marker { display: none; }
.step-dialog-adv > summary::before { content: "▸"; font-size: 10px; }
.step-dialog-adv[open] > summary::before { content: "▾"; }
.step-dialog-adv .step-adv-grid { margin-top: 14px; }
.step-adv-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.step-adv-grid .field { min-width: 120px; }
.step-dialog-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 13px 18px; border-top: 1px solid var(--trait); background: var(--panneau-2);
  border-radius: 0 0 var(--rayon-lg) var(--rayon-lg);
}
.step-dialog-note {
  flex: 1; min-width: 150px; text-align: right;
  font-family: var(--data); font-size: 11.5px; color: var(--sourdine);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.step-dialog-note[data-status="echec"] { color: var(--rouge); }
.step-dialog-note[data-status="ok"] { color: var(--vert); }
.step-type { flex: 0 0 auto; max-width: 220px; }

/* ================================================================== */
/* Mesures : tuiles, bande, courbes, chronologie                       */
/* ================================================================== */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.tile {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 3px;
}
.tile-label { font-size: 12px; color: var(--sourdine); }
.tile-value { font-family: var(--data); font-size: 25px; font-weight: 500; letter-spacing: -.03em; }
.tile-unit { font-size: 14px; color: var(--sourdine); margin-left: 3px; }
.tile-note { font-size: 11.5px; color: var(--sourdine); }
.tile[data-ton="pass"] .tile-value { color: var(--vert); }
.tile[data-ton="fail"] .tile-value { color: var(--rouge); }
.tile[data-ton="skip"] .tile-value { color: var(--ambre); }

.panel-plot {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg);
  padding: 16px 18px; margin-bottom: 16px;
}
.plots { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.plot-large { grid-column: 1 / -1; }
.plot-head { margin-bottom: 12px; }
.plot-line-head { display: flex; align-items: baseline; gap: 10px; }
.plot-title { font-size: 13px; font-weight: 600; }
.plot-value { font-family: var(--data); font-size: 13px; color: var(--sourdine); margin-left: auto; }
.plot-note { font-size: 11.5px; color: var(--sourdine); margin: 4px 0 0; max-width: 76ch; }
.plot-empty { font-size: 12.5px; color: var(--sourdine); }
.plot-grid { stroke: var(--trait); stroke-width: 1; }
.plot-axis { fill: var(--sourdine); font-family: var(--data); font-size: 11px; }
.plot-line { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linejoin: round; }
.plot-median { stroke: var(--trait-fort); stroke-width: 1; stroke-dasharray: 4 4; }
.plot-median-label { fill: var(--sourdine); font-family: var(--data); font-size: 11px; }
.plot-dot { fill: var(--signal); }
.plot-dot[data-status="echec"], .plot-dot[data-status="erreur"] { fill: var(--rouge); }
.plot-last { stroke: var(--panneau); stroke-width: 2; }
.plot-hit { fill: transparent; cursor: pointer; }
.plot-cross { stroke: var(--trait-fort); stroke-width: 1; }
.plot-tick { stroke: var(--trait); stroke-width: 1; }

.bande-wrap { margin-bottom: 26px; }
.bande { position: relative; }
.bande-base { stroke: var(--trait-fort); stroke-width: 1; }
.bande-bar { cursor: pointer; }
.bar-succes { fill: var(--vert); }
.bar-echec, .bar-erreur { fill: var(--rouge); }
.bar-en_cours { fill: var(--signal); }
.bande-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--sourdine); }

.table-wrap { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--rayon-lg); background: var(--panneau); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th {
  text-align: left; font-size: 11.5px; color: var(--sourdine); font-weight: 500;
  padding: 11px 14px; border-bottom: 1px solid var(--trait); white-space: nowrap;
}
table.grid th.num { text-align: right; }
table.grid td {
  padding: 10px 14px; border-bottom: 1px solid var(--trait); white-space: nowrap;
  font-family: var(--data); font-size: 12.5px; color: var(--sourdine);
}
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--panneau-2); }
table.grid tbody tr:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.num { text-align: right; }
table.grid td.libelle { font-family: var(--sans); font-size: 13px; color: var(--texte); }

.verdict { font-family: var(--sans); font-weight: 600; font-size: 12.5px; }
.verdict::before { content: "▲ "; font-size: 9px; vertical-align: 1px; }
.verdict[data-status="succes"] { color: var(--vert); }
.verdict[data-status="echec"], .verdict[data-status="erreur"] { color: var(--rouge); }
.verdict[data-status="echec"]::before, .verdict[data-status="erreur"]::before { content: "▼ "; }
.verdict[data-status="en_cours"] { color: var(--signal); }
.verdict[data-status="en_cours"]::before { content: "● "; }

/* ---------- Détail d'un passage ---------- */

.chrono { display: flex; flex-direction: column; gap: 4px; margin-bottom: 26px; }
.chrono-row {
  display: grid; grid-template-columns: 30px minmax(140px, 1.4fr) minmax(0, 3fr) 74px;
  gap: 12px; align-items: center; padding: 9px 12px;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
}
.chrono-idx { font-family: var(--data); font-size: 13px; color: var(--sourdine); }
.chrono-row[data-status="ok"] .chrono-idx { color: var(--vert); }
.chrono-row[data-status="echec"] .chrono-idx { color: var(--rouge); }
.chrono-label { min-width: 0; font-size: 13px; }
.chrono-sub { display: block; font-family: var(--data); font-size: 11.5px; color: var(--sourdine); }
.chrono-track { position: relative; height: 10px; background: var(--panneau-2); border-radius: 3px; }
.chrono-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--trait-fort); }
.chrono-row[data-status="ok"] .chrono-bar { background: var(--vert); }
.chrono-row[data-status="echec"] .chrono-bar { background: var(--rouge); }
.chrono-row[data-status="ignoree"] .chrono-bar { background: var(--ambre); }
.chrono-ms { font-family: var(--data); font-size: 12.5px; color: var(--sourdine); text-align: right; }
/* Les maillons d'un tunnel réutilisent cette grille, avec le vocabulaire des passages. */
.chrono-row[data-status="succes"] .chrono-idx { color: var(--vert); }
.chrono-row[data-status="succes"] .chrono-bar { background: var(--vert); }
.chrono-row[data-status="erreur"] .chrono-idx { color: var(--rouge); }
.chrono-row[data-status="erreur"] .chrono-bar { background: var(--rouge); }
/* Un maillon jamais joué : la ligne existe, elle est simplement en retrait. */
.chrono-row[data-status="jamais"] { opacity: .55; }
.chrono-label .verdict { margin-left: 8px; }
.chrono-row[data-act="passage"] { cursor: pointer; }
.chrono-row[data-act="passage"]:hover { border-color: var(--trait-fort); }
.chrono-row[data-act="passage"]:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }

/* Le détail des requêtes ratées : une étape par bloc, une requête par ligne. */
.reseau, .console-erreurs { list-style: none; margin: 0 0 26px; padding: 0; }
.reseau-etape {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  border-left: 3px solid var(--ambre); padding: 10px 12px; margin-bottom: 8px;
}
.reseau-tete { display: flex; align-items: baseline; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.reseau-num { font-family: var(--data); font-size: 12px; color: var(--sourdine); }
.reseau-label { font-size: 13px; font-weight: 500; }
.reseau-compte { font-family: var(--data); font-size: 11.5px; color: var(--sourdine); margin-left: auto; }
.reseau-ligne { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; }
.reseau-code {
  font-family: var(--data); font-size: 12px; font-weight: 500; color: var(--ambre);
  background: var(--ambre-voile); border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.reseau-code[data-serie="4"], .reseau-code[data-serie="5"] { color: var(--rouge); background: var(--rouge-voile); }
.reseau-url {
  font-family: var(--data); font-size: 12px; color: var(--sourdine);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

.console-erreur {
  font-family: var(--data); font-size: 12px; color: var(--rouge);
  background: var(--panneau); border: 1px solid var(--trait); border-left: 3px solid var(--rouge);
  border-radius: var(--rayon); padding: 8px 12px; margin-bottom: 6px; overflow-wrap: anywhere;
}

.film { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.film-shot {
  flex: 0 0 auto; width: 210px; padding: 0; cursor: pointer; text-align: left;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon);
  overflow: hidden; box-shadow: var(--ombre);
}
.film-shot img { display: block; width: 100%; height: 118px; object-fit: cover; object-position: top; }
.film-shot:hover { border-color: var(--signal); }
.film-shot[data-format="portrait"] { width: 124px; }
.film-shot[data-format="portrait"] img { height: auto; aspect-ratio: var(--ratio, 412 / 839); }
.film-cap { display: block; padding: 7px 9px; font-family: var(--data); font-size: 11.5px; color: var(--sourdine); }

.run-metrics { font-family: var(--data); font-size: 12px; color: var(--sourdine); }
.run-metrics[data-alerte="true"] { color: var(--rouge); }

/* ---------- Visionneuse de captures ---------- */

.shotDialog {
  border: 0; border-radius: var(--rayon-lg); padding: 14px;
  max-width: 92vw; background: var(--panneau); box-shadow: var(--ombre-haute);
}
.shotDialog::backdrop { background: rgba(16, 24, 38, .7); }
.shotDialog img { display: block; max-width: 100%; max-height: 74vh; border-radius: var(--rayon); border: 1px solid var(--trait); }
.shot-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.shot-caption { flex: 1; min-width: 200px; color: var(--sourdine); font-size: 12px; }
.shot-caption[data-status="echec"] { color: var(--rouge); }
.shot-caption[data-status="ok"] { color: var(--texte); }

/* ---------- Rideau (fenêtre de pointage) ---------- */

.curtain { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(16, 24, 38, .55); }
.curtain-card {
  background: var(--panneau); border-radius: var(--rayon-lg); padding: 22px 24px;
  max-width: 460px; text-align: center; box-shadow: var(--ombre-haute);
}
.curtain-card p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; }

/* ---------- Infobulle ---------- */

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ardoise); color: #e9eef7; border-radius: var(--rayon);
  padding: 7px 10px; font-size: 11.5px; line-height: 1.5; box-shadow: var(--ombre);
}
.tooltip b { font-family: var(--data); font-weight: 600; }

/* ---------- Porte : connexion et mot de passe ---------- */

.porte {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 24px;
  background: var(--page);
}
.porte-carte {
  width: 100%; max-width: 400px;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: 14px;
  padding: 32px; display: grid; gap: 16px;
  box-shadow: 0 1px 2px rgba(24, 32, 43, .04), 0 18px 40px -24px rgba(24, 32, 43, .25);
}
.porte-marque { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.porte-marque .wordmark-name { font-size: 17px; }
.porte-marque .wordmark-sub { font-size: 12.5px; }
.porte-titre { font-size: 22px; letter-spacing: -.02em; }
.porte-note { font-size: 13.5px; color: var(--sourdine); margin: -8px 0 2px; line-height: 1.55; }
.porte-carte .field + .field { margin-top: 14px; }
.porte-carte input { height: 40px; }
.porte-erreur {
  margin: 0; font-size: 13px; color: var(--rouge);
  background: var(--rouge-voile); border-radius: var(--rayon); padding: 9px 12px;
}
.porte-carte .btn-solid { margin-top: 6px; height: 42px; font-size: 14px; }

/* ---------- Bandeau de message ---------- */

.flash {
  margin: 12px 26px 0; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--trait); border-left: 3px solid var(--signal);
  border-radius: var(--rayon); background: var(--panneau); box-shadow: var(--ombre);
  font-size: 13px; color: var(--texte);
}
.flash[data-kind="echec"] { border-left-color: var(--rouge); border-color: #f0c6ce; background: var(--rouge-voile); color: var(--rouge); }
.flash[data-kind="ok"] { border-left-color: var(--vert); border-color: #bfe3d5; background: var(--vert-voile); }

/* ---------- Administration ---------- */

.reglages, .compte-neuf {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg); padding: 18px 20px;
}
.reglages .field-grow, .compte-neuf .field-grow { flex: 1; min-width: 190px; }

.compte {
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-lg);
  padding: 14px 16px; margin-bottom: 10px; border-left: 3px solid var(--trait-fort);
}
.compte[data-role="admin"] { border-left-color: var(--signal); }
.compte[data-actif="false"] { opacity: .62; border-left-color: var(--ambre); }
.compte-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.compte-email { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.compte-role, .compte-etat {
  font-size: 11px; border: 1px solid var(--trait-fort); border-radius: 999px;
  padding: 1px 9px; color: var(--sourdine);
}
.compte[data-role="admin"] .compte-role { color: var(--signal); border-color: #b9c4ee; background: var(--signal-voile); }
.compte-meta { display: block; margin-top: 4px; font-family: var(--data); font-size: 12px; color: var(--sourdine); }
.compte-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0 12px; }
.compte-outils { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.compte-note { font-family: var(--data); font-size: 12px; color: var(--sourdine); margin-left: auto; }

/* ---------- Adaptations ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--ombre-haute);
  }
  body[data-rail="ouvert"] .rail { transform: none; }
  .rail-voile { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(24, 32, 43, .35); }
  .rail-voile[hidden] { display: none !important; }
  .rail-bouton {
    display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 32px; height: 32px; margin-left: -6px; padding: 0;
    border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--panneau); cursor: pointer;
    background-image: linear-gradient(var(--texte), var(--texte)), linear-gradient(var(--texte), var(--texte)), linear-gradient(var(--texte), var(--texte));
    background-size: 14px 1.5px; background-repeat: no-repeat;
    background-position: center 10px, center 15px, center 20px;
  }
  .reglage-groupe { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 900px) {
  .stage-head, .views, .track { padding-left: 18px; padding-right: 18px; }
  .stage-head { padding-top: 12px; }
  .flash { margin-left: 18px; margin-right: 18px; }
  .plots { grid-template-columns: 1fr; }
  .story-head { display: none; }
  .story-row { grid-template-columns: 14px minmax(0, 1fr) clamp(140px, 27vw, 210px); gap: 14px; }
  .story-grip { grid-row: 1 / span 2; }
  .story-inter { grid-column: 2; }
  .story-shot, .story-shot-vide { grid-column: 3; grid-row: 1; width: 100%; }
  .story-actions { grid-column: 2 / -1; }
  .chrono-row { grid-template-columns: 26px minmax(0, 1fr) 70px; }
  .chrono-track { display: none; }
}

@media (max-width: 760px) {
  .app { height: auto; min-height: 100dvh; }
  .views { overflow: visible; }
  .site-scenario { grid-template-columns: 8px minmax(0, 1fr) auto; }
  .site-scenario .rail-bande { display: none; }
  .title-input { font-size: 19px; }
  .stage-tools, .steps-head-tools { margin-left: 0; width: 100%; }
  .stage-bas { flex-direction: column; align-items: stretch; }
  .compte-note { margin-left: 0; width: 100%; }
  .url-row .field { flex: 1 1 100%; }
  .step-type { max-width: none; }
  .tunnel-maillon { flex-wrap: wrap; }
  .tunnel-maillon-outils { width: 100%; justify-content: flex-end; }
}

@media (max-width: 560px) {
  .story-row { grid-template-columns: 14px minmax(0, 1fr); }
  .story-grip { grid-row: 1 / span 3; }
  .story-shot, .story-shot-vide { grid-column: 2; grid-row: auto; aspect-ratio: auto; height: 155px; }
  .story-pas { flex: 1 1 100%; }
  .story-action { flex: 1 1 auto; width: auto; }
  .site-var-row { flex-wrap: wrap; }
  .site-var-value { flex: 1 1 100%; }
  .var-new { flex-wrap: wrap; }
  .var-new #varName, .var-new #varValue { flex: 1 1 100%; width: auto; }
  .stepDialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .stepDialog[open] { display: flex; flex-direction: column; }
  .step-dialog-body { max-height: none; flex: 1; }
  .step-dialog-foot { margin-top: auto; border-radius: 0; }
  .step-dialog-note { text-align: left; width: 100%; order: -1; }
}

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

/* ---------- Le code garde sa police ---------- */

.story-action-cible, .site-var-name, .reseau-url, .console-erreur { font-family: var(--code); }
.story-action-cible, .reseau-url { font-size: 11px; }
.console-erreur { font-size: 11.5px; }

/* Les champs d'une vérification de requête : l'adresse, puis ses trois critères. */
.requete-champs { display: grid; gap: 14px; }

/* ================================================================== */
/* Profil, organisation, membres                                       */
/* ================================================================== */

.reglage-liste { display: block; padding: 6px 20px 14px; }
.membres, .invitations { list-style: none; margin: 0; padding: 0; }
.membre, .invitation {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--trait);
}
.membres > li:last-child, .invitations > li:last-child { border-bottom: 0; }
.membre-avatar {
  flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--signal-voile); color: var(--signal-fonce);
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
}
.membre[data-role="proprietaire"] .membre-avatar { background: var(--signal); color: #fff; }
.membre-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.membre-nom { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.membre-vous {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
  background: var(--survol); color: var(--sourdine); font-size: 11.5px; font-weight: 500;
}
.membre-meta { font-size: 12.5px; color: var(--sourdine); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.membre-role { flex: 0 0 auto; width: 160px; height: 32px; font-size: 13px; }
.membre-badge {
  flex: 0 0 auto; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--trait); color: var(--sourdine); font-size: 12.5px; font-weight: 500;
}
.membre[data-role="proprietaire"] .membre-badge { border-color: #c5d3e6; background: var(--signal-voile); color: var(--signal-fonce); }

.roles-legende { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 6px 0 0; font-size: 12.5px; }
.roles-legende dt { font-weight: 600; color: var(--texte); }
.roles-legende dd { margin: 0; color: var(--sourdine); }

.invitation-neuve { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 12px 0 4px; }
.invitation-neuve .field-grow { min-width: 220px; }
.invitation-lien {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--rayon);
  background: var(--vert-voile); border: 1px solid #bfe3d5;
}
.invitation-lien-titre { margin: 0 0 8px; font-size: 13px; color: var(--vert); font-weight: 500; }
.invitation-lien-ligne { display: flex; gap: 8px; }
.invitation-lien-ligne input { flex: 1; background: var(--panneau); }
.invitations-titre { margin: 18px 0 2px; font-size: 13px; font-weight: 600; color: var(--sourdine); }

/* Un lecteur consulte : ce qui écrit disparaît de l'écran (le serveur refuse de toute façon). */
body[data-lecture="true"] .ecriture,
body[data-lecture="true"] .story-insert,
body[data-lecture="true"] .story-grip,
body[data-lecture="true"] #stepDialogUp,
body[data-lecture="true"] #stepDialogDown,
body[data-lecture="true"] #stepDialogDup,
body[data-lecture="true"] #stepDialogDelete,
body[data-lecture="true"] #stepDialogRun,
body[data-lecture="true"] #stepDialogUpto { display: none !important; }

@media (max-width: 560px) {
  .membre { flex-wrap: wrap; }
  .membre-role { width: 100%; order: 3; }
}

/* Un serveur sans écran : ce qui ouvre une fenêtre de navigateur n'a pas lieu d'être proposé. */
body[data-fenetre="false"] #recordSteps,
body[data-fenetre="false"] #pickSelector,
body[data-fenetre="false"] #followToggle { display: none !important; }
