/* ============================================================
   BacHO — Système applicatif « L'atelier »
   Écrans connectés : mes fiches, éditeur, espace prof.

   L'intention, en une phrase : un atelier scolaire bien rangé.
   Calme, ordonné, un peu officiel — jamais intimidant.

   Une règle porte tout le reste : dans cet espace, le BLANC est
   réservé aux documents. Le fond est en papier, les rails en papier
   appuyé, l'établi plus sombre encore. Quand quelque chose est blanc,
   c'est que c'est une page. Le regard apprend ça en trois secondes
   et n'a plus jamais besoin qu'on le lui explique.

   Dépend de bacho-tokens.css.
   ============================================================ */

:root {
    /* Établi : le plan de travail sous les documents. Plus sombre que le
       papier, pour que la page A4 flotte au lieu de se fondre. */
    --app-bench: #e2e8f0;
    --app-bench-deep: #cbd5e1;

    /* Échelle applicative — 15px de base : l'audience lit sur téléphone. */
    --app-t-micro: 0.6875rem;
    --app-t-sm: 0.8125rem;
    --app-t-body: 0.9375rem;
    --app-t-h3: 1.1875rem;
    --app-t-h2: 1.5625rem;
    --app-t-h1: clamp(1.75rem, 4vw, 2.375rem);

    --app-rail: 248px;
    --app-topbar: 60px;
    --app-gut: clamp(1rem, 3.5vw, 2rem);
    --app-max: 1180px;

    --app-r-ctrl: 10px;
    --app-r-card: 14px;
    --app-r-sheet: 20px;

    /* Une seule stratégie de profondeur : bordure au repos, ombre basse
       au survol. Rien d'autre, nulle part. */
    --app-lift: 0 1px 0 rgba(15, 23, 42, 0.04), 0 10px 24px -14px rgba(15, 23, 42, 0.35);
    --app-lift-strong: 0 2px 0 rgba(15, 23, 42, 0.05), 0 22px 44px -20px rgba(15, 23, 42, 0.4);
}

/* ============================================================
   1. COQUILLE
   ============================================================ */

.app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bh-paper);
    color: var(--bh-ink);
    font-family: var(--bh-sans);
    font-size: var(--app-t-body);
}

.app__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app__scroll {
    flex: 1;
    padding-inline: var(--app-gut);
    padding-bottom: 6rem;
}

.app__inner {
    width: 100%;
    max-width: var(--app-max);
    margin-inline: auto;
}

/* ============================================================
   2. RAIL LATÉRAL
   Assez large pour porter des mots. Un rail d'icônes de 80 px
   oblige à deviner ; 248 px permet de nommer, donc de rassurer.
   ============================================================ */

/* Panneau « verre dépoli » : réservé au menu desktop (≥900px, cf. plus bas).
   Le reste de l'application garde des surfaces pleines, lisibles. */
.rail {
    display: none;
    flex-direction: column;
    width: var(--app-rail);
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: 1.25rem 0.875rem 1rem;
    background: color-mix(in srgb, var(--bh-white) 66%, transparent);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-right: 1px solid var(--bh-ink-line);
    border-radius: 0 20px 20px 0;
    box-shadow: 6px 0 28px -18px rgba(15, 23, 42, 0.18);
}

.rail__brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.5rem 1.25rem;
    text-decoration: none;
}

.rail__mark {
    font-weight: 800;
    font-stretch: 90%;
    font-size: 1.3125rem;
    letter-spacing: -0.04em;
    color: var(--bh-ink);
}

.rail__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bh-gold-bright);
    flex: none;
}

/* L'action principale vit en haut du rail, nommée, pleine.
   C'est le geste pour lequel l'élève a ouvert l'application. */
.rail__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    min-height: 54px;
    margin-bottom: 1.5rem;
    padding: 0 1.1rem;
    border: 0;
    border-radius: var(--app-r-ctrl);
    background: var(--bh-primary);
    color: #ffffff;
    font-size: var(--app-t-h3);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s var(--bh-ease-out), box-shadow 0.2s var(--bh-ease-out), background 0.16s ease;
}

.rail__cta:hover {
    box-shadow: var(--app-lift);
}

.rail__cta:active {
    transform: scale(0.985);
}

.rail__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-height: 0;
}

.rail__group {
    margin: 1.5rem 0 0.4rem;
    padding-inline: 0.6rem;
}

.rail__link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: 40px;
    padding: 0 0.65rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--bh-ink-2);
    font-size: var(--app-t-body);
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.rail__link iconify-icon,
.rail__link svg {
    flex: none;
    color: var(--bh-ink-2);
    transition: color 0.16s ease;
}

