/*
 * Portail WynLink. Couleurs, polices et formes : celles du thème choisi dans « Mon compte » (themes.css, tiré du catalogue
 * des thèmes de la console, RDP_Tool.Themes), reprises ici dans les noms du portail. Présentation sobre, comme la
 * console : filets plutôt qu'ombres, aucune couleur pour dire qu'un état est bon, un rouge pour ce qui ne va pas.
 * Jetons de la charte (--wl-*) dans tokens.css, pour le panneau de marque des pages hors session. Aucune bibliothèque CSS.
 */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/inter-regular.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/inter-medium.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/inter-semibold.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/inter-bold.woff2") format("woff2");
}

/* Polices des thèmes Signal, Atelier et Contraste (celles de la console) : chargées seulement par le thème qui les prend. */

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/Archivo-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/Archivo-Medium.ttf") format("truetype");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/Archivo-SemiBold.ttf") format("truetype");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/Archivo-Bold.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/IBMPlexSans-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/IBMPlexSans-Medium.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/IBMPlexSans-SemiBold.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/IBMPlexSans-Bold.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/IBMPlexMono-Medium.ttf") format("truetype");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
}

/* ---------------------------------------------------------------- Jetons */

/* Noms du portail pour les jetons du thème (themes.css). Les anciens états « succès », « avertissement » et
   « information » n'ont plus de couleur propre : texte ordinaire, rouge de ce qui ne va pas, accent. */
:root {
    --font: var(--th-font);
    --mono: var(--th-mono);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* Panneau de marque des pages hors session (tokens.css) */
    --wl-hero: var(--wl-gradient-hero);

    /* Surfaces et texte */
    --bg: var(--th-page);
    --surface: var(--th-surface);
    --surface-2: var(--th-surface-2);
    --surface-3: var(--th-surface-3);
    --card-bg: var(--th-surface);
    --input-bg: var(--th-field);
    --border: var(--th-line);
    --border-strong: var(--th-line-strong);
    --border-width: var(--th-border-width);
    --text: var(--th-text);
    --text-2: var(--th-text-2);
    --text-muted: var(--th-muted-text);
    --eyebrow: var(--th-muted-text);
    --selection: var(--th-selection);

    /* Actions et états */
    --primary: var(--th-primary);
    --primary-hover: var(--th-primary-hover);
    --primary-active: var(--th-primary-pressed);
    --primary-soft: var(--th-primary-soft);
    --primary-text: var(--th-on-primary);
    --button-primary: var(--th-primary);
    --button-primary-hover: var(--th-primary-hover);
    --button-bg: var(--th-button);
    --button-text: var(--th-button-text);
    --button-border: var(--th-button-border);
    --button-hover-bg: var(--th-button-hover);
    --button-hover-border: var(--th-button-border);
    --button-pressed-bg: var(--th-button-pressed);
    --row-hover: var(--th-surface-2);
    --danger: var(--th-danger);
    --danger-solid: var(--th-danger);
    --danger-soft: var(--th-danger-soft);
    --danger-line: var(--th-danger-line);
    --success: var(--th-text);
    --success-soft: var(--th-surface-2);
    --warning: var(--th-danger);
    --warning-soft: var(--th-danger-soft);
    --info: var(--th-primary);
    --info-soft: var(--th-primary-soft);

    /* Menu latéral */
    --side-bg: var(--th-side);
    --side-border: var(--th-side-line);
    --side-text: var(--th-side-text);
    --side-muted: var(--th-side-muted);
    --side-hover: var(--th-side-hover);
    --side-active: var(--th-side-active);
    --side-active-text: var(--th-side-active-text);
    --side-accent: var(--th-side-accent);

    /* Formes : rayons du thème, pas d'ombre (filets), sinon sous les boîtes de dialogue */
    --radius-sm: var(--th-radius);
    --radius: var(--th-radius);
    --radius-lg: calc(var(--th-radius) * 1.5);
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 18px 48px -18px rgb(0 0 0 / 45%);
    --focus: 0 0 0 2px var(--th-page), 0 0 0 4px var(--th-primary);
}

/* ---------------------------------------------------------------- Base */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Variantes d'Inter de la charte (« a » à un étage, chiffres ouverts) : propres à cette police, donc au thème WynLink. */
html:not([data-theme]) body, html[data-theme="wynlink"] body {
    font-feature-settings: "cv11", "ss01";
}

