/*
 * Portail WynLink : charte graphique WynLink (branding/wynlink-brand.json). Police Inter (auto-hébergée, licence OFL),
 * bleu principal #0066FF, accents cyan et violet, menu latéral bleu sombre. Thème clair par défaut, sombre selon le
 * système. Aucune bibliothèque CSS : jetons (variables) puis composants.
 */

@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");
}

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

:root {
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

    /* Couleurs de la charte */
    --wl-blue: #0066FF;
    --wl-cyan: #00D6F2;
    --wl-violet: #7C3AED;
    --wl-navy: #0B1220;
    --wl-gradient: linear-gradient(135deg, #00D6F2 0%, #0066FF 55%, #7C3AED 100%);
    --wl-hero: linear-gradient(180deg, #000717 0%, #0B1220 100%);

    /* Surfaces et texte */
    --bg: #F6F8FC;
    --surface: #FFFFFF;
    --surface-2: #F3F6FA;
    --surface-3: #E9EEF5;
    --border: #E3E8EF;
    --border-strong: #CBD3DF;
    --text: #0B1220;
    --text-2: #374151;
    --text-muted: #6B7280;

    /* Actions et états */
    --primary: #0066FF;
    --primary-hover: #0057DB;
    --primary-active: #0047B3;
    --primary-soft: #EAF2FF;
    --primary-text: #FFFFFF;
    --success: #047A35;
    --success-solid: #00B94C;
    --success-soft: #E7F8EE;
    --warning: #8F5300;
    --warning-solid: #F59E0B;
    --warning-soft: #FFF5E0;
    --danger: #C42B1C;
    --danger-solid: #D92D20;
    --danger-soft: #FDECEA;
    --info: #0057DB;
    --info-soft: #EAF2FF;

    /* Menu latéral (bleu sombre de la charte, dans les deux thèmes) */
    --side-bg: #031827;
    --side-border: #0F2A42;
    --side-text: #B8C2D3;
    --side-hover: #0A2236;
    --side-active: #02398B;
    --side-active-ring: #0B4DB8;

    /* Formes */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgb(11 18 32 / 6%);
    --shadow: 0 1px 3px rgb(11 18 32 / 6%), 0 8px 24px rgb(11 18 32 / 6%);
    --shadow-lg: 0 20px 50px rgb(11 18 32 / 22%);
    --focus: 0 0 0 3px rgb(0 102 255 / 35%);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #02131F;
        --surface: #061B2B;
        --surface-2: #0A2236;
        --surface-3: #0E2A42;
        --border: #12324F;
        --border-strong: #1B4466;
        --text: #E8EDF5;
        --text-2: #C7D0DD;
        --text-muted: #9AA6B8;
        --primary: #3B8BFF;
        --primary-hover: #5A9EFF;
        --primary-active: #2F7AEB;
        --primary-soft: #0B2A55;
        --primary-text: #02131F;
        --success: #4ADE80;
        --success-soft: #0B3320;
        --warning: #FBBF24;
        --warning-soft: #3A2A07;
        --danger: #F87171;
        --danger-soft: #3B1414;
        --info: #7DB3FF;
        --info-soft: #0B2A55;
        --side-bg: #010E18;
        --shadow-sm: none;
        --shadow: 0 0 0 1px rgb(255 255 255 / 2%);
        --shadow-lg: 0 20px 50px rgb(0 0 0 / 55%);
        --focus: 0 0 0 3px rgb(59 139 255 / 45%);
        color-scheme: dark;
    }
}

/* ---------------------------------------------------------------- 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;
}

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

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

h1:focus {
    outline: none;
}

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: 5px;
    padding: .05rem .35rem;
}

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

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

.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(--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;
}

.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);
}

.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: 1px solid var(--side-border);
    color: var(--side-text);
    overflow-y: auto;
}

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

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

.sidebar-brand img {
    display: block;
    height: 30px;
    width: auto;
}

.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: .9rem .75rem .35rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6F7F96;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--side-text);
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav a:hover {
    background: var(--side-hover);
    color: #FFFFFF;
}

.sidebar-nav a.active {
    background: var(--side-active);
    color: #FFFFFF;
    box-shadow: inset 0 0 0 1px var(--side-active-ring);
}

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

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

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

.sidebar-user .role {
    display: block;
    font-size: .78rem;
    color: #8C9AB0;
}

.sidebar-user form {
    margin: 0;
}

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

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

.avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--wl-gradient);
    color: #FFFFFF;
    font-size: .8rem;
    font-weight: 700;
    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: 2rem 2.25rem 3rem;
    flex: 1;
}

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

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

    .sidebar {
        position: sticky;
        z-index: 20;
        height: auto;
        gap: 0;
        padding: .75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--side-border);
    }

    .sidebar-top {
        padding: 0;
    }

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

    .sidebar-nav, .sidebar-user {
        display: none;
    }

    .nav-toggle:checked ~ .sidebar-nav,
    .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;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .5rem;
    color: var(--text-muted);
    font-size: .875rem;
}

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

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

.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;
}

.count {
    display: inline-block;
    margin-left: .4rem;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 600;
    vertical-align: middle;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.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: 1px solid var(--border);
}

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

.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(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

a.tile:hover {
    text-decoration: none;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.tile-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: linear-gradient(135deg, #062743 0%, #031827 100%);
    color: #2BA4FF;
    box-shadow: inset 0 0 0 1px #0E3A63;
}

/* 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;
}

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

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

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

.stat {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.stat .value {
    display: block;
    margin-top: .35rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.welcome {
    position: relative;
    overflow: hidden;
    padding: 1.75rem 1.75rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--wl-hero);
    color: #E5E7EB;
    box-shadow: var(--shadow);
}

.welcome::after {
    content: "";
    position: absolute;
    inset: auto -10% -60% 35%;
    height: 180%;
    background: radial-gradient(closest-side, rgb(0 102 255 / 35%), transparent 70%);
    pointer-events: none;
}

.welcome h1 {
    color: #FFFFFF;
    position: relative;
}

.welcome p {
    position: relative;
    margin: .4rem 0 0;
    color: #B8C2D3;
    max-width: 62ch;
}

.welcome .tagline {
    position: relative;
    display: block;
    margin-bottom: .5rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .3em;
    text-transform: uppercase;
    background: var(--wl-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------------------------------------------------------------- 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;
}

.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(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .6rem .75rem;
    width: 100%;
    min-height: 2.6rem;
    transition: border-color .15s, box-shadow .15s;
}

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);
}

.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 */

.button {
    font: inherit;
    font-weight: 600;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.5rem;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.button:hover {
    text-decoration: none;
    background: var(--surface-2);
}

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

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

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

.button.danger {
    background: var(--danger-solid);
    border-color: var(--danger-solid);
    color: #FFFFFF;
}

.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: 3rem;
    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 {
        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;
}

.table th {
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--surface-2);
    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: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

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

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

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

.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: 36px;
    height: 36px;
    border-radius: 9px;
}

.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: 1px solid var(--border);
    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: .8rem 1rem;
    border-radius: var(--radius);
    margin: 0 0 1rem;
    border: 1px solid transparent;
    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;
}

.alert-success {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
    color: var(--warning);
}

.alert-info {
    background: var(--info-soft);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
    color: var(--info);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .76rem;
    font-weight: 600;
    padding: .18rem .6rem;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-muted);
    white-space: nowrap;
}

.badge.dot::before {
    content: "";
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: currentColor;
}

.badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.badge.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

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

.badge.info {
    background: var(--info-soft);
    color: var(--info);
}

.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: 4px;
    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 */

.link-card {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow);
    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(2 10 20 / 55%);
    backdrop-filter: blur(2px);
}

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

.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 */

.tabs {
    display: flex;
    gap: .25rem;
    /* Ligne de base tracée à l'intérieur : défilement horizontal sur petit écran, sans barre verticale. */
    box-shadow: inset 0 -1px 0 var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem .9rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

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

.tabs a.active {
    color: var(--primary);
    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;
}

.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;
}

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

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

.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;
}

.logo-dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    .logo-light {
        display: none;
    }

    .logo-dark {
        display: inline-block;
    }
}

@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(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

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

.helper-card strong {
    display: block;
}

/* ---------------------------------------------------------------- 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.";
}
