/* =========================================================================
   IDFMDEX - Systeme de design
   Langage : signaletique de transport / design d'information.
   Ecrit a la main. Aucun framework, aucun build. Un seul theme (sombre).

   REGLE DE FORME (verrou) :
     - Panneaux, champs, boutons, onglets : rayon 2px.
     - Aucun element en forme de pilule.
     - EXCEPTION DOCUMENTEE : les pastilles de ligne gardent la geometrie
       reelle du reseau (Metro = cercle, RER = 6px, Transilien = 4px,
       Tram / Bus / Noctilien = onglet 2px). Cette forme encode une donnee.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Jetons
   ------------------------------------------------------------------------- */
:root {
    /* Surfaces */
    --bg:            #0B0C0E;
    --surface:       #121417;
    --surface-2:     #181B1F;
    --surface-3:     #1E2226;

    /* Traits */
    --line:          #24282D;
    --line-soft:     #1A1D21;
    --line-strong:   #333A40;

    /* Texte */
    --text:          #F4F6F5;
    --muted:         #A2ABAF;
    --faint:         #788287;

    /* Accent de marque (conserve de l'identite existante) */
    --signal:        #00DC7D;
    --signal-ink:    #04130B;
    --signal-dim:    #0D2C1F;
    --signal-line:   #1D4632;

    /* Couleurs semantiques (etat reel, pas decoration) */
    --seen:          #7FA8E8;
    --seen-dim:      #17222F;
    --mecene:        #E3B341;
    --mecene-dim:    #2B2109;
    --alert:         #E5675C;
    --alert-dim:     #2E1715;

    /* Typographie */
    --font-sans: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Azeret Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    /* Rythme */
    --gutter: 1.25rem;
    --shell: 1280px;
    --shell-narrow: 720px;
    --shell-mid: 960px;

    /* Formes */
    --r: 2px;
    --r-lg: 3px;

    /* Mouvement */
    --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --fast: 140ms;
    --base: 260ms;
    --slow: 620ms;

    /* Couches */
    --z-rail: 10;
    --z-sticky: 20;
    --z-nav: 30;
    --z-overlay: 40;
    --z-grain: 50;
}

/* -------------------------------------------------------------------------
   2. Base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.975rem;
    line-height: 1.6;
    font-variation-settings: 'wdth' 100, 'wght' 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.12;
    text-wrap: balance;
}

ul, ol { margin: 0; padding: 0; list-style: none; }

hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

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

/* Grain fixe : casse la platitude numerique sans image. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-grain);
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* -------------------------------------------------------------------------
   3. Accessibilite
   ------------------------------------------------------------------------- */
.skip {
    position: absolute;
    left: 0.75rem;
    top: -4rem;
    z-index: 100;
    padding: 0.7rem 1rem;
    background: var(--signal);
    color: var(--signal-ink);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--r);
    transition: top var(--fast) var(--ease);
}
.skip:focus { top: 0.75rem; }

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

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

/* -------------------------------------------------------------------------
   4. Typographie
   ------------------------------------------------------------------------- */
.display {
    font-variation-settings: 'wdth' 112, 'wght' 800;
    font-weight: 800;
    letter-spacing: -0.038em;
    line-height: 0.96;
    text-wrap: balance;
}

.t-hero    { font-size: clamp(2.65rem, 6.2vw, 4.6rem); }
.t-section { font-size: clamp(1.85rem, 3.6vw, 2.9rem); }
.t-block   { font-size: clamp(1.25rem, 2.1vw, 1.6rem); }

.lede {
    font-size: 1.06rem;
    line-height: 1.62;
    color: var(--muted);
    max-width: 46ch;
    text-wrap: pretty;
}

.body-sm { font-size: 0.875rem; line-height: 1.6; color: var(--muted); }
.body-xs { font-size: 0.78rem; line-height: 1.55; color: var(--faint); }

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

/* Libelle de tableau ou d'entete de colonne. Volontairement rare. */
.label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.c-signal { color: var(--signal); }
.c-seen   { color: var(--seen); }
.c-mecene { color: var(--mecene); }
.c-alert  { color: var(--alert); }
.c-muted  { color: var(--muted); }
.c-faint  { color: var(--faint); }
.c-text   { color: var(--text); }

/* -------------------------------------------------------------------------
   5. Structure
   ------------------------------------------------------------------------- */
