/**
 * OptiGest360° — Refonte de l'interface : COQUE DE MODULE
 * =======================================================
 * Barre latérale (264 px), barre haute (72 px), zone de contenu — valeurs de la
 * maquette validée le 2026-09-10 (kit.py : sidebar_module, topbar, app_module).
 * Classes `rf-` : réservées à la coque, jamais posées par un écran.
 */

html[data-refonte] body {
    margin: 0;
    background: var(--ui-bg);
    color: var(--ui-text-1);
    font-family: var(--ui-font-sans);
    -webkit-font-smoothing: antialiased;
}

.rf-app { display: flex; width: 100%; min-height: 100vh; background: var(--ui-bg); }

/* ═══ Barre latérale ═════════════════════════════════════════════════════ */
.rf-sidebar {
    position: sticky; top: 0; align-self: flex-start; z-index: 30;
    width: 264px; height: 100vh; flex-shrink: 0; box-sizing: border-box;
    padding: 20px 14px 18px 18px; display: flex; flex-direction: column; gap: 18px;
    overflow-y: auto; scrollbar-width: thin; background: var(--ui-bg);
    font-family: var(--ui-font-sans); font-size: 13px; line-height: 18px;
}

.rf-org { display: flex; align-items: center; gap: 12px; padding: 0 4px; min-width: 0; }
.rf-org__logo {
    width: 40px; height: 40px; flex-shrink: 0; box-sizing: border-box; overflow: hidden;
    border-radius: 12px; background: var(--ui-surface); border: 1px solid var(--ui-border);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ui-font-display); font-size: 14px; font-weight: 600; color: var(--ui-text-1);
}
.rf-org__logo img { width: 100%; height: 100%; object-fit: contain; }
.rf-org__text { min-width: 0; }
html[data-refonte] .rf-org__name { margin: 0; font-family: var(--ui-font-sans); font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: normal; color: var(--ui-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-org__module { font-size: 12.5px; line-height: 16px; color: var(--ui-text-3); }

/* Exercice de travail : CONTEXTE, donc orange léger. */
.rf-fy { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.rf-fy__chip {
    position: relative; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; box-sizing: border-box;
    border-radius: 999px; background: var(--ui-brand2-bg); border: 1px solid var(--ui-brand2-border); color: var(--ui-brand2-fg);
    font-size: 12.5px; font-weight: 600;
}
.rf-fy__chip:focus-within { box-shadow: var(--ui-focus-ring); }
.rf-fy__chevron { margin-left: auto; display: flex; }
.rf-fy__form { margin: 0; }
/* Le <select> natif couvre la pastille, invisible : la liste reste celle du système. */
html[data-refonte] .rf-fy__select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; border: 0; font-size: 13px; }
.rf-fy__note { padding-left: 4px; font-size: 11.5px; line-height: 14px; color: var(--ui-text-3); }
html[data-refonte] .rf-fy__note a { color: var(--ui-accent-fg); text-decoration: none; }
html[data-refonte] .rf-fy__note a:hover { text-decoration: underline; }

/* Navigation */
.rf-nav { display: flex; flex-direction: column; gap: 2px; }
html[data-refonte] .rf-nav__item {
    display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; margin: 0;
    padding: 7px 10px; border: 0; border-radius: 12px; background: transparent;
    color: var(--ui-text-2); font-family: var(--ui-font-sans); font-size: 13px; line-height: 18px; font-weight: 400;
    text-align: left; text-decoration: none; cursor: pointer;
}
html[data-refonte] .rf-nav__item > .ui-icon { color: var(--ui-text-3); }
html[data-refonte] .rf-nav__item:hover { background: var(--ui-surface); color: var(--ui-text-1); }
html[data-refonte] .rf-nav__item.is-active { background: var(--ui-accent-strong); color: var(--ui-on-accent); font-weight: 600; }
html[data-refonte] .rf-nav__item.is-active > .ui-icon { color: var(--ui-on-accent); }
html[data-refonte] .rf-nav__item:focus-visible,
html[data-refonte] .rf-nav__child:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); }
.rf-nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Un compteur signale ce qui DEMANDE UNE ACTION, jamais un total (DL/17:97). */
.rf-nav__count {
    margin-left: auto; flex-shrink: 0; padding: 1px 7px; border-radius: 999px;
    background: var(--ui-warning-bg); color: var(--ui-warning-fg);
    font-size: 11.5px; line-height: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.rf-nav__count--danger { background: var(--ui-danger-bg); color: var(--ui-danger-fg); }
.rf-nav__count--info { background: var(--ui-info-bg); color: var(--ui-info-fg); }
.rf-nav__count--success { background: var(--ui-success-bg); color: var(--ui-success-fg); }
.is-active > .rf-nav__count { background: var(--ui-nav-count-on); color: var(--ui-on-accent); }

html[data-refonte] .rf-nav__group-head { color: var(--ui-text-1); font-weight: 500; }
html[data-refonte] .rf-nav__group.has-active > .rf-nav__group-head { font-weight: 600; }
html[data-refonte] .rf-nav__group.has-active > .rf-nav__group-head > .ui-icon:first-child { color: var(--ui-text-2); }
.rf-nav__chevron { display: flex; color: var(--ui-text-3); }
.rf-nav__chevron .rf-nav__chevron-open { display: none; }
.rf-nav__group.is-open .rf-nav__chevron-open { display: block; }
.rf-nav__group.is-open .rf-nav__chevron-closed { display: none; }
.rf-nav__children {
    display: none; flex-direction: column; gap: 2px;
    margin: 2px 0 6px 18px; padding-left: 10px; border-left: 1px solid var(--ui-border);
}
.rf-nav__group.is-open > .rf-nav__children { display: flex; }
html[data-refonte] .rf-nav__child {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px;
    color: var(--ui-text-2); font-size: 13px; line-height: 18px; font-weight: 400; text-decoration: none;
}
html[data-refonte] .rf-nav__child:hover { background: var(--ui-surface); color: var(--ui-text-1); }
html[data-refonte] .rf-nav__child.is-active { background: var(--ui-accent-strong); color: var(--ui-on-accent); font-weight: 600; }
.rf-nav__header { padding: 12px 10px 4px; font-size: 11.5px; line-height: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ui-text-3); }
.rf-nav__divider { height: 1px; margin: 8px 10px; background: var(--ui-border); }