.rail__link:hover {
    background: rgba(15, 23, 42, 0.05);
    color: var(--bh-ink);
}

.rail__link.is-active {
    background: var(--bh-ink);
    color: var(--bh-paper);
}

.rail__link.is-active iconify-icon,
.rail__link.is-active svg {
    color: var(--bh-gold-bright);
}

.rail__count {
    margin-left: auto;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    color: var(--bh-ink-4);
}

.rail__link.is-active .rail__count {
    color: rgba(248, 250, 252, 0.6);
}

/* Pied du rail : qui suis-je, et comment je sors. */
.rail__foot {
    padding-top: 0.85rem;
    border-top: 1px solid var(--bh-ink-line);
}

.rail__user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.16s ease;
}

.rail__user:hover {
    background: rgba(15, 23, 42, 0.05);
}

.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--bh-ink);
    color: var(--bh-gold-bright);
    font-family: var(--bh-mono);
    font-size: var(--app-t-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.rail__identity {
    min-width: 0;
}

.rail__name {
    display: block;
    font-size: var(--app-t-sm);
    font-weight: 600;
    color: var(--bh-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail__role {
    display: block;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bh-ink-2);
}

.rail__signout {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 36px;
    margin-top: 0.25rem;
    padding: 0 0.65rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--bh-ink-3);
    font-size: var(--app-t-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.rail__signout:hover {
    background: var(--bh-red-wash);
    color: var(--bh-red-dark);
}

/* ============================================================
   3. BARRE MOBILE
   ============================================================ */

.topbar-m {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: 56px;
    padding-inline: var(--app-gut);
    background: color-mix(in srgb, var(--bh-paper) 92%, transparent);
    backdrop-filter: saturate(150%) blur(12px);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
    border-bottom: 1px solid var(--bh-ink-line);
}

.topbar-m__brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

/* Sans cette remise a zero, le navigateur dessine son propre cadre autour
   du bouton et l'avatar se retrouve enferme dans un carre gris. */
.topbar-m button {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
}

/* Barre d'onglets basse : la navigation vit sous le pouce. */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: color-mix(in srgb, var(--bh-paper) 94%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-top: 1px solid var(--bh-ink-line);
}

.tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 0.35rem 0;
    border: 0;
    background: none;
    color: var(--bh-ink-4);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.16s ease;
}

.tabbar__item.is-active {
    color: var(--bh-ink);
}

.tabbar__item.is-active iconify-icon {
    color: #92400e;
}

/* Le geste principal reste atteignable même en bas de page. */
.app-fab {
    position: fixed;
    right: var(--app-gut);
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    z-index: 46;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--bh-primary);
    color: var(--bh-gold-bright);
    box-shadow: var(--app-lift-strong);
    cursor: pointer;
}

.app-fab span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.app-fab:active {
    transform: scale(0.97);
}

/* ============================================================
   4. EN-TÊTE DE PAGE
   ============================================================ */

.head {
    padding-block: clamp(1.5rem, 4vw, 2.75rem) 0;
}

.head__eyebrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bh-ink-2);
}

.head__eyebrow::before {
    content: '';
    width: 20px;
    height: 1.5px;
    background: var(--bh-gold);
}

.head h1 {
    margin: 0.75rem 0 0;
    font-size: var(--app-t-h1);
    font-weight: 700;
    font-stretch: 92%;
    letter-spacing: -0.03em;
    line-height: 1.05;
    text-wrap: balance;
}

.head p {
    margin: 0.6rem 0 0;
    max-width: 52ch;
    color: var(--bh-ink-2);
}

/* Titre + action principale sur une même ligne ; passe à la ligne
   naturellement si l'écran est trop étroit pour les deux. */
.head__titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 0.75rem;
    flex-wrap: wrap;
}

.head__titlebar .btn {
    flex: none;
    white-space: nowrap;
}

.head__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

.head__actions .search {
    flex: 1;
}

/* Champ de recherche : discret au repos, net une fois actif. */
.search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 220px;
    max-width: 460px;
}

.search iconify-icon {
    position: absolute;
    left: 12px;
    color: var(--bh-ink-3);
    pointer-events: none;
}

.search input {
    width: 100%;
    min-height: 44px;
    padding: 0 0.9rem 0 2.45rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-ctrl);
    background: var(--bh-white);
    font-size: 1rem;
    color: var(--bh-ink);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search input::placeholder {
    color: var(--bh-ink-3);
}

.search input:focus {
    outline: none;
    border-color: var(--bh-gold);
    box-shadow: 0 0 0 3px var(--bh-gold-wash);
}