.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.shell-mid    { max-width: var(--shell-mid); }
.shell-narrow { max-width: var(--shell-narrow); }

.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: 0.5rem; }
.stack-lg > * + * { margin-top: 2rem; }
.stack-xl > * + * { margin-top: 3.25rem; }

.row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.section { padding-block: clamp(4rem, 9vw, 7.5rem) clamp(4.5rem, 10vw, 8.5rem); }
.section-tight { padding-block: clamp(2.75rem, 6vw, 4.5rem) clamp(3rem, 6.5vw, 5rem); }

.bordered-top { border-top: 1px solid var(--line); }

/* Regle horizontale hairline avec un accent court a gauche. */
.rule-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}

/* -------------------------------------------------------------------------
   6. Panneaux
   Utilises seulement quand l'elevation porte une hierarchie reelle.
   ------------------------------------------------------------------------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.panel-pad { padding: clamp(1.15rem, 2.4vw, 1.75rem); }
.panel-2 { background: var(--surface-2); }

.panel-accent {
    border-left: 2px solid var(--signal);
}
.panel-mecene {
    border-color: var(--mecene-dim);
    background: linear-gradient(180deg, var(--mecene-dim) 0%, var(--surface) 62%);
}
.panel-alert {
    border-color: var(--alert-dim);
    background: var(--surface);
}

/* Groupement sans carte : liste a filets fins. */
.divided > * + * { border-top: 1px solid var(--line-soft); }

/* -------------------------------------------------------------------------
   7. Boutons
   ------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.72rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: none;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    font-variation-settings: 'wdth' 100, 'wght' 600;
    letter-spacing: -0.005em;
    line-height: 1.15;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--fast) var(--ease),
                border-color var(--fast) var(--ease),
                color var(--fast) var(--ease),
                transform var(--fast) var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-signal {
    background: var(--signal);
    color: var(--signal-ink);
}
.btn-signal:hover { background: #2CE795; }

.btn-outline {
    border-color: var(--line-strong);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--text); background: var(--surface-2); }

.btn-quiet {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
}
.btn-quiet:hover { background: var(--surface-3); border-color: var(--line-strong); }

.btn-seen {
    background: var(--seen);
    color: #0A1424;
}
.btn-seen:hover { background: #96BCF2; }

.btn-danger {
    border-color: var(--alert-dim);
    color: var(--alert);
    background: transparent;
}
.btn-danger:hover { background: var(--alert); color: #fff; border-color: var(--alert); }

.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 0.95rem 1.5rem; font-size: 0.95rem; }
.btn-sm { padding: 0.5rem 0.8rem; font-size: 0.8rem; }

.btn[disabled], .btn[aria-disabled='true'] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Lien texte souligne a l'apparition. */
.link {
    color: var(--signal);
    font-weight: 600;
    text-underline-offset: 3px;
    transition: color var(--fast) var(--ease);
}
.link:hover { text-decoration: underline; }

.link-quiet { color: var(--muted); transition: color var(--fast) var(--ease); }
.link-quiet:hover { color: var(--text); }

/* Bouton icone carre. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 1.05rem;
    cursor: pointer;
    transition: color var(--fast) var(--ease),
                border-color var(--fast) var(--ease),
                background var(--fast) var(--ease),
                transform var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.is-alert:hover { color: var(--alert); border-color: var(--alert); }
.icon-btn.is-mecene.is-on { color: var(--mecene); border-color: var(--mecene); }

/* -------------------------------------------------------------------------
   8. Formulaires
   Libelle au-dessus, aide en dessous, jamais de placeholder en guise de label.
   ------------------------------------------------------------------------- */
.field { display: block; margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }

.field > label,
.field-label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.input,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='search'],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.925rem;
    line-height: 1.4;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

input::placeholder, textarea::placeholder { color: #666F74; opacity: 1; }

.input:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--signal);
    background: var(--surface);
}
.input:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 1px;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) center, calc(100% - 12px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.25rem;
    cursor: pointer;
}

input[type='color'] {
    width: 3rem;
    height: 2.55rem;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    cursor: pointer;
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
input[type='color']::-webkit-color-swatch { border: none; border-radius: 0; }

input[type='checkbox'] { accent-color: var(--signal); width: 1rem; height: 1rem; cursor: pointer; }

.field-help { margin-top: 0.35rem; font-size: 0.75rem; color: var(--faint); }
.field-error { margin-top: 0.35rem; font-size: 0.78rem; color: var(--alert); font-weight: 600; }

/* Champ avec icone a gauche. */
.field-icon { position: relative; }
.field-icon > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color var(--fast) var(--ease);
}
.field-icon > input { padding-left: 2.4rem; }
.field-icon:focus-within > i { color: var(--signal); }

