/* =========================================================================
   HORNETPATH - COMPOSANTS « LA RUCHE »
   Depend de tokens.css. Optionnellement complete par liquid-glass.css.
   Ordre de chargement : tokens.css -> liquid-glass.css -> components.css
   ========================================================================= */

/* =========================================================================
   BASE
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .9em; }

/* L'attribut `hidden` doit gagner sur les `display` des composants
   (.overlay est en grid, .toast en flex, etc.). */
[hidden] { display: none !important; }

img, svg, video { max-width: 100%; height: auto; }
::selection { background: rgb(var(--rgb-ember) / .32); }

/* Focus visible : un seul style pour tout le systeme. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================================
   SURFACES
   ========================================================================= */

/* Panneau verre a bordure en degrade. Brique de base du systeme. */
.panel {
  border: 1px solid transparent;
  border-radius: var(--r-panel);
  background:
    linear-gradient(rgb(22 34 58 / .72), rgb(20 31 53 / .72)) padding-box,
    linear-gradient(155deg,
      rgb(var(--rgb-ember) / .55),
      rgb(45 62 96 / .65) 34%,
      rgb(45 62 96 / .65) 64%,
      rgb(var(--rgb-honey) / .38)) border-box;
  box-shadow: var(--sh-2), var(--sh-inset-top);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}
:root.light .panel {
  background:
    linear-gradient(rgb(255 253 247 / .82), rgb(255 253 247 / .82)) padding-box,
    linear-gradient(155deg,
      rgb(var(--rgb-ember) / .55),
      rgb(231 220 192 / .9) 34%,
      rgb(231 220 192 / .9) 64%,
      rgb(var(--rgb-honey) / .4)) border-box;
  box-shadow: var(--sh-2);
}

/* Surface mate, sans verre : tableaux denses, zones de lecture longue. */
.solid {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.divider { height: 1px; border: 0; background: var(--line); margin: var(--sp-6) 0; }

/* =========================================================================
   LAYOUT
   ========================================================================= */
.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 72px) var(--gutter) 100px;
}
.wrap--wide { max-width: 1320px; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h); padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 11px; text-decoration: none;
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
  letter-spacing: var(--ls-title);
}
.brand .mark {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--fog); text-transform: uppercase; align-self: flex-end; margin-bottom: 3px;
}
.nav { display: flex; align-items: center; gap: var(--sp-2); }
.navlink {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500;
  text-decoration: none; color: var(--fog); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--sp-2); background: none; border: none; cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.navlink:hover { color: var(--ink); background: var(--mist); }
.navlink[aria-current="page"] { color: var(--ink); background: var(--mist); }

/* Coquille avec barre laterale. */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100dvh - var(--topbar-h)); }
.sidebar {
  border-right: 1px solid var(--line); padding: var(--sp-6) var(--sp-4);
  position: sticky; top: var(--topbar-h); align-self: start;
  max-height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
}
.sidebar .sechead { margin-top: var(--sp-6); }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--sp-2); text-decoration: none; color: var(--fog);
  font-size: 13.5px; font-weight: 500;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.sidebar a:hover { background: var(--mist); color: var(--ink); }
.sidebar a.active { color: var(--ink); background: rgb(var(--rgb-ember) / .12); }
.sidebar a.active::before {
  content: ""; width: 3px; height: 16px; border-radius: var(--r-pill);
  background: var(--ember); margin-left: -6px; margin-right: 3px;
}
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* =========================================================================
   TYPOGRAPHIE
   ========================================================================= */
h1.page {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-page);
  line-height: var(--lh-tight); letter-spacing: var(--ls-page); margin: 18px 0 14px;
}
.lead { color: var(--fog); font-size: var(--fs-md); max-width: var(--measure); margin: 0; }

