/* Espace admin : tokens du Design System (DEC-006), polices auto-hébergées (comme le site), aucune ressource externe.
   Principes : peu de bordures (1 px, couleur douce), deux rayons (champs 0.5rem, cartes 0.75rem), une seule ombre très légère,
   la couleur réservée au sens (statut, erreur, action principale). Les couleurs de texte gardent leur contraste (WCAG AA). */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/dm-sans-latin.woff2) format('woff2'); }
@font-face { font-family: Fraunces; font-style: normal; font-weight: 600 700; font-display: swap; src: url(/fonts/fraunces-latin.woff2) format('woff2'); }

:root {
  --encre: #57434d;
  --secondaire: #786a70;
  --fond: #fff5f8;
  --surface: #fffdfd;
  --principal: #955572;
  --principal-survol: #76506f;
  --pale: #f4dce5;
  --bordure-champ: #8a6577;
  --erreur: #9b1c2a;
  --succes: #1f6b35;
  --alerte: #7a5300;

  /* Dérivés sobres (teintes très claires des couleurs ci-dessus) */
  --ligne: #efe3e8;
  --survol: #fbf0f4;
  --succes-fond: #eaf4ec;
  --erreur-fond: #fbecee;
  --alerte-fond: #fbf3e1;
  --neutre-fond: #f6f1f3;
  --r-champ: 0.5rem;
  --r-carte: 0.75rem;
  --ombre: 0 1px 2px rgba(87, 67, 77, 0.06);
  --sidebar-w: 16.5rem;
}

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

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; overflow-wrap: break-word; }
h1 { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem); margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-family: "DM Sans", Arial, sans-serif; font-weight: 700; font-size: 1.0625rem; margin: 0 0 0.75rem; }
h3 { font-weight: 700; font-size: 1rem; }
p { margin: 0 0 0.75rem; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 40; }
.skip-link:focus { left: 0; }

/* En-tête des pages sans menu (connexion, invitation) */
.site-header { background: var(--surface); border-bottom: 1px solid var(--ligne); padding: 0.875rem 1.5rem; }
.site-header__inner { max-width: 75rem; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between; }
.site-header__title { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 1.125rem; margin: 0; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }

main { max-width: 28rem; margin: 3rem auto; padding: 0 1.5rem; }

.card { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1.5rem; box-shadow: var(--ombre); }
.card > :last-child { margin-bottom: 0; }
.card + .card { margin-top: 1rem; }

a { color: var(--principal-survol); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--encre); }

:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: 0.9375rem; margin-top: 1.125rem; }
label:first-child, .card > label:first-of-type { margin-top: 0; }
.hint { color: var(--secondaire); font-size: 0.9375rem; margin: 0.25rem 0 0.75rem; }
.card > .hint:first-child, .card > p.hint:first-of-type { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  display: block; width: 100%; min-height: 2.625rem; margin-top: 0.375rem; padding: 0.5rem 0.75rem;
  border: 1px solid var(--bordure-champ); border-radius: var(--r-champ); background: #fff; color: var(--encre); font: inherit; line-height: 1.4;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--encre); outline-offset: 1px; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--erreur); box-shadow: 0 0 0 1px var(--erreur); }
.field-error { color: var(--erreur); font-weight: 600; font-size: 0.9375rem; margin: 0.25rem 0 0; }

.choice, label.choice { display: flex; align-items: flex-start; gap: 0.625rem; font-weight: 400; margin-top: 1rem; }
input[type="checkbox"], input[type="radio"] { flex: none; width: 1.125rem; height: 1.125rem; margin: 0.2rem 0 0; accent-color: var(--principal); }

/* Boutons : un seul gabarit ; plein = action principale, contour = action secondaire, texte = lien discret */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.625rem; margin-top: 1.25rem; padding: 0.5rem 1.25rem;
  border: 1px solid var(--principal); border-radius: var(--r-champ); background: var(--principal); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover, button:hover { background: var(--principal-survol); border-color: var(--principal-survol); color: #fff; }
.button--secondary, .button--ghost { background: transparent; color: var(--principal-survol); border-color: var(--bordure-champ); }
.button--secondary:hover, .button--ghost:hover { background: var(--survol); color: var(--encre); border-color: var(--principal-survol); }
.button--link { background: transparent; border-color: transparent; color: var(--principal-survol); text-decoration: underline; text-underline-offset: 0.18em; margin-top: 0; padding: 0.5rem 0.75rem; }
.button--link:hover { background: var(--survol); border-color: transparent; color: var(--encre); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.25rem; }
.page-actions .button, .page-actions button { margin-top: 0; }

/* Messages */
.alert { border: 1px solid; border-radius: var(--r-champ); padding: 0.75rem 1rem; margin: 0 0 1rem; background: #fff; }
.alert > :last-child { margin-bottom: 0; }
.alert--error { border-color: #e6bcc2; background: var(--erreur-fond); color: var(--erreur); }
.alert--success { border-color: #b9d8c1; background: var(--succes-fond); color: var(--succes); }
.alert--notice { border-color: #e8d49f; background: var(--alerte-fond); color: var(--alerte); }
.alert a { color: inherit; }

.secret, .codes li { font-family: ui-monospace, Consolas, monospace; font-size: 1.0625rem; letter-spacing: 0.04em; overflow-wrap: anywhere; }
input.secret { font-size: 0.9375rem; letter-spacing: 0; }
.codes { columns: 2; padding-left: 1.25rem; }

.qr { margin: 1rem 0; padding: 0.5rem; background: #fff; display: inline-block; border: 1px solid var(--ligne); border-radius: var(--r-champ); }
.qr svg { display: block; width: 13.75rem; height: 13.75rem; max-width: 100%; }

/* Listes : filtres, tableaux, statuts en texte (jamais par la seule couleur) */
main.main--wide { max-width: 76rem; }
.filters { display: grid; gap: 0.75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); align-items: start; margin-bottom: 1.25rem; }
.filters label { margin-top: 0; }
.filters > div { min-width: 0; }
.filters .hint { min-height: 0; }
.filters .actions { grid-column: 1 / -1; display: flex; gap: 0.75rem; flex-wrap: wrap; align-self: end; }
.filters .actions .button, .filters .actions button { margin-top: 0; }
.filters fieldset.slots--filter { grid-column: 1 / -1; margin: 0; }
.filters .check-filter { grid-column: 1 / -1; }
/* Filtre en une ligne (libellé au-dessus, champ dessous, bouton aligné) */
form.filters--inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; }
form.filters--inline > div { flex: 1 1 14rem; min-width: 0; }
form.filters--inline button { margin-top: 0; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.detail-col { min-width: 0; }
@media (max-width: 60rem) { .detail-grid { grid-template-columns: minmax(0, 1fr); } .detail-col + .detail-col { margin-top: 1rem; } }

.table-scroll { overflow-x: auto; border: 1px solid var(--ligne); border-radius: var(--r-carte); background: var(--surface); }
.table-scroll:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
table.requests { border-collapse: collapse; width: 100%; min-width: 40rem; }
table.requests caption { text-align: left; padding: 0.75rem 1rem; font-weight: 600; }
table.requests th, table.requests td { text-align: left; padding: 0.75rem 1rem; border-top: 1px solid var(--ligne); vertical-align: top; }
table.requests thead th { background: var(--neutre-fond); border-top: 0; color: var(--secondaire); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
table.requests thead th a { color: inherit; text-decoration: none; display: inline-block; min-height: 2.25rem; line-height: 2.25rem; }
table.requests thead th a:hover { text-decoration: underline; }
table.requests tbody tr:hover { background: var(--survol); }
table.requests td .badge + .badge, table.requests td .badge { margin: 0 0.25rem 0.25rem 0; }

/* Page Accès : tableau des droits. Colonnes compactes, première colonne figée au défilement, cellule entière cliquable. */
.access-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1.5rem; }
.access-toolbar form.filters--inline { flex: 1 1 20rem; flex-wrap: nowrap; }
.access-toolbar form.filters--inline > div { flex: 1 1 9rem; }
.access-toolbar .page-actions { margin: 0 0 0 auto; }
table.rights { min-width: 0; }
table.rights th, table.rights td { padding: 0.5rem 0.625rem; }
table.rights thead th { text-align: center; vertical-align: bottom; font-size: 0.75rem; letter-spacing: 0.02em; line-height: 1.25; white-space: normal; padding-inline: 0.375rem; min-width: 5.5rem; }
table.rights thead th:first-child, table.rights tbody th { text-align: left; }
table.rights tbody th { font-weight: 400; min-width: 11rem; }
table.rights thead th:first-child, table.rights tbody th { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--ligne); }
table.rights tbody th { background: var(--surface); }
table.rights tbody tr:hover th { background: var(--survol); }
table.rights td { text-align: center; vertical-align: middle; padding: 0; }
table.rights td.is-plain { padding: 0.5rem 0.625rem; }
table.rights td.is-sensitive { background: rgba(251, 236, 238, 0.45); }
table.rights thead th.is-sensitive { background: var(--erreur-fond); }
table.rights thead th .badge { display: block; width: fit-content; margin: 0.25rem auto 0; }
table.rights .cell-check { display: flex; align-items: center; justify-content: center; min-height: 3rem; cursor: pointer; }
table.rights .cell-check:hover { background: var(--pale); }
table.rights .cell-check input { width: 1.375rem; height: 1.375rem; margin: 0; cursor: pointer; }
.save-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; margin-top: 1rem; }
.save-bar > div { flex: 1 1 16rem; max-width: 24rem; }
.save-bar label { margin-top: 0; }
.save-bar button { margin-top: 0; }
@media (max-width: 40rem) { .access-toolbar form.filters--inline { flex-wrap: wrap; } .access-toolbar .page-actions { margin-left: 0; } }

/* Pastilles : texte sur fond doux, sans contour épais */
.badge { display: inline-block; border: 1px solid transparent; border-radius: 999px; padding: 0.0625rem 0.625rem; font-weight: 600; font-size: 0.8125rem; line-height: 1.5; background: var(--neutre-fond); color: var(--encre); white-space: nowrap; }
.badge--waiting { background: var(--alerte-fond); color: var(--alerte); }
.badge--offer_made { background: var(--pale); color: var(--principal-survol); }
.badge--admitted { background: var(--succes-fond); color: var(--succes); }
.badge--refused { background: var(--erreur-fond); color: var(--erreur); }
.badge--received, .badge--withdrawn, .badge--archived { background: var(--neutre-fond); color: var(--encre); border-color: var(--ligne); }
.dup { font-size: 0.9375rem; color: var(--alerte); font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 1rem; }
.pager a, .pager span.current { min-height: 2.5rem; display: inline-flex; align-items: center; padding: 0 0.5rem; }
.pager nav { width: 100%; }

dl.facts { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: 0.625rem 1.5rem; margin: 0; }
dl.facts dt { font-weight: 600; color: var(--secondaire); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ol.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
ol.timeline li { border-left: 2px solid var(--pale); padding: 0.125rem 0 0.125rem 1rem; }
ol.timeline .when { color: var(--secondaire); font-size: 0.9375rem; }
ol.timeline .body { margin: 0.25rem 0 0; overflow-wrap: anywhere; }
@media (max-width: 40rem) { dl.facts { grid-template-columns: 1fr; } }

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

/* Créneaux d'accueil (DEC-013) : grille jours × matin / après-midi, cases à cocher assez grandes. */
fieldset.slots { border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1rem; margin: 1rem 0; min-inline-size: 0; }
.slots-grid { border-collapse: collapse; margin: 0.5rem 0; }
.slots-grid th, .slots-grid td { padding: 0.5rem 1rem; text-align: left; border-bottom: 1px solid var(--ligne); }
.slots-grid thead th { font-weight: 700; }
.slots-grid input[type="checkbox"] { width: 1.5rem; height: 1.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Petits écrans : grille compacte, défilement horizontal limité à une région identifiée et atteignable au clavier. */
.slots-scroll { max-width: 100%; overflow-x: auto; }
.slots-scroll:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
@media (max-width: 40rem) {
  fieldset.slots { padding: 0.5rem; }
  .slots-grid th, .slots-grid td { padding: 0.25rem 0.375rem; text-align: center; }
  .slots-grid tbody th { text-align: left; }
  .slots-grid input[type="checkbox"] { width: 1.75rem; height: 1.75rem; }
}
.filters .slots--filter .slots-scroll { max-width: 100%; }
.filters .slots--filter .slots-grid { width: 100%; max-width: 40rem; table-layout: fixed; }
.filters .slots--filter .slots-grid th:first-child { width: 8rem; }
/* Écran large : noms de jours complets ; écran étroit : abréviations. */
@media (min-width: 40.01rem) {
  .slots-day-short { display: none; }
  .slots-day-full { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
}
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
fieldset.attestations .info { margin: 1rem 0 0.5rem; }

/* ===== Cadre de l'espace connecté : menu latéral, pages alignées à gauche (CSP : aucun style ni script en ligne) ===== */
.nav-toggle:focus-visible ~ .topbar .menu-button { outline: 3px solid var(--encre); outline-offset: 2px; }

.topbar { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30; display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1.25rem 0.75rem; background: var(--surface); border-right: 1px solid var(--ligne); overflow-y: auto;
}
body.has-sidebar { padding-left: var(--sidebar-w); }
body.has-sidebar main { max-width: 46rem; margin: 0; padding: 2.25rem 2.5rem 4rem; }
body.has-sidebar main.main--wide { max-width: 120rem; }
body.has-sidebar main.main--full { max-width: none; }
.scrim { display: none; }

.brand { display: flex; align-items: center; gap: 0.75rem; padding: 0.25rem 0.5rem 1rem; border-bottom: 1px solid var(--ligne); color: var(--encre); text-decoration: none; }
.brand:hover { color: var(--encre); }
.brand__mark { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--r-champ); background: var(--principal); color: #fff; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 0.9375rem; letter-spacing: 0.02em; }
.brand__name { display: block; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 0.9375rem; line-height: 1.2; }
.brand__sub { display: block; color: var(--secondaire); font-size: 0.8125rem; }

.side-nav { flex: 1; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.125rem; }
.side-nav__group { margin: 1.5rem 0.75rem 0.375rem; color: var(--secondaire); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.side-nav__group:first-child { margin-top: 0.5rem; }
.side-nav a { display: flex; align-items: center; gap: 0.75rem; min-height: 2.5rem; padding: 0.375rem 0.75rem; border-radius: var(--r-champ); color: var(--encre); font-weight: 500; font-size: 0.9375rem; text-decoration: none; transition: background-color 0.15s; }
.side-nav a:hover { background: var(--survol); color: var(--encre); }
.side-nav a[aria-current="page"] { background: var(--pale); color: var(--encre); font-weight: 700; }
.side-nav svg, .menu-button svg { flex: none; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.count { margin-left: auto; min-width: 1.5rem; padding: 0 0.5rem; border-radius: 999px; background: var(--principal); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.5rem; text-align: center; }

.side-user { padding-top: 1rem; border-top: 1px solid var(--ligne); }
.side-user__name { display: flex; align-items: center; gap: 0.625rem; margin: 0 0.5rem; font-weight: 600; font-size: 0.9375rem; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--pale); color: var(--principal-survol); font-weight: 700; font-size: 0.875rem; }
.side-user .button--ghost { width: 100%; margin-top: 0.75rem; }

.lead { margin: 0 0 1.5rem; color: var(--secondaire); font-size: 1rem; }
.muted { color: var(--secondaire); font-size: 0.9375rem; }
main > h1 + .card, main > h1 + .alert, main > h1 + form, main > h1 + .panel { margin-top: 1.25rem; }
main > h1 { margin-bottom: 0; }
main > h1 + .lead { margin-top: 0.25rem; }

/* À traiter */
.todo { margin: 0 0 1.5rem; padding: 1rem 1.25rem; border: 1px solid var(--ligne); border-radius: var(--r-carte); background: var(--surface); box-shadow: var(--ombre); }
.todo h2 { margin: 0 0 0.5rem; font-size: 1rem; }
.todo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.125rem; }
.todo a, .todo__warn { display: block; padding: 0.375rem 0; color: var(--encre); }
.todo a:hover { color: var(--principal-survol); }
.todo strong { color: var(--principal-survol); }
.todo__warn strong { color: var(--erreur); }

/* Indicateurs : cartes neutres, un seul chiffre mis en avant ; la couleur ne sert qu'à une petite pastille de repère */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-bottom: 1.5rem; }
.kpi { display: flex; flex-direction: column; gap: 0.125rem; padding: 1rem 1.25rem; border: 1px solid var(--ligne); border-radius: var(--r-carte); background: var(--surface); box-shadow: var(--ombre); color: var(--encre); text-decoration: none; transition: border-color 0.15s, background-color 0.15s; }
.kpi:hover { border-color: var(--bordure-champ); color: var(--encre); }
.kpi__label { display: flex; align-items: center; gap: 0.5rem; color: var(--secondaire); font-size: 0.875rem; font-weight: 600; }
.kpi__label::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--kpi, var(--principal)); }
.kpi__value { font-family: "DM Sans", Arial, sans-serif; font-size: 2rem; font-weight: 700; line-height: 1.2; color: var(--encre); font-variant-numeric: tabular-nums; }
.kpi__note { color: var(--secondaire); font-size: 0.875rem; }
.kpi--received { --kpi: #955572; }
.kpi--waiting { --kpi: #d4a03c; }
.kpi--admitted { --kpi: #3f8f58; }
.kpi--messages { --kpi: #d88ca6; }
.kpi--closed { --kpi: #b5485a; }

/* Panneaux */
.dash-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 1.25rem; border: 1px solid var(--ligne); border-radius: var(--r-carte); background: var(--surface); box-shadow: var(--ombre); min-width: 0; }
.panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.875rem; }
.panel__head h2 { margin: 0; font-size: 1rem; }
.panel__head p { margin: 0; }
.empty { margin: 0; padding: 1.5rem 1rem; border: 1px dashed var(--pale); border-radius: var(--r-champ); color: var(--secondaire); text-align: center; }

.chart { display: block; width: 100%; height: auto; max-height: 14rem; }
.chart__axis { stroke: var(--ligne); stroke-width: 1; }
.chart__bar { fill: #e5b9c9; }
.chart__bar--now { fill: var(--principal); }
.chart__value { fill: var(--encre); font-size: 11px; font-weight: 700; }
.chart__label { fill: var(--secondaire); font-size: 10px; }

.stack { display: block; width: 100%; height: 0.75rem; border-radius: 999px; overflow: hidden; background: var(--pale); margin-bottom: 1rem; }
.c-received { fill: #955572; background: #955572; }
.c-waiting { fill: #d4a03c; background: #d4a03c; }
.c-offer { fill: #d88ca6; background: #d88ca6; }
.c-admitted { fill: #3f8f58; background: #3f8f58; }
.c-refused { fill: #b5485a; background: #b5485a; }
.c-withdrawn { fill: #9a8f94; background: #9a8f94; }
.c-archived { fill: #cbbec4; background: #cbbec4; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.125rem; }
.legend a { display: grid; grid-template-columns: auto 1fr auto 3.5rem; align-items: center; gap: 0.75rem; min-height: 2.5rem; padding: 0.25rem 0.5rem; border-radius: var(--r-champ); color: var(--encre); text-decoration: none; }
.legend a:hover { background: var(--survol); }
.legend__n { font-weight: 700; }
.legend__pct { text-align: right; color: var(--secondaire); }
.dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li + li { border-top: 1px solid var(--ligne); }
.feed a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; padding: 0.5rem; border-radius: var(--r-champ); color: var(--encre); text-decoration: none; }
.feed a:hover { background: var(--survol); }
.feed__main { display: grid; min-width: 0; }
.feed__main strong, .feed__main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .badge { flex: none; }
.foot-note { margin-top: 1.5rem; }

/* Écrans moyens et étroits : le menu devient un tiroir ouvert par le bouton « Menu ». */
@media (max-width: 64rem) {
  body.has-sidebar { padding-left: 0; }
  .topbar { display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; padding: 0.5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--ligne); }
  .topbar__title { margin: 0; font-family: Fraunces, Georgia, serif; font-weight: 600; }
  .menu-button { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0 0.875rem; border-radius: var(--r-champ); background: var(--principal); color: #fff; font-weight: 600; cursor: pointer; }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform 0.2s, visibility 0.2s; box-shadow: 0 0 40px rgba(87, 67, 77, 0.25); }
  .nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(87, 67, 77, 0.4); }
  body.has-sidebar main { padding: 1.5rem 1rem 3rem; max-width: none; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 30rem) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { padding: 0.875rem; } .kpi__value { font-size: 1.75rem; } }
@media print { .sidebar, .topbar { display: none; } body.has-sidebar { padding-left: 0; } }

/* Fiche d'une demande : cartes à icône, grilles de créneaux ✓ / ✗, blocs fusionnés (notes, messages), effacement discret. Aucun script ; la couleur est toujours doublée d'un symbole ou d'un texte. */
.detail-col > .card, .detail-col > .card + .card { margin-top: 0; margin-bottom: 1rem; }
.detail-col > .card { border-top: 0.1875rem solid var(--pale); }
.detail-col > .card > h2 { display: flex; align-items: center; gap: 0.625rem; padding-bottom: 0.625rem; margin-bottom: 1rem; border-bottom: 1px solid var(--ligne); font-size: 1.125rem; color: var(--principal-survol); }
.detail-col > .card > h2::before { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--fond); font-size: 1rem; line-height: 1; }
.card--famille > h2::before { content: "\1F464"; }
.card--enfant > h2::before { content: "\1F9F8"; }
.card--besoin > h2::before { content: "\1F4C5"; }
.card--engagement > h2::before { content: "\1F91D"; }
.card--statut > h2::before { content: "\1F4CC"; }
.card--changer > h2::before { content: "\1F501"; }
.card--notes > h2::before { content: "\1F4DD"; }
.card--messages > h2::before { content: "\2709\FE0F"; }
.card--danger > h2::before { content: "\26A0\FE0F"; background: var(--erreur-fond); }
.card--statut { border-top-color: var(--principal); }
.card--statut .badge { font-size: 0.9375rem; padding: 0.125rem 0.875rem; }
.card--famille dl.facts + dl.facts { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--ligne); }
.card--danger { border-top-color: var(--erreur-fond); background: var(--surface); }
.card--danger > h2 { color: var(--erreur); }
.card--danger .button--link { color: var(--erreur); }

.slots-grid--recap { width: 100%; max-width: 40rem; }
.slots-grid--recap th, .slots-grid--recap td { text-align: center; }
.slots-grid--recap thead th { color: var(--principal); }
.slots-grid--recap tbody th { text-align: left; font-weight: 600; }
.slots-grid--recap tbody tr:nth-child(odd) { background: var(--fond); }
.slots-grid--recap td { font-weight: 700; }
.slots-grid--recap .slot-yes { color: var(--succes); }
.slots-grid--recap .slot-no { color: var(--erreur); opacity: 0.7; }
@media (max-width: 30rem) {
  .slots-grid--recap th, .slots-grid--recap td { padding: 0.25rem 0.125rem; font-size: 0.875rem; white-space: nowrap; }
  .slots-grid--recap tbody th { padding-right: 0.5rem; }
}

.card__sub { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--ligne); }
.card__sub > h3 { margin: 0 0 0.75rem; font-size: 1rem; color: var(--principal-survol); }
.card__sub--preview { background: var(--alerte-fond); border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1rem; }
ol.timeline li { position: relative; border-left-color: var(--pale); }
ol.timeline li::before { content: ""; position: absolute; left: -0.4375rem; top: 0.5rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--principal); border: 2px solid var(--surface); }
ol.timeline { margin-bottom: 0; }
.card--besoin dl.facts, .card--engagement dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0.125rem 0; }
.card--besoin dl.facts dt, .card--engagement dl.facts dt { margin-top: 0.875rem; font-size: 0.875rem; }
.card--besoin dl.facts dt:first-child, .card--engagement dl.facts dt:first-child { margin-top: 0; }
.slots-grid--recap { table-layout: auto; }
.slots-grid--recap th, .slots-grid--recap td { white-space: nowrap; padding-inline: 0.5rem; }
.slots-grid--recap .slots-day-short { display: inline; }
.slots-grid--recap .slots-day-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.message-preview__more { margin: 0 0 0.5rem; }
.message-preview__more > summary { cursor: pointer; color: var(--principal-survol); font-size: 0.9375rem; }
.message-preview .check { display: block; margin-top: 0.5rem; }
.card--recu > h2::before { content: "\2709\FE0F"; }
.card--echanges > h2::before { content: "\1F4AC"; }
.card--recu { border-top-color: var(--principal); }
.quote { margin: 1rem 0 0; padding: 1rem 1.25rem; background: var(--fond); border-left: 0.25rem solid var(--rose, var(--principal)); border-radius: 0 var(--r-champ) var(--r-champ) 0; font-size: 1.0625rem; overflow-wrap: anywhere; }

/* Liste des demandes : recherche en barre, filtres repliables, barre d'outils, tableau en carte, mini-grille des créneaux. */
.card--search { padding: 1rem 1.25rem; }
.card--search .filters { grid-template-columns: minmax(0, 1fr) auto; align-items: end; margin-bottom: 0; }
.card--search .filters .actions { grid-column: auto; margin: 0; }
.card--search .filters .hint { margin-bottom: 0; }
@media (max-width: 40rem) { .card--search .filters { grid-template-columns: minmax(0, 1fr); } }
.card--filters { padding: 0; }
.filters-panel > summary { cursor: pointer; padding: 0.875rem 1.25rem; font-weight: 700; color: var(--principal-survol); list-style: none; display: flex; align-items: center; gap: 0.625rem; }
.filters-panel > summary::-webkit-details-marker { display: none; }
.filters-panel > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--fond); font-weight: 700; }
.filters-panel[open] > summary::before { content: "\2212"; }
.filters-panel > summary:hover { color: var(--encre); }
.filters-panel[open] > summary { border-bottom: 1px solid var(--ligne); }
.filters-panel > .filters { padding: 1rem 1.25rem 0; margin-bottom: 0; }
.filters-panel > .filters .actions { padding-bottom: 1.25rem; }
.list-toolbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1.5rem; margin: 1.5rem 0 0.75rem; }
.list-toolbar h2 { margin: 0; font-size: 1.25rem; color: var(--principal-survol); }
.list-toolbar__export { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.list-toolbar__export .hint { margin: 0; max-width: 40rem; }
.table-scroll { box-shadow: var(--ombre); }
table.requests caption { color: var(--secondaire); font-size: 0.875rem; font-weight: 400; background: var(--surface); border-bottom: 1px solid var(--ligne); }
table.requests tbody tr:nth-child(even) { background: var(--fond); }
table.requests tbody tr:hover { background: var(--survol); }
table.requests td:nth-child(2) a { font-weight: 700; text-decoration: none; white-space: nowrap; }
table.requests td:nth-child(2) a:hover { text-decoration: underline; }
table.requests .dup { display: inline-block; margin-top: 0.25rem; padding: 0.0625rem 0.5rem; border-radius: 999px; background: var(--alerte-fond); font-size: 0.8125rem; }
.td-slots { white-space: nowrap; }
.td-slots .hint { display: block; margin: 0.25rem 0 0; font-size: 0.8125rem; }
.slots-mini { display: inline-grid; grid-template-columns: repeat(5, 0.75rem); gap: 0.1875rem; vertical-align: middle; }
.slots-mini > span { width: 0.75rem; height: 0.75rem; border-radius: 0.1875rem; }
.slots-mini .is-on { background: var(--succes); }
.slots-mini .is-off { background: var(--ligne); }
p.card { padding: 1.25rem; color: var(--secondaire); text-align: center; }
.card--search .filters { align-items: start; }
.card--search .filters .actions { margin-top: 1.625rem; }
@media (max-width: 40rem) { .card--search .filters .actions { margin-top: 0; } }
table.requests th, table.requests td { padding: 0.75rem; }
.td-slots .hint { white-space: normal; }
.card--search .filters .actions { align-self: start; }
.export-icon { display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border: 1px solid var(--ligne); border-radius: 50%; background: var(--surface); color: var(--principal-survol); box-shadow: var(--ombre); }
.export-icon:hover { background: var(--survol); border-color: var(--principal-survol); color: var(--encre); }
.export-icon:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
.export-icon svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.list-toolbar__export { align-items: center; }

/* Formulaire d'un barème tarifaire : sections en cartes sur deux colonnes, taux en grille avec unité, barre d'actions. */
.tariff-form__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tariff-form__col { min-width: 0; }
@media (max-width: 60rem) { .tariff-form__cols { grid-template-columns: minmax(0, 1fr); gap: 1rem; } }
.tariff-form .card { margin: 0 0 1rem; border-top: 0.1875rem solid var(--pale); }
.tariff-form .card > h2, .tariff-form fieldset.rates > legend { display: flex; align-items: center; gap: 0.625rem; margin: 0 0 0.75rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--ligne); width: 100%; font-size: 1.125rem; font-weight: 700; color: var(--principal-survol); }
.tariff-form .card > h2::before, .tariff-form fieldset.rates > legend::before { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--fond); font-size: 1rem; line-height: 1; }
.card--tarif-id > h2::before { content: "\1F4C4"; }
.card--tarif-periode > h2::before { content: "\1F4C5"; }
.card--tarif-limites > h2::before { content: "\1F4B6"; }
.tariff-form fieldset.rates > legend::before { content: "\1F4C8"; }
.tariff-form fieldset.rates { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.form-field { margin-top: 1rem; min-width: 0; }
.form-field:first-of-type { margin-top: 0; }
.form-field > label { margin-top: 0; }
.form-field > .hint { margin: 0.125rem 0 0.375rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.form-grid .form-field { margin-top: 0; }
.rates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.875rem 1rem; }
.rates-grid .form-field { margin-top: 0; }
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 2rem; text-align: right; font-variant-numeric: tabular-nums; }
.input-unit__suffix { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--secondaire); pointer-events: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 0.5rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); box-shadow: var(--ombre); }
.form-actions button { margin-top: 0; }

/* Liste des barèmes : résumé par état, tableau en carte, repère du barème en vigueur. */
.tariff-stats { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; max-width: 40rem; }
.tariff-stat { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.875rem 1.125rem; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); box-shadow: var(--ombre); }
.tariff-stat__value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--encre); font-variant-numeric: tabular-nums; }
.tariff-stat__label { color: var(--secondaire); font-size: 0.875rem; font-weight: 600; }
.tariff-stat--force { border-left: 0.25rem solid var(--succes); }
.tariff-stat--force .tariff-stat__value { color: var(--succes); }
table.tariffs tbody tr.is-current { background: var(--succes-fond); }
table.tariffs td:nth-child(2) a { font-weight: 700; text-decoration: none; }
table.tariffs td:nth-child(2) a:hover { text-decoration: underline; }
.structure-tag { display: inline-block; padding: 0.0625rem 0.625rem; border-radius: var(--r-champ); background: var(--neutre-fond); border: 1px solid var(--ligne); font-size: 0.875rem; font-weight: 600; }
.tariff-now { display: inline-block; margin: 0 0 0 0.5rem; color: var(--succes); font-weight: 700; }
.card--empty { text-align: center; padding: 2rem 1.5rem; }
.card--empty .hint { margin-bottom: 0; }