.rf-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.rf-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.rf-user__text { min-width: 0; }
.rf-user__name { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-user__email { font-size: 12px; line-height: 16px; color: var(--ui-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══ Colonne principale ════════════════════════════════════════════════ */
.rf-main { flex: 1; min-width: 0; box-sizing: border-box; padding: 0 32px 32px 8px; display: flex; flex-direction: column; }
.rf-banners:empty { display: none; }
.rf-banners { padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.rf-topbar { position: relative; z-index: 20; height: 72px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rf-topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rf-topbar__right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.rf-topbar__actions { display: flex; align-items: center; gap: 8px; }
.rf-topbar__actions:empty { display: none; }

html[data-refonte] .rf-round {
    position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; padding: 0; margin: 0; box-sizing: border-box;
    border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); box-shadow: none;
    color: var(--ui-text-2); text-decoration: none; cursor: pointer;
}
html[data-refonte] .rf-round:hover { color: var(--ui-text-1); }
html[data-refonte] .rf-round:focus-visible,
html[data-refonte] .rf-lang:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); }
.rf-round__dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-accent); box-shadow: 0 0 0 2px var(--ui-surface); }
.rf-round__count {
    position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
    border-radius: 999px; background: var(--ui-accent-strong); color: var(--ui-on-accent);
    font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--ui-bg);
}
html[data-refonte] .rf-lang {
    display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; margin: 0; box-sizing: border-box;
    border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); box-shadow: none;
    font-family: var(--ui-font-sans); font-size: 13px; font-weight: 600; color: var(--ui-text-1); cursor: pointer;
}
.rf-lang .ui-icon { color: var(--ui-text-3); }