/* ============================================================
   5. TUILES DE DÉMARRAGE
   Les points d'entrée, nommés et alignés — pas un bouton caché
   dans un coin avec une flèche qui l'explique.
   ============================================================ */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    color: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.22s var(--bh-ease-out), box-shadow 0.22s var(--bh-ease-out),
        border-color 0.18s ease;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-lift);
    border-color: var(--bh-gold-line);
}

.tile__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    background: var(--bh-paper-2);
    color: var(--bh-ink);
}

.tile--primary {
    background: var(--bh-primary);
    border-color: var(--bh-primary);
    color: #ffffff;
}

.tile--primary .tile__icon {
    background: rgba(251, 191, 36, 0.16);
    color: var(--bh-gold-bright);
}

.tile--primary .tile__sub {
    color: rgba(248, 250, 252, 0.6);
}

.tile__label {
    display: block;
    font-size: var(--app-t-body);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tile__sub {
    display: block;
    margin-top: 1px;
    font-size: var(--app-t-micro);
    font-family: var(--bh-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bh-ink-4);
}

/* En dessous de deux colonnes confortables, l'icone passe au-dessus :
   le libelle recupere toute la largeur et cesse de se couper en deux. */
@media (max-width: 560px) {
    .tiles {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .tile {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
        padding: 0.85rem;
    }

    .tile__icon {
        width: 34px;
        height: 34px;
    }
}

/* ============================================================
   6. SECTIONS
   ============================================================ */

.sec {
    margin-top: clamp(2.25rem, 5vw, 3.25rem);
}

.sec__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.sec__head h2 {
    margin: 0;
    font-size: var(--app-t-h2);
    font-weight: 700;
    font-stretch: 94%;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.sec__head p {
    margin: 0.35rem 0 0;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-2);
    max-width: 56ch;
}

.sec__tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================
   7. CONTRÔLES
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0 0.9rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-ctrl);
    background: var(--bh-white);
    color: var(--bh-ink);
    font-size: var(--app-t-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s var(--bh-ease-out),
        box-shadow 0.16s var(--bh-ease-out);
}

.btn:hover {
    border-color: var(--bh-ink-3);
}

.btn:active {
    transform: scale(0.98);
}

.btn--solid {
    background: var(--bh-primary);
    border-color: var(--bh-primary);
    color: #ffffff;
}

.btn--solid:hover {
    border-color: var(--bh-primary-dark);
    background: var(--bh-primary-dark);
    box-shadow: var(--app-lift);
}

.btn--gold {
    background: var(--bh-gold-bright);
    border-color: var(--bh-gold-bright);
    color: var(--bh-ink);
}

.btn--quiet {
    background: transparent;
    border-color: transparent;
    color: var(--bh-ink-3);
    font-weight: 500;
}

.btn--quiet:hover {
    background: rgba(15, 23, 42, 0.05);
    border-color: transparent;
    color: var(--bh-ink);
}

.btn--icon {
    width: 40px;
    padding: 0;
}

/* Segmenté : grille / liste, niveau, tri. */
.seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-ctrl);
    background: var(--bh-white);
}

.seg button,
.seg a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 32px;
    padding: 0 0.7rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--bh-ink-3);
    font-size: var(--app-t-sm);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.2s var(--bh-ease), color 0.2s var(--bh-ease);
}

.seg button.is-active,
.seg button.active,
.seg a.is-active {
    background: var(--bh-primary);
    color: #ffffff;
}

/* Menu déroulant */
.menu {
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 190px;
    max-width: calc(100vw - 2 * var(--app-gut));
    padding: 5px;
    border: 1px solid var(--bh-ink-line);
    border-radius: 12px;
    background: var(--bh-white);
    box-shadow: var(--app-lift-strong);
    transform-origin: top left;
    animation: menuIn 0.16s var(--bh-ease-out);
}

/* Quand le declencheur est a droite de sa section, le panneau s'y aligne. */
.menu--right {
    left: auto;
    right: 0;
    transform-origin: top right;
}

@keyframes menuIn {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(-3px);
    }
}

.menu button {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 36px;
    padding: 0 0.6rem;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--bh-ink-2);
    font-size: var(--app-t-sm);
    text-align: left;
    cursor: pointer;
}

.menu button:hover {
    background: var(--bh-paper);
    color: var(--bh-ink);
}

/* ============================================================
   8. LE CASIER — les fiches en vraies pages debout.
   C'est la signature de cet écran : on ne montre pas une carte
   qui parle d'un document, on montre le document.
   ============================================================ */

.locker {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 210px;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-left: var(--app-gut);
    padding: 0.25rem var(--app-gut) 1.5rem;
    margin-inline: calc(var(--app-gut) * -1);
    scrollbar-width: none;
}

.locker::-webkit-scrollbar {
    display: none;
}

.locker--grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    overflow: visible;
    padding-inline: 0;
    margin-inline: 0;
}