/* Degrade or clippe. Sur un ou deux mots d'un titre, jamais un paragraphe. */
.title-magic {
  background: linear-gradient(120deg, #fde79b 8%, var(--honey) 45%, var(--ember));
  background-clip: text; -webkit-background-clip: text; color: transparent;
}
:root.light .title-magic { background-image: linear-gradient(120deg, #a86c08 12%, var(--ember) 60%, #d98a0f); }

/* Eyebrow avec filets degrades. */
.ornament {
  display: inline-flex; align-items: center; gap: .875rem;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .3em;
  text-transform: uppercase; color: var(--honey);
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; width: 40px;
  background: linear-gradient(to right, transparent, rgb(var(--rgb-honey) / .6));
}
.ornament::after { background: linear-gradient(to left, transparent, rgb(var(--rgb-honey) / .6)); }

.sechead {
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: var(--ls-wide);
  text-transform: uppercase; color: var(--fog); margin: 46px 0 6px;
}
.count { font-family: var(--font-mono); font-size: 12px; color: var(--fog); white-space: nowrap; }

/* Bloc de prose (contenu de cours, documentation). */
.prose { max-width: 72ch; }
.prose h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-xl); letter-spacing: var(--ls-title); margin: var(--sp-8) 0 var(--sp-3); }
.prose h3 { font-weight: 600; font-size: var(--fs-lg); margin: var(--sp-6) 0 var(--sp-2); }
.prose p, .prose li { color: color-mix(in srgb, var(--ink) 88%, var(--fog)); }
.prose a { color: var(--honey); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { color: var(--ember); }
.prose blockquote {
  margin: var(--sp-5) 0; padding: var(--sp-3) var(--sp-5);
  border-left: 3px solid var(--ember); background: rgb(var(--rgb-ember) / .06);
  border-radius: 0 var(--r-md) var(--r-md) 0; color: var(--fog);
}
.prose :not(pre) > code {
  background: rgb(var(--rgb-ember) / .12); color: var(--honey);
  padding: .15em .4em; border-radius: var(--r-sm);
}

/* =========================================================================
   BOUTONS
   ========================================================================= */

/* Primaire. UN SEUL par ecran. */
.btn-magic {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-sans); font-weight: 600; font-size: 14px; cursor: pointer;
  border: none; border-radius: var(--r-lg); padding: 10px 18px; text-decoration: none;
  background: linear-gradient(180deg, #ffc04a, var(--flame));
  color: var(--on-ember);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), var(--sh-ember);
  transition: box-shadow var(--t-base) ease, transform var(--t-base) ease, filter var(--t-base) ease;
}
.btn-magic:hover {
  transform: translateY(-1px); filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 14px 36px -10px rgb(var(--rgb-ember) / .65);
}
.btn-magic:active { transform: translateY(0); }
:root.light .btn-magic { background: linear-gradient(180deg, #f2a417, var(--flame)); }

/* Secondaire. */
.btn-quiet {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none;
  font-family: var(--font-sans); font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--cream) 70%, transparent);
  color: var(--ink); border-radius: .6rem; padding: 9px 14px;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, transform .1s ease;
}
.btn-quiet:hover { background: var(--mist); border-color: rgb(var(--rgb-ember) / .55); }
.btn-quiet:active { transform: scale(.98); }

/* Destructif. Toujours en contour, jamais plein. */
.btn-danger {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none;
  font-family: var(--font-sans); font-weight: 500; font-size: 13px;
  border: 1px solid rgb(var(--rgb-terra) / .45); background: transparent; color: var(--terra);
  border-radius: .6rem; padding: 8px 13px;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.btn-danger:hover { background: rgb(var(--rgb-terra) / .12); border-color: rgb(var(--rgb-terra) / .7); }

/* Tertiaire, sans bordure. */
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none;
  font-family: var(--font-sans); font-weight: 500; font-size: 13.5px;
  border: none; background: none; color: var(--fog); border-radius: .6rem; padding: 9px 12px;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.btn-ghost:hover { background: var(--mist); color: var(--ink); }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--cream) 70%, transparent);
  color: var(--fog); cursor: pointer; transition: var(--t-fast) ease;
}
.icon-btn:hover { color: var(--ember); border-color: rgb(var(--rgb-ember) / .55); }
.icon-btn .i-moon { display: none; }
:root.light .icon-btn .i-sun { display: none; }
:root.light .icon-btn .i-moon { display: inline; }

/* Tailles et etats communs. */
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-block { width: 100%; }
:where(.btn-magic, .btn-quiet, .btn-danger, .btn-ghost, .icon-btn):disabled,
:where(.btn-magic, .btn-quiet, .btn-danger, .btn-ghost)[aria-disabled="true"] {
  opacity: .45; cursor: not-allowed; transform: none; filter: none;
}
.btn-magic[data-loading="true"] { color: transparent; position: relative; pointer-events: none; }
.btn-magic[data-loading="true"]::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: var(--r-pill);
  border: 2px solid rgb(26 18 6 / .3); border-top-color: var(--on-ember);
  animation: spin .7s linear infinite;
}

