/* ==========================================================================
   Polices — hébergées ici : la politique de sécurité (default-src 'self') interdit les CDN.
   ========================================================================== */
@font-face {
    font-family: "Bricolage Grotesque";
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/bricolage-grotesque.woff2") format("woff2");
}

@font-face {
    font-family: "Geist";
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/geist.woff2") format("woff2");
}

@font-face {
    font-family: "Geist Mono";
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/geist-mono.woff2") format("woff2");
}

/* ==========================================================================
   Jetons de design — changer la charte se fait ici.
   Tous les couples texte / fond respectent un contraste AA (4.5:1 minimum).
   ========================================================================== */
:root {
    color-scheme: light dark;

    --font: "Geist", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    --font-display: "Bricolage Grotesque", var(--font);
    --font-mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

    --ink: #111410;
    --text: #23261f;
    --muted: #5f6357;
    --page: #f5f4f0;
    --surface: #ffffff;
    --surface-alt: #f8f7f3;
    --border: #e5e3db;
    --border-strong: #85897a;

    /* Couleur d'interaction (liens, focus) et accent de marque (aplats uniquement, jamais en texte sur clair). */
    --brand: #2c6a0f;
    --brand-hover: #1d4a07;
    --brand-soft: #eaf6d6;
    --accent: #c8f169;
    --on-accent: #111410;

    --primary: #111410;
    --primary-hover: #2b3027;
    --on-primary: #ffffff;

    /* Le panneau des pages publiques reste sombre dans les deux thèmes. */
    --panel: #0f120d;
    --on-panel: #f3f5ee;
    --on-panel-muted: #a9ae9c;

    --danger: #b3261e;
    --danger-hover: #8f1d17;
    --danger-soft: #fdecea;
    --success: #1a6b3c;
    --success-soft: #e6f5ec;

    --radius: 18px;
    --radius-small: 10px;
    --shadow: 0 1px 2px rgb(17 20 16 / 5%), 0 10px 28px -16px rgb(17 20 16 / 18%);
    --shadow-hover: 0 2px 4px rgb(17 20 16 / 6%), 0 22px 40px -18px rgb(17 20 16 / 30%);
    --ring: 0 0 0 4px rgb(44 106 15 / 16%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f3f5ee;
        --text: #e2e5db;
        --muted: #a4a996;
        --page: #0d0f0c;
        --surface: #161914;
        --surface-alt: #1c2019;
        --border: #2a2f26;
        --border-strong: #6f7566;

        --brand: #c8f169;
        --brand-hover: #dcf79a;
        --brand-soft: #25301a;

        --primary: #c8f169;
        --primary-hover: #dcf79a;
        --on-primary: #111410;

        --panel: #080a07;

        --danger: #ff8a80;
        --danger-hover: #ffaba3;
        --danger-soft: #3a1a1a;
        --success: #7ddba3;
        --success-soft: #14301f;

        --shadow: 0 1px 2px rgb(0 0 0 / 40%);
        --shadow-hover: 0 14px 32px -12px rgb(0 0 0 / 80%);
        --ring: 0 0 0 4px rgb(200 241 105 / 18%);
    }
}

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

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

/* Halo de marque derrière l'en-tête des pages de l'application. */
.app {
    background:
        radial-gradient(52rem 22rem at 12% -8rem, var(--brand-soft), transparent 70%),
        var(--page);
    background-repeat: no-repeat;
}

h1, h2 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -.025em;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
    font-weight: 700;
}

h2 {
    margin: 0 0 1.25rem;
    font-size: 1.3rem;
    font-weight: 650;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--brand);
    text-underline-offset: .2em;
}

a:hover {
    color: var(--brand-hover);
}

:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.icon {
    flex: none;
    width: 1.15em;
    height: 1.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -999rem;
    z-index: 20;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    padding: .6rem 1rem;
    color: var(--text);
    background: var(--surface);
    border-radius: var(--radius-small);
    box-shadow: var(--shadow-hover);
}