.doc {
    position: relative;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

/* La page : ratio A4 exact, posée sur l'établi, avec sa tranche. */
.doc__page {
    position: relative;
    aspect-ratio: 794 / 1123;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bh-white);
    border: 1px solid var(--bh-ink-line);
    box-shadow: var(--app-lift);
    transition: transform 0.26s var(--bh-ease-out), box-shadow 0.26s var(--bh-ease-out);
}

.doc:hover .doc__page {
    transform: translateY(-3px);
    box-shadow: var(--app-lift-strong);
}

.doc__page::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--bh-gold-bright);
    z-index: 2;
}

.doc__meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.doc__title {
    flex: 1;
    min-width: 0;
    font-size: var(--app-t-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc__pts {
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 600;
    color: var(--bh-ink-3);
    flex: none;
}

.doc__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0.45rem;
}

/* Action destructive : présente, jamais offerte. */
.doc__del {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--bh-ink-line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bh-white) 88%, transparent);
    backdrop-filter: blur(6px);
    color: var(--bh-ink-3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.doc:hover .doc__del,
.doc__del:focus-visible {
    opacity: 1;
}

.doc__del:hover {
    background: var(--bh-red);
    border-color: var(--bh-red-dark);
    color: #fff;
}

@media (hover: none) {
    .doc__del {
        opacity: 1;
    }
}

/* Carte « ajouter » : même gabarit que les pages, pour que la rangée
   reste un casier plutôt qu'une grille avec un intrus. */
.doc--new .doc__page {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.6rem;
    background: var(--bh-white);
    border: 1px dashed var(--bh-ink-line);
    box-shadow: none;
    color: var(--bh-ink-3);
    text-align: center;
    padding: 1rem;
}

.doc--new .doc__page::before {
    display: none;
}

.doc--new:hover .doc__page {
    border-color: var(--bh-gold);
    color: var(--bh-ink);
    box-shadow: var(--app-lift);
}

/* ============================================================
   9. ÉTATS
   Un écran sans état vide, sans chargement et sans erreur n'est
   pas fini. Ceux-ci comptent autant que le cas nominal.
   ============================================================ */

.state {
    display: grid;
    justify-items: center;
    gap: 0.85rem;
    padding: clamp(2.5rem, 8vw, 4.5rem) 1.5rem;
    border: 1px dashed var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    text-align: center;
}

.state__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--bh-paper-2);
    color: var(--bh-ink-3);
}

.state h3 {
    margin: 0;
    font-size: var(--app-t-h3);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.state p {
    margin: 0;
    max-width: 42ch;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

.spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid var(--bh-ink-line);
    border-top-color: var(--bh-gold);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Squelette de page pendant le chargement : on montre la forme du
   résultat, pas un vide anxiogène. */
.skeleton {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 210px;
    gap: 1rem;
    overflow: hidden;
}

.skeleton__page {
    aspect-ratio: 794 / 1123;
    border-radius: 6px;
    border: 1px solid var(--bh-ink-line);
    background: linear-gradient(100deg, var(--bh-white) 30%, var(--bh-paper-2) 50%, var(--bh-white) 70%);
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: -150% 0;
    }
}

/* ============================================================
   10. BANDEAU D'AIDE
   ============================================================ */

.helpline {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-ctrl);
    background: var(--bh-white);
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

.helpline iconify-icon {
    flex: none;
}

.helpline a {
    color: var(--bh-ink);
    font-weight: 600;
    text-underline-offset: 3px;
    text-decoration-color: var(--bh-gold-line);
}

/* Pagination du répertoire des figures */
.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 1.5rem;
}

.pager[hidden] {
    display: none;
}

.pager__btn {
    display: inline-grid;
    place-items: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.6rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-ctrl);
    background: var(--bh-white);
    color: var(--bh-ink-2);
    font: inherit;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.pager__btn:hover:not(:disabled) {
    border-color: var(--bh-ink-3);
}

.pager__btn.is-active {
    border-color: var(--bh-ink);
    background: var(--bh-ink);
    color: var(--bh-paper);
}

.pager__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pager__gap {
    padding: 0 0.2rem;
    color: var(--bh-ink-4, var(--bh-ink-3));
}

/* En tête de page : la notification doit se voir avant tout le reste. */
.helpline--top {
    position: sticky;
    top: 0.5rem;
    z-index: 20;
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(37, 211, 102, 0.45);
    border-left: 4px solid #25d366;
    background: #effbf3;
    color: var(--bh-ink-2);
    font-size: var(--app-t-body, 0.9375rem);
    box-shadow: var(--app-lift);
}

.helpline--top span {
    flex: 1 1 14rem;
}