/* -------------------------------------------------------------------------
   9. Messages
   ------------------------------------------------------------------------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-left-width: 2px;
    border-radius: var(--r);
    background: var(--surface);
    font-size: 0.875rem;
    line-height: 1.5;
}
.notice i { font-size: 1.05rem; flex: 0 0 auto; margin-top: 0.1rem; }
.notice-ok    { border-left-color: var(--signal); color: var(--text); }
.notice-ok i  { color: var(--signal); }
.notice-bad   { border-left-color: var(--alert); color: var(--text); }
.notice-bad i { color: var(--alert); }
.notice-info  { border-left-color: var(--seen); color: var(--text); }
.notice-info i{ color: var(--seen); }

/* Etat vide compose, pas une page blanche. */
.empty {
    padding: clamp(2rem, 5vw, 3.25rem) 1.25rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r);
    text-align: center;
    color: var(--muted);
}
.empty i { font-size: 1.75rem; color: var(--faint); display: block; margin-bottom: 0.75rem; }
.empty strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 0.3rem; }

/* Squelette de chargement, calque sur la forme finale. */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 220% 100%;
    animation: shimmer 1.4s linear infinite;
    border-radius: var(--r);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* -------------------------------------------------------------------------
   10. Pastilles de ligne
   Geometrie fidele au reseau. C'est une donnee, pas un ornement.
   ------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 2.3rem;
    height: 2.3rem;
    padding-inline: 0.35rem;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #fff;
    border-radius: 2px;
    transition: transform var(--fast) var(--ease);
}
.badge-metro       { border-radius: 50%; width: 2.3rem; padding: 0; }
.badge-rer         { border-radius: 6px; width: 2.3rem; padding: 0; }
.badge-train       { border-radius: 4px; width: 2.3rem; padding: 0; }
.badge-tram        { border-radius: 2px; height: 1.85rem; min-width: 2.3rem; font-size: 0.82rem; }
.badge-bus         { border-radius: 2px; height: 1.85rem; min-width: 2.6rem; font-size: 0.82rem; }

.badge-sm { min-width: 1.9rem; height: 1.9rem; font-size: 0.78rem; }
.badge-sm.badge-metro, .badge-sm.badge-rer, .badge-sm.badge-train { width: 1.9rem; }
.badge-sm.badge-bus, .badge-sm.badge-tram { height: 1.55rem; min-width: 2.15rem; font-size: 0.72rem; }

.badge-lg { min-width: 2.9rem; height: 2.9rem; font-size: 1.15rem; }
.badge-lg.badge-metro, .badge-lg.badge-rer, .badge-lg.badge-train { width: 2.9rem; }
.badge-lg.badge-bus, .badge-lg.badge-tram { height: 2.3rem; min-width: 3.1rem; font-size: 1rem; }

a:hover > .badge, .badge-hover:hover { transform: translateY(-2px); }

/* Grille de pastilles. */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr));
    gap: 0.6rem;
}
.badge-cell { display: flex; align-items: center; justify-content: center; padding-block: 0.35rem; }

/* -------------------------------------------------------------------------
   11. Barre de progression
   Fine, sans piste lourde. Les chiffres portent l'information.
   ------------------------------------------------------------------------- */
.meter {
    height: 3px;
    width: 100%;
    background: var(--line);
    border-radius: 0;
    overflow: hidden;
}
.meter > span {
    display: block;
    height: 100%;
    background: var(--signal);
    transform-origin: left center;
    transition: width var(--slow) var(--ease-out);
}
.meter-seen > span { background: var(--seen); }

.meter-row { display: grid; gap: 0.45rem; }
.meter-row .row-between { font-size: 0.78rem; }

/* Cadran circulaire. */
.dial { position: relative; width: 6.5rem; height: 6.5rem; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.04em;
}