code {
    padding: .1em .4em;
    font-family: var(--font-mono);
    font-size: .88em;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* ==========================================================================
   En-tête
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--page) 80%, transparent);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1.75rem;
    max-width: 76rem;
    margin: 0 auto;
    padding: .75rem 1.5rem;
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
    text-decoration: none;
}

a.brand:hover {
    color: var(--ink);
}

.brand__mark {
    width: 2.1rem;
    height: 2.1rem;
    flex: none;
}

.brand__mark-bg {
    fill: var(--accent);
}

.brand__mark-check {
    fill: none;
    stroke: var(--on-accent);
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand__tag,
.eyebrow {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.brand__tag {
    padding: .2rem .55rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.site-nav {
    flex: 1;
}

.site-nav ul {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .15rem;
    margin: 0;
    padding: .25rem;
    list-style: none;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.site-nav a {
    display: block;
    padding: .35rem .95rem;
    font-size: .95rem;
    font-weight: 550;
    color: var(--muted);
    text-decoration: none;
    border-radius: 999px;
    transition: color .15s ease, background-color .15s ease;
}

.site-nav a:hover {
    color: var(--ink);
}

.site-nav a[aria-current] {
    color: var(--on-primary);
    background: var(--primary);
}

.account {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .7rem;
    font-size: .9rem;
}

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

.account__logout {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-left: .4rem;
    padding: .4rem .85rem;
    font-weight: 550;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color .15s ease;
}

.account__logout:hover {
    color: var(--ink);
    border-color: var(--border-strong);
}

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    font-size: .85rem;
    font-weight: 650;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 999px;
}

.avatar--square {
    border-radius: 9px;
}

/* ==========================================================================
   Mise en page
   ========================================================================== */
main {
    flex: 1;
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

main:focus {
    outline: none;
}

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

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .75rem;
    color: var(--muted);
}

.eyebrow::before {
    content: "";
    width: .5rem;
    height: .5rem;
    background: var(--accent);
    border: 1px solid var(--brand);
    border-radius: 999px;
}

.page-header__count {
    margin: 0;
    font-family: var(--font-mono);
    font-size: .85rem;
    color: var(--muted);
}

.page-header__lead {
    max-width: 38rem;
    margin: .7rem 0 0;
    font-size: 1.08rem;
    color: var(--muted);
}

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

.card--flush {
    padding: 0;
    overflow: hidden;
}

.split {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 60rem) {
    .split {
        grid-template-columns: minmax(18rem, 23rem) 1fr;
    }

    .split > .card {
        position: sticky;
        top: 5.5rem;
    }
}

.empty {
    display: grid;
    justify-items: center;
    gap: 1rem;
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.empty p {
    margin: 0;
}

.empty__icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.4rem;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 999px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1.5rem;
    font-size: .95rem;
    font-weight: 550;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--ink);
}

/* ==========================================================================
   Messages
   ========================================================================== */
.message {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin: 0 0 1.75rem;
    padding: .8rem 1rem;
    font-weight: 500;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: var(--radius-small);
}

.message::before {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    font-size: .85rem;
    font-weight: 700;
    border-radius: 999px;
}

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

.message--success::before {
    content: "✓";
    color: var(--success-soft);
    background: var(--success);
}

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

.message--error::before {
    content: "!";
    color: var(--danger-soft);
    background: var(--danger);
}

/* ==========================================================================
   Formulaires et boutons
   ========================================================================== */
.field {
    margin-bottom: 1.25rem;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0 1.25rem;
}

label {
    display: block;
    margin-bottom: .4rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink);
}

.label-hint {
    font-weight: 400;
    color: var(--muted);
}

input:not([type="hidden"]),
select {
    width: 100%;
    min-height: 2.9rem;
    padding: .6rem .85rem;
    font: inherit;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-small);
    transition: border-color .15s ease, box-shadow .15s ease;
}