.helpline--top a {
    flex: none;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
}

.helpline--top a:hover {
    background: #1fb457;
}

/* ============================================================
   11. RESPONSIVE
   ============================================================ */

@media (min-width: 900px) {
    .rail {
        display: flex;
    }

    /* Bord du panneau de verre : un fin reflet vertical qui marque
       nettement la frontière avec le contenu (surfaces pleines). */
    .rail::after {
        content: '';
        position: absolute;
        top: 10%;
        bottom: 10%;
        right: -1px;
        width: 2px;
        border-radius: 2px;
        background: linear-gradient(180deg,
            transparent 0%,
            rgba(255, 255, 255, 0.85) 18%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0.85) 82%,
            transparent 100%);
        pointer-events: none;
    }

    .topbar-m,
    .tabbar,
    .app-fab {
        display: none;
    }

    .app__scroll {
        padding-bottom: 4rem;
        /* Transition douce entre le verre du rail et les surfaces
           pleines du contenu : une teinte qui s'estompe, jamais de flou. */
        background-image: linear-gradient(90deg,
            color-mix(in srgb, var(--bh-white) 55%, transparent) 0,
            transparent 64px);
        background-repeat: no-repeat;
    }
}

@media (max-width: 899px) {
    .app__scroll {
        /* Même principe côté mobile : adoucit la frontière avec la
           barre haute et la barre d'onglets, elles aussi en verre. */
        background-image:
            linear-gradient(180deg, color-mix(in srgb, var(--bh-paper) 70%, transparent) 0, transparent 28px),
            linear-gradient(0deg, color-mix(in srgb, var(--bh-paper) 70%, transparent) 0, transparent 28px);
        background-repeat: no-repeat;
        background-position: top, bottom;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   12. RANGÉES DE DOCUMENTS
   Le carrousel lui-même (.carousel-container, .carousel-track,
   .carousel-item et son contenu) vit désormais entièrement dans
   public/css/carousel.css, chargé sur les pages qui l'utilisent.
   Ne restent ici que les pièces du composant "page" partagées
   avec les modales d'aperçu (sheetModal/ficheModal) : elles ne
   sont pas propres au carrousel.
   ============================================================ */

.fiche-preview-wrapper {
    position: relative;
}

.delete-fiche-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--bh-ink-line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bh-white) 90%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--bh-ink-3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.carousel-item:hover .delete-fiche-btn,
.delete-fiche-btn:focus-visible {
    opacity: 1;
}

.delete-fiche-btn:hover {
    background: var(--bh-red);
    border-color: var(--bh-red-dark);
    color: #fff;
}

@media (hover: none) {
    .delete-fiche-btn {
        opacity: 1;
    }
}

/* ============================================================
   13. NIVEAUX
   ============================================================ */

.level {
    margin-top: 1.75rem;
}

.level__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.level__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.level__dot--1 { background: var(--bh-green); }
.level__dot--2 { background: var(--bh-gold); }
.level__dot--3 { background: var(--bh-ink); }

.level__head h3 {
    margin: 0;
    font-size: var(--app-t-body);
    font-weight: 600;
    letter-spacing: -0.015em;
}

.level__head span {
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bh-ink-4);
}

/* ============================================================
   14. MODALES APPLICATIVES
   ============================================================ */

.sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.sheet__scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fade 0.2s ease;
}

@keyframes fade {
    from {
        opacity: 0;
    }
}

.sheet__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 94dvh;
    background: var(--bh-paper);
    border-radius: var(--app-r-sheet) var(--app-r-sheet) 0 0;
    box-shadow: 0 -20px 60px -20px rgba(15, 23, 42, 0.6);
    overflow: hidden;
    animation: sheetUp 0.28s var(--bh-ease-out);
}

@keyframes sheetUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
}

.sheet__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex: none;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--bh-ink-line);
}

.sheet__head h3 {
    margin: 0;
    font-size: var(--app-t-h3);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.sheet__head p {
    margin: 3px 0 0;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    letter-spacing: 0.06em;
    color: var(--bh-ink-3);
}

.sheet__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border: 1px solid var(--bh-ink-line);
    border-radius: 50%;
    background: var(--bh-white);
    color: var(--bh-ink-2);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.sheet__close:hover {
    background: var(--bh-ink);
    color: var(--bh-paper);
}

/* L'établi : c'est ici que la page A4 se détache vraiment. */
.sheet__body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.15rem;
    background: var(--app-bench);
}

.sheet__doc {
    width: 100%;
    background: var(--bh-white);
    border: 1px solid var(--bh-ink-line);
    border-radius: 6px;
    box-shadow: var(--app-lift-strong);
    overflow: hidden;
}

