/* ==========================================================================
   Planning Formations — Design system
   1. Tokens  2. Base  3. Layout  4. Components  5. Pages  6. Vendors  7. Motion
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Couleurs — surfaces */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f6;
  --border: #e6e8ec;
  --border-strong: #d2d6dd;

  /* Couleurs — texte */
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-on-color: #ffffff;

  /* Couleurs — marque & sémantique */
  --primary: #3b5bdb;
  --primary-hover: #3150c8;
  --primary-active: #2843ad;
  --primary-soft: #eef2ff;
  --primary-text: #3150c8;

  --success: #16a34a;
  --success-hover: #15803d;
  --success-soft: #ecfdf3;
  --success-text: #15803d;
  --success-border: #bbf0cf;

  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-text: #a14e05;
  --warning-border: #fde3a7;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fbcfcf;

  --info-soft: #eff6ff;
  --info-text: #1d4ed8;
  --info-border: #c7dbfe;

  --neutral-soft: #f1f3f6;
  --neutral-text: #374151;

  /* Repères calendrier */
  --mark-closure: rgba(248, 113, 113, .24);
  --mark-room-closure: rgba(245, 180, 30, .26);
  --mark-open: rgba(52, 211, 120, .22);
  --mark-unavailable: rgba(150, 120, 245, .24);

  /* Focus */
  --ring: 0 0 0 3px rgba(59, 91, 219, .28);
  --ring-danger: 0 0 0 3px rgba(220, 38, 38, .22);

  /* Typographie */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-display: 1.875rem;  /* 30 */
  --fs-h1: 1.5rem;         /* 24 */
  --fs-h2: 1.0625rem;      /* 17 */
  --fs-h3: .9375rem;       /* 15 */
  --fs-body: .9375rem;     /* 15 */
  --fs-sm: .875rem;        /* 14 */
  --fs-xs: .8125rem;       /* 13 */
  --fs-caption: .75rem;    /* 12 */

  /* Espacements (base 4px) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Rayons */
  --r-xs: 4px;    /* puces, petites pastilles */
  --r-sm: 6px;    /* badges, petits boutons */
  --r-md: 8px;    /* boutons, champs */
  --r-lg: 12px;   /* cartes, conteneurs */
  --r-xl: 16px;   /* modales */
  --r-full: 999px;

  /* Ombres — uniquement pour la profondeur réelle */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 4px -2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);

  /* Mouvement */
  --dur-1: 120ms;   /* survol, pression */
  --dur-2: 200ms;   /* apparition d'éléments */
  --dur-3: 280ms;   /* modales, tiroir */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  /* Gabarit */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --content-max: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1b1f27;
    --surface-3: #232833;
    --border: #272c37;
    --border-strong: #363c49;

    --text: #e9ebf0;
    --text-2: #aeb5c2;
    --text-3: #8c94a4;

    --primary: #4562ea;
    --primary-hover: #5470f0;
    --primary-active: #3b57d8;
    --primary-soft: rgba(99, 125, 255, .14);
    --primary-text: #9db0ff;

    --success: #22a559;
    --success-hover: #1f9a52;
    --success-soft: rgba(34, 197, 94, .12);
    --success-text: #6ee7a0;
    --success-border: rgba(34, 197, 94, .28);

    --warning: #d97706;
    --warning-soft: rgba(245, 158, 11, .12);
    --warning-text: #fcd34d;
    --warning-border: rgba(245, 158, 11, .3);

    --danger: #e5484d;
    --danger-hover: #d13a3f;
    --danger-soft: rgba(239, 68, 68, .12);
    --danger-text: #fca5a5;
    --danger-border: rgba(239, 68, 68, .3);

    --info-soft: rgba(59, 130, 246, .12);
    --info-text: #93c5fd;
    --info-border: rgba(59, 130, 246, .3);

    --neutral-soft: #232833;
    --neutral-text: #c9ced8;

    --mark-closure: rgba(248, 113, 113, .35);
    --mark-room-closure: rgba(252, 211, 77, .3);
    --mark-open: rgba(74, 222, 128, .28);
    --mark-unavailable: rgba(167, 139, 250, .32);

    --ring: 0 0 0 3px rgba(120, 145, 255, .38);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  }
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
img, svg { display: block; max-width: 100%; }
svg.icon { display: inline-block; flex-shrink: 0; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px !important; height: 16px !important; }
.icon-lg { width: 22px !important; height: 22px !important; }

a { color: var(--primary-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-xs); }

h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: var(--fs-h1); letter-spacing: -.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85em; background: var(--surface-3); padding: 1px 6px; border-radius: var(--r-xs); word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
::selection { background: var(--primary-soft); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s-4); top: -60px; z-index: 3000; background: var(--surface); color: var(--text); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); box-shadow: var(--shadow-md); transition: top var(--dur-2) var(--ease-out); }
.skip-link:focus { top: var(--s-4); }

/* Utilitaires */
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.strong { font-weight: 600; }
.mt { margin-top: var(--s-4); }
.mt-lg { margin-top: var(--s-6); }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

/* 3. Layout ---------------------------------------------------------------- */
.app { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 900;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 var(--s-4) 0 var(--s-5); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--text); font-weight: 650; font-size: .975rem; letter-spacing: -.015em; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; flex-shrink: 0; }
.brand-mark svg.icon { width: 17px; height: 17px; stroke-width: 2.1; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--fs-caption); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: var(--s-5) var(--s-3) var(--s-2); }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 38px; padding: 0 var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.nav a svg.icon { color: var(--text-3); transition: color var(--dur-1) var(--ease-out); }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a:hover svg.icon { color: var(--text-2); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav a[aria-current="page"] svg.icon { color: var(--primary-text); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--warning-soft); color: var(--warning-text); border: 1px solid var(--warning-border); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }

.sidebar-cta { padding: var(--s-2) var(--s-4) 0; }
.sidebar-foot { border-top: 1px solid var(--border); padding: var(--s-3); }
.user-chip { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r-md); color: var(--text); }
.user-chip:hover { background: var(--surface-3); text-decoration: none; }
.user-chip .meta { min-width: 0; line-height: 1.3; }
.user-chip .name { font-size: var(--fs-sm); font-weight: 600; }
.user-chip .role { font-size: var(--fs-caption); color: var(--text-3); }
.sidebar-foot .foot-actions { display: flex; gap: var(--s-1); margin-top: var(--s-1); }
.sidebar-foot .foot-actions form { flex: 1; display: flex; }
.sidebar-foot .foot-actions a, .sidebar-foot .foot-actions button { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 36px; border-radius: var(--r-md); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; background: none; border: 0; font-family: inherit; cursor: pointer; }
.sidebar-foot .foot-actions a:hover, .sidebar-foot .foot-actions button:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }

.avatar { flex-shrink: 0; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-full); background: var(--primary-soft); color: var(--primary-text); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }

.topbar { display: none; }
.scrim { display: none; }
.mobile-only, .mobile-only-flex { display: none !important; }
.content:focus { outline: none; }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.content { max-width: var(--content-max); margin: 0 auto; padding: var(--s-8) var(--s-10) var(--s-16); }
.content-narrow { max-width: 760px; }

/* En-tête de page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--s-2); }
.page-head .eyebrow a { color: var(--text-3); }
.page-head .eyebrow a:hover { color: var(--text); text-decoration: none; }
.page-head .subtitle { margin-top: var(--s-1); color: var(--text-3); font-size: var(--fs-sm); }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); align-items: start; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.section { margin-top: var(--s-6); }

/* 4. Components ------------------------------------------------------------ */

/* Carte */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: var(--s-5) var(--s-6); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-6); border-bottom: 1px solid var(--border); min-height: 56px; }
.card-head h2 { font-size: var(--fs-h3); }
.card-head .desc { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap; }
.card-flush { padding: 0; }
.card + .card, .card + .section { margin-top: var(--s-5); }
.grid > .card + .card, .grid > * + *, .stack > * + * { margin-top: 0; }
.card-link { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; flex-shrink: 0; min-height: 32px; }
.card-link:hover { color: var(--primary-text); text-decoration: none; }

/* Statistiques */
.stat { position: relative; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); color: var(--text); transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-md); background: var(--surface-3); color: var(--text-2); }
.stat-icon.is-warning { background: var(--warning-soft); color: var(--warning-text); }
.stat-icon.is-primary { background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.is-success { background: var(--success-soft); color: var(--success-text); }
.stat-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: var(--s-2); }
.stat-value small { font-size: 1rem; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.stat-hint { font-size: var(--fs-xs); color: var(--text-3); }
.meter { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; margin-top: var(--s-2); }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform-origin: left; animation: grow-x 600ms var(--ease-out) both; }
.meter.is-full > span { background: var(--warning); }

/* Boutons */
.btn {
  --btn-bg: var(--primary); --btn-bg-hover: var(--primary-hover); --btn-bg-active: var(--primary-active); --btn-fg: #fff; --btn-border: transparent;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 38px; padding: 0 var(--s-4);
  border: 1px solid var(--btn-border); border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-xs);
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; color: var(--btn-fg); }
.btn:active { background: var(--btn-bg-active); transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; pointer-events: none; }
.btn svg.icon { width: 17px; height: 17px; }