h1, h2, h3 {
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.015em;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin: 0;
}

/* Blazor place le focus sur le titre après une navigation : pas d'anneau sur un titre. */
h1:focus, h1:focus-visible {
    outline: none;
    box-shadow: none;
}

::selection {
    background: var(--primary-soft);
    color: var(--text);
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 .75rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .5rem;
}

p {
    margin: 0 0 .75rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

strong {
    font-weight: 600;
}

code, kbd {
    font-family: var(--mono);
    font-size: .9em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .05rem .35rem;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.icon {
    flex: none;
    vertical-align: middle;
}

/* Attribut hidden : caché même quand la classe donne un display (.alert, .button…). Les attributs style sont bloqués
   par la politique de sécurité du contenu (style-src 'self') : pas de style="display: none" pour cacher. */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 100;
    background: var(--button-primary);
    color: var(--primary-text);
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
}

.muted {
    color: var(--text-muted);
}

.hint {
    color: var(--text-muted);
    font-size: .875rem;
    margin: 0;
}

.nowrap {
    white-space: nowrap;
}

.mono {
    font-family: var(--mono);
}

.hint.spaced {
    margin-bottom: 1rem;
}

.hint.spaced-top {
    margin-top: .75rem;
}

/* ---------------------------------------------------------------- Mise en page : application */

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

/* Menu latéral aux couleurs du thème (marine pour WynLink), séparé du contenu par un filet. */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem .875rem 1rem;
    background: var(--side-bg);
    border-right: var(--border-width) solid var(--side-border);
    color: var(--side-text);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--side-border) transparent;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 .5rem;
}

.sidebar-brand {
    display: inline-flex;
    padding: .25rem 0;
}

/* Logo pour fond sombre ou pour fond clair, selon le menu du thème. */
.sidebar-brand img {
    height: 30px;
    width: auto;
}

.sidebar-brand .logo-on-dark {
    display: var(--th-side-logo-on-dark, inline-block);
}

.sidebar-brand .logo-on-light {
    display: var(--th-side-logo-on-light, none);
}

.nav-toggle {
    display: none;
}

.nav-toggle-button {
    display: none;
    color: var(--side-text);
    padding: .35rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
}

.nav-section {
    margin: 1rem .75rem .35rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--side-muted);
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    border-radius: var(--radius);
    color: var(--side-text);
    text-decoration: none;
    transition: color .2s, background-color .2s;
}

.sidebar-nav a .icon {
    color: var(--side-muted);
    transition: color .2s;
}

.sidebar-nav a:hover {
    background: var(--side-hover);
    text-decoration: none;
}

.sidebar-nav a:hover .icon {
    color: var(--side-text);
}

/* Rubrique ouverte : fond du thème, icône à l'accent du menu (comme la console). */
.sidebar-nav a.active {
    background: var(--side-active);
    color: var(--side-active-text);
    font-weight: 600;
}

.sidebar-nav a.active .icon {
    color: var(--side-accent);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem .5rem 0;
    border-top: var(--border-width) solid var(--side-border);
}

.sidebar-user .who {
    min-width: 0;
    flex: 1;
}

.sidebar-user .name {
    display: block;
    color: var(--side-text);
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .role {
    display: block;
    font-size: .78rem;
    color: var(--side-muted);
}

.sidebar-user form {
    margin: 0;
}

.sidebar-user .icon-button {
    color: var(--side-text);
}

.sidebar-user .icon-button:hover {
    background: var(--side-hover);
    color: var(--side-text);
}

.avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--side-active);
    color: var(--side-active-text);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.avatar.small {
    width: 30px;
    height: 30px;
    font-size: .72rem;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 2.25rem 2.25rem 3rem;
    flex: 1;
}

.footer {
    padding: 1rem 2.25rem 1.5rem;
    color: var(--text-muted);
    font-size: .75rem;
    display: flex;
    gap: .5rem;
    justify-content: center;
}