/* -------------------------------------------------------------------------
   12. Navigation
   ------------------------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    height: 4rem;
    background: rgba(11, 12, 14, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-variation-settings: 'wdth' 115, 'wght' 800;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.wordmark .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    background: var(--signal);
    color: var(--signal-ink);
    border-radius: 2px;
    font-size: 1rem;
}

.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
    position: relative;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: var(--r);
    transition: color var(--fast) var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link.is-active { color: var(--text); font-weight: 600; }
.nav-link.is-active::after {
    content: '';
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    bottom: -0.35rem;
    height: 2px;
    background: var(--signal);
}

.nav-tools { display: flex; align-items: center; gap: 0.5rem; }

/* Identite du compte dans la barre. */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 3px;
    background: var(--signal);
    color: var(--signal-ink);
    font-variation-settings: 'wdth' 110, 'wght' 800;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1;
}
.avatar-lg { width: 3.75rem; height: 3.75rem; font-size: 1.7rem; border-radius: 3px; }
.avatar-mecene { background: var(--mecene); color: #1B1405; }

.identity { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.identity-name { font-size: 0.9rem; font-weight: 600; line-height: 1.2; }
.identity-role {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--signal);
}
.identity-role.is-mecene { color: var(--mecene); }

/* Barre d'onglets mobile. */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-nav);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 3.75rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(11, 12, 14, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
}
.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color var(--fast) var(--ease);
}
.tab i { font-size: 1.3rem; }
.tab:hover { color: var(--muted); }
.tab.is-active { color: var(--text); }
.tab.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 2.25rem;
    height: 2px;
    background: var(--signal);
}
.tab { position: relative; }

/* Entete de sous-page avec retour. */
.subhead {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    background: rgba(11, 12, 14, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.subhead-inner {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 4rem;
    padding-block: 0.7rem;
}
.subhead h1 { font-size: 1.1rem; font-variation-settings: 'wdth' 108, 'wght' 700; }

/* -------------------------------------------------------------------------
   13. Rail de ligne (plan vertical)
   ------------------------------------------------------------------------- */
.rail { position: relative; padding-left: 2.6rem; }
.rail::before {
    content: '';
    position: absolute;
    left: 0.72rem;
    top: 1.35rem;
    bottom: 1.35rem;
    width: 4px;
    background: var(--rail-color, var(--signal));
    border-radius: 2px;
}
.rail-stop {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-block: 0.7rem;
}
.rail-stop::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    margin-left: 0.45rem;
    width: 0.6rem;
    height: 0.6rem;
    background: var(--bg);
    border: 3px solid var(--rail-color, var(--signal));
    border-radius: 50%;
    z-index: var(--z-rail);
}
.rail-stop.is-terminus::before {
    width: 0.85rem;
    height: 0.85rem;
    margin-left: 0.32rem;
    background: var(--rail-color, var(--signal));
}
.rail-name { font-size: 0.9rem; font-weight: 500; }
.rail-stop.is-done .rail-name { color: var(--text); }

.tag-terminus {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.08rem 0.35rem;
    background: var(--surface-3);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 2px;
}

/* Boutons de pointage d'arret. */
.mark-set { display: flex; gap: 0.4rem; flex: 0 0 auto; }
.mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--faint);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color var(--fast) var(--ease),
                background var(--fast) var(--ease),
                border-color var(--fast) var(--ease),
                transform var(--fast) var(--ease);
}
.mark:active { transform: translateY(1px); }
.mark:hover { border-color: var(--line-strong); color: var(--muted); }
.mark.is-on[data-mark='seen'] {
    background: var(--seen-dim);
    border-color: var(--seen);
    color: var(--seen);
}
.mark.is-on[data-mark='exit'] {
    background: var(--signal-dim);
    border-color: var(--signal);
    color: var(--signal);
}
.mark.pop { animation: pop 260ms var(--ease-out); }
@keyframes pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.16); }
    100% { transform: scale(1); }
}

/* -------------------------------------------------------------------------
   14. Accordeon natif
   ------------------------------------------------------------------------- */
details.fold { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
details.fold + details.fold { margin-top: 0.6rem; }
details.fold > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background var(--fast) var(--ease);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: var(--surface-2); }
details.fold > summary .caret { color: var(--faint); font-size: 1.05rem; transition: transform var(--base) var(--ease); }
details.fold[open] > summary .caret { transform: rotate(180deg); }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
.fold-body { padding: 1.15rem; }
details.fold[open] .fold-body { animation: foldIn 240ms var(--ease-out); }
@keyframes foldIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------------
   15. Tableaux et listes de donnees
   ------------------------------------------------------------------------- */