select {
    padding-right: 2.5rem;
    appearance: none;
    background-image: url("../img/chevron.svg");
    background-repeat: no-repeat;
    background-position: right .8rem center;
    background-size: 1.1rem;
}

input::placeholder {
    color: var(--muted);
}

input:not([type="hidden"]):focus-visible,
select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 0;
    border-color: var(--brand);
    border-radius: var(--radius-small);
    box-shadow: var(--ring);
}

input[type="file"] {
    padding: 1rem;
    color: var(--muted);
    background-color: var(--surface-alt);
    border-style: dashed;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--brand);
}

input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: .5rem .95rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    cursor: pointer;
}

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

.field--checkbox {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.field--checkbox input {
    flex: none;
    width: 1.15rem;
    min-height: 0;
    height: 1.15rem;
    padding: 0;
    accent-color: var(--brand);
}

.field--checkbox label {
    margin: 0;
    font-weight: 400;
}

/* ==========================================================================
   Double authentification
   ========================================================================== */
.steps {
    margin: 0 0 1.5rem;
    padding-left: 1.25rem;
}

.steps li {
    margin-bottom: .75rem;
}

/* Fond blanc dans les deux thèmes : un QR code clair sur sombre n'est pas lu par toutes les applications. */
.qr-code {
    width: fit-content;
    margin: 1rem 0 .75rem;
    padding: .75rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    line-height: 0;
}

.secret {
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
    user-select: all;
}

.backup-codes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: .5rem 1.5rem;
    margin: 1.25rem 0 1.5rem;
    padding: 1rem 1.25rem;
    list-style: none;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
}

/* Choix de la méthode : deux blocs, séparés par un filet. */
.method {
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
}

.method:last-child {
    padding-bottom: 0;
}

.method__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin: 0;
    font-size: 1.05rem;
}

.method .help {
    margin-bottom: 1rem;
}

/* Action secondaire présentée comme un lien, mais qui reste un bouton : elle modifie quelque chose (POST). */
button.button--link {
    display: inline;
    min-height: 0;
    padding: 0;
    font: inherit;
    font-weight: 550;
    color: var(--brand);
    text-decoration: underline;
    background: none;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    cursor: pointer;
}

button.button--link:hover {
    color: var(--brand-hover);
    background: none;
}

.backup-codes code {
    font-family: var(--font-mono);
    font-size: 1rem;
    user-select: all;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.9rem;
    padding: .6rem 1.3rem;
    font: inherit;
    font-weight: 600;
    color: var(--on-primary);
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

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

button:active,
.button:active {
    transform: scale(.98);
}

button .icon,
.button .icon {
    transition: transform .15s ease;
}

button:hover .icon,
.button:hover .icon {
    transform: translateX(2px);
}

.button--block {
    width: 100%;
}

.button--quiet,
.button--danger {
    background: transparent;
}

td .button--quiet,
td .button--danger {
    min-height: 2.25rem;
    padding: .3rem .85rem;
    font-size: .88rem;
}

.button--quiet {
    color: var(--text);
    border-color: var(--border-strong);
}

.button--quiet:hover {
    color: var(--ink);
    background: var(--surface-alt);
}

.button--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

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

.button--danger:hover .icon {
    transform: none;
}

/* Formulaire de publication : deux étapes côte à côte. */
.publish {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 64rem) {
    .publish {
        grid-template-columns: 1fr 1fr;
    }
}

.publish__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .75rem;
    grid-column: 1 / -1;
}

.step {
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    margin-right: .35rem;
    font-family: var(--font-mono);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: 0;
    vertical-align: .12em;
    color: var(--on-accent);
    background: var(--accent);
    border-radius: 999px;
}

.fieldset {
    min-width: 0;
    margin: 0;
}

/* Une légende ne participe pas au flux de la carte : on la replace à l'intérieur. */
.fieldset legend {
    float: left;
    width: 100%;
    margin: 0 0 1.25rem;
    padding: 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -.025em;
    color: var(--ink);
}

