/* ==========================================================================
   asset/style.css — STYLE COMMUN
   Chargé par TOUTES les pages du site, sans exception, avant toute feuille de page.
   Contient : tokens (thèmes clair et sombre), base, composants, modules de jeu.
   Aucune règle propre à une page ne doit s’y trouver.
   ========================================================================== */
/* Repères de lecture :
 * 01 Thèmes et base ; 02 Bandeau et actions ; 03 Cartes et données ;
 * 04 Navigation ; 05 Modules du cockpit ; 06 Contrôles et formulaires ;
 * 07 Feedback ; 08 Sous-menus ; 09 Ajustements V3 ; 10 Palette.
 * Les compléments en fin de fichier précisent la base : conserver leur ordre.
 * Les aperçus [data-preview-theme] utilisent les mêmes palettes que le document.
 * Contrats : --p = progression en pourcentage ; --c = couleur sémantique locale.
 */
@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
/* ==========================================================================
   01 — THÈMES ET BASE : tokens actifs, typographie et enveloppe de page
   ========================================================================== */
:root, [data-preview-theme="light"] {
    color-scheme: light;
    --bg: var(--light-bg);
    --card: var(--light-card);
    --raise: var(--light-bg);
    --fill: var(--light-fill);
    --hair: var(--light-hair);
    --bar: rgba(245,245,247,.85);
    --ink: var(--light-ink);
    --ink-2: var(--light-ink-muted);
    --ink-3: var(--light-ink-muted);
    --blue: var(--light-blue);
    --pink: var(--light-pink);
    --ok: var(--light-ok);
    --warn: var(--light-warn);
    --bad: var(--light-bad);
    --c-info: #4ac0ff;
    --c-mag: #fb7185;
    --c-div: #f6c453;
    --c-fic: #a78bfa;
    --c-spo: #26b077;
    --c-doc: #22d3ee;
    --r-card: 14px;
    --r-ctl: 8px;
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 56px;
    --shadow: 0 1px 2px rgba(0,0,0,.04);
    --f-head: "Barlow Condensed","Arial Narrow",sans-serif;
    --f-ui: "Barlow",system-ui,sans-serif;
    --f-mono: "JetBrains Mono",ui-monospace,Consolas,monospace;
}

:root[data-theme="dark"], [data-preview-theme="dark"] {
    color-scheme: dark;
    --bg: var(--dark-bg);
    --card: var(--dark-card);
    --raise: var(--dark-raise);
    --fill: var(--dark-fill);
    --hair: var(--dark-hair);
    --bar: rgba(11,11,13,.85);
    --ink: var(--light-bg);
    --ink-2: var(--dark-ink-muted);
    --ink-3: var(--dark-ink-muted);
    --blue: var(--dark-blue);
    --pink: var(--dark-pink);
    --ok: var(--dark-ok);
    --warn: var(--dark-warn);
    --bad: var(--dark-bad);
    --shadow: none;
}

* {
    box-sizing: border-box
}

:root {
    padding-top: env(safe-area-inset-top,0px)
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 16px/1.5 var(--f-ui);
    -webkit-font-smoothing: antialiased
}

h1,h2,p,ul {
    margin: 0;
    padding: 0
}

.mono {
    font-family: var(--f-mono);
    font-variant-numeric: tabular-nums
}

.cap {
    font: 600 12px/1 var(--f-ui);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--s5) calc(var(--s7) + env(safe-area-inset-bottom,0px))
}

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

/* ==========================================================================
   02 — BANDEAU ET ACTIONS : identité, timecode de démonstration et boutons
   ========================================================================== */
.top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hair)
}

.top__in {
    max-width: 1200px;
    margin: 0 auto;
    height: 56px;
    padding: 0 var(--s5);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s3);
    font: 600 21px/1 var(--f-head);
    letter-spacing: .02em
}

.brand svg {
    width: 28px;
    height: 28px
}

.tc {
    display: flex;
    align-items: center;
    gap: var(--s3);
    font: 400 15px/1 var(--f-mono);
    color: var(--ink-2)
}

.air {
    padding: var(--s1) var(--s2);
    border: 1px solid var(--pink);
    border-radius: var(--r-air);
    color: var(--pink);
    font: 600 11px/1 var(--f-head);
    letter-spacing: .16em
}

.live {
    /* Le voyant reste visible entre les pulsations et ne se rétrécit pas en flex. */
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--pink);
    animation: breathe 3.6s ease-in-out infinite
}

@keyframes breathe {
    0%,100% {
        opacity: .25
    }
    50% {
        opacity: 1
    }
}