@media (max-width: 960px) {
    .app {
        grid-template-columns: 1fr;
    }

    /* Menu en barre du haut, replié sous le bouton. */
    .sidebar {
        position: sticky;
        z-index: 20;
        height: auto;
        max-height: 100vh;
        gap: 0;
        padding: .75rem 1rem;
        border-right: none;
        border-bottom: var(--border-width) solid var(--side-border);
    }

    .nav-toggle-button {
        border: var(--border-width) solid var(--side-border);
        border-radius: var(--radius);
    }

    .sidebar-user {
        margin-top: .75rem;
    }

    .sidebar-top {
        padding: 0;
    }

    .nav-toggle-button {
        display: inline-flex;
    }

    /* « .sidebar > » : plus précis que .language-picker, défini plus loin. */
    .sidebar-nav, .sidebar > .sidebar-language, .sidebar-user {
        display: none;
    }

    .nav-toggle:checked ~ .sidebar-nav,
    .nav-toggle:checked ~ .sidebar-language,
    .nav-toggle:checked ~ .sidebar-user {
        display: flex;
    }

    .nav-toggle:checked ~ .sidebar-nav {
        padding-top: .75rem;
    }

    .nav-toggle:focus-visible + .sidebar-top .nav-toggle-button {
        box-shadow: var(--focus);
    }

    .content {
        padding: 1.5rem 1rem 2.5rem;
    }
}

/* ---------------------------------------------------------------- En-têtes de page */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header .titles {
    min-width: 0;
}

.page-header .title-line {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.page-subtitle {
    margin: .35rem 0 0;
    color: var(--text-muted);
    max-width: 70ch;
}

.page-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Fil d'Ariane au-dessus du titre, en texte discret. */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .4rem;
    color: var(--eyebrow);
    font-size: .82rem;
}

.breadcrumb a {
    color: inherit;
}

.breadcrumb a:hover {
    color: var(--text);
    text-decoration: none;
}

.section {
    margin-top: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: .9rem;
}

.section-header h2 {
    margin: 0;
}