/* =========================================================================
   FORMULAIRES
   ========================================================================= */
.label { display: block; font-size: 13px; font-weight: 500; color: var(--fog); margin: 0 0 6px 2px; }
.label .req { color: var(--ember); }

.field, .input, .select, .textarea {
  width: 100%; border-radius: var(--r-md); border: 1px solid var(--line);
  background-color: color-mix(in srgb, var(--cream) 82%, transparent);
  padding: .65rem .9rem; font-family: var(--font-sans); font-size: 14px;
  color: var(--ink); outline: none;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.field::placeholder, .input::placeholder, .textarea::placeholder {
  color: color-mix(in srgb, var(--fog) 75%, transparent);
}
.field:focus, .input:focus, .select:focus, .textarea:focus {
  border-color: rgb(var(--rgb-ember) / .65);
  box-shadow: 0 0 0 3px rgb(var(--rgb-ember) / .2);
}
.input[aria-invalid="true"] { border-color: rgb(var(--rgb-terra) / .7); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(var(--rgb-terra) / .2); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
/* ATTENTION - `.select` n'habille que le bouton FERME. La liste qui s'ouvre est
   dessinee par le systeme : `<option>` n'est pas stylable en CSS sous Firefox,
   et l'est a peine sous Chrome. Un `<select>` natif casse donc la charte des
   qu'on l'ouvre. Ne l'utiliser que pour un formulaire secondaire ou une liste
   tres longue (ou le selecteur natif du mobile est preferable).
   Partout ailleurs : `.listbox` ci-dessous. */
.select {
  appearance: none; padding-right: 2.4rem; 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='%2393a3c4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
}
/* La couleur du popup natif ne se controle pas, mais on peut au moins eviter
   le blanc pur sous Chrome et Windows en declarant le schema. */
.select option { background: var(--cream); color: var(--ink); }

/* ----- Liste deroulante maison (obligatoire par defaut) -----
   Rendue en HTML, donc identique sur Firefox, Chrome et Safari, et habillee
   en liquid glass comme le reste du systeme. Balisage et clavier : bloc 13
   de patterns.html. */
.listbox { position: relative; }

.listbox-btn {
  width: 100%; display: flex; align-items: center; gap: var(--sp-2);
  border-radius: var(--r-md); border: 1px solid var(--line);
  background-color: color-mix(in srgb, var(--cream) 82%, transparent);
  padding: .65rem .9rem; font-family: var(--font-sans); font-size: 14px;
  color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.listbox-btn:hover { border-color: rgb(var(--rgb-ember) / .45); }
.listbox-btn[aria-expanded="true"] {
  border-color: rgb(var(--rgb-ember) / .65);
  box-shadow: 0 0 0 3px rgb(var(--rgb-ember) / .2);
}
.listbox-btn .listbox-val { flex: 1; }
.listbox-btn .listbox-val[data-placeholder] { color: color-mix(in srgb, var(--fog) 75%, transparent); }
.listbox-btn svg { flex: none; color: var(--fog); transition: transform var(--t-fast) var(--ease); }
.listbox-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.listbox-menu {
  position: absolute; z-index: var(--z-dropdown); top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  max-height: 260px; overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-lg);
  animation: pop .16s var(--ease-out) both;
}
/* Si le menu n'a pas de classe .glass, il reste lisible malgre tout. */
.listbox-menu:not(.glass) { background: var(--cream); border: 1px solid var(--line); box-shadow: var(--sh-2); }

.listbox-opt {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--sp-2);
  padding: 9px 11px; border-radius: var(--r-sm); font-size: 14px;
  color: var(--ink); cursor: pointer; user-select: none;
  transition: background-color var(--t-fast) ease;
}
.listbox-opt:hover,
.listbox-opt[data-active="true"] { background: rgb(var(--rgb-ember) / .12); }
.listbox-opt[aria-selected="true"] { color: var(--honey); font-weight: 500; }
.listbox-opt[aria-selected="true"]::after {
  content: ""; margin-left: auto; width: 10px; height: 6px;
  border: 2px solid currentColor; border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -2px);
}
.listbox-opt[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
/* La description passe a la ligne sous le libelle, sans casser la coche. */
.listbox-opt .desc { flex: 0 0 100%; font-size: 12px; color: var(--fog); margin-top: 1px; }
.listbox-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.listbox-group {
  padding: 10px 11px 4px; font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--fog);
}