.sheet__desc {
    margin: 1rem 0 0;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-2);
    line-height: 1.55;
}

.sheet__nav {
    position: absolute;
    top: 50%;
    z-index: 6;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--bh-ink-line);
    border-radius: 50%;
    background: color-mix(in srgb, var(--bh-white) 92%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--bh-ink);
    cursor: pointer;
    transform: translateY(-50%);
    box-shadow: var(--app-lift);
}

.sheet__nav:hover {
    background: var(--bh-ink);
    color: var(--bh-paper);
}

.sheet__nav--prev { left: 0.6rem; }
.sheet__nav--next { right: 0.6rem; }

.sheet__foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    flex: none;
    padding: 0.85rem 1.15rem;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    background: var(--bh-paper);
    border-top: 1px solid var(--bh-ink-line);
}

.sheet--video .sheet__panel {
    background: #0f172a;
    max-width: 900px;
}

.sheet--video .sheet__head {
    border-bottom-color: rgba(248, 250, 252, 0.14);
    color: var(--bh-paper);
}

.sheet--video .sheet__close {
    background: rgba(248, 250, 252, 0.1);
    border-color: rgba(248, 250, 252, 0.2);
    color: var(--bh-paper);
}

.sheet--video .sheet__body {
    padding: 0;
    background: #000;
}

.sheet--video .sheet__body iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

/* Feuille de profil : une identité, et une sortie. */
.sheet__grip {
    width: 42px;
    height: 4px;
    margin: 0.65rem auto 0;
    border-radius: 2px;
    background: var(--bh-paper-3);
    flex: none;
}

.profile {
    display: grid;
    justify-items: center;
    gap: 0.2rem;
    padding: 1.4rem 1.15rem 0.6rem;
}

.profile .avatar {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
    margin-bottom: 0.65rem;
}

.profile h3 {
    margin: 0;
    font-size: var(--app-t-h3);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.profile p {
    margin: 0;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

.profile__actions {
    display: grid;
    gap: 0.5rem;
    padding: 1.25rem 1.15rem 0;
}

.profile__actions .btn {
    justify-content: flex-start;
    min-height: 48px;
}

.btn--danger {
    color: var(--bh-red-dark);
    border-color: rgba(239, 68, 68, 0.28);
}

.btn--danger:hover {
    background: var(--bh-red-wash);
    border-color: var(--bh-red-dark);
}

@media (min-width: 640px) {
    .sheet {
        align-items: center;
        padding: 1.5rem;
    }

    .sheet__panel {
        max-width: 720px;
        border-radius: var(--app-r-sheet);
        animation: sheetIn 0.26s var(--bh-ease-out);
    }

    .sheet__grip {
        display: none;
    }
}

@keyframes sheetIn {
    from {
        transform: translateY(14px) scale(0.985);
        opacity: 0;
    }
}

/* ============================================================
   15. GRILLES SECONDAIRES — figures et vidéos
   ============================================================ */

.tablewrap {
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    overflow: hidden;
}

.tablewrap table {
    width: 100%;
    border-collapse: collapse;
}

.tablewrap thead {
    background: var(--bh-paper);
}

.tablewrap th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bh-ink-3);
    border-bottom: 1px solid var(--bh-ink-line);
}

.tablewrap td {
    padding: 0.7rem 1rem;
    font-size: var(--app-t-sm);
    border-bottom: 1px solid var(--bh-ink-line-soft);
}

.grid-figures {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 0.75rem;
}

.grid-videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.vid {
    display: block;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.24s var(--bh-ease-out), box-shadow 0.24s var(--bh-ease-out);
}

.vid:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-lift);
}

.vid__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bh-paper-2);
}

.vid__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vid__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.28);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vid:hover .vid__play {
    opacity: 1;
}

.vid__play span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: var(--bh-paper);
    color: var(--bh-ink);
    font-size: var(--app-t-sm);
    font-weight: 600;
}

.vid__body {
    padding: 0.85rem 0.95rem 1rem;
}

.vid__body h3 {
    margin: 0;
    font-size: var(--app-t-body);
    font-weight: 650;
    letter-spacing: -0.015em;
}

.vid__body p {
    margin: 0.3rem 0 0;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
    line-height: 1.5;
}

/* Tailwind pilote encore l'affichage de plusieurs blocs via .hidden.
   On garantit que cette classe l'emporte sur nos display: grid / flex. */
.hidden {
    display: none !important;
}

/* ============================================================
   16. APERÇU DU DOCUMENT RÉEL
   La fiche A4 est rendue dans une iframe. Son échelle n'est plus
   codée en dur en pixels : elle se déduit de la largeur réellement
   disponible, ce qui la rend juste sur tous les écrans.
   Le document lui-même n'est pas touché — seul son cadre l'est.
   ============================================================ */