/* Nombre d'éléments à côté d'un titre, en texte discret. */
.count {
    display: inline-block;
    margin-left: .4rem;
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Cartes */

/* Bloc à filet, sans ombre. */
.card {
    background: var(--card-bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
}

.card-body {
    padding: 1.25rem 1.4rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.4rem;
    border-bottom: var(--border-width) solid var(--border);
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1rem;
}

/* Titre à icône dans le corps d'une carte (Abonnement, Annuaire) : icône écartée du texte, comme dans un en-tête. */
.card-body > h2:has(> .icon) {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.card-header .hint {
    margin-top: .25rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.tile {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.15rem 1.25rem;
    background: var(--card-bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color .2s, background-color .2s;
}

a.tile:hover {
    text-decoration: none;
    border-color: var(--border-strong);
    background: var(--surface-2);
}

a.tile:hover .chevron {
    color: var(--primary);
}

/* Icône d'une rubrique : le trait à l'accent, sans tuile. */
.tile-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--primary);
}

/* Titre de la carte seulement : un mot en gras dans la description (adresse) reste dans la phrase. */
.tile > span > strong {
    display: block;
    margin-bottom: .2rem;
    color: var(--text);
}

.tile span {
    color: var(--text-muted);
    font-size: .9rem;
}

/* Bloc « WynLink Console » de l'accueil : boutons de téléchargement sous l'icône et la description, sur toute la
   largeur de la carte. Dans la seule colonne du texte, « Télécharger pour Windows » (sans retour à la ligne) ne tient
   pas dans une carte étroite et l'élargissait au-delà du cadre. */
.tile.console-download {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: .75rem;
}

.tile .console-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.tile .chevron {
    margin-left: auto;
    align-self: center;
    color: var(--text-muted);
    transition: color .2s;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Accueil : les cases s'étirent sur toute la largeur au lieu de laisser des colonnes vides à droite. Avec quatre
   indicateurs et le même espacement, elles tombent sur les colonnes des cartes d'accès rapide en dessous. */
.stats.stretch {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Colonne : la valeur est calée en bas de la case, alignée d'une case à l'autre même quand un libellé passe sur deux lignes. */
.stat {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.25rem;
    background: var(--card-bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
}

.stat .label {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 500;
}

.stat .label .icon {
    color: var(--text-muted);
}

.stat .value {
    display: block;
    margin-top: auto;
    padding-top: .35rem;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

/* Valeur en texte (date, « toutes les heures ») plutôt qu'en nombre : plus petite, sur une ligne. */
.stat .value.small-value {
    font-size: 1.05rem;
    letter-spacing: 0;
    white-space: nowrap;
}

/* Annuaire : membres que la dernière synchronisation n'a pas pu reprendre (pack plein, adresse manquante…). */
.sync-details {
    margin-top: 4px;
    font-size: 0.85rem;
}

.sync-details summary {
    cursor: pointer;
    color: var(--danger);
}

.sync-details ul {
    margin: 4px 0 0;
    padding-left: 18px;
    color: var(--text-muted);
}

/* Accueil : titre et phrase d'introduction, sans bandeau. */
.welcome {
    margin-bottom: 1.5rem;
}

.welcome p {
    margin: .4rem 0 0;
    color: var(--text-muted);
    max-width: 62ch;
}

.welcome .tagline {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- Formulaires */

.form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.form.narrow {
    max-width: 460px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: start;
}

.form-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
}

/* Bouton aligné sur le champ (sous la hauteur de son libellé), même quand un message de validation s'affiche. */
.form-inline > .form-actions {
    padding-top: 1.75rem;
}

@media (max-width: 600px) {
    .form-inline {
        grid-template-columns: 1fr;
    }

    .form-inline > .form-actions {
        padding-top: 0;
    }
}

.form-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Champs et boutons alignés en bas (libellé au-dessus du champ) ; le champ prend la place restante. */
.form-actions.bottom {
    align-items: flex-end;
}

.form-actions .field.grow {
    flex: 1 1 260px;
}

/* Case à cocher à la hauteur d'un champ voisin (en bas de sa cellule de grille). */
.checkbox.field-height {
    min-height: 2.6rem;
    align-self: end;
}

/* Liste déroulante dans un en-tête de carte (filtre). */
select.compact-select {
    width: auto;
    min-height: 2.35rem;
    padding: .4rem .6rem;
}

/* Rangée sous une grille de champs (cases à cocher, puis boutons). */
.form-actions.spaced-top {
    margin-top: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

label, .label {
    font-weight: 500;
    font-size: .9rem;
    color: var(--text-2);
}

/* Les champs Blazor (InputText) n'ont pas toujours d'attribut type : tous les champs de saisie sauf cases et boutons.
   :where() ramène la priorité à zéro, pour que les variantes (.search, .code-input…) s'appliquent sans !important. */
:where(input:not([type=checkbox], [type=radio], [type=hidden], [type=submit], [type=button]), select) {
    font: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    width: 100%;
    min-height: 2.5rem;
    transition: border-color .2s, box-shadow .2s;
}

input::placeholder {
    color: var(--text-muted);
    opacity: .8;
}

input:hover, select:hover {
    border-color: var(--text-muted);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus);
}

input:disabled, input[readonly] {
    background: var(--surface-2);
    color: var(--text-muted);
}

input.invalid {
    border-color: var(--danger);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 400;
    color: var(--text-2);
}

.checkbox input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--primary);
}

/* Droits à cocher (PermissionChecklist). */
.permissions {
    display: grid;
    gap: .45rem;
    margin: 1rem 0 0;
    padding: .75rem 1rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.permissions legend {
    padding: 0 .35rem;
    font-weight: 600;
    font-size: .9rem;
}

.permissions label:has(input:disabled) {
    opacity: .6;
}

/* Cases à cocher filtrables (droits sur les postes) : liste défilante sous sa recherche. */
.check-list {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.check-list legend {
    padding: 0;
    margin-bottom: .5rem;
}

.check-list-items {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    max-height: 16rem;
    overflow-y: auto;
    padding: .65rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.check-list .checkbox {
    align-items: flex-start;
}

.check-list .checkbox input {
    margin-top: .15rem;
    flex: none;
}

.check-list .sub {
    display: block;
    color: var(--text-muted);
    font-size: .8rem;
}

.validation-message {
    color: var(--danger);
    font-size: .85rem;
}

.search {
    position: relative;
    min-width: 220px;
}

.search .icon {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search input {
    padding-left: 2.2rem;
    min-height: 2.35rem;
}

.read-only-value {
    padding: .6rem 0;
    color: var(--text);
}

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

/* Boutons du thème : principal à l'accent, les autres en contour ; ni halo ni mouvement. */
.button {
    font: inherit;
    font-weight: 500;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.4rem;
    padding: .45rem 1rem;
    border-radius: var(--radius);
    border: var(--border-width) solid var(--button-border);
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}

.button:hover {
    text-decoration: none;
    background: var(--button-hover-bg);
    border-color: var(--button-hover-border);
}

.button:active {
    background: var(--button-pressed-bg);
}

.button.primary {
    background: var(--button-primary);
    border-color: var(--button-primary);
    color: var(--primary-text);
}

.button.primary:hover {
    background: var(--button-primary-hover);
    border-color: var(--button-primary-hover);
}

.button.primary:active {
    background: var(--primary-active);
    border-color: var(--primary-active);
}

.button.danger {
    background: var(--danger-solid);
    border-color: var(--danger-solid);
    color: var(--th-page);
}

.button.danger:hover {
    filter: brightness(.94);
}

.button.danger-outline {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}

.button.danger-outline:hover {
    background: var(--danger-soft);
}

.button.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}

.button.ghost:hover {
    background: var(--surface-2);
}

.button.small {
    min-height: 2rem;
    padding: .3rem .7rem;
    font-size: .82rem;
}

.button.block {
    width: 100%;
}

.button.large {
    min-height: 2.75rem;
    font-size: 1rem;
}

.button:disabled, .button[aria-disabled=true] {
    opacity: .55;
    cursor: not-allowed;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.icon-button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.link-button {
    font: inherit;
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
}

.link-button:hover {
    text-decoration: underline;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2s;
    }

    .tile, .tile .chevron, .button {
        transition: none;
    }
}

/* ---------------------------------------------------------------- Tableaux */

/* Grand écran : rien n'est rogné (menus d'actions flottants). Petit écran : le tableau défile, les menus s'ouvrent
   dans la ligne. */
.table-wrap {
    /* Bloc de référence : les libellés masqués (position absolue) restent dans le tableau et n'élargissent pas la page. */
    position: relative;
    overflow: visible;
}

@media (max-width: 1100px) {
    .table-wrap {
        overflow-x: auto;
    }

    .menu-list {
        position: static;
        margin-top: .35rem;
        box-shadow: none;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.table th, .table td {
    text-align: left;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Titres de colonnes en texte discret, sur un filet marqué (comme les listes de la console). */
.table th {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom-color: var(--border-strong);
    white-space: nowrap;
}

.table th:first-child, .table td:first-child {
    padding-left: 1.4rem;
}

.table th:last-child, .table td:last-child {
    padding-right: 1.4rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: var(--row-hover);
}

.table td {
    transition: background-color .15s;
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table .actions-col {
    text-align: right;
    white-space: nowrap;
}

/* Tableau à nombreuses colonnes (packs) : titres sur plusieurs lignes, colonnes resserrées, boutons sur une ligne, et
   défilement horizontal plutôt qu'un débordement de la carte quand elle reste trop étroite. */
.table-wrap.scroll {
    overflow-x: auto;
}

.table.compact th {
    white-space: normal;
    line-height: 1.3;
    vertical-align: bottom;
}

.table.compact th, .table.compact td {
    padding-left: .65rem;
    padding-right: .65rem;
}

.table.compact th:first-child, .table.compact td:first-child {
    padding-left: 1.4rem;
}

.table.compact th:last-child, .table.compact td:last-child {
    padding-right: 1.4rem;
}

.table.compact .row-actions {
    flex-wrap: nowrap;
}

/* Packs à souscrire (page « Abonnement ») : une carte par pack, le pack en cours mis en avant. */
.offers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.offer h3 {
    margin: 0 0 .35rem;
}

.offer .price {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 .75rem;
}

.offer .price .muted {
    font-size: .9rem;
    font-weight: 400;
}

.offer .features {
    margin: 0 0 1rem;
    padding-left: 1.1rem;
    color: var(--text-2);
    font-size: .9rem;
}

.offer.current {
    border-color: var(--primary);
}

/* Place d'un bouton absent : les icônes des lignes restent alignées. */
.icon-button.placeholder {
    visibility: hidden;
}

.table.audit td {
    font-size: .87rem;
}

/* Journal : libellés longs sur plusieurs lignes, adresses e-mail et IPv6 coupées au besoin, chaque colonne assez large
   pour se lire ; le tableau tient dans sa carte et ne défile qu'en dernier recours. */
.table.audit .badge {
    white-space: normal;
    line-height: 1.35;
    border-radius: .75rem;
}

.table.audit .event {
    min-width: 8.5rem;
}

.table.audit .party, .table.audit .details, .table.audit .ip {
    overflow-wrap: anywhere;
}

.table.audit .party {
    min-width: 9rem;
}

.table.audit .details {
    min-width: 12rem;
}

.table.audit .ip {
    min-width: 8rem;
}

.row-disabled td {
    color: var(--text-muted);
}

.person {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

.person .name {
    font-weight: 600;
    color: var(--text);
}

.person .sub, td .sub {
    display: block;
    color: var(--text-muted);
    font-size: .83rem;
}

.person .tile-icon {
    width: 24px;
    height: 24px;
}

.row-actions {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Menu d'actions d'une ligne (sans JavaScript) */
.menu {
    position: relative;
    display: inline-block;
}

.menu > summary {
    list-style: none;
}

.menu > summary::-webkit-details-marker {
    display: none;
}

.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + .35rem);
    z-index: 30;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    padding: .35rem;
    background: var(--surface);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.menu-list button {
    font: inherit;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .65rem;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.menu-list button:hover, .menu-list button:focus-visible {
    background: var(--surface-2);
}

.menu-list button.danger {
    color: var(--danger);
}

.menu-list hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: .3rem 0;
}

/* ---------------------------------------------------------------- Messages, badges */

.alert {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    padding: .35rem 0 .35rem .9rem;
    margin: 0 0 1rem;
    border-left: 2px solid var(--border-strong);
    color: var(--text);
    font-size: .92rem;
}

.alert > .icon {
    margin-top: .1rem;
}

.alert .alert-body {
    flex: 1;
    min-width: 0;
}

.alert p {
    margin: .15rem 0;
}

.alert .icon-button {
    width: 1.75rem;
    height: 1.75rem;
    margin: -.2rem -.3rem 0 0;
    color: inherit;
}

/* Messages : un filet à gauche, sans fond ; rouge pour ce qui ne va pas, accent pour une information. */
.alert-success {
    border-left-color: var(--border-strong);
}

.alert-success > .icon {
    color: var(--text-muted);
}

.alert-danger, .alert-warning {
    border-left-color: var(--danger);
}

.alert-danger > .icon, .alert-warning > .icon {
    color: var(--danger);
}

.alert-danger {
    color: var(--danger);
}

.alert-info {
    border-left-color: var(--primary);
}

.alert-info > .icon {
    color: var(--primary);
}

/* États en mots, sans pastille ni aplat : rouge seulement pour ce qui ne va pas. */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.badge.success, .badge.info {
    color: var(--text);
}

.badge.warning, .badge.danger {
    color: var(--danger);
}

/* Charge d'un relais (page « Relais ») : accent du thème, rouge quand le relais est plein. */
.load-bar-line {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 12rem;
}

.load-bar {
    flex: 1;
    height: .5rem;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--primary);
    overflow: hidden;
}

.load-bar.full {
    color: var(--danger);
}

.load-bar > svg {
    display: block;
    width: 100%;
    height: 100%;
}

.load-bar-label {
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
    white-space: nowrap;
}

.load-bar-label.full {
    color: var(--danger);
    font-weight: 600;
}

.badge-line {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .5rem;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}

.empty .tile-icon {
    margin-bottom: .35rem;
}

.empty strong {
    color: var(--text);
}

.loading {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.5rem 1.4rem;
    color: var(--text-muted);
}

.skeleton {
    height: .9rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
    background-size: 200% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: -100% 0;
    }
}

/* ---------------------------------------------------------------- Lien d'accès, confirmation */

/* Lien à transmettre : bloc au filet de l'accent. */
.link-card {
    border-color: var(--primary);
    margin-bottom: 1.25rem;
}

.copy-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.copy-row input {
    flex: 1 1 280px;
    font-family: var(--mono);
    font-size: .85rem;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(0 0 0 / 45%);
}

.dialog {
    width: min(480px, 100%);
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.4rem 1.5rem 1.25rem;
}

/* Fenêtre de réglage (cases à cocher) : plus large, défilante sur petit écran. */
.dialog.wide {
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.dialog-head {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
}

.dialog-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
}

.dialog-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.dialog h2 {
    margin: .25rem 0 .4rem;
}

.dialog p {
    color: var(--text-2);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

/* Confirmation sans JavaScript (formulaires des pages statiques) */
.confirm-inline > summary {
    list-style: none;
    display: inline-flex;
}

.confirm-inline > summary::-webkit-details-marker {
    display: none;
}

.confirm-inline[open] > summary {
    margin-bottom: .75rem;
}

.confirm-inline .alert {
    margin: 0;
}

.confirm-inline .alert .button {
    margin-top: .5rem;
}

/* ---------------------------------------------------------------- Mon compte */

/* Onglets en pastilles, comme le menu du site : un cadre, l'onglet ouvert en bleu translucide. Défilement horizontal
   sur petit écran, sans barre verticale. */
/* Onglets soulignés sur un filet, l'onglet ouvert à l'accent. */
.tabs {
    display: flex;
    max-width: 100%;
    gap: .25rem;
    margin-bottom: 1.5rem;
    border-bottom: var(--border-width) solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .8rem;
    margin-bottom: calc(-1 * var(--border-width));
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: color .2s, border-color .2s;
}

.tabs a:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs a.active {
    color: var(--text);
    border-bottom-color: var(--primary);
}

.steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 2.75rem;
}

.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: .9rem;
}

/* Page d'assistance, bloc Linux : commande à coller dans un terminal, avec son bouton « Copier ». */
.command {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .5rem 0;
    padding: .5rem .5rem .5rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.command code {
    flex: 1;
    background: none;
    border: 0;
    padding: 0;
    overflow-wrap: anywhere;
    user-select: all;
}

/* Page d'assistance : procédure de l'autre système, repliée sous celle proposée. */
.other-system {
    margin-top: 1.5rem;
}

.other-system > summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
}

.other-system[open] > summary {
    margin-bottom: 1rem;
}

.qr-code {
    display: block;
    background: #FFFFFF;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: .5rem 0;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.recovery-codes code {
    display: block;
    text-align: center;
    padding: .45rem;
    font-size: .95rem;
}

.recovery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* ---------------------------------------------------------------- Pages publiques (connexion, assistance) */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    background: var(--wl-hero);
    color: #B8C2D3;
}

.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("brand/vague-lumineuse.svg") center / cover no-repeat;
    opacity: .9;
    pointer-events: none;
}

.auth-hero > * {
    position: relative;
}

.auth-hero img {
    height: 38px;
    width: auto;
    align-self: flex-start;
}

.auth-hero h2 {
    color: #FFFFFF;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: 16ch;
    margin: 0 0 1rem;
}

.auth-hero p {
    max-width: 42ch;
    font-size: 1rem;
}

.auth-hero .pillars {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: .85rem;
    color: #8C9AB0;
}

.auth-hero .pillars span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.auth-hero .pillars .icon {
    color: #2BA4FF;
}

.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

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

.auth-card .mobile-brand img {
    height: 32px;
}

.auth-card h1 {
    font-size: 1.55rem;
    margin-bottom: .4rem;
}

.auth-card .lead {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: space-between;
    font-size: .9rem;
}

/* « ou » entre la connexion par mot de passe et celle par une clé de sécurité. */
.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

/* Sélecteur de langue des pages hors session, sous le formulaire. */
.language-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .35rem 1rem;
    margin-top: 2rem;
    font-size: .85rem;
    color: var(--text-muted);
}

/* Dans le menu des pages d'une session : sur une ligne, au-dessus du compte. */
.sidebar-language {
    gap: .25rem .75rem;
    margin: 0 0 .6rem;
    font-size: .8rem;
}

/* Dans le menu : ses couleurs, pas celles de la page. */
.sidebar .sidebar-language, .sidebar .sidebar-language .link-button {
    color: var(--side-muted);
}

.sidebar .sidebar-language .link-button:hover, .sidebar .sidebar-language .link-button[aria-current="true"] {
    color: var(--side-text);
}

.language-picker .link-button {
    color: var(--text-muted);
    font-weight: 400;
}

.language-picker .link-button:hover {
    color: var(--text);
}

.language-picker .link-button[aria-current="true"] {
    color: var(--text);
    font-weight: 600;
}

/* Logo de la page, pour fond clair ou sombre selon la clarté du thème (themes.css). */
.logo-light {
    display: var(--th-logo-on-light, inline-block);
}

.logo-dark {
    display: var(--th-logo-on-dark, none);
}

@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-card .mobile-brand {
        display: block;
    }

    .auth-main {
        justify-content: flex-start;
        padding-top: 2.5rem;
    }
}

.code-input {
    font-family: var(--mono);
    font-size: 1.6rem;
    letter-spacing: .3em;
    text-align: center;
    padding: .75rem;
    min-height: 3.5rem;
}

.helper-card {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.helper-card .tile-icon {
    width: 24px;
    height: 24px;
}

.helper-card strong {
    display: block;
}

/* Méthodes de double authentification (Mon compte) : une carte par méthode, ses actions dessous. */
.method-list .helper-card > div {
    flex: 1;
}

.method-list .helper-card p {
    margin: .2rem 0 0;
}

.method-list .form-actions {
    margin-top: .75rem;
}

/* Clés de sécurité du compte : une par ligne (nom, date d'ajout, « Retirer » à droite). */
.key-list {
    list-style: none;
    margin: .5rem 0 0;
    padding: 0;
    display: grid;
    gap: .4rem;
}

.key-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .7rem;
}

.key-list li .button {
    margin-left: auto;
}

/* ---------------------------------------------------------------- Erreurs Blazor, reconnexion */

#blazor-error-ui {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: .75rem;
    max-width: 560px;
    margin: 0 auto;
    padding: .85rem 1rem;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    box-shadow: var(--shadow-lg);
}

#blazor-error-ui .reload {
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    margin-left: auto;
    font: inherit;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: var(--danger);
}

.blazor-error-boundary::after {
    content: "Une erreur s'est produite dans cette partie de la page.";
}

/* ---------------------------------------------------------------- Double authentification (lien e-mail, choix) */

.request-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .45rem 1rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.request-details dt {
    color: var(--text-muted);
}

.request-details dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.method-choice {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.method-choice .tile {
    width: 100%;
}

/* Historique des sessions : filtres dans l'en-tête de la carte, notes modifiables dans le tableau. */
.history-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

.history-filters label.inline {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.history-filters input[type=date] {
    width: auto;
    min-height: 2.35rem;
    padding: .35rem .5rem;
}

.history-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    color: var(--text-2);
}

.table.sessions td.notes {
    min-width: 16rem;
    max-width: 28rem;
}

.table.sessions .notes-text {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.notes-editor {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.notes-editor textarea {
    font: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: .5rem .6rem;
    resize: vertical;
}

/* Inscription en libre-service (account/register) : rendu statique, sans script. */
.register-step {
    margin: 0 0 1rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--primary);
}

.register-names {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

@media (max-width: 600px) {
    .register-names {
        grid-template-columns: 1fr;
    }
}

.register-kind {
    border: 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.register-kind legend {
    padding: 0;
    margin-bottom: .35rem;
    font-weight: 500;
    font-size: .9rem;
    color: var(--text-2);
}

/* Indépendant coché : pas de société à saisir (l'organisation porte son nom). */
.register-organization:has(#kind-individual:checked) .register-company {
    display: none;
}

.register-phone {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: .5rem;
}

.register-terms {
    align-items: flex-start;
}

.register-terms input {
    margin-top: .2rem;
    flex: none;
}

.register-summary {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .4rem 1rem;
    margin: 0 0 1.25rem;
}

.register-summary dt {
    color: var(--text-muted);
}

.register-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Réglages de la détection d'activité suspecte : poids dans un tableau. */
.narrow-number {
    width: 6rem;
    text-align: right;
}

/* Liste à choix multiple (pays d'intervention) : quelques lignes visibles. */
select[multiple] {
    min-height: 8rem;
}

/* Pays avec son drapeau (activité suspecte, connexions en cours). */
.country {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

.country .flag {
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}