/* Lune en clair, soleil en sombre : l'icône suit le thème sans script. */
.rf-theme-sun { display: none; }
html[data-theme="dark"] .rf-theme-moon { display: none; }
html[data-theme="dark"] .rf-theme-sun { display: block; }

/* Panneaux de la barre haute (langue, nouveautés, notifications) */
.rf-pop-wrap { position: relative; }
.rf-pop {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1050; box-sizing: border-box;
    min-width: 224px; padding: 4px; border-radius: 12px;
    background: var(--ui-surface); border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow);
    font-family: var(--ui-font-sans); color: var(--ui-text-1); text-align: left;
}
.rf-pop--panel { width: 360px; padding: 0; overflow: hidden; }
.rf-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--ui-border); }
html[data-refonte] .rf-pop__title { margin: 0; font-family: var(--ui-font-display); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-text-1); }
.rf-pop__list { max-height: 360px; overflow-y: auto; }
.rf-pop__foot { padding: 10px 14px; border-top: 1px solid var(--ui-border); }
.rf-changelog { padding: 12px 14px; border-bottom: 1px solid var(--ui-border); }
.rf-changelog:last-child { border-bottom: 0; }
.rf-changelog__title { margin: 6px 0 2px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ui-text-1); }
.rf-changelog__text { margin: 0; font-size: 12px; line-height: 16px; color: var(--ui-text-2); }

/* Éléments rendus par le script des notifications (classes historiques, gardées
   pour que le même script serve les deux coques). */
.rf-notif .notification-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--ui-border); font-size: 13px; line-height: 18px; background: transparent; }
.rf-notif .notification-item--unread { background: var(--ui-accent-subtle); }
.rf-notif .notification-item__icon { color: var(--ui-text-3); padding-top: 2px; }
.rf-notif .notification-item--success .notification-item__icon { color: var(--ui-success-fg); }
.rf-notif .notification-item--warning .notification-item__icon { color: var(--ui-warning-fg); }
.rf-notif .notification-item--danger .notification-item__icon { color: var(--ui-danger-fg); }
.rf-notif .notification-item--info .notification-item__icon { color: var(--ui-info-fg); }
.rf-notif .notification-item__body { flex: 1; min-width: 0; }
.rf-notif .notification-item__title { display: block; font-weight: 600; color: var(--ui-text-1); text-decoration: none; }
.rf-notif .notification-item__message { margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--ui-text-2); }
.rf-notif .notification-item__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rf-notif .notification-item__time { font-size: 11.5px; color: var(--ui-text-3); white-space: nowrap; }
.rf-notif .notification-item__dismiss { padding: 0; border: 0; background: none; color: var(--ui-text-3); cursor: pointer; }
.rf-notif .notification-empty { padding: 28px 16px; text-align: center; color: var(--ui-text-3); font-size: 13px; }
.rf-notif .notification-empty p { margin: 6px 0 0; }