.btn-secondary { --btn-bg: var(--surface); --btn-bg-hover: var(--surface-3); --btn-bg-active: var(--border); --btn-fg: var(--text); --btn-border: var(--border-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bg-hover: var(--surface-3); --btn-bg-active: var(--border); --btn-fg: var(--text-2); box-shadow: none; }
.btn-ghost:hover { --btn-fg: var(--text); }
.btn-success { --btn-bg: var(--success); --btn-bg-hover: var(--success-hover); --btn-bg-active: var(--success-hover); }
.btn-danger { --btn-bg: var(--danger); --btn-bg-hover: var(--danger-hover); --btn-bg-active: var(--danger-hover); }
.btn-danger:focus-visible { box-shadow: var(--ring-danger); }
.btn-danger-ghost { --btn-bg: transparent; --btn-bg-hover: var(--danger-soft); --btn-bg-active: var(--danger-soft); --btn-fg: var(--danger-text); box-shadow: none; }
.btn-success-soft { --btn-bg: var(--success-soft); --btn-bg-hover: var(--success-soft); --btn-bg-active: var(--success-soft); --btn-fg: var(--success-text); --btn-border: var(--success-border); box-shadow: none; }
.btn-success-soft:hover { filter: brightness(.97); }
.btn-danger-soft { --btn-bg: transparent; --btn-bg-hover: var(--danger-soft); --btn-bg-active: var(--danger-soft); --btn-fg: var(--danger-text); --btn-border: var(--border-strong); box-shadow: none; }

.btn-sm { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 6px; }
.btn-sm svg.icon { width: 15px; height: 15px; }
.btn-lg { min-height: 44px; padding: 0 var(--s-5); font-size: var(--fs-body); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* État de chargement */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent;
  animation: spin 640ms linear infinite;
}
.btn-group { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
form.inline-form { display: inline-flex; gap: var(--s-2); margin: 0; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-5); min-width: 0; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.req { color: var(--danger-text); margin-left: 2px; }
.optional { color: var(--text-3); font-weight: 400; font-size: var(--fs-xs); margin-left: var(--s-1); }
.hint { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; }
.field-error { font-size: var(--fs-xs); color: var(--danger-text); display: flex; gap: var(--s-1); align-items: center; }

.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--fs-sm); line-height: 1.4;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}
input:hover:not(:disabled):not([readonly]), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; box-shadow: none; }
input[readonly]:focus { box-shadow: none; border-color: var(--border-strong); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus { box-shadow: var(--ring-danger); }
textarea { min-height: 88px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=color] { width: 56px; height: 40px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
input[type=date], input[type=time] { font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

.input-group { display: flex; gap: var(--s-2); }
.input-group > input { flex: 1; min-width: 0; }
.input-affix { position: relative; }
.input-affix > input { padding-right: 44px; }
.input-affix > .affix-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-3); border-radius: var(--r-sm); cursor: pointer; }
.input-affix > .affix-btn:hover { color: var(--text); background: var(--surface-3); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 var(--s-4); }
.form-row > .field { margin-bottom: var(--s-5); }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section { padding: var(--s-6); }
.form-section-head { margin-bottom: var(--s-5); }
.form-section-head h2 { font-size: var(--fs-h3); }
.form-section-head p { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }

/* Réglage horizontal (paramètres) */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s-3) var(--s-8); padding: var(--s-5) 0; border-top: 1px solid var(--border); }
.setting:first-child { border-top: 0; padding-top: 0; }
.setting:last-child { padding-bottom: 0; }
.setting .setting-label { font-size: var(--fs-sm); font-weight: 550; }
.setting .setting-desc { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* Cases & interrupteurs */
.check { display: flex; align-items: flex-start; gap: var(--s-3); font-weight: 400; font-size: var(--fs-sm); cursor: pointer; padding: 2px 0; color: var(--text); }
.check input { margin-top: 3px; }
.check .check-desc { display: block; color: var(--text-3); font-size: var(--fs-xs); margin-top: 1px; }
.checks { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }

.switch { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); cursor: pointer; padding: var(--s-3) 0; font-weight: 400; }
.switch + .switch { border-top: 1px solid var(--border); }
.switch .switch-text { font-size: var(--fs-sm); color: var(--text); font-weight: 500; }
.switch .switch-desc { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; margin-top: 2px; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 36px; height: 20px; margin-top: 1px; border-radius: var(--r-full); background: var(--border-strong); cursor: pointer; transition: background-color var(--dur-2) var(--ease-out); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--dur-2) var(--ease-out); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: none; box-shadow: var(--ring); }

/* Puces sélectionnables (jours, statuts, formateurs…) */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { position: relative; display: inline-flex; align-items: center; cursor: pointer; font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--surface); color: var(--text-2); font-size: var(--fs-xs);
  transition: all var(--dur-1) var(--ease-out);
}
.chip span::before { content: ""; width: 14px; height: 14px; margin-left: -2px; border-radius: 50%; border: 1.5px solid var(--border-strong); transition: all var(--dur-1) var(--ease-out); background: center / 10px no-repeat; }
.chip:hover span { border-color: var(--text-3); color: var(--text); }
.chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.chip input:checked + span::before { border-color: var(--primary); background-color: var(--primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.chip input:focus-visible + span { box-shadow: var(--ring); }

/* Contrôle segmenté */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-md); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented label, .segmented a { position: relative; margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .segmented a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--s-3);
  border-radius: 6px; font-size: var(--fs-xs); font-weight: 550; color: var(--text-2); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.segmented a:hover, .segmented label:hover span { color: var(--text); text-decoration: none; }
.segmented input:checked + span, .segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.segmented .count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 550; white-space: nowrap; line-height: 1; border: 1px solid transparent; }
.badge::before { content: none; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning-border); }
.badge-accepted { background: var(--success-soft); color: var(--success-text); border-color: var(--success-border); }
.badge-refused { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.badge-info { background: var(--primary-soft); color: var(--primary-text); }
.badge-grey { background: var(--neutral-soft); color: var(--neutral-text); border-color: var(--border); }
.badge-outline { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; box-shadow: 0 0 0 2px var(--surface); }
.dot-lg { width: 12px; height: 12px; }
.with-dot { display: inline-flex; align-items: center; gap: var(--s-2); }

/* Alertes (persistantes) */
.alert { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-sm); margin-bottom: var(--s-5); animation: fade-up var(--dur-2) var(--ease-out) both; }
.alert > svg.icon { margin-top: 2px; }
.alert .alert-body { flex: 1; min-width: 0; }
.alert strong { font-weight: 600; }
.alert ul { margin: var(--s-1) 0 0; padding-left: 1.1rem; }
.alert li + li { margin-top: 2px; }
.alert .alert-close { margin: -4px -6px -4px 0; align-self: flex-start; }
.alert-success { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); }
.alert-error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning-text); }
.alert-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info-text); }
.alert-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.alert-compact { padding: var(--s-2) var(--s-3); font-size: var(--fs-xs); margin-bottom: var(--s-3); }