.fieldset legend + * {
    clear: both;
}

.fieldset .help {
    margin: 0 0 1.5rem;
}

.fieldset .field:last-child {
    margin-bottom: 0;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.25rem;
    font-family: var(--font-mono);
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ==========================================================================
   Étiquettes et pastilles
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--muted);
    background: var(--surface-alt);
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    border-radius: 999px;
}

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

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

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

.tile {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.15rem;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 12px;
}

/* ==========================================================================
   Cartes d'audit (espace client)
   ========================================================================== */
.audit-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.audit-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    padding: 1.5rem;
    overflow: hidden;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 60%, transparent), transparent 7rem),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.audit-card:hover,
.audit-card:focus-within {
    border-color: var(--brand);
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.audit-card .tile {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}

.audit-card__title {
    margin: .25rem 0 0;
    font-size: 1.4rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.audit-card__title a {
    color: var(--ink);
    text-decoration: none;
}

/* Toute la carte est cliquable, mais le lien reste le seul élément focusable. */
.audit-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
}

.audit-card__title a:focus-visible {
    outline: none;
}

.audit-card__title a:focus-visible::after {
    outline: 3px solid var(--brand);
    outline-offset: -3px;
}

.audit-card__meta {
    display: grid;
    gap: .4rem;
    margin: 0;
    font-size: .9rem;
    color: var(--muted);
}

.audit-card__meta div {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.audit-card__meta dt {
    display: flex;
    flex: none;
}

.audit-card__meta dd {
    margin: 0;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: .84rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.audit-card__cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 1rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
    border-top: 1px solid var(--border);
}

.audit-card__cta .icon {
    width: 2rem;
    height: 2rem;
    padding: .45rem;
    color: var(--on-primary);
    background: var(--primary);
    border-radius: 999px;
    transition: transform .2s ease;
}

.audit-card:hover .audit-card__cta .icon,
.audit-card:focus-within .audit-card__cta .icon {
    transform: translateX(3px);
}

/* ==========================================================================
   Tableaux (back-office)
   ========================================================================== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

thead th {
    padding-block: .8rem;
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
    background: var(--surface-alt);
}

tbody th {
    font-weight: 600;
    color: var(--ink);
}

tbody th a {
    color: var(--ink);
    text-decoration: none;
}

tbody th a:hover {
    color: var(--brand);
    text-decoration: underline;
}

tbody tr:last-child th,
tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background-color .15s ease;
}

tbody tr:hover {
    background: var(--surface-alt);
}

td form {
    margin: 0;
}

.cell-lead {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-width: 14rem;
}

.cell-sub {
    display: block;
    margin-top: .1rem;
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.cell-date {
    font-family: var(--font-mono);
    font-size: .88rem;
    white-space: nowrap;
}

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

.cell-muted {
    font-size: .9rem;
    color: var(--muted);
}

/* ==========================================================================
   Fiches (client, utilisateur)
   ========================================================================== */
.sheet-header {
    align-items: center;
    justify-content: flex-start;
}

.sheet-header h1 {
    overflow-wrap: anywhere;
}

.sheet-header .eyebrow {
    margin-bottom: .4rem;
}

.sheet-header__action {
    margin-left: auto;
}

.sheet-header__action form {
    margin: 0;
}

.avatar--large {
    width: 4.5rem;
    height: 4.5rem;
    font-family: var(--font-display);
    font-size: 2rem;
    border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}

.avatar--square.avatar--large {
    border-radius: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin: 0 0 2.5rem;
}

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

.stat dt,
.details dt {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat dd {
    margin: .5rem 0 0;
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--ink);
}

.stat dd.stat__note {
    margin-top: .6rem;
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0;
    color: var(--muted);
}

.sheet-grid {
    display: grid;
    gap: 2rem 1.5rem;
    align-items: start;
}

@media (min-width: 64rem) {
    .sheet-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.sheet-section {
    margin-top: 2.5rem;
}

/* Formulaire d'une ligne : un champ et son bouton, l'aide dessous. */
.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 .75rem;
    align-items: end;
    margin-bottom: 1.25rem;
}

.inline-form .field {
    margin-bottom: 0;
}

.inline-form .help {
    grid-column: 1 / -1;
    margin-top: .5rem;
}

.cell-lead--compact {
    min-width: 0;
}

.sheet-note {
    color: var(--muted);
}

.details {
    display: grid;
    gap: 1.1rem;
    margin: 0;
}

.details dd {
    margin: .3rem 0 0;
    font-weight: 550;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.details dd.cell-muted {
    font-weight: 400;
    color: var(--muted);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chips li {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .9rem;
    font-family: var(--font-mono);
    font-size: .84rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow-wrap: anywhere;
}

.chips .icon {
    color: var(--muted);
}

/* ==========================================================================
   Pied de page
   ========================================================================== */
.site-footer {
    padding: 1.5rem;
    font-size: .85rem;
    text-align: center;
    color: var(--muted);
}

.site-footer p {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
}

/* ==========================================================================
   Pages publiques (connexion, mot de passe) : panneau de marque + formulaire
   ========================================================================== */
.auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 1.5rem;
    overflow: hidden;
    color: var(--on-panel);
    background:
        radial-gradient(34rem 24rem at 110% -10%, rgb(200 241 105 / 28%), transparent 65%),
        radial-gradient(30rem 22rem at -20% 115%, rgb(91 63 214 / 35%), transparent 65%),
        var(--panel);
}

/* Trame de fond, estompée vers les bords. */
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 6%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 6%) 1px, transparent 1px);
    background-size: 3rem 3rem;
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    pointer-events: none;
}

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