/* Contenu */
.rf-content { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.rf-legacy { min-width: 0; }

/* Impersonation : bandeau d'AVERTISSEMENT (ton warning, pas un dégradé). */
.rf-impersonation {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px;
    border-radius: 12px; background: var(--ui-warning-bg); border: 1px solid var(--ui-warning-border); color: var(--ui-warning-fg);
    font-size: 13px; line-height: 18px;
}
.rf-impersonation__text { min-width: 0; display: flex; align-items: center; gap: 10px; }
.rf-impersonation__title { font-weight: 600; color: var(--ui-text-1); }
.rf-impersonation__reason { font-size: 12px; color: var(--ui-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-impersonation form { margin: 0; flex-shrink: 0; }

/* ═══ Pages d'authentification (connexion, mot de passe oublié…) ════════ */
.rf-auth { min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 40px 16px; background: var(--ui-bg); color: var(--ui-text-1); font-family: var(--ui-font-sans); font-size: 14px; line-height: 20px; }
.rf-auth__logo { display: block; width: 176px; height: auto; }
.rf-logo-sombre { display: none; }
html[data-theme="dark"] .rf-logo-clair { display: none; }
html[data-theme="dark"] .rf-logo-sombre { display: block; }
.rf-auth__card { width: 440px; max-width: 100%; padding: 32px; }
html[data-refonte] .rf-auth__title { margin: 0; font-family: var(--ui-font-display); font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--ui-text-1); }
html[data-refonte] .rf-auth__subtitle { margin: 4px 0 0; font-size: 14px; line-height: 20px; color: var(--ui-text-2); }
html[data-refonte] .rf-auth__foot { margin: 0; text-align: center; font-size: 13px; color: var(--ui-text-2); }
.rf-auth__legal { font-size: 12px; line-height: 16px; color: var(--ui-text-3); text-align: center; }
.rf-auth__reveal[aria-pressed="true"] { color: var(--ui-accent-fg); }
.rf-divider { display: flex; align-items: center; gap: 12px; color: var(--ui-text-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.rf-divider::before, .rf-divider::after { content: ""; flex: 1; height: 1px; background: var(--ui-border); }
@media (max-width: 480px) { .rf-auth__card { padding: 24px 20px; } }

/* ═══ Pré-authentification (second facteur, acceptation des documents) ═══
   Les pages filles gardent leurs classes og-* : redéfinies ici aux jetons. */
.rf-preauth :where(p, form, ul, ol, h1, h2, h3) { margin: 0; }
html[data-refonte] .rf-preauth .og-titre { margin: 0 0 4px; font-family: var(--ui-font-display); font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--ui-text-1); }
.rf-preauth .og-sous-titre { margin: 0 0 20px; font-size: 14px; line-height: 21px; color: var(--ui-text-2); }
.rf-preauth .og-libelle { display: block; margin-bottom: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ui-text-1); }
html[data-refonte] .rf-preauth .og-champ {
    width: 100%; height: 44px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--ui-border); border-radius: 12px;
    background: var(--ui-surface); color: var(--ui-text-1); font-family: var(--ui-font-sans); font-size: 15px;
}
html[data-refonte] .rf-preauth .og-champ:focus { outline: 0; border-color: var(--ui-accent); box-shadow: 0 0 0 3px var(--ui-accent-subtle); }
html[data-refonte] .rf-preauth .og-bouton {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; box-sizing: border-box; padding: 0 20px;
    border: 0; border-radius: 999px; background: var(--ui-accent-strong); color: var(--ui-on-accent);
    font-family: var(--ui-font-sans); font-size: 14px; font-weight: 600; cursor: pointer;
}
html[data-refonte] .rf-preauth .og-bouton:hover { background: var(--ui-accent-strong-hover); }
html[data-refonte] .rf-preauth .og-bouton:focus-visible,
html[data-refonte] .rf-preauth .og-lien:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); }
html[data-refonte] .rf-preauth .og-lien {
    display: inline-block; margin-top: 16px; padding: 0; border: 0; background: none;
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ui-accent-fg); text-decoration: none; cursor: pointer;
}
html[data-refonte] .rf-preauth .og-lien:hover { text-decoration: underline; }
.rf-preauth .og-erreur { margin-bottom: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ui-danger-border); background: var(--ui-danger-bg); color: var(--ui-danger-fg); font-size: 13px; line-height: 19px; }
.rf-preauth .og-note { margin-top: 16px; padding: 12px; border-radius: 12px; background: var(--ui-surface-2); color: var(--ui-text-2); font-size: 13px; line-height: 20px; }
/* Fond blanc IMPOSÉ derrière le QR : noir sur transparent, il serait illisible et non scannable sur fond sombre. */
.rf-preauth .og-qr { display: flex; justify-content: center; padding: 12px; border-radius: 12px; border: 1px solid var(--ui-border); background: var(--ui-blanc); }
.rf-preauth .og-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; font-family: var(--ui-font-mono); }
.rf-preauth .og-codes span { padding: 10px; border-radius: 8px; border: 1px solid var(--ui-border); background: var(--ui-surface-2); color: var(--ui-text-1); font-size: 14px; letter-spacing: 0.04em; text-align: center; }
@media (max-width: 400px) { .rf-preauth .og-codes { grid-template-columns: 1fr; } }