/* Toasts */
.toasts { position: fixed; z-index: 2500; right: var(--s-6); bottom: var(--s-6); display: flex; flex-direction: column; gap: var(--s-2); width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  animation: toast-in var(--dur-3) var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out var(--dur-2) var(--ease-in) both; }
.toast > svg.icon { margin-top: 1px; }
.toast-success > svg.icon { color: var(--success); }
.toast-info > svg.icon { color: var(--primary); }
.toast-warning > svg.icon { color: var(--warning); }
.toast-error > svg.icon { color: var(--danger); }
.toast .toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.toast .toast-close { width: 28px; height: 28px; margin: -2px -2px -2px 0; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-3); border-radius: var(--r-sm); cursor: pointer; }
.toast .toast-close:hover { background: var(--surface-3); color: var(--text); }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-caption); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: var(--s-3) var(--s-4); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-1) var(--ease-out); }
.table tbody tr:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: var(--s-6); }
.table th:last-child, .table td:last-child { padding-right: var(--s-6); }
.table .cell-actions { text-align: right; white-space: nowrap; width: 1%; }
.table .cell-actions .btn-group { justify-content: flex-end; flex-wrap: nowrap; }
.table .primary-cell { font-weight: 600; color: var(--text); }
.table .sub { display: block; color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; margin-top: 1px; }
.table tr.is-muted td { color: var(--text-3); }
.table tr.is-muted td .primary-cell, .table tr.is-muted .with-dot { opacity: .7; }
.table-compact td, .table-compact th { padding: var(--s-2) var(--s-3); }
.table-compact th:first-child, .table-compact td:first-child { padding-left: var(--s-5); }
.table-compact th:last-child, .table-compact td:last-child { padding-right: var(--s-5); }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--r-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--r-lg); }
a.row-link { color: inherit; font-weight: 600; }
a.row-link:hover { color: var(--primary-text); }

/* Liste agenda */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda > li + li { border-top: 1px solid var(--border); }
.agenda > li:last-child, .agenda > li:last-child > .agenda-item { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.agenda-item { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-6); color: var(--text); transition: background-color var(--dur-1) var(--ease-out); }
a.agenda-title { color: var(--text); }
a.agenda-title:hover { color: var(--primary-text); text-decoration: none; }
a.agenda-item:hover { background: var(--surface-2); text-decoration: none; }
.date-tile { flex-shrink: 0; width: 46px; text-align: center; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); overflow: hidden; line-height: 1.1; }
.date-tile .m { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-text); background: var(--primary-soft); padding: 3px 0; }
.date-tile .d { display: block; font-size: 1.05rem; font-weight: 650; padding: 4px 0 5px; font-variant-numeric: tabular-nums; }
.date-tile.is-today { border-color: var(--primary); }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-weight: 600; font-size: var(--fs-sm); display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.agenda-meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; flex-wrap: wrap; gap: 2px var(--s-3); margin-top: 2px; }
.agenda-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.agenda-meta svg.icon { width: 13px; height: 13px; }
.agenda-side { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

/* État vide */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--s-10) var(--s-6); color: var(--text-3); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-lg); background: var(--surface-3); color: var(--text-3); margin-bottom: var(--s-3); }
.empty-icon.is-success { background: var(--success-soft); color: var(--success-text); }
.empty h3 { font-size: var(--fs-sm); color: var(--text); margin-bottom: 2px; }
.empty p { font-size: var(--fs-xs); max-width: 320px; margin: 0 auto; }
.empty .btn { margin-top: var(--s-4); }
.empty-sm { padding: var(--s-6) var(--s-4); }

/* Squelettes */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.3s infinite; }
@media (prefers-color-scheme: dark) { .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); } }
.skeleton-line { height: 12px; margin: 10px 0; }
.skeleton-block { height: 56px; margin-bottom: var(--s-2); border-radius: var(--r-md); }

/* Indicateur de chargement en haut de carte */
.progress-bar { position: relative; height: 2px; overflow: hidden; background: transparent; }
.progress-bar.is-active::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--primary); border-radius: 2px; animation: indeterminate 1s var(--ease-in-out) infinite; }

/* Modales */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in var(--dur-3) var(--ease-out) both; }
dialog.modal.is-closing { animation: modal-out var(--dur-2) var(--ease-in) both; }
dialog.modal::backdrop { background: rgba(10, 14, 25, .45); animation: fade-in var(--dur-3) var(--ease-out) both; }
dialog.modal.is-closing::backdrop { animation: fade-out var(--dur-2) var(--ease-in) both; }
.modal-sm { width: min(420px, calc(100vw - 32px)) !important; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-5) var(--s-6) 0; }
.modal-head h2 { font-size: 1.125rem; }
.modal-head .modal-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.modal-body { padding: var(--s-5) var(--s-6); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.confirm-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--danger-soft); color: var(--danger-text); margin-bottom: var(--s-4); }

/* Liste de détails */
dl.details { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--s-3) var(--s-6); margin: 0; font-size: var(--fs-sm); }
dl.details dt { color: var(--text-3); }
dl.details dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }

/* Faits clés */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.fact { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-right: 1px solid var(--border); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact svg.icon { color: var(--text-3); margin-top: 2px; }
.fact .k { font-size: var(--fs-caption); color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.fact .v { font-size: var(--fs-sm); font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.fact .v small { display: block; font-weight: 400; color: var(--text-3); font-size: var(--fs-xs); }

/* Menu déroulant (details) */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 200px; padding: var(--s-1);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  transform-origin: top right;
  animation: pop-in var(--dur-2) var(--ease-out) both;
}
.menu-list form { display: block; margin: 0; }
.menu-item { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 36px; padding: 0 var(--s-3); border: 0; background: transparent; border-radius: var(--r-sm); color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; white-space: nowrap; }
.menu-item svg.icon { color: var(--text-3); width: 16px; height: 16px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); text-decoration: none; color: var(--text); outline: none; }
.menu-item.is-danger, .menu-item.is-danger svg.icon { color: var(--danger-text); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: var(--s-1) 0; }

/* Onglets */
.tabs { display: flex; gap: var(--s-1); padding: 0 var(--s-4); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 48px; padding: 0 var(--s-3); border: 0; background: transparent; color: var(--text-3); font: inherit; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; white-space: nowrap; transition: color var(--dur-1) var(--ease-out); }
.tab::after { content: ""; position: absolute; left: var(--s-2); right: var(--s-2); bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); transform: scaleX(0); transition: transform var(--dur-2) var(--ease-out); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .count { font-size: 11px; padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tab:focus-visible { outline: none; box-shadow: inset var(--ring); border-radius: var(--r-sm); }
.tab-panel { animation: fade-in var(--dur-2) var(--ease-out) both; }

/* Chronologie */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s-5) var(--s-6); font-size: var(--fs-sm); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 22px; bottom: 2px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.a-deleted::before, .timeline li.a-cancelled::before, .timeline li.a-refused::before { background: var(--danger); }
.timeline li.a-accepted::before, .timeline li.a-created::before { background: var(--success); }
.timeline li.a-room_changed::before, .timeline li.a-modified::before, .timeline li.a-unavailability::before { background: var(--warning); }
.timeline li.a-trainer_updated::before { background: var(--text-3); }
.timeline .tl-title { font-weight: 600; }
.timeline .tl-text { color: var(--text-2); }
.timeline .tl-meta { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* Barres horizontales */
.bars { display: flex; flex-direction: column; gap: var(--s-3); }
.bar { display: grid; grid-template-columns: 76px 1fr 52px; align-items: center; gap: var(--s-3); font-size: var(--fs-xs); }
.bar .track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.bar .fill { height: 100%; border-radius: inherit; background: var(--primary); transform-origin: left; animation: grow-x 700ms var(--ease-out) both; }
.bar .val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Carte géographique */
.map { height: 340px; border-radius: var(--r-md); border: 1px solid var(--border); z-index: 1; background: var(--surface-3); }
.map-sm { height: 220px; }
.map-flush { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Indicateur d'étapes */
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; margin-right: var(--s-2); vertical-align: 1px; transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.step-num.is-done { background: var(--success); color: #fff; }
.step-num.is-done span { display: none; }
.step-num svg.icon { width: 13px; height: 13px; stroke-width: 3; display: none; }
.step-num.is-done svg.icon { display: block; }

/* Option de salle (radio carte) */
.room-list { display: flex; flex-direction: column; gap: var(--s-2); }
.room-option {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--fs-sm); text-align: left; font-weight: 400;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.room-option:hover { border-color: var(--text-3); }
.room-option:focus-visible, .room-option:focus-within { outline: none; box-shadow: var(--ring); }
.room-option .radio { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; transition: border-color var(--dur-1) var(--ease-out); }
.room-option .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); transform: scale(0); transition: transform var(--dur-2) var(--ease-out); }
.room-option.selected, .room-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.room-option.selected .radio, .room-option:has(input:checked) .radio { border-color: var(--primary); }
.room-option.selected .radio::after, .room-option:has(input:checked) .radio::after { transform: scale(1); }
.room-option input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.room-option .room-main { flex: 1; min-width: 0; }
.room-option .room-name { font-weight: 600; }
.room-option .room-sub { font-size: var(--fs-xs); color: var(--text-3); }
.room-option .room-tags { display: flex; gap: var(--s-1); flex-wrap: wrap; justify-content: flex-end; }
.room-option.disabled { cursor: not-allowed; background: var(--surface-2); border-style: dashed; box-shadow: none; }
.room-option.disabled:hover { border-color: var(--border-strong); }
.room-option.disabled .room-name { color: var(--text-2); }
.room-option.disabled .radio { opacity: .4; }
.room-option .reasons { list-style: none; font-size: var(--fs-xs); color: var(--danger-text); margin: var(--s-1) 0 0; padding: 0; }
.room-option .reasons li::before { content: "– "; }
.group-label { font-size: var(--fs-caption); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: var(--s-5) 0 var(--s-2); }
details.disclosure > summary { display: inline-flex; align-items: center; gap: var(--s-1); cursor: pointer; font-size: var(--fs-xs); color: var(--text-3); font-weight: 550; list-style: none; padding: var(--s-1) 0; border-radius: var(--r-xs); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary svg.icon { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease-out); }
details.disclosure[open] > summary svg.icon { transform: rotate(90deg); }
details.disclosure > summary:hover { color: var(--text); }
details.disclosure[open] > *:not(summary) { animation: fade-up var(--dur-2) var(--ease-out) both; }

/* Liste de séances calculées */
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-list li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); animation: fade-up var(--dur-2) var(--ease-out) both; }
.plan-list li .grow { min-width: 0; }
.plan-list .time { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); }
.plan-summary strong { font-size: var(--fs-h3); }

/* Statut de soumission */
.submit-status { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); margin-bottom: var(--s-3); min-height: 20px; }
.submit-status.is-ok { color: var(--success-text); }
.submit-status.is-warn { color: var(--warning-text); }
.submit-status svg.icon { width: 16px; height: 16px; margin-top: 1px; }

.sticky-side { position: sticky; top: var(--s-6); }

/* Barre d'action collante (formulaires longs) */
.action-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-6); padding: var(--s-3) var(--s-4); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.action-bar .dirty-msg { margin-right: auto; font-size: var(--fs-xs); color: var(--text-3); display: inline-flex; align-items: center; gap: var(--s-2); }
.action-bar .dirty-msg::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); transition: background-color var(--dur-2) var(--ease-out); }
.action-bar.is-dirty .dirty-msg { color: var(--warning-text); }
.action-bar.is-dirty .dirty-msg::before { background: var(--warning); }