/* Accessibilité : respect de la préférence de réduction du mouvement. */
@media (prefers-reduced-motion:reduce) {
    .live {
        animation: none
    }
}

.right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--s4);
    font-size: 14px;
    color: var(--ink-2)
}

.btn {
    height: var(--control-h);
    padding: 0 var(--s5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--r-ctl);
    background: var(--fill);
    color: var(--ink);
    font: 500 15px/1 var(--f-ui);
    cursor: pointer;
    transition: background var(--duration-ui)
}

.btn:hover {
    background: color-mix(in srgb,var(--ink) 12%,transparent)
}

.btn--pri {
    background: var(--pri);
    color: var(--on-pri)
}

.btn--pri:hover {
    background: color-mix(in srgb,var(--pri) 88%,var(--ink))
}

.btn--bad {
    color: var(--bad)
}

.hero {
    padding: var(--s7) 0 var(--s6);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s5)
}

.hero h1 {
    margin-top: var(--s3);
    font: 600 76px/.95 var(--f-head);
    letter-spacing: -.005em
}

.hero p {
    margin-top: var(--s3);
    color: var(--ink-2);
    font-size: 17px
}

/* ==========================================================================
   03 — CARTES ET DONNÉES : indicateurs, grilles et lignes de programmes
   ========================================================================== */
.stats {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    border-top: 1px solid var(--hair);
    border-bottom: 1px solid var(--hair)
}

.stat {
    padding: var(--s5) var(--s5) var(--s5) 0
}

.stat+.stat {
    padding-left: var(--s5);
    border-left: 1px solid var(--hair)
}

.stat .v {
    display: block;
    margin-top: var(--s3);
    font: 600 52px/1 var(--f-head)
}

.stat .v em {
    font-style: normal;
    font-size: 28px;
    color: var(--ink-3);
    font-weight: 500
}

.stat small {
    display: block;
    margin-top: var(--s2);
    color: var(--ink-2);
    font-size: 14px
}

.up {
    color: var(--ok)
}

.main {
    display: grid;
    grid-template-columns: minmax(0,7fr) minmax(0,5fr);
    gap: var(--s5);
    align-items: start;
    margin-top: var(--s6)
}

.col {
    display: grid;
    gap: var(--s5)
}

.card {
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-card);
    box-shadow: var(--shadow);
    overflow: hidden
}

.card__h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
    padding: var(--s5) var(--s5) var(--s3)
}

.card__h h2 {
    font: 600 28px/1 var(--f-head);
    letter-spacing: .01em
}

.card__b {
    padding: var(--s2) var(--s5) var(--s5)
}

/* Programme du soir : liste façon guide TV */
.ep {
    display: grid;
    grid-template-columns: 64px minmax(0,1fr) auto;
    align-items: center;
    gap: var(--s4);
    padding: var(--s4) var(--s5);
    border-top: 1px solid var(--hair)
}

.ep .t {
    font: 400 15px/1 var(--f-mono);
    color: var(--ink-3)
}

.ep .n {
    display: block;
    font: 600 21px/1.15 var(--f-head);
    letter-spacing: .01em
}

.ep .m {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-top: var(--s1);
    color: var(--ink-2);
    font-size: 14px
}

.ep .m i {
    width: 9px;
    height: 9px;
    border-radius: var(--r-ctl);
    background: var(--c)
}

.ep .s {
    font: 600 13px/1 var(--f-ui);
    color: var(--ink-3)
}

.ep.done .n {
    color: var(--ink-3)
}

.ep.cur {
    background: var(--raise)
}

.ep.cur .t,.ep.cur .s {
    color: var(--pink)
}

.ep .bar {
    height: 3px;
    margin-top: var(--s3);
    background: var(--hair);
    border-radius: var(--r-ctl);
    overflow: hidden
}

.ep .bar b {
    display: block;
    height: 100%;
    width: calc(var(--p,0)*1%);
    background: var(--pink)
}

.ep .s.warn {
    color: var(--warn)
}

.lbl {
    font: 600 13px/1 var(--f-ui)
}

.t-ok {
    color: var(--ok)
}

.t-warn {
    color: var(--warn)
}

.t-bad {
    color: var(--bad)
}

.t-blue {
    color: var(--blue)
}

.t-pink {
    color: var(--pink)
}

/* --p vient de la valeur affichée ; la barre ne calcule aucun résultat métier. */
.meter {
    height: 4px;
    background: var(--hair);
    border-radius: var(--r-ctl);
    overflow: hidden
}