/* ═══ Pages d'erreur (404, 403, 419, 429, 500, 503, gone) : sobres ════════ */
html[data-refonte] body.rf-error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.rf-error { box-sizing: border-box; width: 100%; max-width: 520px; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; font-family: var(--ui-font-sans); }
.rf-error__code { font-family: var(--ui-font-display); font-size: clamp(64px, 12vw, 104px); line-height: 1; font-weight: 600; letter-spacing: -0.04em; color: var(--ui-accent-strong); font-variant-numeric: tabular-nums; }
.rf-error__illustration { width: 104px; height: 104px; margin: 4px 0; }
.rf-error__illustration svg { width: 100%; height: 100%; }
/* Couleurs historiques des illustrations (écrites dans chaque page) → jetons. */
.rf-error__illustration [stroke="#e2e8f0"] { stroke: var(--ui-border); }
.rf-error__illustration [stroke="#94a3b8"] { stroke: var(--ui-text-3); }
.rf-error__illustration [stroke="#06352c"], .rf-error__illustration [stroke="#6366f1"] { stroke: var(--ui-accent); }
.rf-error__illustration [fill="#06352c"], .rf-error__illustration [fill="#6366f1"] { fill: var(--ui-accent); }
.rf-error__illustration [stroke="#f59e0b"] { stroke: var(--ui-brand2); }
.rf-error__illustration [fill="#f59e0b"] { fill: var(--ui-brand2); }
.rf-error__illustration [stroke="#ef4444"] { stroke: var(--ui-danger-fg); }
.rf-error__illustration [fill="#ef4444"] { fill: var(--ui-danger-fg); }
.rf-error__illustration [stroke="#10b981"] { stroke: var(--ui-success-fg); }
.rf-error__illustration [fill="#10b981"] { fill: var(--ui-success-fg); }
.rf-error__illustration [fill="#f1f5f9"], .rf-error__illustration [fill="#f0f9ff"] { fill: var(--ui-surface-2); }
.rf-error__illustration [fill="#fff7ed"], .rf-error__illustration [fill="#fefce8"] { fill: var(--ui-brand2-bg); }
.rf-error__illustration [fill="#fef2f2"] { fill: var(--ui-danger-bg); }
.rf-error__illustration [fill="#f0fdf4"] { fill: var(--ui-success-bg); }
html[data-refonte] .rf-error__title { margin: 0; font-family: var(--ui-font-display); font-size: 20px; line-height: 28px; font-weight: 600; color: var(--ui-text-1); }
.rf-error__message { margin: 0 0 12px; max-width: 44ch; font-size: 14px; line-height: 21px; color: var(--ui-text-2); }
.rf-error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* Actions écrites par chaque page (.btn, .btn-primary, .btn-ghost) → boutons de la refonte. */
html[data-refonte] .rf-error__actions .btn {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; box-sizing: border-box;
    border: 1px solid var(--ui-border); border-radius: 999px; background: var(--ui-surface); color: var(--ui-text-1);
    font-family: var(--ui-font-sans); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
html[data-refonte] .rf-error__actions .btn:hover { background: var(--ui-surface-2); }
html[data-refonte] .rf-error__actions .btn-primary { border-color: var(--ui-accent-strong); background: var(--ui-accent-strong); color: var(--ui-on-accent); }
html[data-refonte] .rf-error__actions .btn-primary:hover { border-color: var(--ui-accent-strong-hover); background: var(--ui-accent-strong-hover); }
html[data-refonte] .rf-error__actions .btn:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); }
.rf-error__brand { margin-top: 28px; font-size: 12px; color: var(--ui-text-3); }
.rf-error__brand strong { color: var(--ui-accent-fg); font-weight: 600; }
@media (max-width: 640px) { html[data-refonte] .rf-error__actions .btn { width: 100%; justify-content: center; } }