/* Ligne dynamique (paramètres personnalisés) */
.dyn-rows { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-3); }
.dyn-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s-2); animation: fade-up var(--dur-2) var(--ease-out) both; }

/* Cartes de liste (salles, cours) */
.entity-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); min-width: 0; }
.entity-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.entity-card.is-inactive { background: var(--surface-2); }
.entity-card.is-inactive .entity-title { color: var(--text-2); }
.entity-head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-5) 0; }
.entity-title { font-size: var(--fs-h3); font-weight: 600; color: var(--text); line-height: 1.35; }
a.entity-title:hover { color: var(--primary-text); text-decoration: none; }
.entity-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 2px var(--s-2); align-items: center; }
.entity-body { padding: var(--s-3) var(--s-5) var(--s-4); flex: 1; font-size: var(--fs-sm); color: var(--text-2); }
.entity-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: var(--s-3); }
.entity-stats { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--fs-xs); color: var(--text-3); }
.entity-stats strong { color: var(--text); font-weight: 600; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.entity-foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); }
.entity-foot .spacer { flex: 1; }
.color-bar { width: 4px; align-self: stretch; border-radius: var(--r-full); flex-shrink: 0; min-height: 38px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; max-width: 100%; }
.tag > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Filtres */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); padding: var(--s-4) var(--s-6); border-bottom: 1px solid var(--border); }
.toolbar .field { margin: 0; min-width: 150px; flex: 1 1 150px; max-width: 220px; gap: 4px; }
.toolbar .field label { font-size: var(--fs-caption); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.toolbar .toolbar-actions { display: flex; gap: var(--s-2); margin-left: auto; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-6); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.result-count { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Légende */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.swatch-dashed { background: transparent; border: 1.5px dashed var(--warning); }

/* Copie / partage */
.share { display: flex; gap: var(--s-2); }
.share input { flex: 1; min-width: 0; font-size: var(--fs-xs); background: var(--surface-2); color: var(--text-2); }

/* Connexion */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: var(--bg); background-image: radial-gradient(circle at 50% -20%, var(--primary-soft), transparent 60%); }
.auth-card { width: 100%; max-width: 400px; animation: fade-up var(--dur-3) var(--ease-out) both; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: var(--s-6); }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; margin-bottom: var(--s-4); box-shadow: var(--shadow-md); }
.auth-brand .brand-mark svg.icon { width: 22px; height: 22px; }
.auth-brand h1 { font-size: 1.375rem; }
.auth-brand p { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--s-1); }
.auth-card .card-body { padding: var(--s-8); }
.auth-foot { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--s-6); }
.or-sep { display: flex; align-items: center; gap: var(--s-3); color: var(--text-3); font-size: var(--fs-xs); margin: var(--s-5) 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Profil formateur */
.profile-head { display: flex; align-items: center; gap: var(--s-4); }
.profile-head .meta { color: var(--text-3); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 2px var(--s-3); margin-top: 2px; }
.kv-inline { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-6); font-size: var(--fs-sm); }
.kv-inline .k { color: var(--text-3); }
.kv-inline strong { font-variant-numeric: tabular-nums; }