.meter i {
    display: block;
    height: 100%;
    width: calc(var(--p)*1%);
    background: var(--blue)
}

.alert p {
    margin: var(--s2) 0 var(--s4);
    font-size: 16px
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    align-items: center
}

.note {
    color: var(--ink-2);
    font-size: 14px
}

.tr {
    display: grid;
    grid-template-columns: minmax(0,1.6fr) minmax(0,1fr) minmax(0,1.4fr) 100px;
    align-items: center;
    gap: var(--s4);
    padding: var(--s4) var(--s5);
    border-top: 1px solid var(--hair)
}

.tr.h {
    padding-top: 0;
    padding-bottom: var(--s3);
    border-top: 0
}

.tr strong {
    display: block;
    font: 600 20px/1.15 var(--f-head);
    letter-spacing: .01em
}

.tr small {
    color: var(--ink-2);
    font-size: 14px
}

.meter+small {
    display: block;
    margin-top: var(--s1)
}

.three {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr))
}

.three>div {
    padding: var(--s5)
}

.three>div+div {
    border-left: 1px solid var(--hair)
}

.three .cap {
    display: block;
    margin-bottom: var(--s4)
}

.sw {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s3)
}

.sw div {
    width: 56px;
    font: 400 11px/1.3 var(--f-mono);
    color: var(--ink-2)
}

.sw i {
    display: block;
    height: var(--control-h);
    margin-bottom: var(--s1);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl);
    background: var(--c)
}

.field {
    display: grid;
    gap: var(--s1);
    margin-bottom: var(--s3)
}

.field label {
    font: 500 13px var(--f-ui);
    color: var(--ink-2)
}

.field input {
    height: var(--control-h);
    padding: 0 var(--s3);
    background: var(--fill);
    border: 1px solid transparent;
    border-radius: var(--r-ctl);
    color: var(--ink);
    font: 400 15px var(--f-mono)
}

.field input:focus {
    border-color: var(--blue);
    outline: 2px solid var(--blue);
    outline-offset: var(--s1)
}

.field input[aria-invalid="true"] {
    border-color: var(--bad)
}

/* Structure visuelle commune ; création et fermeture pilotées par le JavaScript. */
.toast {
    display: flex;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--raise);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl)
}

.toast::before {
    content: "";
    width: 3px;
    border-radius: var(--r-ctl);
    background: var(--bad)
}

.toast b {
    display: block;
    font-size: 14px
}

.toast span {
    color: var(--ink-2);
    font-size: 13px
}

/* ==========================================================================
   04 — NAVIGATION PRINCIPALE : barre inférieure et état actif
   ========================================================================== */
.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--hair);
    padding-bottom: env(safe-area-inset-bottom,0px)
}

.tabs div {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    padding: var(--s2) var(--s4) var(--s2)
}

.tabs a {
    display: grid;
    justify-items: center;
    gap: var(--s1);
    min-width: 64px;
    padding: var(--s1) var(--s2);
    color: var(--ink-2);
    font: 500 11px/1 var(--f-ui);
    text-decoration: none
}

.tabs svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round
}

.tabs a.on {
    color: var(--blue)
}

/* ==========================================================================
   05 — MODULES DU COCKPIT : voyants, chaînes, diffusion et classements
   ========================================================================== */
.leds {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: var(--s5);
    padding: 0 0 var(--s5)
}

.led {
    display: flex;
    align-items: center;
    gap: var(--s3)
}

.led i {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
    background: var(--c);
    box-shadow: none
}

.led b {
    display: block;
    font: 600 14px/1.2 var(--f-ui)
}

.led small {
    color: var(--ink-2);
    font-size: 13px
}

.chans {
    display: flex;
    gap: var(--s1)
}

.chan {
    height: var(--control-h);
    padding: 0 var(--s3);
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    border: 0;
    border-radius: var(--r-ctl);
    background: var(--fill);
    color: var(--ink);
    font: 500 13px/1 var(--f-ui);
    cursor: pointer
}

.chan[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg)
}

.chan .live {
    width: 7px;
    height: 7px
}

.chan--add {
    background: transparent;
    border: 1px dashed var(--hair);
    color: var(--ink-3);
    cursor: not-allowed
}

.cd span {
    display: block;
    font: 600 64px/1 var(--f-head);
    letter-spacing: -.005em
}

.cd small {
    display: block;
    margin-top: var(--s1);
    color: var(--ink-2);
    font-size: 14px
}

.chk {
    list-style: none;
    margin: var(--s5) 0 0;
    padding: 0
}

.chk li {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) 0;
    border-top: 1px solid var(--hair);
    font-size: 15px
}