/* ═══ Documents légaux (v1 et v2) : texte long, lisible, sans décor ═══════
   La coquille ne change aucun texte ; les classes legal-* sont celles des pages. */
.rf-legal { box-sizing: border-box; max-width: 860px; margin: 0 auto; padding: 32px 20px 48px; color: var(--ui-text-1); font-family: var(--ui-font-sans); font-size: 15px; line-height: 1.65; }
.rf-legal__header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--ui-border); }
.rf-legal__header--stack { flex-direction: column; align-items: flex-start; gap: 6px; }
html[data-refonte] .rf-legal__brand { font-size: 13px; font-weight: 600; color: var(--ui-accent-fg); text-decoration: none; }
.rf-legal__sep { color: var(--ui-text-disabled); }
html[data-refonte] .rf-legal__title { margin: 0; font-family: var(--ui-font-display); font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; color: var(--ui-text-1); }
html[data-refonte] .rf-legal .legal-meta { margin: 0; font-size: 13px; line-height: 19px; color: var(--ui-text-3); }
.rf-legal__warning { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 24px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ui-warning-border); background: var(--ui-warning-bg); color: var(--ui-text-1); font-size: 13.5px; line-height: 20px; }
.rf-legal__warning > .ui-icon { flex-shrink: 0; margin-top: 2px; color: var(--ui-warning-fg); }
html[data-refonte] .rf-legal .legal-content h2 { margin: 32px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--ui-border); font-family: var(--ui-font-display); font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ui-text-1); }
html[data-refonte] .rf-legal .legal-content h3 { margin: 20px 0 6px; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ui-text-1); }
html[data-refonte] .rf-legal .legal-content p, html[data-refonte] .rf-legal .legal-content li { font-size: 15px; line-height: 1.65; color: var(--ui-text-1); }
html[data-refonte] .rf-legal .legal-content a, html[data-refonte] .rf-legal .legal-toc a { color: var(--ui-accent-fg); }
.rf-legal .legal-content code { padding: 1px 6px; border-radius: 4px; background: var(--ui-surface-2); font-family: var(--ui-font-mono); font-size: 13px; }
.rf-legal .legal-toc { margin-bottom: 28px; padding: 16px 20px; border-radius: 12px; border: 1px solid var(--ui-border); background: var(--ui-surface); }
html[data-refonte] .rf-legal .legal-toc h2 { margin: 0 0 8px; padding: 0; border: 0; font-family: var(--ui-font-sans); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ui-text-3); }
.rf-legal .legal-toc ol { margin: 0; padding-left: 20px; }
html[data-refonte] .rf-legal .legal-toc a { font-size: 14px; text-decoration: none; }
html[data-refonte] .rf-legal .legal-toc a:hover { text-decoration: underline; }
.rf-legal .legal-content table { width: 100%; margin: 16px 0; border-collapse: collapse; font-size: 13.5px; }
/* Tables légales nues (plus d'enveloppe legal-table-wrap) : sur petit écran, la
   table défile elle-même, comme dans la mise en page légale d'origine. */