.fiche-preview-wrapper {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--bh-white);
    border-radius: 0;
    box-shadow: none;
}

.fiche-preview-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 794px;
    height: 1123px;
    border: 0;
    transform: scale(var(--doc-scale, 0.26));
    transform-origin: top left;
    pointer-events: none;
    user-select: none;
    display: block;
}

/* Dans une feuille modale l'aperçu occupe toute la largeur du panneau. */
.sheet__doc .fiche-preview-wrapper {
    position: relative;
    inset: auto;
    width: 100%;
    aspect-ratio: 794 / 1123;
}

/* Statut de paiement : une pastille lisible, pas un ruban en diagonale.
   L'information compte, le décor non. */
.doc__pay {
    position: absolute;
    top: 8px;
    left: 12px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid;
    font-family: var(--bh-mono);
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.doc__pay--paid {
    background: color-mix(in srgb, var(--bh-green-wash) 88%, transparent);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--bh-green-dark);
}

.doc__pay--due {
    background: color-mix(in srgb, var(--bh-white) 88%, transparent);
    border-color: var(--bh-ink-line);
    color: var(--bh-ink-3);
}

/* Zone de clic : couvre la page, laisse la corbeille accessible. */
.doc__hit {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: pointer;
}

/* La barre d'onglets s'adapte au nombre reel d'entrees. */
.tabbar--3 {
    grid-template-columns: repeat(3, 1fr);
}

.tabbar--4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Etat court : une phrase, pas une carte pleine hauteur. */
.state--slim {
    display: block;
    margin-top: 1rem;
    padding: 1.1rem 1.25rem;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

/* Un niveau dont toutes les cartes sont filtrees se retire du flux. */
.level.is-empty {
    display: none;
}

/* ============================================================
   17. LE RÉPERTOIRE DE FIGURES (/elements)
   Une figure animée montre le mouvement tout de suite, en boucle.
   La vignette est donc grande : c'est le contenu, pas une icône.
   ============================================================ */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.25rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0 0.9rem;
    line-height: 1;
    border: 1px solid var(--bh-ink-line);
    border-radius: 999px;
    background: var(--bh-white);
    color: var(--bh-ink-2);
    font-family: inherit;
    font-size: var(--app-t-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.chip small {
    font-family: var(--bh-mono);
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1;
    color: var(--bh-ink-3);
}

.chip:hover {
    border-color: var(--bh-ink-3);
}

.chip.is-active {
    background: var(--bh-ink);
    border-color: var(--bh-ink);
    color: var(--bh-paper);
}

.chip.is-active small {
    color: var(--bh-gold-bright);
}

.figs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.85rem;
}

.fig {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s var(--bh-ease-out), box-shadow 0.22s var(--bh-ease-out),
        border-color 0.16s ease;
}

.fig:hover,
.fig:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--app-lift);
    border-color: var(--bh-gold-line);
    outline: none;
}

/* Fond papier sous le visuel : les figures sont souvent détourées
   sur blanc, et un blanc sur blanc ne montre plus rien. */
/* Fond blanc, et non papier : les animations gymniques sont des GIF
   à fond blanc opaque. Sur du papier, elles se découpaient en un
   rectangle blanc cerné de beige. */
.fig__vue {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background: var(--bh-white);
    border-bottom: 1px solid var(--bh-ink-line);
    overflow: hidden;
}

.fig__vue img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.fig__vue.is-vide::after {
    content: '';
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bh-paper-2);
}

.fig__vue.is-vide img {
    display: none;
}

/* Un repère discret : cette figure bouge. */
.fig__anim {
    position: absolute;
    top: 7px;
    left: 7px;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bh-ink) 94%, transparent);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-family: var(--bh-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bh-gold-bright);
}

.fig__bas {
    display: grid;
    gap: 0.5rem;
    padding: 0.85rem 0.9rem 1rem;
}

.fig__nom {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--bh-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fig__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* La famille de mouvement remplace la pastille A–E : un nom de
   famille ne tient pas dans une pastille d'une lettre, et la
   cotation dépend du référentiel de la session. */
.fig__famille {
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--bh-ink-2);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attribution d'une ressource qui n'est pas la nôtre : discrète,
   mais lisible et cliquable. */
.credit {
    margin-top: 1.25rem;
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    color: var(--bh-ink-4);
}

.credit a {
    color: var(--bh-ink-3);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Squelette : la forme du résultat, pas un vide. */
.fig--skeleton {
    aspect-ratio: 1 / 1.28;
    border-style: dashed;
    background: linear-gradient(100deg, var(--bh-white) 30%, var(--bh-paper-2) 50%, var(--bh-white) 70%);
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
    cursor: default;
}

.fig--skeleton:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--bh-ink-line);
}