.chk li.ok {
    --c: var(--ok)
}

.chk li.bad {
    --c: var(--bad)
}

.chk i {
    position: relative;
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    background: color-mix(in srgb,var(--c) 16%,transparent)
}

.chk i::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font: 700 11px/1 var(--f-ui);
    color: var(--c)
}

.chk .bad i::after {
    content: "!"
}

.chk .btn {
    margin-left: auto
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media (max-width:899px) {
    .leds {
        grid-template-columns: repeat(2,1fr)
    }
}

.t-mute {
    color: var(--ink-2)
}

/* Programme en cours : le rose indique la diffusion, pas un état de validation. */
.now2 .cap {
    color: var(--pink)
}

.now2 h3 {
    margin: var(--s3) 0 var(--s2);
    font: 600 52px/1 var(--f-head);
    letter-spacing: -.005em
}

.now2 .mt {
    display: flex;
    align-items: center;
    gap: var(--s2);
    color: var(--ink-2);
    font-size: 15px
}

.now2 .mt i {
    width: 9px;
    height: 9px;
    border-radius: var(--r-ctl);
    background: var(--c)
}

.pg {
    height: 4px;
    margin-top: var(--s6);
    background: var(--hair);
    border-radius: var(--r-ctl);
    overflow: hidden
}

.pg b {
    display: block;
    height: 100%;
    width: calc(var(--p,0)*1%);
    background: var(--pink)
}

.pgl {
    display: flex;
    justify-content: space-between;
    margin-top: var(--s2);
    font-size: 12px;
    color: var(--ink-3)
}

.ac {
    display: grid;
    grid-template-columns: minmax(0,1.7fr) 84px minmax(0,1fr) 72px;
    align-items: center;
    gap: var(--s4);
    padding: var(--s4) var(--s5);
    border-top: 1px solid var(--hair)
}

.ac.h {
    padding-top: 0;
    padding-bottom: var(--s3);
    border-top: 0
}

.ac strong {
    display: block;
    font: 600 19px/1.15 var(--f-head);
    letter-spacing: .01em
}

.ac small {
    color: var(--ink-2);
    font-size: 13px
}

.ac>span:nth-child(3) {
    font-size: 14px;
    color: var(--ink-2)
}

.rk {
    display: grid;
    grid-template-columns: 24px minmax(0,1fr) auto;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3);
    border-radius: var(--r-ctl)
}

.rk.me {
    background: var(--raise)
}

.rk .r {
    color: var(--ink-3);
    font-size: 14px
}

.rk b {
    font: 600 19px/1.1 var(--f-head);
    letter-spacing: .01em
}

.rk small {
    margin-left: var(--s2);
    color: var(--ink-2);
    font-size: 13px
}

.rk .meter {
    height: 3px;
    margin-top: var(--s1)
}

.rk .meter i {
    background: var(--ink-3)
}

.rk.me .meter i {
    background: var(--blue)
}