@media (max-width: 640px) { .rf-legal .legal-content table { display: block; overflow-x: auto; } }
html[data-refonte] .rf-legal .legal-content th, html[data-refonte] .rf-legal .legal-content td { padding: 8px 10px; border: 1px solid var(--ui-border); text-align: left; vertical-align: top; }
html[data-refonte] .rf-legal .legal-content th { background: var(--ui-surface-2); font-weight: 600; }
.rf-legal .legal-identity { padding: 0; list-style: none; }
.rf-legal .legal-identity li { margin: 2px 0; }
.rf-legal .legal-box { margin: 16px 0; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--ui-border); background: var(--ui-surface); }
.rf-legal .legal-check { font-family: "DejaVu Sans", var(--ui-font-sans); }
.rf-legal__footer { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--ui-border); font-size: 13px; line-height: 20px; color: var(--ui-text-3); }
.rf-legal__footer--stack { flex-direction: column; }
.rf-legal__footer p { margin: 0; }
.rf-legal__links { margin-left: auto; }
.rf-legal__nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
html[data-refonte] .rf-legal__footer a { color: var(--ui-accent-fg); text-decoration: none; }
html[data-refonte] .rf-legal__footer a:hover { text-decoration: underline; }
html[data-refonte] .rf-legal__footer a[aria-current="page"] { font-weight: 600; text-decoration: underline; }
@media print {
    .rf-legal__warning, .rf-legal .legal-toc, .rf-legal__nav { display: none !important; }
    html[data-refonte] body { background: var(--ui-blanc); }
}

/* ═══ Portail candidat (inscription, connexion, espace) ═════════════════
   Les pages filles gardent leurs classes (carte, sous, champ, duo, bouton…) :
   redéfinies ici aux jetons. Page publique, sans session de dossier. */
html[data-refonte] body.rf-portail { display: flex; flex-direction: column; min-height: 100vh; font-family: var(--ui-font-sans); line-height: 1.6; }
.rf-portail :where(h2, p, form, ul, ol) { margin: 0; }
.rf-portail__bar { border-bottom: 1px solid var(--ui-border); background: var(--ui-surface); }
.rf-portail__inner { box-sizing: border-box; max-width: 720px; margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
html[data-refonte] .rf-portail__name { margin: 0; font-family: var(--ui-font-display); font-size: 18px; line-height: 24px; font-weight: 600; color: var(--ui-text-1); }
.rf-portail__main { box-sizing: border-box; flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 32px 20px 48px; }
.rf-portail__flash { margin-bottom: 20px; }
.rf-portail .carte { padding: 28px; border-radius: 16px; border: 1px solid var(--ui-border); background: var(--ui-surface); box-shadow: var(--ui-shadow-sm); }
.rf-portail .carte + .carte { margin-top: 16px; }
html[data-refonte] .rf-portail h2 { margin-bottom: 6px; font-family: var(--ui-font-display); font-size: 20px; line-height: 28px; font-weight: 600; color: var(--ui-text-1); }
.rf-portail .sous { margin-bottom: 24px; font-size: 14px; line-height: 21px; color: var(--ui-text-2); }
html[data-refonte] .rf-portail label { display: block; margin-bottom: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ui-text-1); }
html[data-refonte] .rf-portail input[type=text], html[data-refonte] .rf-portail input[type=email],
html[data-refonte] .rf-portail input[type=password], html[data-refonte] .rf-portail input[type=tel] {
    width: 100%; height: 44px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--ui-border); border-radius: 12px;
    background: var(--ui-surface); color: var(--ui-text-1); font-family: var(--ui-font-sans); font-size: 15px;
}
html[data-refonte] .rf-portail input:focus { outline: 0; border-color: var(--ui-accent); box-shadow: 0 0 0 3px var(--ui-accent-subtle); }
.rf-portail .champ + .champ { margin-top: 16px; }
.rf-portail .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rf-portail .duo .champ + .champ { margin-top: 0; }
@media (max-width: 520px) { .rf-portail .duo { grid-template-columns: 1fr; } }
html[data-refonte] .rf-portail .bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; box-sizing: border-box;
    margin-top: 24px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ui-accent-strong); color: var(--ui-on-accent);
    font-family: var(--ui-font-sans); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