/* Le mouvement en grand, sur l'établi. */
.sheet__body--fig {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.sheet__body--fig img {
    max-width: 100%;
    max-height: 58dvh;
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    border: 1px solid var(--bh-ink-line);
    box-shadow: var(--app-lift);
}

@media (min-width: 640px) {
    .figs {
        grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
        gap: 1rem;
    }
}

/* ============================================================
   18. PASTILLES DE CATÉGORIE
   Mêmes règles que dans bacho-system.css, reprises ici parce que
   les écrans connectés ne chargent pas la feuille éditoriale.
   Les couleurs viennent des mêmes jetons : pas de dérive possible.
   ============================================================ */

.bh-cat {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--bh-r-chip);
    background: var(--bh-white);
    font-family: var(--bh-mono);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: var(--bh-ink);
}

.bh-cat--a { background: var(--bh-gold-wash); border-color: var(--bh-gold-line); color: #92400e; }
.bh-cat--b { background: var(--bh-blue-wash); border-color: rgba(37, 99, 235, 0.28); color: var(--bh-blue); }
.bh-cat--c { background: var(--bh-green-wash); border-color: rgba(16, 185, 129, 0.28); color: var(--bh-green-dark); }
.bh-cat--d { background: #ede9fe; border-color: rgba(124, 58, 237, 0.26); color: #7c3aed; }
.bh-cat--e { background: var(--bh-red-wash); border-color: rgba(239, 68, 68, 0.26); color: var(--bh-red-dark); }

.bh-label {
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bh-ink-2);
}

/* ============================================================
   19. MON PROFIL (/profil)
   Une carte d'identité, un bordereau, des actions. Rien de
   modifiable sur place : ces informations partent sur un document
   d'examen, une correction doit être relue.
   ============================================================ */

.idcard {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card) var(--app-r-card) 0 0;
    background: var(--bh-ink);
}

.idcard__avatar {
    width: 56px;
    height: 56px;
    flex: none;
    font-size: 1.15rem;
    background: rgba(251, 191, 36, 0.16);
    color: var(--bh-gold-bright);
}

.idcard__who {
    min-width: 0;
}

.idcard__who h2 {
    margin: 0;
    font-size: var(--app-t-h2);
    font-weight: 700;
    font-stretch: 94%;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--bh-paper);
    overflow-wrap: anywhere;
}

.idcard__who .bh-label {
    margin-top: 0.35rem;
    color: rgba(248, 250, 252, 0.55);
}

.idlist {
    margin: 0;
    border: 1px solid var(--bh-ink-line);
    border-top: 0;
    border-radius: 0 0 var(--app-r-card) var(--app-r-card);
    background: var(--bh-white);
    overflow: hidden;
}

.idlist__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--bh-ink-line-soft);
}

.idlist__row:last-child {
    border-bottom: 0;
}

.idlist__row[hidden] {
    display: none;
}

.idlist dt {
    font-family: var(--bh-mono);
    font-size: var(--app-t-micro);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bh-ink-3);
    flex: none;
}

.idlist dd {
    margin: 0;
    min-width: 0;
    text-align: right;
    font-size: var(--app-t-body);
    font-weight: 600;
    color: var(--bh-ink);
    overflow-wrap: anywhere;
}

.acts {
    display: grid;
    gap: 0.6rem;
}

.act {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.95rem 1.1rem;
    border: 1px solid var(--bh-ink-line);
    border-radius: var(--app-r-card);
    background: var(--bh-white);
    color: inherit;
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s var(--bh-ease-out), box-shadow 0.2s var(--bh-ease-out),
        border-color 0.16s ease;
}

.act:hover {
    transform: translateY(-2px);
    border-color: var(--bh-gold-line);
    box-shadow: var(--app-lift);
}

.act__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    background: var(--bh-paper-2);
    color: var(--bh-ink);
}

.act b {
    display: block;
    font-size: var(--app-t-body);
    font-weight: 650;
    letter-spacing: -0.012em;
}

.act__sub {
    display: block;
    margin-top: 1px;
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

/* L'action destructive se signale sans crier : elle reste une carte
   parmi les autres, mais son intention est lisible. */
.act--danger .act__icon {
    background: var(--bh-red-wash);
    color: var(--bh-red-dark);
}

.act--danger:hover {
    border-color: rgba(239, 68, 68, 0.35);
}

.act__out {
    width: 100%;
    margin-top: 1rem;
    min-height: 48px;
    justify-content: center;
}

@media (min-width: 700px) {
    .acts {
        grid-template-columns: 1fr 1fr;
    }

    .act__out {
        width: auto;
    }
}