.rk .v {
    font-size: 15px
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media (max-width:899px) {
    .ac {
        grid-template-columns: 1fr auto
    }
    .ac.h {
        display: none
    }
    .ac>:nth-child(3) {
        grid-column: 1
    }
    .ac>:nth-child(4) {
        grid-column: 2;
        grid-row: 2
    }
    .now2 h3 {
        font-size: 40px
    }
}

/* Responsive : adaptations jusqu’à 1023 px ; ordre de cascade conservé. */
@media (max-width:1023px) {
    .main {
        grid-template-columns: 1fr
    }
    .three {
        grid-template-columns: 1fr
    }
    .three>div+div {
        border-left: 0;
        border-top: 1px solid var(--hair)
    }
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media (max-width:899px) {
    .top__in {
        grid-template-columns: 1fr auto
    }
    .right {
        display: none
    }
    .hero {
        flex-direction: column;
        align-items: flex-start;
        padding-top: var(--s6)
    }
    .hero h1 {
        font-size: 52px
    }
    .stats {
        grid-template-columns: repeat(2,1fr)
    }
    .stat:nth-child(3) {
        padding-left: 0;
        border-left: 0
    }
    .stat:nth-child(n+3) {
        border-top: 1px solid var(--hair)
    }
    .tr {
        grid-template-columns: 1fr auto
    }
    .tr .mid {
        grid-column: 1/3;
        order: 3
    }
    .tr.h {
        display: none
    }
    .tabs a {
        min-width: 52px
    }
}

:root {
    --c-rea: #f43f5e;
    --c-cul: #60a5fa
}

:root {
    --shadow-pop: 0 12px 32px rgba(0,0,0,.14)
}

:root[data-theme="dark"], [data-preview-theme="dark"] {
    --shadow-pop: 0 12px 32px rgba(0,0,0,.55)
}

/* ==========================================================================
   06 — CONTRÔLES ET FORMULAIRES : actions, choix, champs et jauges
   ========================================================================== */
.fa {
    display: flex;
    justify-content: flex-end;
    gap: var(--s2);
    flex-wrap: wrap
}

.fa--c {
    justify-content: center
}

.ib {
    width: 40px;
    height: var(--control-h);
    display: grid;
    place-items: center;
    flex: none;
    border: 0;
    border-radius: var(--r-ctl);
    background: var(--fill);
    color: var(--ink-2);
    cursor: pointer
}

.ib:hover {
    color: var(--ink)
}

.ib svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round
}

.ver {
    font: 400 12px var(--f-mono);
    color: var(--ink-3)
}

.spin {
    width: 14px;
    height: 14px;
    margin-right: var(--s2);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    flex: none;
    animation: spin 700ms linear infinite;
}

/* Rotation liée au chargement ; neutralisée plus bas si le mouvement est réduit. */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.is-loading {
    pointer-events: none;
    opacity: .85
}

/* Sélection exclusive : le JavaScript maintient aria-pressed sur les boutons. */
.seg {
    display: inline-flex;
    padding: var(--s1);
    border-radius: var(--r-ctl);
    background: var(--fill)
}

.seg button {
    height: var(--control-h);
    padding: 0 var(--s4);
    border: 0;
    border-radius: var(--r-ctl);
    background: transparent;
    color: var(--ink-2);
    font: 500 13px var(--f-ui);
    cursor: pointer
}

.seg [aria-pressed="true"] {
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow)
}

/* Interrupteur : le véritable champ conserve le focus et la sémantique native. */
.swt {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--s3);
    cursor: pointer;
    font-size: 15px
}

.swt input {
    position: absolute;
    opacity: 0
}

.swt span {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    background: color-mix(in srgb,var(--ink) 20%,transparent);
    transition: background var(--duration-ui)
}

.swt span::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--on-pri);
    box-shadow: var(--shadow);
    transition: transform var(--duration-ui)
}

.swt input:checked+span {
    background: var(--blue)
}

.swt input:checked+span::after {
    transform: translateX(18px)
}

.swt input:focus-visible+span {
    outline: 2px solid var(--blue);
    outline-offset: 2px
}

/* Menu contextuel natif : details/summary porte son état ouvert/fermé. */
.am {
    position: relative;
    display: inline-block
}

.am summary {
    list-style: none
}

.am summary::-webkit-details-marker {
    display: none
}

.am__p {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 5;
    min-width: 180px;
    display: grid;
    padding: var(--s1);
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl);
    box-shadow: var(--shadow-pop)
}

.am__p button {
    height: var(--control-h);
    padding: 0 var(--s3);
    border: 0;
    border-radius: var(--r-ctl);
    background: transparent;
    color: var(--ink);
    text-align: left;
    font: 500 14px var(--f-ui);
    cursor: pointer
}

.am__p button:hover {
    background: var(--fill)
}

.am__p .d {
    color: var(--bad)
}

.fm fieldset {
    margin: 0 0 var(--s5);
    padding: 0;
    border: 0
}

.fm legend {
    padding: 0;
    margin-bottom: var(--s1);
    font: 600 22px/1.1 var(--f-head)
}

.fg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s4);
    margin-top: var(--s3)
}

.fg .full {
    grid-column: 1/-1
}

.field select,.field textarea {
    padding: 0 var(--s3);
    background: var(--fill);
    border: 1px solid transparent;
    border-radius: var(--r-ctl);
    color: var(--ink);
    font: 400 15px var(--f-ui)
}

.field select {
    height: var(--control-h)
}

.field textarea {
    min-height: 92px;
    padding: var(--s3);
    resize: vertical
}

.field select:focus,.field textarea:focus {
    border-color: var(--blue);
    outline: 2px solid var(--blue);
    outline-offset: var(--s1)
}

.field input:read-only {
    color: var(--ink-2)
}

.field input:disabled {
    opacity: .5
}

.field--ok input {
    border-color: var(--ok)
}

.field .help {
    font-size: 12px;
    color: var(--ink-3)
}

.ig {
    display: flex
}

.ig input {
    flex: 1;
    border-radius: var(--r-ctl) 0 0 var(--r-ctl)
}

