/* VOLET « VISIBILITÉ GOOGLE & IA » (16/10/2026) — templates/visibilite/*. Préfixe vz-.
   Mobile d'abord : une colonne, tableaux défilant dans leur propre cadre, textes longs (requêtes,
   chemins) qui passent à la ligne au lieu d'élargir la page.
   Feuille partagée avec l'espace client (espace/trafic.html.twig), qui la reteint dans espace/trafic.css.
   DA VISEUR (10/11/2026) : la fenêtre « détail d'un robot » (hub seulement) passe aux jetons --esp-* ; les règles
   partagées gardent leur forme, le bloc final, limité au hub par :where(body:not(.espace)), leur donne la palette
   de l'espace (encre, gris chauds, un seul accent ; libellés de 12 px ; champs de 16 px). */
.good-txt { color: var(--success); }

.vz-liste { display: grid; gap: 10px; margin-bottom: 18px; }
.vz-ligne { display: block; color: var(--fg); padding: 12px 14px; }
.vz-ligne:hover { border-color: var(--border-lit); }
.vz-ligne-off { opacity: .7; }
.vz-ligne-tete { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vz-ligne-tete .spacer { flex: 1; }
.vz-ligne-chiffres { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.vz-ligne-chiffres b { color: var(--fg); font-size: 15px; }
.vz-ligne-chiffres em { font-style: normal; font-size: 12px; }

.vz-config h3 { margin-top: 18px; }
.vz-email { word-break: break-all; }
.vz-etapes { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.vz-etapes li { margin: 4px 0; }
.vz-form { display: grid; gap: 6px; max-width: 760px; }
.vz-form label { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.vz-form input, .vz-form textarea { width: 100%; box-sizing: border-box; }
.vz-form textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.vz-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.vz-fichier { cursor: pointer; }

.vz-page .toolbar { flex-wrap: wrap; gap: 8px; }
.vz-periodes, .vz-tete-section { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 14px; }
.vz-periodes .spacer, .vz-tete-section .spacer { flex: 1; }
.vz-tete-section h2 { margin: 0; }
.vz-periode { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; color: var(--muted); }
.vz-periode.actif { color: #fff; border-color: var(--esp-ink); background: var(--esp-ink); }

.vz-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .vz-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.vz-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.vz-kpi-lib { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); } :where(body:not(.espace)) .vz-kpi-lib { font-size: 12px; }
.vz-kpi strong { font-size: 24px; font-weight: 700; }
.vz-delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.vz-mieux { color: var(--success); }
.vz-moins { color: var(--danger); }
.vz-egal { color: var(--muted); }

.vz-courbe { position: relative; display: grid; grid-template-columns: 38px 1fr 46px; gap: 6px; height: 220px; padding-bottom: 18px; }
.vz-courbe svg { width: 100%; height: 200px; overflow: visible; border-bottom: 1px solid var(--border); }
.vz-barre { fill: var(--accent); opacity: .75; }
.vz-barre:hover { opacity: 1; }
.vz-ligne-imp { fill: none; stroke: var(--accent-2); stroke-width: 2; }
.vz-axe { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: 10.5px; color: var(--muted); } :where(body:not(.espace)) .vz-axe { font-size: 12px; }
.vz-axe-g { text-align: right; }
.vz-dates { position: absolute; left: 44px; right: 52px; bottom: 0; height: 16px; font-size: 10.5px; color: var(--muted); } :where(body:not(.espace)) .vz-dates { font-size: 12px; }
.vz-dates span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.vz-legende { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.vz-l-barre, .vz-l-ligne { display: inline-block; width: 14px; height: 8px; border-radius: 2px; background: var(--accent); margin-left: 8px; }
.vz-l-ligne { height: 2px; background: var(--accent-2); }
.vz-marque { margin: 10px 0 0; }

.vz-mots { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 8px; }
.vz-mot { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; background: var(--bg-2); }
.vz-mot p { margin: 6px 0 0; overflow-wrap: anywhere; }
.vz-mot-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vz-mot-tete strong { overflow-wrap: anywhere; }
.vz-mot-corps { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.vz-pos { font-size: 22px; font-weight: 700; min-width: 3ch; }
.vz-spark { width: 100%; max-width: 160px; height: 24px; flex: 1; }
.vz-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; }

.vz-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.vz-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vz-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); } :where(body:not(.espace)) .vz-table th { font-size: 12px; }
.vz-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.vz-table .num { text-align: right; white-space: nowrap; }
.vz-cellule-texte { min-width: 160px; overflow-wrap: anywhere; }
.vz-chemin { overflow-wrap: anywhere; }

.vz-deux { display: grid; gap: 14px; }
.vz-deux > * { min-width: 0; } /* sinon la carte prend la largeur de son tableau au lieu de le faire défiler */
@media (min-width: 1100px) { .vz-deux { grid-template-columns: 1fr 1fr; } }

.vz-robots { display: grid; gap: 4px; margin-bottom: 12px; }
.vz-robot { display: grid; grid-template-columns: minmax(0, 1fr) 90px; grid-template-areas: "nom nombre" "courbe courbe" "evol err"; gap: 2px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.vz-robot-nom { grid-area: nom; overflow-wrap: anywhere; }
.vz-robot .vz-spark { grid-area: courbe; max-width: none; }
.vz-robot .num { grid-area: nombre; text-align: right; font-weight: 700; }
.vz-robot > span:nth-last-child(2) { grid-area: evol; }
.vz-robot > span:last-child { grid-area: err; text-align: right; }
@media (min-width: 760px) {
  .vz-robot { grid-template-columns: minmax(180px, 1.2fr) minmax(120px, 2fr) 90px 80px 70px; grid-template-areas: "nom courbe nombre evol err"; }
  .vz-robot > span:nth-last-child(2) { text-align: right; }
}

.vz-cron { margin: 0 0 12px; padding: 10px 12px; border: 1px dashed var(--border-lit); border-radius: 6px; }
.vz-cron p { margin: 0 0 6px; }
.vz-cron-form .btn { margin-top: 4px; }

/* ── DÉTAIL D'UN ROBOT (Franck, 02/11/2026 : « pouvoir cliquer sur une ligne de stats pour l'avoir en détail
   avec un graphique interactif ») — templates/visibilite/_robot_detail.html.twig, public/js/visibilite.js.
   La ligne devient un <button> : même aspect qu'avant, curseur et survol en plus. La fenêtre est plein écran au
   téléphone (et en paysage écrasé), centrée et large ailleurs ; cibles de 44 px au doigt. */
/* Marges négatives : le texte reste aligné comme avant, seul le fond du survol déborde de 6 px. */
button.vz-robot {
  width: calc(100% + 12px); margin: 0 -6px; padding: 6px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background-color .15s;
}
/* Survol seulement là où il existe : au doigt (iPad), le survol RESTE sur la ligne touchée, qui paraissait
   encore choisie après la fermeture de la fenêtre (relecture du 02/11/2026). */
@media (hover: hover) {
  button.vz-robot:hover { background: var(--esp-n200); }
  button.vz-robot:hover .vz-robot-nom b { color: var(--esp-accent-text); }
  .vz-seg button:hover { background: var(--esp-n200); color: var(--esp-ink); }
  .vz-legende-btn:hover { border-color: var(--esp-ink); }
}
button.vz-robot:active, button.vz-robot[aria-expanded="true"] { background: var(--esp-n300); box-shadow: inset 3px 0 0 var(--esp-accent); }
button.vz-robot:focus { outline: none; }
button.vz-robot:focus-visible { outline: 2px solid var(--esp-accent); outline-offset: -2px; }
button.vz-robot { min-height: 44px; }

.vz-dlg {
  /* Couleurs des séries : lues aussi par le graphique (une seule source ; visibilite.js les lit sur cette fenêtre).
     viseur.md § 3.3 : passages réussis en gris (ok-vif), redirections en accent clair bordé de rouge foncé, erreurs
     en accent, autres en gris clair bordé. Les bords (--vz-*-bord) donnent le contraste de 3:1 aux aplats clairs. */
  --vz-ok: #7d7979;
  --vz-ok-bord: #7d7979;
  --vz-redirections: #ff9783;
  --vz-redirections-bord: #ae1800;
  --vz-erreurs: #ec3013;
  --vz-erreurs-bord: #ec3013;
  --vz-autres: #d7d3d3;
  --vz-autres-bord: #7d7979;
  width: min(1100px, calc(100vw - 48px));
  max-width: none; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  margin: auto; padding: 0; color: var(--esp-ink);
  background: var(--esp-panel);
  border: 1px solid var(--esp-n300); border-top: 2px solid var(--esp-ink); border-radius: 0;
  box-shadow: var(--esp-shadow-xl);
  overflow: hidden auto; overscroll-behavior: contain;
}
.vz-dlg[open] { display: flex; flex-direction: column; }
.vz-dlg::backdrop { background: var(--esp-scrim); }
.vz-dlg [hidden] { display: none !important; }
.vz-c-ok { --c: var(--vz-ok); --c-bord: var(--vz-ok-bord); }
.vz-c-redirections { --c: var(--vz-redirections); --c-bord: var(--vz-redirections-bord); }
.vz-c-erreurs { --c: var(--vz-erreurs); --c-bord: var(--vz-erreurs-bord); }
.vz-c-autres { --c: var(--vz-autres); --c-bord: var(--vz-autres-bord); }

.vz-dlg-tete { display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 8px 20px; position: sticky; top: 0; z-index: 1; background: var(--esp-panel); border-bottom: 1px solid var(--esp-n300); }
.vz-dlg-titres { flex: 1; min-width: 0; }
.vz-dlg-titre { margin: 4px 0 2px; font-size: 18px; font-weight: 800; text-transform: none; letter-spacing: .01em; overflow-wrap: anywhere; }
.vz-dlg-sous { margin: 0; font-size: 13px; color: var(--esp-muted); overflow-wrap: anywhere; }
.vz-dlg-fermer { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--esp-ink); font-size: 24px; line-height: 1; cursor: pointer; }
.vz-dlg-fermer:hover { background: var(--esp-n200); }
.vz-dlg-fermer:active { background: var(--esp-n300); }
.vz-dlg-fermer:focus-visible { outline: 2px solid var(--esp-accent); outline-offset: -2px; }

.vz-dlg-corps { padding: 12px 20px 18px; min-width: 0; }
.vz-dlg-expl { margin: 0 0 12px; }
.vz-dlg-reglages { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.vz-seg { display: inline-flex; flex-wrap: wrap; gap: 0; padding: 0; max-width: 100%; border: 1px solid var(--esp-n400); background: var(--esp-panel); }
.vz-seg button { min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-right: 1px solid var(--esp-n300); background: none; color: var(--esp-ink); font: 700 13px var(--esp-font); cursor: pointer; touch-action: manipulation; }
.vz-seg button:last-child { border-right: 0; }
.vz-seg button:active { background: var(--esp-n300); }
.vz-seg button[aria-pressed="true"] { color: #fff; background: var(--esp-ink); }
.vz-seg button:focus { outline: none; }
.vz-seg button:focus-visible { outline: 2px solid var(--esp-accent); outline-offset: -2px; }
.vz-dlg-periode { margin: 0 0 10px; font-size: 13px; color: var(--esp-muted); }
.vz-dlg-erreur { margin: 0 0 10px; color: var(--esp-danger); font-size: 13px; font-weight: 600; }
.vz-dlg-corps[aria-busy="true"] .vz-dlg-chiffres, .vz-dlg-corps[aria-busy="true"] .vz-dlg-graphe { opacity: .5; transition: opacity .2s; }

.vz-dlg-chiffres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .vz-dlg-chiffres { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
.vz-tuile { display: grid; align-content: start; gap: 3px; padding: 10px 12px; border: 1px solid var(--esp-n300); border-top: 2px solid var(--esp-ink); background: var(--esp-panel); min-width: 0; }
.vz-tuile-titre { font-size: 12px; font-weight: 800; color: var(--esp-muted); text-transform: uppercase; letter-spacing: .12em; }
.vz-tuile-valeur { font-family: var(--esp-font); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 800; color: var(--esp-ink); line-height: 1.15; overflow-wrap: anywhere; }
.vz-tuile-valeur.vz-mieux { color: var(--esp-ink); }
.vz-tuile-valeur.vz-moins { color: var(--esp-danger); }
.vz-tuile-valeur.vz-egal { color: var(--esp-muted); }
.vz-tuile-detail { font-size: 12px; color: var(--esp-muted); overflow-wrap: anywhere; }
.vz-repartition { display: flex; height: 8px; margin-top: 4px; overflow: hidden; background: var(--esp-n200); }
.vz-repartition i { display: block; height: 100%; width: 0; background: var(--c); box-shadow: inset 0 0 0 1px var(--c-bord, transparent); }

.vz-dlg-graphe { position: relative; height: 300px; margin-top: 14px; min-width: 0; }
.vz-dlg-graphe canvas { display: block; max-width: 100%; }
.vz-dlg-graphe canvas:focus { outline: none; }
.vz-dlg-graphe canvas:focus-visible { outline: 2px solid var(--esp-accent); outline-offset: 2px; }
.vz-dlg-sans { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; padding: 16px; text-align: center; color: var(--esp-muted); border: 1px dashed var(--esp-n500); }

.vz-legende { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vz-legende-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--esp-n400); background: var(--esp-panel); color: var(--esp-ink); font: 700 13px var(--esp-font); cursor: pointer; touch-action: manipulation; }
.vz-legende-btn:active { background: var(--esp-n300); }
.vz-legende-btn i { flex: none; width: 12px; height: 12px; background: var(--c); box-shadow: inset 0 0 0 1px var(--c-bord, transparent); }
.vz-legende-btn[aria-pressed="false"] { color: var(--esp-muted); text-decoration: line-through; }
.vz-legende-btn[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 2px var(--c-bord, var(--c)); }
.vz-legende-btn:focus { outline: none; }
.vz-legende-btn:focus-visible { outline: 2px solid var(--esp-accent); outline-offset: 1px; }
.vz-dlg-note { margin: 12px 0 0; }

@media (pointer: coarse) {
  .vz-seg button, .vz-legende-btn { min-height: 44px; min-width: 44px; }
}
/* Téléphone (et paysage écrasé) : la fenêtre prend tout l'écran. */
@media (max-width: 767px), (max-height: 500px) {
  .vz-dlg { width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border: 0; border-radius: 0; }
  .vz-dlg-tete { padding: 10px 6px 6px 16px; }
  .vz-dlg-corps { padding: 10px 16px 18px; }
  .vz-dlg-graphe { height: 240px; }
  .vz-tuile-valeur { font-size: 19px; }
  /* Au téléphone, le graphique d'abord (c'est ce qu'on vient voir), les chiffres ensuite. */
  .vz-dlg-corps { display: flex; flex-direction: column; }
  .vz-dlg-chiffres { order: 1; margin-top: 14px; }
  .vz-dlg-note { order: 2; }
}
@media (max-width: 400px) {
  .vz-long { display: none; }
  .vz-seg { flex: 1 1 100%; }
  .vz-seg button { flex: 1 1 0; padding: 4px 8px; }
}

/* ---------- DA Viseur dans le hub (10/11/2026) ----------
   Limité au BO par :where(body:not(.espace)) (spécificité nulle : la règle d'origine est reprise plus bas) ; l'espace
   garde ce qu'espace/trafic.css lui donne. Barres de la courbe à l'encre, impressions en accent, libellés de 12 px,
   champ de la clé JSON en 16 px (iOS ne zoome pas), lignes de la liste à liseré. */
:where(body:not(.espace)) .good-txt { color: var(--esp-ink); }
:where(body:not(.espace)) .vz-ligne { color: var(--esp-ink); }
:where(body:not(.espace)) .vz-ligne:hover { border-color: var(--esp-ink); }
:where(body:not(.espace)) .vz-ligne:active { background: var(--esp-n200); }
:where(body:not(.espace)) .vz-ligne-off { opacity: 1; color: var(--esp-muted); }
:where(body:not(.espace)) .vz-ligne-chiffres b { color: var(--esp-ink); }
:where(body:not(.espace)) .vz-form label { font-size: 13px; font-weight: 700; color: var(--esp-muted); }
:where(body:not(.espace)) .vz-form textarea, :where(body:not(.espace)) #vzCle { font-family: var(--esp-mono); font-size: 16px; }
:where(body:not(.espace)) .vz-periode { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-color: var(--esp-n400); background: var(--esp-panel); color: var(--esp-ink); font-size: 13px; font-weight: 700; }
:where(body:not(.espace)) .vz-periode:hover { border-color: var(--esp-ink); background: var(--esp-n200); }
:where(body:not(.espace)) .vz-periode.actif { border-color: var(--esp-ink); background: var(--esp-ink); color: #fff; }
:where(body:not(.espace)) .vz-kpi-lib, :where(body:not(.espace)) .vz-table th { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--esp-muted); }
:where(body:not(.espace)) .vz-table th { border-bottom: 2px solid var(--esp-ink); }
:where(body:not(.espace)) .vz-table { font-size: 13px; }
:where(body:not(.espace)) .vz-mieux { color: var(--esp-ink); }
:where(body:not(.espace)) .vz-moins { color: var(--esp-danger); }
:where(body:not(.espace)) .vz-barre { fill: var(--esp-ink); opacity: .8; }
:where(body:not(.espace)) .vz-ligne-imp { stroke: var(--esp-accent); }
:where(body:not(.espace)) .vz-axe, :where(body:not(.espace)) .vz-dates { font-size: 12px; color: var(--esp-muted); }
:where(body:not(.espace)) .vz-l-barre { background: var(--esp-ink); }
:where(body:not(.espace)) .vz-l-ligne { background: var(--esp-accent); }
:where(body:not(.espace)) .vz-mot { border-color: var(--esp-n300); background: var(--esp-panel); }
:where(body:not(.espace)) .vz-spark polyline { stroke: var(--esp-ink); stroke-width: 1.5; }
:where(body:not(.espace)) .vz-robot { border-bottom-color: var(--esp-n300); }
:where(body:not(.espace)) .vz-cron { border-color: var(--esp-n500); }
:where(body:not(.espace)) .vz-ligne-erreur { margin: 6px 0 0; font-weight: 600; overflow-wrap: anywhere; }
:where(body:not(.espace)) .vz-saut { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--esp-accent-text); }
:where(body:not(.espace)) .vz-saut:active { background: var(--esp-n300); }