.auth-aside .brand {
    color: var(--on-panel);
}

.auth-aside__body,
.auth-aside__note {
    display: none;
}

.auth-aside__title {
    max-width: 12em;
    margin: 0 0 1.25rem;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 1.2rem + 2.8vw, 3.9rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -.035em;
}

.auth-aside__title em {
    font-style: normal;
    color: var(--accent);
}

.auth-aside__lead {
    max-width: 26rem;
    margin: 0;
    font-size: 1.1rem;
    color: var(--on-panel-muted);
}

.auth-aside__note {
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: .85rem;
    color: var(--on-panel-muted);
}

.auth main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 28rem;
    padding: 2.5rem 1.5rem;
}

.auth .card {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.auth h1 {
    margin-bottom: .6rem;
    font-size: clamp(2rem, 1.6rem + 1.2vw, 2.6rem);
}

.auth__lead {
    margin-bottom: 2rem;
    font-size: 1.05rem;
    color: var(--muted);
}

.auth__footer {
    margin: 1.5rem 0 0;
    text-align: center;
}

.auth__footer a {
    font-weight: 550;
}

@media (min-width: 60rem) {
    .auth {
        grid-template-columns: minmax(0, 11fr) minmax(0, 10fr);
        grid-template-rows: 1fr auto;
    }

    .auth-aside {
        grid-row: 1 / -1;
        justify-content: space-between;
        margin: 1rem 0 1rem 1rem;
        padding: 2.5rem 3rem;
        border-radius: 28px;
    }

    .auth-aside__body {
        display: block;
    }

    .auth-aside__note {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }

    .audit-card:hover,
    .audit-card:focus-within,
    button:active,
    .button:active {
        transform: none;
    }
}

/* Le dernier champ d'une carte ne doit pas ajouter sa marge à l'espacement de la carte. */
.publish > .card:not(.fieldset) {
    padding-bottom: .5rem;
}

/* ==========================================================================
   Transitions entre les pages : un fondu natif au lieu d'un rechargement sec.
   Sans effet dans les navigateurs qui ne le gèrent pas ; l'en-tête reste fixe pendant le fondu.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    .site-header {
        view-transition-name: site-header;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: .18s;
    }
}