.ig span {
    display: grid;
    place-items: center;
    padding: 0 var(--s3);
    background: var(--hair);
    border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
    color: var(--ink-2);
    font: 500 14px var(--f-mono)
}

.choices {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: var(--s3);
    margin-top: var(--s3)
}

.choice {
    display: flex;
    gap: var(--s3);
    padding: var(--s4);
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl);
    cursor: pointer
}

.choice:has(input:checked) {
    border-color: var(--blue);
    background: color-mix(in srgb,var(--blue) 7%,var(--card))
}

.choice input {
    margin-top: var(--s1);
    accent-color: var(--blue)
}

.choice b {
    display: block;
    font: 600 17px/1.2 var(--f-head)
}

.choice small {
    color: var(--ink-2);
    font-size: 13px
}

.rh {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: var(--s3)
}

.rh label {
    font: 500 13px var(--f-ui);
    color: var(--ink-2)
}

.rng {
    width: 100%;
    margin: var(--s2) 0;
    accent-color: var(--blue)
}

.rs {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--ink-3)
}

.meter--lg {
    height: 8px;
    border-radius: var(--r-air)
}

.meter--ok i {
    background: var(--ok)
}

.meter--bad i {
    background: var(--bad)
}

.pbl .ph {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--s2);
    font-size: 14px
}

.pbl small {
    display: block;
    margin-top: var(--s2);
    color: var(--ink-2);
    font-size: 13px
}

.legal {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: var(--s3)
}

.legal a {
    display: block;
    padding: var(--s4);
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl);
    color: var(--ink);
    text-decoration: none
}

.legal b {
    font: 600 18px var(--f-head)
}

.legal small {
    display: block;
    color: var(--ink-2);
    font-size: 13px
}

.subm {
    display: grid;
    justify-items: center;
    gap: var(--s1);
    margin-bottom: var(--s3)
}

/* ==========================================================================
   07 — FEEDBACK : messages intégrés, notifications, toasts et modales
   ========================================================================== */
.fi {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: var(--r-ctl);
    background: color-mix(in srgb,var(--c) 15%,transparent);
    color: var(--c);
    font: 700 15px/1 var(--f-ui)
}

.alr {
    display: flex;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--raise);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl)
}

.alr b {
    display: block;
    font-size: 14px
}

.alr p {
    color: var(--ink-2);
    font-size: 13px
}

.nl,.tl {
    display: grid;
    gap: var(--s2)
}

/* Notification persistante : .unread distingue une entrée encore non lue. */
.nt {
    display: flex;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-ctl)
}

.nt.unread {
    background: var(--raise)
}

.nt .bd {
    flex: 1
}

.nt b {
    font-size: 14px
}

.nt p {
    color: var(--ink-2);
    font-size: 13px
}

.nt.unread b::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: var(--s2);
    border-radius: 50%;
    background: var(--blue);
    vertical-align: 2px
}

.nt time {
    color: var(--ink-3);
    font: 400 12px var(--f-mono)
}

.nt .btn {
    margin-top: var(--s2)
}

.toast::before {
    background: var(--c,var(--bad))
}

.toast .fi {
    color: var(--c)
}

.toast .ib {
    margin-left: auto;
    background: transparent
}

/* Superposition des retours temporaires ; la réserve basse est précisée plus loin. */
.toast-region {
    position: fixed;
    right: var(--s4);
    bottom: var(--s4);
    z-index: 50;
    display: grid;
    gap: var(--s2);
    width: min(360px,calc(100% - 32px))
}

.toast-region .toast {
    box-shadow: var(--shadow-pop)
}

.empty {
    padding: var(--s7) var(--s4);
    text-align: center;
    border: 1px dashed var(--hair);
    border-radius: var(--r-card)
}

.empty h3 {
    margin: var(--s3) 0 var(--s1)
}

.empty p {
    max-width: 44ch;
    margin: 0 auto var(--s4);
    color: var(--ink-2);
    font-size: 14px
}

/* Squelettes statiques : aucun effet de chargement décoratif continu. */
.sk {
    display: grid;
    gap: var(--s2)
}

.sk i {
    height: 12px;
    border-radius: var(--r-ctl);
    background: var(--fill)
}

/* Dialogue natif : showModal() fournit le fond bloquant et la gestion du focus. */
.modal {
    width: min(480px,calc(100% - 32px));
    padding: var(--s5);
    border: 1px solid var(--hair);
    border-radius: var(--r-card);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-pop)
}

.modal::backdrop {
    background: var(--backdrop)
}

.modal h3 {
    margin: 0 0 var(--s2);
    font: 600 26px/1.1 var(--f-head)
}