html[data-refonte] .rf-portail .bouton:hover { background: var(--ui-accent-strong-hover); }
html[data-refonte] .rf-portail .bouton:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); }
.rf-portail .lien-bas { margin-top: 20px; text-align: center; font-size: 14px; color: var(--ui-text-2); }
html[data-refonte] .rf-portail .lien-bas a { color: var(--ui-accent-fg); font-weight: 600; text-decoration: none; }
html[data-refonte] .rf-portail .lien-bas a:hover { text-decoration: underline; }
.rf-portail .note { margin-top: 6px; font-size: 12.5px; line-height: 18px; color: var(--ui-text-3); }

/* ═══ Gabarit épuré (page d'attente de vérification) ════════════════════ */
.rf-clean__flashes { display: flex; flex-direction: column; gap: 8px; max-width: 720px; margin: 16px auto 0; padding: 0 16px; }

/* ═══ Espace sans module (Réglages) : barre haute seule, contenu centré ═══ */
.rf-solo { min-height: 100vh; box-sizing: border-box; padding: 0 32px 32px; background: var(--ui-bg); color: var(--ui-text-1); font-family: var(--ui-font-sans); }
.rf-solo__bar, .rf-solo__content, .rf-solo > .rf-banners { max-width: 1200px; margin-left: auto; margin-right: auto; }
.rf-solo__user { padding: 0; }
.rf-solo__logout { margin: 0; }
/* Bouton flottant d'enregistrement : les classes opacity-0 / pointer-events-none
   sont basculées par le script du gabarit ; leur effet est garanti ici, sans Tailwind. */
.rf-float-save { position: fixed; right: 32px; bottom: 32px; z-index: 40; transition: opacity 0.2s ease; }
.rf-float-save.opacity-0 { opacity: 0; }
.rf-float-save.pointer-events-none { pointer-events: none; }
.rf-float-save .ui-btn { box-shadow: var(--ui-shadow); }
@media (max-width: 640px) {
    .rf-solo { padding: 0 16px 96px; }
    .rf-float-save { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .rf-float-save { transition: none; } }

/* ═══ Petits écrans : la barre latérale devient un tiroir ═══════════════ */
.rf-menu-btn { display: none !important; }
.rf-scrim { display: none; }
@media (max-width: 1024px) {
    .rf-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 1070; height: 100vh;
        transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none;
    }
    .rf-app.is-nav-open .rf-sidebar { transform: none; box-shadow: var(--ui-shadow-overlay); }
    .rf-app.is-nav-open .rf-scrim { display: block; position: fixed; inset: 0; z-index: 1060; background: var(--ui-scrim); }
    .rf-main { padding: 0 20px 24px; }
    .rf-menu-btn { display: flex !important; }
}
@media (max-width: 640px) {
    .rf-main { padding: 0 16px 24px; }
    .rf-topbar__right .rf-hide-sm { display: none; }
    .rf-topbar .ui-breadcrumb__item:not(.is-current),
    .rf-topbar .ui-breadcrumb__sep { display: none; }
    .rf-pop--panel { width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) { .rf-sidebar { transition: none; } }

@media print {
    .rf-sidebar, .rf-topbar, .rf-scrim, .rf-banners, .ui-toasts { display: none !important; }
    .rf-main { padding: 0; }
    html[data-refonte] body, .rf-app { background: var(--ui-blanc); }
    /* Pendant de og-print.css (qui ne connaît que les classes ds-*) : les
       commandes de l'écran ne s'impriment pas — filtres, actions, onglets,
       pagination, menus, boutons-liens (og-print masque déjà tout <button>). */
    .ui-filterbar, .ui-table-toolbar, .ui-page-header__actions, .ui-page-header__back,
    .ui-segmented, .ui-tabs, .ui-pagination, .ui-dropdown, .ui-menu,
    .ui-btn, .ui-icon-btn, .ui-table__actions, .ui-alert__close, .ui-filter-chip__remove,
    .ui-modal:not(.is-active), .ui-drawer { display: none !important; }
    /* Une carte flottante s'imprime bordée : l'ombre ne passe pas sur papier. */
    .ui-card { box-shadow: none !important; border: 1px solid var(--ui-paper-line); break-inside: avoid; }
}