@media (prefers-reduced-motion: reduce) {
  .listbox-menu { animation: none; }
  .listbox-btn svg { transition: none; }
}
.help { font-size: 12.5px; color: var(--fog); margin: 6px 2px 0; }
.err  { font-size: 12.5px; color: var(--terra); font-family: var(--font-mono); margin: 6px 2px 0; }

.field-row { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1); }
.field-row .input { flex: 1; }
.form-grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* Case a cocher et radio. */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input {
  appearance: none; width: 18px; height: 18px; flex: none; margin: 0;
  border: 1px solid var(--line); border-radius: 5px;
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  display: grid; place-items: center; cursor: pointer;
  transition: var(--t-fast) ease;
}
.check input[type="radio"] { border-radius: var(--r-pill); }
.check input:checked {
  background: linear-gradient(180deg, #ffc04a, var(--flame)); border-color: transparent;
}
.check input:checked::after {
  content: ""; width: 9px; height: 5px; border: 2px solid var(--on-ember);
  border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px);
}
.check input[type="radio"]:checked::after {
  width: 7px; height: 7px; border: 0; border-radius: var(--r-pill);
  background: var(--on-ember); transform: none;
}

/* Interrupteur. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input {
  appearance: none; width: 40px; height: 23px; margin: 0; flex: none;
  border-radius: var(--r-pill); background: var(--mist); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: var(--t-fast) ease;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: var(--r-pill); background: var(--fog); transition: var(--t-fast) var(--ease);
}
.switch input:checked { background: linear-gradient(180deg, #ffc04a, var(--flame)); border-color: transparent; }
.switch input:checked::after { left: 20px; background: var(--on-ember); }

/* Zone de depot. */
.drop {
  border: 1.5px dashed var(--line); border-radius: var(--r-panel); padding: 48px 24px;
  text-align: center; color: var(--fog); cursor: pointer; transition: .16s ease;
  background: color-mix(in srgb, var(--cream) 45%, transparent);
}
.drop:hover { border-color: rgb(var(--rgb-ember) / .55); }
.drop.hover { border-color: var(--ember); background: var(--mist); color: var(--ink); }
.drop .ico { color: var(--ember); margin-bottom: var(--sp-3); }
.drop b { color: var(--ember); font-weight: 600; }
.drop small { display: block; margin-top: var(--sp-2); color: var(--fog); font-size: var(--fs-sm); }

.msg { margin: 14px 2px 0; font-size: 13.5px; min-height: 20px; font-family: var(--font-mono); color: var(--fog); }
.msg.ok { color: var(--honey); }
.msg.err { color: var(--terra); }

/* Barre de recherche. */
.search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-family: var(--font-sans); font-size: 14px; }
.search input::placeholder { color: var(--fog); }
.search svg { flex: none; color: var(--fog); }

.toolbar { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-7) 0 var(--sp-2); flex-wrap: wrap; }

/* =========================================================================
   CARTES ET LISTES
   ========================================================================= */
.folder { margin-top: var(--sp-8); }
.folder-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-5); border-bottom: 1px solid var(--line);
}
.folder-head h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-xl); letter-spacing: var(--ls-title); margin: 0; }
.folder-head .n { font-family: var(--font-mono); font-size: 12px; color: var(--honey); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }

/* Carte : panneau + halo de pollen en haut a droite. */
.card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-3);
  padding: 22px 24px 24px; text-decoration: none; color: inherit;
  transition: transform var(--t-base) ease, box-shadow var(--t-base) ease;
}
.card::before {
  content: ""; position: absolute; top: -55%; right: -25%; width: 12rem; height: 12rem;
  border-radius: var(--r-pill); pointer-events: none;
  background: radial-gradient(closest-side, var(--glow, rgb(var(--rgb-ember) / .22)), transparent);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.card.tp    { --glow: rgb(var(--rgb-ember) / .24); }
.card.cours { --glow: rgb(var(--rgb-azure) / .2); }
.card .t { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); line-height: var(--lh-snug); letter-spacing: -.015em; }
.card .f { font-family: var(--font-mono); font-size: 11.5px; color: var(--fog); word-break: break-all; }
.card .go { margin-top: auto; font-size: 13px; font-weight: 500; color: var(--honey); display: inline-flex; align-items: center; gap: 6px; }
.card:hover .go { color: var(--ember); }