.modal p {
    margin-bottom: var(--s5);
    color: var(--ink-2)
}

/* Accessibilité : respect de la préférence de réduction du mouvement. */
@media (prefers-reduced-motion:reduce) {
    .spin,.sk i {
        animation: none
    }
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media (max-width:899px) {
    .fg,.choices,.legal {
        grid-template-columns: 1fr
    }
}

.toast .fi {
    color: var(--c);
    font: 700 15px/1 var(--f-ui)
}

.toast .tx {
    flex: 1;
    min-width: 0
}

.toast-region {
    bottom: calc(var(--s4) + 76px + env(safe-area-inset-bottom,0px))
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media (max-width:899px) {
    .tabs div {
        padding: var(--s2)
    }
    .tabs a {
        min-width: 0;
        padding: var(--s1)
    }
}

.btn {
    white-space: nowrap
}

.top__in {
    grid-template-columns: minmax(0,1fr) auto minmax(0,1fr)
}

.brand {
    white-space: nowrap
}

/* Version discrète au bas du sous-menu Légal, distincte des liens d’action. */
.subm .ver {
    display: block;
    margin-top: var(--s1);
    padding: var(--s2) var(--s3);
    border-top: 1px solid var(--hair);
    text-align: center;
}

.right {
    gap: var(--s3);
    white-space: nowrap
}

.right>* {
    flex: none
}

.tabs a.on {
    font-weight: 600
}

/* ==========================================================================
   08 — SOUS-MENUS : positionnement, zone de passage et ouverture
   ========================================================================== */
.ti {
    position: relative;
    display: flex
}

.ti .subm {
    position: absolute;
    /* Toutes les piles, y compris Légal, sont centrées sur leur onglet. */
    left: 50%;
    bottom: 100%;
    margin: 0 0 var(--s2);
    padding: var(--s1);
    display: grid;
    /* Chaque bouton occupe la largeur de la pile, déterminée par le plus long libellé. */
    justify-items: stretch;
    /* Évite le calcul de largeur à partir de l’onglet étroit (capture Admin). */
    width: max-content;
    max-width: calc(100vw - var(--s6));
    z-index: 20;
    gap: var(--s1);
    white-space: nowrap;
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-pop);
    visibility: hidden;
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
    transition: opacity .15s,transform .15s,visibility 0s .25s
}

.ti .subm::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px
}

.ti:hover .subm,.ti:focus-within .subm,.ti.open .subm {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%);
    transition-delay: 0s
}

.tabs .subm a {
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    min-width: 0;
    width: 100%;
    height: var(--control-h);
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 0 var(--s5);
    color: var(--ink);
    font: 500 15px/1 var(--f-ui)
}

.tabs .subm a.btn--pri {
    background: var(--pri);
    color: var(--on-pri)
}

/* ==========================================================================
   09 — AJUSTEMENTS V3 : accessibilité, cadre partagé et responsive
   ========================================================================== */
/* Compléments V3 : dimensions communes, accessibilité et cadre applicatif. */
:root {
    --control-h: 40px;
    --r-air: 4px;
    --duration-ui: 150ms;
    --pri: var(--light-blue);
    --on-pri: var(--light-card);
    --backdrop: rgba(5,8,16,.55);
    --nav-h: 76px
}

.meter--warn i {
    background: var(--warn)
}

.brand {
    color: var(--ink);
    text-decoration: none
}

.brand img {
    width: 28px;
    height: 28px
}

.ib img {
    width: 18px;
    height: 18px
}

.top__in {
    min-height: var(--s7);
    height: auto;
    gap: var(--s3);
    padding-block: var(--s2)
}

.right .btn {
    gap: var(--s2)
}

.wrap {
    min-width: 0;
    padding-bottom: calc(var(--nav-h) + var(--s6) + env(safe-area-inset-bottom,0px))
}

.tabs>div {
    max-width: 1200px;
    gap: var(--s2)
}

.tabs a,.tabs .nav-trigger {
    min-height: var(--control-h)
}

.tabs .nav-trigger {
    display: grid;
    justify-items: center;
    gap: var(--s1);
    padding: var(--s1) var(--s2);
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font: 500 11px/1 var(--f-ui);
    cursor: pointer
}

.tabs .nav-trigger.on {
    color: var(--blue);
    font-weight: 600
}

.tabs .subm {
    /* La pile et sa zone de passage restent visibles, sans ascenseur interne. */
    max-height: none;
    overflow: visible;
}

.tabs .subm a {
    min-height: var(--control-h)
}