/* 5. Responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); }
  .content { padding: var(--s-8) var(--s-8) var(--s-16); }
}

@media (max-width: 1023px) {
  .sidebar {
    width: min(300px, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease-out), visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 850; background: rgba(10, 14, 25, .4); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-out); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .mobile-only { display: inline-flex !important; }

  .topbar {
    display: flex; align-items: center; gap: var(--s-2);
    position: sticky; top: 0; z-index: 800;
    height: var(--topbar-h); padding: 0 var(--s-2) 0 var(--s-2);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { flex: 1; font-size: var(--fs-body); }
  .topbar .btn-icon { width: 44px; min-height: 44px; }
  .main { margin-left: 0; }
  .content { padding: var(--s-6) var(--s-6) var(--s-16); }
  .grid-main-side { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
  .setting { grid-template-columns: 1fr; gap: var(--s-3); }
}

@media (max-width: 720px) {
  :root { --fs-h1: 1.3125rem; }
  .content { padding: var(--s-5) var(--s-4) calc(var(--s-16) + env(safe-area-inset-bottom)); }
  .grid { gap: var(--s-4); }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: var(--s-4); }
  .stat-value { font-size: 1.5rem; }
  .stat-icon { display: none; }
  .page-head { align-items: stretch; flex-direction: column; margin-bottom: var(--s-5); }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn, .page-head .actions > a.btn { flex: 1; }
  .card-body, .form-section { padding: var(--s-4); }
  .card-head, .card-foot, .toolbar, .filter-bar, .legend { padding-left: var(--s-4); padding-right: var(--s-4); }
  .agenda-item { padding: var(--s-3) var(--s-4); }
  .table th:first-child, .table td:first-child { padding-left: var(--s-4); }
  .table th:last-child, .table td:last-child { padding-right: var(--s-4); }
  .toolbar .field { max-width: none; flex-basis: calc(50% - var(--s-2)); min-width: 0; }
  .toolbar .toolbar-actions { width: 100%; margin-left: 0; }
  .toolbar .toolbar-actions .btn { flex: 1; }

  /* Champs : 16px pour éviter le zoom iOS, cibles tactiles de 44px */
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .btn-icon.btn-sm { width: 36px; }
  .chip span { min-height: 38px; }
  .nav a { min-height: 44px; }
  .menu-item { min-height: 44px; }

  /* Tableaux empilés en cartes */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody tr:hover td { background: transparent; }
  .table-stack td { display: flex; justify-content: space-between; gap: var(--s-4); padding: 3px 0 !important; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-xs); text-align: left; flex-shrink: 0; padding-top: 1px; }
  .table-stack td[data-label=""]::before, .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.cell-main { display: block; text-align: left; padding-bottom: var(--s-1) !important; }
  .table-stack td.cell-actions { width: 100%; padding-top: var(--s-2) !important; }
  .table-stack td.cell-actions .btn-group { justify-content: flex-start; flex-wrap: wrap; }
  .table-stack td.cell-actions::before { content: none; }

  .mobile-only-flex { display: flex !important; }
  .hide-sm { display: none !important; }
  .toolbar.collapsible:not(.is-open) { display: none; }
  .toolbar.collapsible.is-open { animation: fade-up var(--dur-2) var(--ease-out) both; }
  .filter-bar .segmented { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filter-bar .segmented a { justify-content: center; }
  dl.details { grid-template-columns: 1fr; gap: 2px; }
  dl.details dd { margin-bottom: var(--s-3); }
  .facts { grid-template-columns: 1fr 1fr; }
  .fact { border-right: 0; border-bottom: 1px solid var(--border); }
  .fact:nth-child(odd) { border-right: 1px solid var(--border); }
  .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal-foot .btn, .modal-foot form, .modal-foot form .btn { width: 100%; }
  .modal-foot .spacer { display: none; }
  .modal-head, .modal-body { padding-left: var(--s-5); padding-right: var(--s-5); }
  .toasts { left: 50%; right: auto; bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .dyn-row { grid-template-columns: 1fr auto; }
  .dyn-row input:first-child { grid-column: 1 / -1; }
  .room-option { flex-wrap: wrap; }
  .room-option .room-tags { width: 100%; justify-content: flex-start; padding-left: 30px; }
  .action-bar { margin-left: calc(var(--s-4) * -1); margin-right: calc(var(--s-4) * -1); border-radius: 0; border-left: 0; border-right: 0; padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .action-bar .btn { flex: 1; }
  .action-bar .dirty-msg { display: none; }
  .map { height: 260px; }
  .bar { grid-template-columns: 64px 1fr 48px; }
}

@media (min-width: 1600px) {
  :root { --content-max: 1360px; }
}

/* 6. Vendors --------------------------------------------------------------- */

/* FullCalendar */
.calendar-shell { padding: var(--s-4) var(--s-6) var(--s-5); }
.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: color-mix(in srgb, var(--primary-soft) 70%, transparent);
  --fc-now-indicator-color: var(--danger);
  --fc-list-event-hover-bg-color: var(--surface-3);
  --fc-highlight-color: var(--primary-soft);
  --fc-non-business-color: color-mix(in srgb, var(--surface-3) 55%, transparent);
  --fc-event-border-color: transparent;
  font-size: var(--fs-xs);
}
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: var(--s-4); gap: var(--s-3); flex-wrap: wrap; }
.fc .fc-toolbar-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; text-transform: capitalize; }
.fc .fc-button {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 600; padding: 0 var(--s-3); min-height: 34px; text-transform: none;
  box-shadow: var(--shadow-xs); transition: background-color var(--dur-1) var(--ease-out);
}
.fc .fc-button:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.fc .fc-button:focus { box-shadow: var(--shadow-xs) !important; outline: none; }
.fc .fc-button:focus-visible { box-shadow: var(--ring) !important; }
.fc .fc-button:disabled { opacity: .45; background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary); }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.fc .fc-button .fc-icon { font-size: 1.1em; vertical-align: -2px; }
.fc .fc-col-header-cell { background: var(--surface-2); }
.fc .fc-col-header-cell-cushion { padding: var(--s-2) 4px; font-weight: 600; color: var(--text-2); text-transform: capitalize; }
.fc .fc-col-header-cell-cushion:hover, .fc .fc-daygrid-day-number:hover { text-decoration: none; color: var(--text); }
.fc .fc-daygrid-day-number { color: var(--text-2); padding: 6px 8px; font-variant-numeric: tabular-nums; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--primary-text); font-weight: 700; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { color: var(--text-3); font-variant-numeric: tabular-nums; }
.fc .fc-timegrid-slot { height: 2.2em; }
.fc .fc-scrollgrid { border-radius: var(--r-md); overflow: hidden; }
.fc-theme-standard .fc-scrollgrid { border-color: var(--border); }
.fc .fc-daygrid-day:hover, .fc .fc-timegrid-slot-lane:hover { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); cursor: pointer; }
.fc .fc-event { cursor: pointer; border-radius: 5px; border-width: 0 0 0 3px; padding: 1px 3px; font-weight: 550; transition: filter var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.fc .fc-event:hover { filter: brightness(.94); }
.fc .fc-event:focus-visible { box-shadow: var(--ring); }
.fc .fc-event .fc-event-main { color: #fff; }
.fc .fc-h-event .fc-event-main, .fc .fc-v-event .fc-event-main { color: #fff; }
.fc .ev-pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); border-left: 3px dashed #fff !important; }
.fc .ev-refused { opacity: .45; text-decoration: line-through; }
.fc .fc-bg-event { opacity: 1; }
.fc .fc-bg-event.bg-closure { background: var(--mark-closure); }
.fc .fc-bg-event.bg-room-closure { background: var(--mark-room-closure); }
.fc .fc-bg-event.bg-open { background: var(--mark-open); }
.fc .fc-bg-event.bg-unav { background: var(--mark-unavailable); }
.fc .fc-bg-event .fc-event-title { font-style: normal; font-size: 11px; color: var(--text-2); margin: 4px; font-weight: 550; }
.fc .fc-daygrid-more-link { color: var(--primary-text); font-weight: 600; }
.fc .fc-popover { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.fc .fc-popover-header { background: var(--surface-2); padding: var(--s-2) var(--s-3); }
.fc .fc-list { border-radius: var(--r-md); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--surface-2); }
.fc .fc-list-event-dot { border-color: currentColor; }
.fc .fc-list-empty { background: var(--surface); color: var(--text-3); }
.fc .fc-multimonth { border-color: var(--border); border-radius: var(--r-md); }
.fc .fc-multimonth-title { font-size: var(--fs-sm); font-weight: 600; text-transform: capitalize; padding: var(--s-3) 0 var(--s-2); }
.fc .fc-multimonth-daygrid { background: var(--surface); }
.fc .fc-day-other .fc-daygrid-day-top { opacity: .45; }
.fc a { color: inherit; }
.fc .fc-non-business { background: var(--fc-non-business-color); }

/* Calendrier — résumé, contenu des séances, dialogues */
.cal-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); min-height: 48px; padding: var(--s-2) var(--s-6); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.cal-summary strong { color: var(--text); font-variant-numeric: tabular-nums; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: var(--fs-xs); font-weight: 550; cursor: pointer; transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out); }
.chip-btn:hover { background: var(--surface-3); color: var(--text); }
.chip-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.chip-btn.is-warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning-text); }
.chip-btn.is-warning:hover { filter: brightness(.97); }
.legend-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0; color: var(--text-3); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.legend-link:hover { color: var(--text); }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1; }
.kbd-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-3) var(--s-5); margin: 0; font-size: var(--fs-sm); align-items: center; }
.kbd-list dt { display: flex; gap: 4px; }
.kbd-list dd { margin: 0; color: var(--text-2); }
.swatch-pending { background: repeating-linear-gradient(135deg, var(--warning-border) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--warning); }
.inline-link { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-weight: 550; margin-left: 4px; }
.move-diff { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-sm); }
.move-diff > svg.icon { color: var(--text-3); }
.move-diff .k { display: block; font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.move-diff .v { font-weight: 550; line-height: 1.4; }
.move-diff > div:last-child .v { color: var(--primary-text); }

.fc .ev { overflow: hidden; height: 100%; line-height: 1.3; padding: 2px 3px; }
.fc .ev-title { font-weight: 650; display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc .ev-meta { opacity: .92; font-size: 11px; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.fc .fc-timegrid-event-short .ev-more { display: none; }
.fc .ev-flag svg.icon { width: 12px; height: 12px; stroke-width: 2.4; }
.fc .ev-inline { display: flex; align-items: center; gap: 5px; padding: 1px 4px; height: auto; white-space: nowrap; }
.fc .ev-inline .ev-time { font-weight: 500; opacity: .9; font-variant-numeric: tabular-nums; }
.fc .ev-inline .ev-title { font-weight: 600; }
.fc .fc-daygrid-event { border-radius: 4px; margin-top: 2px; }
.fc .ev-list { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-3); }
.fc .ev-list-title { font-weight: 600; color: var(--text); }
.fc .ev-list-meta { color: var(--text-3); font-size: var(--fs-xs); flex: 1; min-width: 160px; }
.fc .fc-list-event td { padding-top: var(--s-3); padding-bottom: var(--s-3); }
.fc .fc-list-event-time { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { display: inline-block; font-weight: 600; color: var(--text); }
.fc .fc-list-day-text::first-letter { text-transform: uppercase; }
.fc .fc-list-event:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--primary-text); font-weight: 700; }
.fc .fc-highlight { background: var(--primary-soft); }
.fc .fc-event-mirror { opacity: .85; box-shadow: var(--shadow-md); }
.fc .fc-event-dragging:not(.fc-event-mirror) { opacity: .4; }
.fc .fc-event-dragging, .fc .fc-event-resizing { box-shadow: var(--shadow-lg); }
.fc .fc-timegrid-event .fc-event-resizer-end { height: 8px; bottom: -2px; cursor: ns-resize; }
.fc .fc-timegrid-event:hover .fc-event-resizer-end::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: rgba(255,255,255,.8); }
.is-trainer .fc .ev-other { opacity: .5; }
.is-trainer .fc .ev-other:hover { opacity: .85; }
.fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }

@media (max-width: 720px) {
  .cal-summary { padding: var(--s-2) var(--s-4); gap: var(--s-2) var(--s-4); }
  .legend-link { display: none; }
  .calendar-shell { padding: var(--s-3); }
  .fc .fc-toolbar.fc-header-toolbar { display: grid; grid-template-columns: 1fr auto; }
  .fc .fc-toolbar-chunk:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .fc .fc-toolbar-chunk:nth-child(3) { justify-self: end; }
  .fc .fc-toolbar-title { font-size: 1rem; }
  .fc .fc-button { min-height: 38px; }
}

/* Leaflet */
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content-wrapper { border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.leaflet-popup-content { margin: var(--s-3) var(--s-4); font-size: var(--fs-xs); line-height: 1.5; }

/* 7. Motion ---------------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Entrée de page : contenu principal, une seule fois, discret */
.content > :not(.toasts):not(dialog):not(script) { animation: fade-up var(--dur-3) var(--ease-out) both; }
.content > :nth-child(3) { animation-delay: 30ms; }
.content > :nth-child(4) { animation-delay: 60ms; }
.content > :nth-child(n+5) { animation-delay: 90ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton::after, .progress-bar.is-active::after { animation: none !important; }
  .btn.is-loading::after { animation: spin 1.6s linear infinite !important; }
}

@media print {
  .sidebar, .topbar, .toasts, .page-head .actions, .action-bar { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