/* Lignes avec barre d'accent verticale. */
.rows { display: flex; flex-direction: column; margin-top: var(--sp-3); }
.row {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 14px 6px 14px 18px; transition: background-color var(--t-fast) ease;
}
.row::before {
  content: ""; position: absolute; left: 4px; top: 12px; bottom: 12px; width: 3px;
  border-radius: var(--r-pill); background: var(--row-accent, var(--line));
}
.row.tp    { --row-accent: var(--ember); }
.row.cours { --row-accent: var(--azure); }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: rgb(var(--rgb-ember) / .05); }
.row .t { font-weight: 500; }
.row .f { font-family: var(--font-mono); font-size: 11.5px; color: var(--fog); }
.row .spacer { flex: 1; }

/* Statistique. */
.stat { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; }
.stat .k { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--fog); }
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); letter-spacing: var(--ls-page); line-height: 1; }
.stat .d { font-size: 12.5px; color: var(--fog); }
.stat .d.up { color: var(--sap); }
.stat .d.down { color: var(--terra); }

/* Etat vide. */
.empty { text-align: center; padding: 64px 24px; }
.empty b { display: block; font-family: var(--font-display); font-weight: 500; color: var(--ink); font-size: 22px; margin-bottom: var(--sp-2); }
.empty a { color: var(--ember); font-weight: 500; text-decoration: none; }

/* =========================================================================
   TAGS, PILULES, AVATARS
   ========================================================================= */
.tag {
  display: inline-flex; align-items: center; align-self: flex-start;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; padding: 5px 10px; border-radius: var(--r-pill); border: 1px solid;
}
.tag.tp    { background: rgb(var(--rgb-ember) / .15); color: var(--ember); border-color: rgb(var(--rgb-ember) / .32); }
.tag.cours { background: rgb(var(--rgb-azure) / .16); color: var(--azure-ink); border-color: rgb(var(--rgb-azure) / .34); }
.tag.ok    { background: rgb(var(--rgb-sap) / .16); color: var(--sap); border-color: rgb(var(--rgb-sap) / .34); }
.tag.warn  { background: rgb(var(--rgb-honey) / .16); color: var(--honey); border-color: rgb(var(--rgb-honey) / .34); }
.tag.bad   { background: rgb(var(--rgb-terra) / .14); color: var(--terra); border-color: rgb(var(--rgb-terra) / .34); }
:root.light .tag.cours { background: rgb(var(--rgb-azure) / .1); border-color: rgb(var(--rgb-azure) / .3); }
:root.light .tag.ok    { background: rgb(var(--rgb-sap) / .12); border-color: rgb(var(--rgb-sap) / .32); }

/* Tag cochable : meme pilule, mais avec une case a cocher. Sert dans /admin a
   marquer un cours comme TP. Non coche = c'est un cours. */
.tag.tag-sw {
  gap: 7px; cursor: pointer; font: inherit;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.tag.tag-sw .box {
  width: 12px; height: 12px; flex: none; border-radius: 3px;
  border: 1.5px solid currentColor; opacity: .55;
  display: inline-flex; align-items: center; justify-content: center;
}
.tag.tag-sw[aria-pressed="true"] .box { opacity: 1; background: currentColor; }
.tag.tag-sw[aria-pressed="true"] .box::after {
  content: ''; width: 6px; height: 3px; margin-top: -2px;
  border-left: 1.5px solid var(--paper); border-bottom: 1.5px solid var(--paper);
  transform: rotate(-45deg);
}
.tag.tag-sw:hover { filter: brightness(1.12); }
.tag.tag-sw:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1); }
.chip {
  display: inline-flex; align-items: center; font-family: var(--font-sans); font-size: 13px;
  font-weight: 500; padding: var(--sp-2) 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: color-mix(in srgb, var(--cream) 70%, transparent);
  color: var(--fog); cursor: pointer; transition: var(--t-fast) ease;
}
.chip:hover { border-color: rgb(var(--rgb-ember) / .5); color: var(--ink); }
.chip.active {
  background: linear-gradient(180deg, #ffc04a, var(--flame)); color: var(--on-ember);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 8px 22px -12px rgb(var(--rgb-ember) / .6);
}
.chip .x { margin-left: var(--sp-2); opacity: .55; font-size: 15px; line-height: 1; }
.chip .x:hover { opacity: 1; }

.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: var(--r-pill); font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--on-ember); background: linear-gradient(160deg, var(--honey), var(--flame));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--paper); }