.tabs img {
    width: 24px;
    height: 24px
}

.icon-definitions {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden
}

.swt {
    min-height: var(--control-h)
}

.rng {
    min-height: var(--control-h)
}

.field input,.field select,.field textarea {
    min-width: 0;
    width: 100%
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed
}

.btn {
    text-decoration: none
}

.seg {
    padding: 0
}

.is-loading {
    cursor: wait
}

.sk {
    color: var(--ink-2)
}

.card__h,.pbl .ph {
    flex-wrap: wrap
}

.main>* {
    min-width: 0
}

.toast-region {
    bottom: calc(var(--s4) + var(--nav-h) + env(safe-area-inset-bottom,0px))
}

.toast .tx {
    overflow-wrap: anywhere
}

/* Thème : le SVG hérite de .ib svg (18 px et trait commun).
   Le bouton conserve le carré .ib de 40 px, comme les autres actions du bandeau. */

/* Responsive : adaptations jusqu’à 1023 px ; ordre de cascade conservé. */
@media(max-width:1023px) {
    .top__in {
        grid-template-columns: 1fr auto
    }
    .tc {
        justify-self: end
    }
    .right {
        grid-column: 1/-1;
        display: flex;
        flex-wrap: wrap
    }
}

/* Responsive : adaptations jusqu’à 899 px ; ordre de cascade conservé. */
@media(max-width:899px) {
    .top {
        position: relative
    }
    .top__in {
        padding-inline: var(--s3)
    }
    .brand {
        flex-wrap: wrap;
        gap: var(--s2);
        font-size: 18px
    }
    .tc {
        flex-wrap: wrap;
        justify-content: flex-end;
        font-size: 12px;
        gap: var(--s2)
    }
    .right {
        gap: var(--s2)
    }
    .wrap {
        padding-inline: var(--s3)
    }
    .tabs>div {
        overflow-x: auto;
        justify-content: flex-start
    }
    /* Le flou ferait du bandeau le repère des sous-menus fixed et les couperait. */
    .tabs {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--card);
    }
    .tabs--static>div {
        overflow: visible;
        flex-wrap: wrap;
    }
    .tabs>div>a,.tabs .ti {
        flex: none
    }
    .tabs .ti .subm {
        position: fixed;
        left: var(--s3);
        right: var(--s3);
        width: auto;
        bottom: calc(var(--nav-h) + env(safe-area-inset-bottom,0px));
        transform: none;
        margin: 0
    }
    .tabs--static .ti .subm {
        position: absolute;
        left: auto;
        right: 0;
        bottom: 100%
    }
    .tabs--static .ti .subm {
        width: max-content;
    }
    .ep {
        grid-template-columns: auto minmax(0,1fr);
        padding: var(--s3)
    }
    .ep .s {
        grid-column: 2
    }
    .hero h1 {
        font-size: clamp(2.5rem,10vw,3.25rem)
    }
    .leds {
        gap: var(--s3)
    }
}

/* Accessibilité : respect de la préférence de réduction du mouvement. */
@media(prefers-reduced-motion:reduce) {
    *,*::before,*::after {
        animation: none!important;
        transition: none!important;
        scroll-behavior: auto!important
    }
}

.ib:disabled {
    opacity: .5;
    cursor: not-allowed
}

/* ==========================================================================
   10 — PALETTE : valeurs centralisées pour les thèmes et les nuanciers
   ========================================================================== */
/* Palette de référence commune aux thèmes et aux nuanciers. */
:root {
    --light-bg: #f5f5f7;
    --dark-bg: #0b0b0d;
    --light-card: #ffffff;
    --dark-card: #151517;
    --dark-raise: #1e1e21;
    --light-fill: rgba(0,0,0,.05);
    --dark-fill: rgba(255,255,255,.07);
    --light-hair: rgba(0,0,0,.09);
    --dark-hair: rgba(255,255,255,.09);
    --light-ink: #1d1d1f;
    --light-ink-muted: #6e6e73;
    --dark-ink-muted: #a1a1a8;
    --light-blue: #2563e8;
    --dark-blue: #6e9bff;
    --light-pink: #b91c8b;
    --dark-pink: #fc4fc6;
    --light-ok: #087b55;
    --dark-ok: #34d6a0;
    --light-warn: #945800;
    --dark-warn: #ffb340;
    --light-bad: #bf2033;
    --dark-bad: #ff5a6a;
}

/* L’état JS .open prime sur le survol/focus pour permettre la fermeture par Échap. */
.tabs .ti:not(.open) .subm {
    visibility: hidden;
    opacity: 0
}
