/* Styles de la page, servis à part sous /assets/ : la politique de sécurité refuse les balises de style dans les pages. */
  :root {
    --s1: #2a78d6; --s2: #eb6834; --s3: #138a62; --s4: #a87100; --s5: #c9567f; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
    --bg: #f7f7f5; --surface: #ffffff; --ink: #1d1d1b; --ink-2: #5c5c57; --muted: #6e6e69;
    --line: #e4e4df; --map-empty: #ebebe7; --input-border: #8c8c86; --bar: #2f6fb3; --bar-hover: #1f4f86; --err: #b3261e; --up: #1b7a3d; --down: #b3261e; --note: #a35f00; --cmp: #1d1d1b;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
      --bg: #151514; --surface: #1f1f1d; --ink: #ededea; --ink-2: #b4b4ae; --muted: #8f8f89;
      --line: #33332f; --map-empty: #2c2c29; --input-border: #6b6b66; --bar: #6ea3dc; --bar-hover: #9cc2ea; --err: #f2b8b5; --up: #7fd19b; --down: #f2b8b5; --note: #f0b44c; --cmp: #ededea;
    }
  }
  /* Thème choisi dans la page (bouton Thème), quel que soit le réglage du système. */
  :root[data-theme="dark"] {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --bg: #151514; --surface: #1f1f1d; --ink: #ededea; --ink-2: #b4b4ae; --muted: #8f8f89;
    --line: #33332f; --map-empty: #2c2c29; --input-border: #6b6b66; --bar: #6ea3dc; --bar-hover: #9cc2ea; --err: #f2b8b5; --up: #7fd19b; --down: #f2b8b5; --note: #f0b44c; --cmp: #ededea;
  }
  :root { color-scheme: light dark; } :root[data-theme="light"] { color-scheme: light; } :root[data-theme="dark"] { color-scheme: dark; }
  * { box-sizing: border-box; }
  a { color: var(--bar); }
  .filters select { max-width: 100%; }
  .jump { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
  .jump a { color: var(--ink-2); display: inline-flex; align-items: center; min-height: 24px; }
  .jump a:hover { color: var(--bar); }
  /* Impression / PDF : couleurs claires, tous les blocs dépliés, sans commandes ni temps réel. */
  #print-head { display: none; }
  body.share #tv-link, body.share #gsc-card { display: none; }
  @media print {
    :root {
      --bg: #ffffff; --surface: #ffffff; --ink: #1d1d1b; --ink-2: #5c5c57; --muted: #6e6e69;
      --line: #dcdcd6; --map-empty: #ebebe7; --input-border: #8c8c86; --bar: #2f6fb3; --bar-hover: #1f4f86; --err: #b3261e; --up: #1b7a3d; --down: #b3261e; --note: #a35f00; --cmp: #1d1d1b;
    }
    body { background: #fff; }
    .filters, .jump, #rt, #share-banner, .edit, .star, #seg-form, #filter-banner button, #section-banner button, .csv, button.ndel, .tip, #live, header .btn { display: none !important; }
    #print-head { display: block; margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
    #print-head b { color: var(--ink); font-size: 16px; }
    .card-body[hidden] { display: block !important; }
    button.fold-btn::before { display: none; }
    .card { break-inside: avoid; box-shadow: none; }
    .grid { grid-template-columns: 1fr 1fr; }
    details.sub > summary { list-style: none; }
    a { color: inherit; text-decoration: none; }
    /* Impression du bilan de l'année seul (bouton de sa fenêtre). */
    body.print-year > :not(#year) { display: none !important; }
    body.print-year #year { position: static; display: block; border: 0; padding: 0; max-width: none; width: auto; box-shadow: none; }
    body.print-year #year::backdrop { display: none; }
    body.print-year #year > :not(#year-frame):not(h2) { display: none !important; }
    body.print-year .year-frame { max-height: none; overflow: visible; border: 0; padding: 0; }
  }
  body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
  main { max-width: 1840px; margin: 0 auto; padding: 24px clamp(16px, 2.5vw, 40px) 48px; }
  /* Grand écran : blocs sur 12 colonnes (deux par ligne, quatre pour les petits tableaux), graphiques sur toute la largeur. */
  @media screen and (min-width: 1400px) {
    #single { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
    #single[hidden] { display: none; } /* « Tous les projets » : la grille ne doit pas faire réapparaître la vue d'un projet */
    #single > * { grid-column: 1 / -1; margin-top: 0 !important; margin-bottom: 0 !important; }
    #single > .card { grid-column: span 6; }
    #single > .grid { display: contents; }
    #single > .grid > .card { grid-column: span 3; }
    #single > .card.full { grid-column: 1 / -1; }
    #single > h2.sect { margin: 12px 0 0 !important; }
    /* Colonne de libellés : prend la place restante, coupée par « … » si besoin (pas de défilement dans les blocs étroits). */
    #single td.t:nth-child(-n+2) { max-width: 0; width: 100%; }
  }
  /* Objectifs (beaucoup de colonnes) : toute la largeur tant que deux blocs côte à côte seraient trop étroits. */
  @media screen and (min-width: 1400px) and (max-width: 1699px) {
    #single > #goals-card, #single > #funnels-card { grid-column: 1 / -1; }
  }
  :focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  /* Lien d'évitement : visible seulement au clavier, mène au verdict (après la barre de filtres). */
  .skip { position: absolute; left: 16px; top: -100px; z-index: 50; background: var(--surface); color: var(--bar); border: 1px solid var(--bar); border-radius: 8px; padding: 8px 12px; }
  .skip:focus { top: 12px; }
  .verdict:focus { outline: none; }
  .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; }
  h1 { font-size: 20px; margin: 0 0 16px; }
  /* h2 = titre de partie, h3 = titre de carte (le titre d'une carte isolée peut être un h2 avec le même style). */
  /* Blocs vides : masqués chez les clients, sans CSV partout. Explications repliées sous les tableaux. */
  body.readonly #single .card.is-empty, body.share #single .card.is-empty, .card.is-empty .csv { display: none !important; }
  details.how { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
  details.how > summary { cursor: pointer; width: fit-content; min-height: 24px; display: flex; align-items: center; color: var(--muted); }
  details.how > summary:hover { color: var(--bar); }
  details.how > p.hint { margin: 4px 0 0; }
  @media print { details.how > summary { display: none; } }
  /* Verdict : une phrase en tête (le chiffre dans la phrase), le « pourquoi » dessous, le temps réel en une ligne. */
  .verdict { margin: 4px 0 20px; max-width: 70ch; }
  .verdict-title { margin: 0; font-size: clamp(19px, 2.4vw, 24px); line-height: 1.3; font-weight: 500; text-wrap: balance; }
  .verdict-title b { font-weight: 700; font-variant-numeric: tabular-nums; }
  /* Place de la phrase réservée avant l'arrivée des chiffres (deux lignes, trois sur téléphone) : rien ne saute dessous. */
  .verdict-title { min-height: calc(1.3em * 2); }
  @media (max-width: 600px) { .verdict-title { min-height: calc(1.3em * 3); } }
  .explain { margin: 8px 0 0; font-size: 15px; color: var(--ink-2); }
  .explain b { font-weight: 600; color: var(--ink); }
  .rt-line { margin: 10px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
  .rt-line:empty { display: none; }
  .rt-line .rt-dot { margin: 0; top: 0; }
  /* Projet silencieux : le verdict devient l'alerte (titre en couleur d'erreur, le texte le dit aussi), détails à l'encre
     dans un encadré complet (pas de liseré). */
  .verdict.is-silent .verdict-title { color: var(--err); font-weight: 600; }
  .ov-alert { color: var(--err); font-weight: 600; }
  .silent-alert { margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--err); border-radius: 10px; background: var(--surface); font-size: 15px; }
  .silent-alert p { margin: 0; } .silent-alert p + p { margin-top: 6px; }
  /* Clients (accès en lecture, lien de partage) : temps réel en une ligne sous le verdict, pas de messages pour
     l'administrateur. L'administrateur garde le bloc complet. */
  body:not(.readonly):not(.share) .rt-line { display: none; }
  body.readonly #rt, body.share #rt, body.readonly #news-banner { display: none !important; }
  /* Machinerie réservée à l'administrateur : consignes d'intégration, colonne IP, personnalisation, liens de campagne,
     trafic suspect. */
  body.readonly .dev, body.share .dev, body.readonly .ip, body.readonly #layout-btn, body.readonly #utm-card,
  body.readonly #susp-card, body.readonly #views-btn { display: none !important; }
  /* Téléphone : temps réel en une ligne sous la synthèse pour tous (le bloc complet la repousserait d'un écran ; il reste
     dans « Tous les projets ») ; ni raccourcis clavier ni mode écran dans « Plus ». */
  @media (max-width: 600px) {
    #app:has(#single:not([hidden])) #rt { display: none; }
    body #single .rt-line:not(:empty) { display: flex; }
    #keys-btn, #tv-link { display: none; }
  }
  /* Toutes les boîtes de dialogue (y compris recherche, fiche, nouveautés, notifications) : mêmes bords, fond et marges. */
  dialog { max-width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 20px 24px; }
  dialog::backdrop { background: rgb(0 0 0 / .4); }
  dialog h2 { margin: 0 0 12px; font-size: 18px; }
  dialog#views { width: min(520px, calc(100vw - 32px)); box-sizing: border-box; }
  .glossary dt { font-weight: 600; margin-top: 10px; }
  .glossary dd { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
  dialog#glossary { max-height: 85vh; overflow: auto; }
  .tile { position: relative; }
  .help-btn { font-family: system-ui, sans-serif; font-variant-emoji: text; position: absolute; top: 4px; right: 4px; border: 0; background: none; color: var(--muted); font-size: 15px; padding: 0; min-height: 28px; min-width: 28px; cursor: pointer; }
  .help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--bar); }
  .help-text { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); }
  dialog#year { width: min(720px, calc(100vw - 32px)); box-sizing: border-box; }
  /* Accueil du téléphone : seulement le site, la période et le menu ; le reste revient avec le tableau de bord complet. */
  body.phone-home #compare, body.phone-home #cmp-dates, body.phone-home .filters label.toggle, body.phone-home #views-btn, body.phone-home #layout-btn,
  body.phone-home #setup-warn { display: none !important; }
  .home-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .home-banner .linkish { all: unset; cursor: pointer; text-decoration: underline; font-size: 13px; color: var(--ink-2); min-height: 24px; }
  .home-banner .linkish:focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  .notif-state { font-weight: 600; }
  #notif-devices ul { margin: 6px 0; padding-left: 20px; }
  .ps-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 8px 0 12px; }
  .ps-kpis div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
  .ps-kpis b { display: block; font-size: 20px; }
  .ps-kpis span { font-size: 12px; color: var(--ink-2); }
  .ps-kpis span.d { display: block; margin-top: 2px; }
  .ps-vs { margin: 8px 0; }
  #ps-cmp-out { overflow-x: auto; }
  .news-item h3 { margin: 16px 0 4px; font-size: 16px; }
  .news-item ul { margin: 4px 0; padding-left: 20px; }
  .news-item li { margin: 4px 0; }
  .ps-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
  .ps-cols ol { margin: 4px 0; padding-left: 20px; font-size: 14px; }
  #ps-chart { display: block; width: 100%; height: 70px; }
  #ps-chart rect { fill: var(--bar); }
  #search-q { width: 100%; font-size: 16px; }
  .search-results { list-style: none; padding: 0; margin: 8px 0 12px; max-height: 50vh; overflow-y: auto; }
  .search-results button { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 24px; }
  .search-results button:focus-visible, .search-results button:hover { background: var(--bg); outline: 2px solid var(--bar); outline-offset: -2px; }
  .search-results .kind { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
  dialog.wide { width: min(760px, calc(100vw - 32px)); max-width: calc(100vw - 32px); box-sizing: border-box; }
  .year-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
  #year-shared input { width: 100%; }
  .year-frame { max-height: min(70vh, 640px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #1d1d1b; padding: 16px; }
  .phone-qr svg { display: block; width: min(260px, 70vw); height: auto; margin: 8px auto; border-radius: 8px; }
  .phone-qr.expired svg { opacity: .15; }
  dialog#phone label { display: grid; gap: 4px; font-size: 14px; }
  dialog#phone input { width: 100%; box-sizing: border-box; font-size: 12px; }
  dialog#layout { width: min(560px, calc(100vw - 32px)); box-sizing: border-box; }
  .lay-sect { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .lay-sect h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 15px; }
  .lay-sect h3 span { flex: 1; }
  .lay-sect label { display: inline-flex; gap: 6px; align-items: center; margin: 2px 14px 2px 0; font-size: 14px; }
  .lay-hidden { display: none !important; }
  /* L'essentiel : chiffres clés, graphique, objectifs, pages et sites d'origine seulement. */
  body.essential #single .tile:not(.ess),
  body.essential #single .card:not(.tile):not(.ess), body.essential #single h2.sect, body.essential .jump,
  body.essential #quality, body.essential #fold-all, body.essential #unfold-all { display: none !important; }
  /* Temps réel sans personne (projet ouvert) : la ligne sous la synthèse suffit, pour tous. */
  #app:has(#single:not([hidden])) #rt.idle { display: none; }
  body:has(#rt.idle) #single .rt-line:not(:empty) { display: flex; }
  #essential-btn[aria-pressed="true"] { background: var(--bar); color: var(--surface); border-color: var(--bar); }
  .views-list { list-style: none; margin: 0 0 12px; padding: 0; }
  .views-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .views-list a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  #views-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
  #views-form label { flex: 1 1 220px; display: grid; gap: 4px; }
  dl.keys { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 12px; }
  dl.keys dt { white-space: nowrap; } dl.keys dd { margin: 0; }
  kbd { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 6px; border: 1px solid var(--input-border); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }
  .tg-item { margin: 6px 0 10px; }
  .tg-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
  .tg-bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin: 4px 0; }
  .tg-bar span { display: block; height: 100%; background: var(--bar); border-radius: 5px; }
  .tg-item.done .tg-bar span { background: var(--up); }
  .tg-note { font-size: 13px; color: var(--ink-2); margin: 0; }
  .forecast { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
  .forecast p { margin: 0 0 6px; font-size: 14px; }
  .forecast p.fc-how { margin: 4px 0 0; font-size: 12px; white-space: normal; }
  #fc-chart { display: block; width: 100%; height: 64px; }
  #fc-chart[hidden], .forecast p.fc-how[hidden] { display: none; }
  #fc-chart .real { fill: var(--bar); }
  #fc-chart .proj { fill: none; stroke: var(--bar); stroke-width: 1.5; stroke-dasharray: 3 2; }
  #yoy-chart { display: block; width: 100%; height: 90px; }
  #yoy-chart .cur { fill: var(--bar); }
  #yoy-chart .prev { fill: none; stroke: var(--muted); stroke-width: 1.5; }
  .yoy-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; background: var(--bar); }
  .yoy-key.prev { background: none; border: 1.5px solid var(--muted); box-sizing: border-box; }
  .yoy-months { display: grid; grid-template-columns: repeat(12, 1fr); text-align: center; font-size: 11px; color: var(--muted); margin-top: 2px; }
  #t-yoy, #t-years, #fx-out { overflow-x: auto; }
  /* Années superposées : l'année en cours en trait plein épais, les précédentes en traits plus fins et pointillés différents. */
  #years-chart { display: block; width: 100%; height: auto; overflow: visible; }
  #years-chart .grid-line { stroke: var(--line); }
  #years-chart text { font-size: 11px; fill: var(--muted); }
  #years-chart .yl { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
  #years-chart .yl.y0 { stroke: var(--bar); stroke-width: 3; }
  #years-chart .yl.y1 { stroke: var(--note); stroke-dasharray: 6 3; }
  #years-chart .yl.y2 { stroke: var(--muted); stroke-dasharray: 2 3; }
  #years-chart .yl.y3 { stroke: var(--muted); stroke-dasharray: 8 3 2 3; opacity: .8; }
  #years-chart .yl.y4 { stroke: var(--muted); stroke-dasharray: 1 4; opacity: .7; }
  #years-chart text.yt { font-weight: 600; }
  #years-chart text.y0 { fill: var(--bar); } #years-chart text.y1 { fill: var(--note); }
  .years-sw { display: inline-block; width: 22px; vertical-align: 3px; border-top: 2px solid var(--muted); margin: 0 4px 0 10px; }
  .years-sw.y0 { border-top: 3px solid var(--bar); } .years-sw.y1 { border-top: 2px dashed var(--note); } .years-sw.y2, .years-sw.y4 { border-top-style: dotted; }
  .ovc { position: relative; margin: 16px 0 4px; }
  .ovc > svg { display: block; width: calc(100% - 146px); height: 200px; overflow: visible; margin-left: 36px; }
  .ovc .axis { margin-left: 36px; }
  .ovc .grid { stroke: var(--line); stroke-dasharray: 2 4; }
  .ovc .ytick { position: absolute; left: 0; width: 30px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ovc polyline { fill: none; stroke-width: 2; stroke-linejoin: miter; stroke-linecap: butt; }
  .ovc .base { stroke: var(--line); }
  .ovc .cross { stroke: var(--muted); stroke-width: 1; }
  .ovc .end { position: absolute; left: calc(100% - 104px); transform: translateY(-50%); font-size: 12px; color: var(--ink-2); white-space: nowrap; max-width: 104px; overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 600px) { .ovc > svg, .ovc .axis { width: calc(100% - 36px) !important; } .ovc .end { display: none; } }
  .ovc .legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
  .ovc .legend .sw { vertical-align: middle; margin-right: 6px; }
  .ovc .ov-days { margin-top: 8px; }
  /* Fiche : titre et « Fermer » collés en haut pendant le défilement (téléphone : la fiche dépasse l'écran). */
  .ps-head { position: sticky; top: -20px; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    margin: -20px -24px 8px; padding: 20px 24px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .ps-head h2 { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ps-head h2:focus { outline: none; }
  .ps-x { flex: none; min-width: 44px; min-height: 44px; font-size: 22px; line-height: 1; padding: 0; }
  .ovc .ov-table { overflow-x: auto; max-height: 360px; overflow-y: auto; }
  h2.sect { font-size: 19px; margin: 36px 0 10px; color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
  h3, .card > h2, .card-head h2 { font-size: 14px; margin: 0 0 12px; color: var(--ink-2); font-weight: 600; }
  .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
  /* Comparaison et filtres : en ligne sur ordinateur ; repliés sous « Comparer et filtrer » sur téléphone. */
  .view-opts, .view-opts-list { display: contents; }
  .view-opts > summary.btn { display: none; list-style: none; cursor: pointer; }
  .view-opts > summary::-webkit-details-marker { display: none; }
  #reset-view[hidden] { display: none; }
  @media (max-width: 600px) {
    .view-opts { display: block; }
    .view-opts[open] { flex-basis: 100%; }
    .view-opts > summary.btn { display: inline-flex; align-items: center; }
    .view-opts > summary::after { content: ' ▾'; white-space: pre; }
    .view-opts[open] > summary::after { content: ' ▴'; }
    .view-opts-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  }
  select, input, button { font: inherit; padding: 6px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--surface); color: var(--ink); }
  button { cursor: pointer; }
  /* Pendant un chargement : contenu précédent estompé (aria-busy sur <main>). */
  #single, #overview { transition: opacity .2s; }
  main[aria-busy="true"] #single, main[aria-busy="true"] #overview { opacity: .55; }
  @media (prefers-reduced-motion: reduce) { #single, #overview { transition: none; } }
  /* 5 chiffres par rangée au plus (10 tuiles : 5 + 5 plutôt que 7 + 3), 2 sur téléphone. */
  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(160px, 18%), 1fr)); gap: 12px; margin-bottom: 16px; }
  .card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; overflow-x: auto; }
  .tile .v { padding-right: 18px; font-size: clamp(21px, 6.4vw, 28px); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .tile .l { color: var(--ink-2); font-size: 13px; }
  @media (max-width: 480px) { .tile .v { font-size: clamp(18px, 5.2vw, 28px); } }
  /* Place réservée aux évolutions et à la légende : pas de décalage de la page quand les chiffres arrivent. */
  .tile .d { min-height: 2.6em; }
  .tile .d:empty { min-height: 0; } /* pas de comparaison : pas d'espace réservé */
  .setup-list { display: inline-flex; flex-wrap: wrap; gap: 0 16px; margin: 0; padding: 0; list-style: none; }
  @media (min-width: 1000px) { table:not(.sh) td.t { max-width: 420px; } }
  @media screen and (min-width: 1400px) { body.essential #single > #goals-card { grid-column: 1 / -1; } } /* seul sur sa ligne en « L’essentiel » */
  #legend { min-height: 2.8em; }
  /* Blocs hors de l'écran : rendus seulement à l'approche (page longue, téléphones lents). */
  #single .card:not(.tile) { content-visibility: auto; contain-intrinsic-size: auto 200px; }
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-top: 12px; }
  .grid > * { min-width: 0; overflow-x: auto; }
  .chart { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
  .chart.dense { gap: 0; }
  /* Échelle verticale des graphiques à colonnes : graduations rondes dans une marge à gauche, traits discrets derrière les barres. */
  .chart.scaled { margin-left: 44px; }
  .chart.scaled + .axis { margin-left: 44px; }
  .chart.scaled .tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--line); pointer-events: none; z-index: 0; }
  .chart.scaled .tick.zero { border-top: 0; }
  .chart.scaled .tick span { position: absolute; right: calc(100% + 6px); transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
  .chart.scaled .col { z-index: 1; }
  .chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; }
  /* Jour annoté : trait pointillé vertical et losange sous l'axe. */
  .chart .col.note::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--note); }
  .chart .col.note::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 8px; height: 8px; background: var(--note); transform: translateX(-50%) rotate(45deg); }
  /* Jours sans visite d'un projet silencieux : hachures fines à l'encre discrète (lisibles en clair et en sombre). */
  .chart .col.quiet { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--muted) 5px 6px); }
  .chart .col.future { opacity: .35; background: repeating-linear-gradient(90deg, transparent 0 3px, var(--line) 3px 4px); }
  .chart .col span { display: block; width: 100%; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 1px; }
  .chart.dense .col span { border-radius: 0; }
  .chart .col:hover span { background: var(--bar-hover); }
  .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 10px; }
  .dates { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); }
  .dates[hidden] { display: none; }
  .dates label, label.toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink-2); min-height: 24px; }
  /* Comparaison détaillée : trait de la période comparée sur chaque barre. */
  .chart .col i.cmp { position: absolute; left: 0; right: 0; border-top: 2px solid var(--cmp); pointer-events: none; }
  .legend .sw { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin: 0 4px 0 0; }
  .legend .sw.cur { background: var(--bar); border-radius: 2px; }
  .legend .sw.cmp { border-top: 2px solid var(--cmp); height: 0; vertical-align: 3px; margin-left: 12px; }
  /* Lien de partage (lecture seule) : ni administration, ni modification, ni données par visiteur. */
  /* Accès en lecture seule (jeton « read ») : pas de modification ni de paramètres, mais tout le reste. */
  body.share .admin, body.share .private, body.share [data-csv="events"], body.share .edit, body.share #section-clear,
  body.readonly .edit, body.readonly .settings-link { display: none !important; }
  /* Accordéons : le titre de chaque carte est un bouton qui la replie ou la déplie. */
  button.fold-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 24px; cursor: pointer; border-radius: 4px; }
  button.fold-btn:focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  button.fold-btn::before { content: ''; flex: none; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
  button.fold-btn[aria-expanded="false"]::before { transform: rotate(-45deg); }
  button.fold-btn:hover { color: var(--ink); }
  .card.folded .card-head h2, .card.folded .card-head h3, .card.folded > h2, .card.folded > h3 { margin-bottom: 0; }
  .card.folded .card-head > :not(h2):not(h3) { display: none; }
  .grid { align-items: start; }
  @media (prefers-reduced-motion: reduce) { button.fold-btn::before { transition: none; } }
  @media (pointer: coarse) { button.fold-btn { min-height: 44px; } }
  .vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 12px; }
  .vital { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
  .vital .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
  .vital .l { font-size: 13px; color: var(--ink-2); }
  .vital .r { font-size: 12px; font-weight: 600; }
  .vdist { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin: 6px 0 4px; background: var(--line); }
  .vdist span { display: block; height: 100%; }
  .vg { color: var(--up); } .vn { color: var(--note); } .vp { color: var(--down); }
  .vdist .vg { background: var(--up); } .vdist .vn { background: var(--note); } .vdist .vp { background: var(--down); }
  td .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
  .funnel { margin: 0 0 16px; }
  .funnel h4 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; margin: 0 0 6px; }
  .funnel h4 .d { display: inline; }
  .fstep { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 4px 0; font-size: 14px; }
  .fstep .num { color: var(--muted); font-variant-numeric: tabular-nums; }
  .fstep .bar { grid-column: 2 / 4; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
  .fstep .bar span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
  .fstep .drop { grid-column: 2 / 4; font-size: 12px; color: var(--down); }
  .fu-steps { padding-left: 1.4em; margin: 10px 0; }
  .fu-steps li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
  .fu-steps input { flex: 1 1 160px; min-width: 0; }
  label.fu-name { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); max-width: 360px; }
  h4.sub, h3.sub { font-size: 13px; margin: 16px 0 6px; color: var(--ink-2); font-weight: 600; }
  .card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .card-head h2, .card-head h3 { min-width: 0; }
  button.csv { font-size: 12px; padding: 2px 8px; color: var(--ink-2); white-space: nowrap; flex-shrink: 0; min-height: 24px; }
  /* Cibles d'au moins 24 px (WCAG 2.5.8) : liens isolés des bandeaux et de l'alerte, identifiants de visite. */
  #setup-warn a, .silent-alert a, p > a.settings-link { display: inline-block; min-height: 24px; line-height: 24px; }
  .ps-axis { display: flex; justify-content: space-between; gap: 8px; }
  #t-overview button.rowlink { color: var(--bar); text-decoration: underline; text-underline-offset: 2px; }
  #legend, #chart-legend, #imported-note { max-width: 80ch; }
  button.linkish.undo { margin-left: 4px; }
  ul.notes { list-style: none; padding: 0; margin: 12px 0 0; }
  ul.notes:empty { display: none; }
  ul.notes li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
  ul.notes li::before { content: '◆'; color: var(--note); font-size: 11px; }
  /* Objectifs suggérés : le bouton passe à la ligne sur un écran étroit (jamais coupé). */
  #goal-suggest ul.notes li { flex-wrap: wrap; }
  #goal-suggest ul.notes li .btn { margin-left: auto; }
  ul.notes .when { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 8.5em; }
  ul.notes .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  #tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 8px; border-radius: 6px; display: none; white-space: nowrap; z-index: 10; }
  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
  th { color: var(--muted); font-weight: 500; font-size: 12px; }
  td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
  td.t { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .empty { color: var(--muted); font-size: 13px; }
  .d { font-size: 12px; margin-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .d.up { color: var(--up); } .d.down { color: var(--down); }
  td .d { display: block; }
  @media (max-width: 600px) { .ov-clicks { display: none; } }
  /* Téléphone : lignes empilées (stackTables) ; en-têtes gardés pour les lecteurs d'écran, intitulé devant chaque valeur. */
  @media (max-width: 480px) {
    table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    table.stack, table.stack tbody { display: block; }
    table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    table.stack td { display: block; border: 0; padding: 0; text-align: left; max-width: none; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
    table.stack td.lead { grid-column: 1 / -1; order: -1; font-weight: 600; }
    table.stack td[data-label]:not(.lead)::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
    table.stack td.bar, table.stack td:empty { display: none; }
    /* Actions (☆, fiche, ce qui y mène) : en bas de la ligne, à leur taille, sans intitulé ; cibles de 44 px. */
    table.stack td.act { grid-column: 1 / -1; order: 1; width: auto; text-align: left; white-space: normal; }
    table.stack td.act :is(button, a) { min-height: 44px; min-width: 44px; }
    #t-recent table.stack td { white-space: normal; }
  }
  .silent { color: var(--down); font-weight: 600; white-space: nowrap; }
  details.sub summary { cursor: pointer; }
  details.sub ul { margin: 4px 0 2px; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
  details.fold > summary { cursor: pointer; color: var(--ink-2); font-size: 14px; font-weight: 600; min-height: 24px; display: list-item; line-height: 24px; }
  details.fold[open] > summary { margin-bottom: 12px; }
  tr.link { cursor: pointer; } tr.link:hover td, tr.sel td { background: var(--bg); }
  /* Bouton d'ouverture d'une ligne : même aspect que le texte de la cellule, mais accessible au clavier. */
  button.rowlink { border: 0; background: none; padding: 0; min-height: 24px; min-width: 24px; color: inherit; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  tr.link:hover button.rowlink, button.rowlink:focus-visible { text-decoration: underline; }
  .hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
  .quality { margin: -8px 0 16px; font-size: 13px; color: var(--ink-2); }
  .quality button.rowlink { font-size: 13px; }
  .np-timing { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--bar); background: var(--bg); border-radius: 6px; font-size: 14px; }
  .err { color: var(--err); }
  .msg { font-size: 13px; margin: 8px 0 0; }
  .msg:empty, #recent-filter:empty { display: none; }
  .map svg { display: block; width: 100%; height: auto; max-height: 460px; }
  .map path { stroke: var(--surface); stroke-width: .6; }
  .map path:hover { stroke: var(--ink); stroke-width: 1.2; }
  .map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
  .map-legend .d { margin: 0; }
  .map-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
  .map-legend .sw { width: 14px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }
  table.seg th { white-space: normal; }
  @media (max-width: 480px) { table.seg { font-size: 13px; } table.seg th, table.seg td { padding-left: 2px; padding-right: 2px; } }
  .seg-pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
  .seg-pages ol { margin: 4px 0 0; padding-left: 20px; font-size: 14px; }
  .seg-pages li { margin: 2px 0; overflow-wrap: anywhere; }
  .banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--bar); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
  .banner.warn { border-color: var(--note); }
  /* Menu « Plus » : actions moins fréquentes (lien, impression, écran, thème, raccourcis, déconnexion). */
  .more-menu { position: relative; }
  .more-menu > summary { list-style: none; cursor: pointer; }
  .more-menu > summary::-webkit-details-marker { display: none; }
  .more-menu > summary::after { content: ' ▾'; white-space: pre; }
  .more-menu[open] > summary::after { content: ' ▴'; }
  .more-list { position: absolute; right: 0; z-index: 20; margin-top: 6px; display: grid; gap: 6px; min-width: 220px; padding: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .15); }
  /* Menu « Plus » : groupes nommés, lignes de menu (pas une pile de boutons). */
  .more-list { gap: 4px; }
  .more-g { display: grid; gap: 0; }
  .more-g + .more-g { border-top: 1px solid var(--line); padding-top: 4px; }
  .more-h { margin: 4px 10px 2px; font-size: 12px; color: var(--muted); }
  .more-g > button, .more-g > a.btn { border: 0; background: none; border-radius: 6px; padding: 8px 10px; text-align: left; justify-content: flex-start; color: var(--ink); font: inherit; min-height: 36px; }
  .more-g > button:hover, .more-g > a.btn:hover { background: var(--bg); }
  .more-g:not(:has(> :is(button, a):not([hidden]))) { display: none; }
  /* Téléphone : « Paramètres » passe dans « Plus › Compte » (place pour « Rechercher » dans la barre). */
  @media (min-width: 601px) { .phone-only { display: none !important; } }
  @media (max-width: 600px) { .wide-only { display: none !important; } }
  @media (max-width: 600px) { .more-menu { position: static; } .more-list { left: 16px; right: 16px; min-width: 0; } }
  .banner.warn a { color: var(--ink); }
  button.linkish { all: unset; cursor: pointer; text-decoration: underline; color: var(--ink-2); font-size: 13px; }
  button.linkish:focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  .banner button { padding: 4px 10px; }
  .banner[hidden], .banner:empty { display: none; }
  .banner.alert { border-color: var(--err); }
  .banner.alert span { color: var(--err); }
  .star, .ndel { border: 0; background: none; padding: 0 4px; min-width: 24px; min-height: 24px; color: var(--muted); font-size: 15px; line-height: 1; }
  .star:hover, .ndel:hover { color: var(--bar); }
  .star.on { color: var(--bar); cursor: default; }
  .star[data-gdel] { font-size: 13px; color: var(--err); text-decoration: underline; text-underline-offset: 2px; }
  /* Actions d'une ligne (fiche d'un segment, ce qui mène à un objectif) : reconnaissables comme des liens. */
  button.rowlink[data-seg-dim], button.rowlink[data-goal] { color: var(--bar); text-decoration: underline; text-underline-offset: 2px; }
  button.danger { color: var(--err); border-color: var(--err); }
  .star.armed, button.armed { color: var(--err); border: 1px solid var(--err); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
  td.act { width: 1%; white-space: nowrap; text-align: right; }
  .goal-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
  .goal-form .full { grid-column: 1 / -1; }
  #utm-preview { display: block; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 13px; }
  #t-utm { overflow-x: auto; }
  #t-utm .utm-copy { margin-right: 4px; }
  .goal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
  .goal-form input, .goal-form select { width: 100%; }
  .goal-form [hidden] { display: none; }
  .goal-form label.inline { flex-direction: row; align-items: center; gap: 6px; align-self: center; }
  .goal-form input[type="checkbox"] { width: auto; }
  .gdesc { display: block; color: var(--muted); font-size: 12px; }
  td.act button + button { margin-left: 4px; }
  .ok { color: var(--up); }
  td.bar { width: 26%; min-width: 48px; }
  table.sh td.t { max-width: 150px; }
  td.n, th.n { white-space: nowrap; }
  details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 6px; }
  .meter { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
  .meter span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
  .heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 11px; color: var(--muted); }
  .heat div { min-height: 18px; border-radius: 3px; }
  .heat .c { background: var(--line); cursor: default; }
  .heat .hx { text-align: center; }
  .heat .dl { align-self: center; }
  .scroll { max-height: 520px; overflow: auto; }
  #t-recent td { font-size: 13px; white-space: nowrap; }
  #t-recent td.t { max-width: 200px; }
  .tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
  button.vid { font-family: ui-monospace, monospace; font-size: inherit; border: 0; background: none; padding: 0; color: inherit; text-decoration: underline dotted; min-height: 24px; min-width: 24px; }
  a.btn, summary.btn { display: inline-flex; align-items: center; padding: 6px 10px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none; }
  a.btn:hover, summary.btn:hover { border-color: var(--bar); }
  summary.btn:focus-visible { outline: 2px solid var(--bar); outline-offset: 2px; }
  /* Temps réel */
  #rt { margin-bottom: 16px; }
  #rt-title { font-size: 14px; margin: 0 0 12px; color: var(--ink-2); font-weight: 600; }
  .rt-top { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 16px; align-items: end; }
  .rt-top.solo { grid-template-columns: 1fr; }
  @media (max-width: 600px) { .rt-top { grid-template-columns: 1fr; } }
  .rt-now .v { font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .rt-now .l { color: var(--ink-2); font-size: 14px; }
  .rt-now .hint { margin: 2px 0 0; }
  .tag.me { background: var(--bar); color: var(--surface); margin-left: 6px; }
  .rt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--up); margin-right: 8px; vertical-align: middle; position: relative; top: -3px; }
  .rt-dot[hidden] { display: none; }
  @media (prefers-reduced-motion: no-preference) {
    .rt-dot { animation: rt-pulse 2s ease-in-out infinite; }
    @keyframes rt-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 45%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
  }
  .chart.rt-chart { height: 64px; gap: 2px; }
  .chart.rt-chart .col span { border-radius: 2px 2px 0 0; }
  .rt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; margin-top: 16px; }
  .rt-grid[hidden], #rt-chart-wrap[hidden] { display: none; }
  .rt-grid h3 { margin-bottom: 6px; }
  /* Place réservée avant l'arrivée des chiffres : la page ne saute pas au chargement. */
  @media (min-width: 900px) { #rt-detail > div { min-height: 180px; } }
  .rt-grid table { font-size: 13px; }
  .rt-grid td { padding: 4px; }
  ul.rt-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
  ul.rt-list li { display: flex; gap: 6px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--line); min-width: 0; }
  ul.rt-list .when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  ul.rt-list .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #rt-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
  #rt-err { margin: 8px 0 0; }
  #rt-err:empty { display: none; }
  #rt-overview table { margin-top: 12px; }
  footer { color: var(--muted); font-size: 12px; margin-top: 32px; }
  footer a { color: inherit; }
  #login { max-width: 360px; }
  #login input { width: 100%; margin: 8px 0; }
  /* Écrans tactiles : cibles d'au moins 44 px. */
  @media (pointer: coarse) {
    select, input:not([type="checkbox"]), button, a.btn, summary.btn { min-height: 44px; }
    .star, .ndel, button.vid, button.rowlink { min-width: 44px; }
    summary { padding-block: 12px; }
  }