/* Logo hexagone. */
.hex-mark {
  display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px;
  color: var(--on-ember); filter: drop-shadow(0 4px 12px rgb(var(--rgb-ember) / .45));
}
.hex-mark svg { width: 100%; height: 100%; }

/* =========================================================================
   NAVIGATION SECONDAIRE
   ========================================================================= */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: var(--sp-6) 0 var(--sp-5); }
.tab {
  position: relative; padding: 10px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--fog); background: none; border: none; cursor: pointer;
  font-family: var(--font-sans); transition: color var(--t-fast) ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  border-radius: var(--r-pill); background: linear-gradient(90deg, var(--honey), var(--ember));
}

.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; color: var(--fog); font-family: var(--font-mono); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--honey); }
.crumbs .sep { opacity: .5; }

.pager { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: var(--sp-8); }
.pager a, .pager span {
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px;
  border-radius: var(--sp-2); font-size: 13px; text-decoration: none; color: var(--fog);
  border: 1px solid transparent; transition: var(--t-fast) ease;
}
.pager a:hover { background: var(--mist); color: var(--ink); }
.pager [aria-current="page"] { color: var(--on-ember); background: linear-gradient(180deg, #ffc04a, var(--flame)); }

/* =========================================================================
   RETOURS UTILISATEUR
   ========================================================================= */
.alert {
  display: flex; gap: var(--sp-3); padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid; font-size: 13.5px; align-items: flex-start;
}
.alert svg { flex: none; margin-top: 1px; }
.alert.info { background: rgb(var(--rgb-azure) / .1); border-color: rgb(var(--rgb-azure) / .32); color: var(--azure-ink); }
.alert.ok   { background: rgb(var(--rgb-sap) / .1);   border-color: rgb(var(--rgb-sap) / .32);   color: var(--sap); }
.alert.warn { background: rgb(var(--rgb-ember) / .1); border-color: rgb(var(--rgb-ember) / .32); color: var(--ember); }
.alert.bad  { background: rgb(var(--rgb-terra) / .1); border-color: rgb(var(--rgb-terra) / .32); color: var(--terra); }
.alert b { display: block; color: var(--ink); margin-bottom: 2px; }

.toasts {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2); max-width: 360px;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3); padding: 13px 16px;
  border-radius: var(--r-lg); font-size: 13.5px;
  animation: toast-in .35s var(--ease-out) both;
}
.toast .close { margin-left: auto; opacity: .5; cursor: pointer; background: none; border: 0; color: inherit; }
.toast .close:hover { opacity: 1; }

/* Modale : le fond recule, le verre epais avance. */
.overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgb(var(--rgb-paper) / .6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: var(--sp-5);
  animation: fade .2s ease both;
}
.modal {
  position: relative; z-index: var(--z-modal); width: 100%; max-width: 460px;
  padding: 28px 30px; animation: pop .3s var(--ease-out) both;
}
.modal h2 { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: var(--ls-title); margin: 0 0 var(--sp-2); }
.modal .sub { color: var(--fog); font-size: 14px; margin: 0 0 var(--sp-5); }
.modal-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-5); }

/* Infobulle. */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px); z-index: var(--z-tooltip);
  padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap;
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--mist); color: var(--ink); border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: var(--t-fast) ease;
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Progression. */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--mist); overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--honey), var(--ember));
  box-shadow: 0 0 12px rgb(var(--rgb-ember) / .5);
  transition: width .5s var(--ease);
}

.spinner {
  width: 18px; height: 18px; border-radius: var(--r-pill); display: inline-block;
  border: 2px solid rgb(var(--rgb-ember) / .25); border-top-color: var(--ember);
  animation: spin .7s linear infinite;
}

.skeleton {
  border-radius: var(--r-md); background: var(--mist); position: relative; overflow: hidden;
  color: transparent; user-select: none;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgb(var(--rgb-honey) / .1), transparent);
  animation: shimmer 1.4s infinite;
}

/* =========================================================================
   DONNEES
   ========================================================================= */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--fog);
  font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.table tbody tr { transition: background-color var(--t-fast) ease; }
.table tbody tr:hover { background: rgb(var(--rgb-ember) / .05); }
.table td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--r-panel); }

.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fog);
  background: var(--mist); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px;
}