.data-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.9rem;
    transition: background var(--fast) var(--ease);
}
.data-row:hover { background: var(--surface-2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1.25rem; font-size: 0.875rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--text); }

/* -------------------------------------------------------------------------
   16. Mouvement d'entree
   ------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--slow) var(--ease-out), transform var(--slow) var(--ease-out);
    will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay='1'] { transition-delay: 70ms; }
.reveal[data-delay='2'] { transition-delay: 140ms; }
.reveal[data-delay='3'] { transition-delay: 210ms; }
.reveal[data-delay='4'] { transition-delay: 280ms; }
.reveal[data-delay='5'] { transition-delay: 350ms; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* -------------------------------------------------------------------------
   17. Page d'accueil
   ------------------------------------------------------------------------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
    padding-top: clamp(3rem, 6vw, 6rem);
    padding-bottom: clamp(3.5rem, 7vw, 6.5rem);
}
.hero-copy { max-width: 34ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2rem; }

/* Bande de modes : donnees reelles du reseau, pas un mur de logos. */
.modes {
    display: flex;
    flex-wrap: wrap;
    gap: 0 clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    padding-block: 1.6rem;
    border-block: 1px solid var(--line);
}
.mode-item { display: flex; align-items: center; gap: 0.6rem; padding-block: 0.4rem; }
.mode-item span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Section double colonne avec plan. */
.split {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
}

/* Rail horizontal des roles : largeurs et hauteurs inegales. */
.roles {
    position: relative;
    display: grid;
    grid-template-columns: 1.18fr 0.86fr 0.96fr;
    gap: clamp(1.5rem, 3.5vw, 3rem);
    padding-top: 3.25rem;
}
.roles::before {
    content: '';
    position: absolute;
    top: 0.62rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--line);
}
.role { position: relative; }
.role::before {
    content: '';
    position: absolute;
    top: -3.25rem;
    left: 0;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: 0.22rem;
    background: var(--bg);
    border: 3px solid var(--line-strong);
    border-radius: 50%;
}
.role.is-lead::before { border-color: var(--signal); background: var(--signal); }
.role:nth-child(2) { padding-top: 2.4rem; }
.role:nth-child(3) { padding-top: 1.1rem; }
.role h3 { font-size: 1.32rem; font-variation-settings: 'wdth' 108, 'wght' 700; margin-bottom: 0.6rem; }
.role p { font-size: 0.9rem; color: var(--muted); }
.role-meta {
    margin-top: 1.1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line-soft);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
}

/* Bande photographique pleine largeur. */
.band { position: relative; overflow: hidden; border-block: 1px solid var(--line); }
.band img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) contrast(1.08) brightness(0.42);
}
.band::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, var(--bg) 8%, rgba(11, 12, 14, 0.72) 52%, rgba(11, 12, 14, 0.45) 100%);
}
.band-inner { position: relative; z-index: 2; padding-block: clamp(4rem, 9vw, 7rem); }

/* Apercu de composant reel dans le hero. */
.preview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.preview-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.preview-body { padding: 0.5rem 1.1rem 1.1rem; }
.preview-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

/* Pied de page. */
.foot { border-top: 1px solid var(--line); padding-block: 3rem 3.5rem; }
.foot-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; }
.foot-links a { font-size: 0.85rem; color: var(--muted); transition: color var(--fast) var(--ease); }
.foot-links a:hover { color: var(--text); }

/* -------------------------------------------------------------------------
   17b. Pages de compte
   Ecran scinde : volet d'identite a gauche, formulaire a droite.
   Remplace la carte centree posee sur des halos flous.
   ------------------------------------------------------------------------- */
.auth {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    padding: clamp(2rem, 4vw, 3.25rem);
    border-right: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
}
.auth-aside h2 {
    font-variation-settings: 'wdth' 112, 'wght' 800;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1;
    font-size: clamp(2rem, 3.4vw, 3.1rem);
    max-width: 16ch;
}

.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 3rem);
}
.auth-form { width: 100%; max-width: 24rem; margin-inline: auto; }
.auth-form h1 {
    font-variation-settings: 'wdth' 108, 'wght' 800;
    font-weight: 800;
    font-size: 1.65rem;
    letter-spacing: -0.03em;
    margin-bottom: 0.4rem;
}

.auth-brand-mobile { display: none; margin-bottom: 2rem; }