.code {
  position: relative; margin: var(--sp-5) 0; padding: 16px 18px; overflow-x: auto;
  border-radius: var(--r-md); background: rgb(var(--rgb-paper) / .55);
  border: 1px solid var(--line); font-family: var(--font-mono); font-size: 13px;
  line-height: 1.65; color: var(--ink);
}
.code::before {
  content: attr(data-lang); position: absolute; top: 10px; right: 14px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--fog);
}

/* =========================================================================
   LOGIN / ECRAN CENTRE
   ========================================================================= */
.center-wrap {
  position: relative; min-height: calc(100dvh - var(--topbar-h));
  display: grid; place-items: center; padding: var(--sp-5); overflow: hidden;
}
.login-card { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 44px 38px; text-align: center; }
/* display:grid et non inline-grid : « margin: 0 auto » ne centre pas un
   element inline, le logo restait colle a gauche et l'ornement venait
   se poser a cote de lui au lieu de passer dessous. */
.login-card .hex-mark { display: grid; width: 46px; height: 46px; margin: 0 auto 18px; }
.login-card .ornament { margin: 0 0 14px; }
.login-card h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); letter-spacing: var(--ls-page); margin: 0 0 var(--sp-2); }
.login-card .sub { color: var(--fog); font-size: 14px; margin: 0 0 var(--sp-6); }
.login-card .input { margin-bottom: var(--sp-3); text-align: left; }
.login-card .btn-magic { width: 100%; padding: 13px; }
.login-err { color: var(--terra); font-size: 13px; font-family: var(--font-mono); min-height: 18px; margin-top: var(--sp-3); }

/* =========================================================================
   MOTION
   ========================================================================= */
@keyframes rise    { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop     { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in{ from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes firefly {
  0%, 100% { opacity: 0; transform: translate3d(0,0,0); }
  12%  { opacity: .7; }
  45%  { opacity: .25; transform: translate3d(16px, -30px, 0); }
  70%  { opacity: .55; transform: translate3d(-4px, -52px, 0); }
  92%  { opacity: 0; transform: translate3d(6px, -70px, 0); }
}

.rise { animation: rise var(--t-slow) var(--ease) both; }
.rise-2 { animation-delay: .1s; }
.rise-3 { animation-delay: .2s; }
.rise-4 { animation-delay: .32s; }
.rise-5 { animation-delay: .44s; }

/* Pollen flottant. 6 unites maximum, ecrans vitrine seulement. */
.firefly {
  position: absolute; width: 5px; height: 5px; border-radius: var(--r-pill);
  background: var(--honey); box-shadow: 0 0 12px 3px rgb(var(--rgb-ember) / .5);
  opacity: 0; animation: firefly 11s ease-in-out infinite;
}

/* =========================================================================
   PREFERENCES ET RESPONSIVE
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .rise, .toast, .modal, .overlay { animation: none; }
  .firefly { animation: none; opacity: .2; }
  .skeleton::after, .spinner, .btn-magic[data-loading="true"]::after { animation-duration: 2.5s; }
  .btn-magic, .btn-quiet, .card, .field, .input, .chip, .row, .table tbody tr { transition: none; }
  .card:hover, .btn-magic:hover { transform: none; }
}

@media (max-width: 560px) {
  .grid, .grid.cols-2 { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .toasts { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); max-width: none; }
  .modal { padding: 24px 22px; }
  .topbar { padding: 0 var(--sp-4); }
}

@media print {
  .topbar, .sidebar, .toasts, .firefly, .btn-magic, .btn-quiet { display: none; }
  body { background: #fff; color: #000; }
  .panel, .solid { box-shadow: none; border: 1px solid #ccc; backdrop-filter: none; }
}

/* ── Portail de connexion : voie SSO ─────────────────────────────────
   Le bouton est en second plan par rapport a « Se connecter » : l'aplat
   miel reste reserve a l'action principale de l'ecran. */
.login-sso { margin-top: 22px; text-align: center; }

/* Le mot est centre sur un filet qui traverse la largeur, plutot que
   pose seul contre le bord. */
.login-sso-sep {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  color: var(--fog); font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
}
.login-sso-sep::before, .login-sso-sep::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.btn-sso {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 16px;
  border: 1px solid var(--ember); border-radius: var(--r-md, 10px);
  background: transparent; color: var(--ember);
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background var(--t-fast, .15s), color var(--t-fast, .15s);
}
.btn-sso:hover {
  background: rgb(var(--rgb-ember) / .14);
  color: var(--honey);
}