.auth-switch {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--muted);
}

/* Motif de plan dans le volet d'identite : pure donnee de reseau. */
.auth-plan { display: flex; flex-direction: column; gap: 0; }
.auth-plan-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-block: 0.55rem;
}
.auth-plan-row + .auth-plan-row { border-top: 1px solid var(--line-soft); }
.auth-plan-row span:last-child {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--faint);
}

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-brand-mobile { display: block; }
    .auth-main { justify-content: flex-start; padding-top: 2.5rem; }
}

/* -------------------------------------------------------------------------
   18. Onboarding
   ------------------------------------------------------------------------- */
.ob { position: relative; min-height: 100dvh; display: flex; flex-direction: column; }
.ob-steps {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    padding-top: 2rem;
}
.ob-steps span {
    width: 2.25rem;
    height: 2px;
    background: var(--line-strong);
    transition: background var(--base) var(--ease);
}
.ob-steps span.is-on { background: var(--signal); }

.ob-slide {
    display: none;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    padding-block: 2.5rem 3.5rem;
}
.ob-slide.is-on { display: flex; animation: obIn 420ms var(--ease-out); }
@keyframes obIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.pick-list { max-height: 22rem; overflow-y: auto; scrollbar-width: thin; }
.pick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.7rem 0.85rem;
    transition: background var(--fast) var(--ease);
}
.pick-row:hover { background: var(--surface-2); }

/* -------------------------------------------------------------------------
   19. Utilitaires
   ------------------------------------------------------------------------- */
.hide-scroll { scrollbar-width: none; -ms-overflow-style: none; }
.hide-scroll::-webkit-scrollbar { display: none; }

.hscroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 0.35rem;
}
.hscroll > * { scroll-snap-align: start; flex: 0 0 auto; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.pad-safe { padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0)); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }

.is-hidden { display: none !important; }

/* Barre de defilement globale. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4A535A; }

/* -------------------------------------------------------------------------
   19b. Panneau constructeur (admin)
   ------------------------------------------------------------------------- */
.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}
.admin-rail { max-height: 26rem; overflow-y: auto; scrollbar-width: thin; }

.stop-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.9rem;
    transition: background var(--fast) var(--ease);
}
.stop-row:hover { background: var(--surface-2); }
.stop-rail {
    position: relative;
    width: 1.1rem;
    align-self: stretch;
    flex: 0 0 auto;
}
.stop-rail::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--line-strong);
    transform: translateX(-50%);
}
.stop-row.is-first .stop-rail::before { top: 50%; }
.stop-row.is-last .stop-rail::before { bottom: 50%; }
.stop-dot {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 0.6rem; height: 0.6rem;
    background: var(--rail-color, var(--signal));
    border-radius: 50%;
}

@media (max-width: 1023px) {
    .admin-grid { grid-template-columns: 1fr; }
    .admin-rail { max-height: none; }
}

/* -------------------------------------------------------------------------
   20. Repli mobile, declare explicitement pour chaque disposition
   ------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .roles { grid-template-columns: 1fr 1fr; }
    .roles::before { display: none; }
    .role::before { display: none; }
    .role:nth-child(2), .role:nth-child(3) { padding-top: 0; }
    .roles { padding-top: 0; gap: 2rem; }
    .role { padding-top: 1.25rem; border-top: 2px solid var(--line); }
    .role.is-lead { border-top-color: var(--signal); }
}

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; padding-top: 2.75rem; gap: 2.5rem; }
    .hero-copy { max-width: none; }
    .split { grid-template-columns: 1fr; gap: 2rem; }
    .foot-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    :root { --gutter: 1rem; }
    .roles { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .identity .identity-text { display: none; }
    .t-hero { font-size: clamp(2.35rem, 10vw, 3.1rem); }
    .hero-cta .btn { flex: 1 1 100%; }
    .modes { gap: 0 1.5rem; }
    .dial { width: 5.5rem; height: 5.5rem; }
    .dial-value { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .grid-2 { grid-template-columns: 1fr; }
    .mark { width: 2.1rem; height: 2.1rem; }
    .rail { padding-left: 2.25rem; }
}

@media (min-width: 721px) {
    .tabbar { display: none; }
    .pad-safe { padding-bottom: 3rem; }
}

@media print {
    .nav, .tabbar, .subhead, body::after { display: none !important; }
    body { background: #fff; color: #000; }
}
