/* ==========================================================================
   Feuille de style unique du logiciel.

   Pour changer l'allure du site, commence par les variables de la section 1
   (couleurs, arrondis) : tout le reste s'adapte automatiquement.
   Le mode sombre suit le réglage de l'ordinateur ou du téléphone.

   Sommaire : 1 variables · 2 base · 3 cadre des pages · 4 composants
              5 formulaires · 6 tableaux et listes · 7 tableau de bord
              8 pages d'accès · 9 petits écrans
   ========================================================================== */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-grotesque.477b564b86e0.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

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

  --paper: #f3f6f5;          /* fond de page */
  --panel: #ffffff;          /* fond des blocs */
  --sunken: #eaf0ee;         /* zones en creux, survols discrets */
  --ink: #10201d;            /* texte */
  --muted: #566763;          /* texte secondaire */
  --line: #d9e2df;           /* filets */
  --line-strong: #b9c8c3;    /* bordures de champs */

  --brand: #0e5f52;          /* couleur principale : boutons */
  --brand-strong: #0a483f;
  --on-brand: #ffffff;
  --brand-ink: #0e5f52;      /* liens */
  --brand-soft: #e1efeb;

  --gold: #f2b33d;           /* accent : « aujourd'hui », repères */
  --gold-soft: #fdf1d3;
  --gold-line: #e6c873;

  --ok: #1a7a40;     --ok-soft: #e1f3e8;
  --warn: #85560a;   --warn-soft: #fff0cc;
  --danger: #b3261e; --danger-soft: #fbe8e5; --danger-solid: #b3261e;

  --side: #0b2723;           /* menu de gauche */
  --side-ink: #c5d8d3;
  --side-muted: #86a39c;
  --side-line: rgba(255, 255, 255, .1);
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(255, 255, 255, .11);

  --radius: 12px;
  --radius-sm: 8px;
  --focus: #0e5f52;
  --font: "Bricolage", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1412;
    --panel: #12201d;
    --sunken: #0e1a17;
    --ink: #e5eeeb;
    --muted: #9aaea9;
    --line: #223632;
    --line-strong: #37504a;

    --brand: #45bda7;
    --brand-strong: #62cfba;
    --on-brand: #04201b;
    --brand-ink: #6fd3be;
    --brand-soft: #14302a;

    --gold-soft: #2e2711;
    --gold-line: #6b5518;

    --ok: #72d397;     --ok-soft: #12301f;
    --warn: #f1c25e;   --warn-soft: #33270d;
    --danger: #ff9188; --danger-soft: #3a1a18; --danger-solid: #cf3a39;

    --side: #08110f;
    --focus: #6fd3be;
  }
}

/* ---- 2. base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.15; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.25rem + 1.7vw, 2.4rem); font-stretch: 88%; letter-spacing: -.02em; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--brand-ink); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
code { font-family: var(--mono); }
strong { font-weight: 650; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.side :focus-visible, .topbar :focus-visible, .auth-art :focus-visible { outline-color: var(--gold); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: .75rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); box-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.skip-link:focus { top: .75rem; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: break-word; }
.push-right { margin-left: auto; }
.stack { display: grid; gap: 1.1rem; align-content: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.narrow { max-width: 36rem; }
.note { padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--sunken); color: var(--muted); font-size: .92rem; }

/* ---- 3. cadre des pages --------------------------------------------------- */
.shell { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 1.75rem;
  padding: 1.35rem .9rem 1rem;
  background: var(--side); color: var(--side-ink);
  overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; font-size: 1.22rem; font-weight: 650; font-stretch: 90%; letter-spacing: -.01em; }
.side .brand { color: #fff; padding: 0 .55rem; }
.logo { width: 2rem; height: 2rem; flex: none; }

.nav { display: grid; gap: .2rem; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .66rem .8rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--side-ink);
  font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -.9rem; top: .5rem; bottom: .5rem; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }

.side-foot { margin-top: auto; display: grid; gap: .35rem; padding-top: 1rem; border-top: 1px solid var(--side-line); }
.env-flag { align-self: start; justify-self: start; margin: 0 0 .35rem .8rem; padding: .12rem .6rem; border-radius: 999px; background: var(--gold); color: #3d2a00; font-size: .78rem; font-weight: 650; }
.who { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: var(--radius-sm); color: var(--side-ink); text-decoration: none; }
.who:hover { background: var(--side-hover); }
.who[aria-current="page"] { background: var(--side-active); }
.who-text { display: grid; min-width: 0; line-height: 1.25; }
.who-text strong { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: var(--side-muted); font-size: .82rem; }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 2.15rem; height: 2.15rem;
  border-radius: 50%; background: var(--gold); color: #3d2a00;
  font-size: .82rem; font-weight: 700; text-decoration: none;
}

.topbar { display: none; }
.scrim { display: none; }

.main { min-width: 0; padding: clamp(1.25rem, 3vw, 2.4rem) clamp(1rem, 3.5vw, 3rem) 4rem; }
:where(.main > *) { max-width: 72rem; }  /* :where() = priorité nulle, pour que .narrow puisse la contredire */
.main:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.lede { margin-top: .4rem; color: var(--muted); }
.lede-date::first-letter { text-transform: uppercase; }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .6rem; color: var(--muted); font-size: .92rem; text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }

.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }

/* ---- 4. composants -------------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel-note { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.panel-body { padding: 1.25rem; }
.panel-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-top: 1px solid var(--line); background: var(--sunken); border-radius: 0 0 var(--radius) var(--radius); }
.panel-head + .feed, .panel-head + .table-panel { border-top: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.7rem; padding: .55rem 1.1rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-quiet { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--sunken); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--sunken); }
.btn-danger { background: var(--danger-solid); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-danger-quiet { background: transparent; color: var(--danger); }
.btn-danger-quiet:hover { background: var(--danger-soft); }
.btn-sm { min-height: 2.2rem; padding: .3rem .8rem; font-size: .92rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: progress; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: var(--radius-sm); background: none; color: inherit; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn-sm { width: 2rem; height: 2rem; }
.icon-btn-danger { color: var(--danger); }
.icon-btn-danger:hover { background: var(--danger-soft); }

.msgs { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.msg { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem .9rem; border: 1px solid; border-radius: var(--radius-sm); }
.msg > .i { margin-top: .2rem; }
.msg > p, .msg > div { flex: 1; min-width: 0; }
.msg .icon-btn { margin: -.3rem -.4rem -.3rem 0; color: inherit; }
.msg .icon-btn:hover { background: rgba(0, 0, 0, .08); }
.msg-success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.msg-error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.msg-warning { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.msg-info, .msg-debug { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.msg p { color: var(--ink); }
.msg-error p, .msg-warning p, .msg-success p { color: inherit; }
.msg-error p, .msg-warning p, .msg-success p, .msg-info p { font-weight: 500; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .12rem .65rem;
  border-radius: 999px; background: var(--sunken); color: var(--muted);
  font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .75; }
.pill-brand, .pill-active { background: var(--brand-soft); color: var(--brand-ink); }
.pill-ok, .pill-done { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-archived { opacity: .75; }

.empty { display: grid; justify-items: center; gap: .6rem; padding: 3.5rem 1.5rem; text-align: center; }
.empty p { max-width: 26rem; }
.empty .btn { margin-top: .6rem; }
.empty-flat { padding: 2.5rem 1.5rem 3rem; }
.empty-mark, .notice-mark { display: inline-grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 1.35rem; }
.notice-mark { margin-bottom: 1.1rem; }
.notice-mark-alert { background: var(--danger-soft); color: var(--danger); }

.secret { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; margin-bottom: 1.25rem; padding: 1.1rem 1.25rem; border: 1px solid var(--gold-line); border-radius: var(--radius); background: var(--gold-soft); }
.secret p { margin-top: .25rem; color: var(--muted); }
.secret-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.secret-code { padding: .45rem .8rem; border: 1px solid var(--gold-line); border-radius: var(--radius-sm); background: var(--panel); font-size: 1.3rem; letter-spacing: .05em; user-select: all; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .7rem 1.5rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---- 5. formulaires -------------------------------------------------------- */
.field { display: grid; gap: .4rem; }
.field-label { font-weight: 600; }
.opt { color: var(--muted); font-weight: 400; font-size: .9rem; }
.field-hint { color: var(--muted); font-size: .9rem; }
.field-hint ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.field-error { color: var(--danger); font-size: .92rem; font-weight: 500; }
.field-error:empty { display: none; }
.field-error p + p { margin-top: .2rem; }

.input, .select, .textarea {
  width: 100%; min-height: 2.75rem; padding: .6rem .85rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink); font: inherit;
}
.textarea { min-height: 7.5rem; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 2.4rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23778a85' 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 .7rem center; background-size: 1.1rem; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.has-error .input, .has-error .select, .has-error .textarea, [aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder { color: var(--muted); opacity: .8; }
input[type="date"].input { min-height: 2.75rem; }

.check-row { display: flex; align-items: center; gap: .65rem; cursor: pointer; }
.check { width: 1.2rem; height: 1.2rem; flex: none; accent-color: var(--brand); cursor: pointer; }

.pw { position: relative; }
.pw .input { padding-right: 3rem; }
.pw-toggle { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); width: 2.4rem; height: 2.4rem; color: var(--muted); }
.pw-toggle[aria-pressed="false"] .i-hide, .pw-toggle[aria-pressed="true"] .i-show { display: none; }

.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .select { width: auto; min-width: 11rem; }
.search { position: relative; flex: 1 1 16rem; max-width: 26rem; }
.search .i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 2.6rem; }

/* ---- 6. tableaux et listes ---------------------------------------------------- */
.table-panel { overflow: hidden; border-radius: var(--radius); }
.panel.table-panel { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: .75rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--sunken); color: var(--muted); font-size: .88rem; font-weight: 600; text-align: left; white-space: nowrap; }
.table td { padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.cell-actions { text-align: right; white-space: nowrap; }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--brand-ink); text-decoration: underline; }
.row-sub { margin-top: .15rem; color: var(--muted); font-size: .9rem; }
.is-late { color: var(--warn); font-weight: 600; }
.person { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.person-text { display: grid; line-height: 1.3; min-width: 0; }
.person-text strong { font-weight: 600; }
.person-text small { color: var(--muted); }
.person:hover strong { color: var(--brand-ink); text-decoration: underline; }
.event-kind { display: inline-flex; align-items: center; gap: .7rem; font-weight: 550; }

.feed { display: grid; margin: 0; padding: 0; list-style: none; }
.feed-item { display: flex; gap: .8rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--sunken); color: var(--muted); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-alert { background: var(--danger-soft); color: var(--danger); }
.feed-body { min-width: 0; line-height: 1.35; }
.feed-title { font-weight: 600; }
.feed-msg { color: var(--ink); font-size: .94rem; overflow-wrap: anywhere; }
.feed-meta { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .1rem; color: var(--muted); font-size: .86rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.pager-count, .pager-page { color: var(--muted); font-size: .92rem; }
.pager-nav { display: flex; align-items: center; gap: .75rem; }

/* ---- 7. tableau de bord ---------------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 1.25rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.figure { display: grid; align-content: start; gap: .15rem; margin: 0; padding: 1.1rem 1.3rem 1.2rem; background: var(--panel); }
.figure dt { color: var(--muted); font-size: .94rem; font-weight: 550; }
.figure-value { margin: 0; font-size: 2.6rem; font-weight: 600; font-stretch: 85%; line-height: 1.05; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.figure-hint { margin: 0; color: var(--muted); font-size: .88rem; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (min-width: 1241px) {
  .dash-chart { grid-column: 1; grid-row: 1; }
  .dash-projects { grid-column: 1; grid-row: 2; }
  .dash-feed { grid-column: 2; grid-row: 1 / span 2; }
}
.chart-scroll { overflow-x: auto; padding: 1rem 1.1rem .8rem; }
.chart { display: block; width: 100%; min-width: 30rem; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font: 500 13px var(--font); }
.chart-bar { fill: var(--brand); }
.chart-bar.is-today { fill: var(--gold); }

/* ---- 8. pages d'accès ------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.auth-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 2.5rem 3rem; overflow: hidden; background: var(--side); color: #fff; }
.auth-rings { position: absolute; inset: 0; width: 100%; height: 100%; color: #fff; }
.auth-art-brand, .auth-pitch { position: relative; }
.auth-art-brand { color: #fff; }
.auth-pitch { max-width: 20rem; font-size: clamp(1.6rem, 1.1rem + 1.4vw, 2.2rem); font-weight: 560; font-stretch: 85%; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.auth-pane { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-box { width: min(100%, 25rem); }
.auth-brand { display: none; margin-bottom: 2rem; color: var(--ink); }
.auth-title { margin-bottom: .5rem; }
.auth-sub { margin-bottom: 1.6rem; color: var(--muted); }
.auth-box > p { margin-bottom: 1rem; }
.auth-foot { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); }

.plain { display: grid; justify-items: center; gap: 1rem; max-width: 30rem; margin: 0 auto; padding: 18vh 1.5rem 3rem; text-align: center; }
.plain .logo { width: 3rem; height: 3rem; margin-bottom: .5rem; }
.plain-code { color: var(--muted); font-size: 1rem; font-weight: 600; letter-spacing: .08em; }
.plain h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }
.plain .btn { margin-top: .75rem; }

/* ---- 9. petits écrans ------------------------------------------------------------- */
@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; background: var(--side); color: #fff; }
  .topbar .brand { flex: 1; color: #fff; font-size: 1.1rem; }
  .topbar .logo { width: 1.75rem; height: 1.75rem; }
  .topbar .icon-btn:hover { background: var(--side-hover); }

  /* sans JavaScript, le menu reste affiché sous la barre du haut */
  .side { position: static; height: auto; gap: 1rem; padding-bottom: .75rem; }
  .side > .brand { display: none; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .js .side {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(18.5rem, 86vw); height: 100vh; height: 100dvh;
    padding-bottom: 1rem; transform: translateX(-102%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  .js .side > .brand { display: inline-flex; }
  .js .nav { grid-template-columns: minmax(0, 1fr); }
  .js [data-nav-open] .side { transform: none; visibility: visible; transition-delay: 0s; }
  .js [data-nav-open] .scrim { position: fixed; inset: 0; z-index: 30; display: block; background: rgba(4, 14, 12, .6); }
  [data-nav-open] { overflow: hidden; }
  html:not(.js) .topbar .icon-btn { display: none; }

  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-brand { display: inline-flex; }
  .auth-pane { align-items: start; padding-top: 3rem; }
}

@media (max-width: 720px) {
  .figure-value { font-size: 2.1rem; }
  .figure { padding: .95rem 1rem 1rem; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-head { margin-bottom: 1.25rem; }
  .toolbar .select { flex: 1 1 8rem; min-width: 0; }
  .search { flex-basis: 100%; max-width: none; }
  .panel-foot .push-right { margin-left: 0; }

  /* les tableaux deviennent des fiches empilées */
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .3rem 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .88rem; font-weight: 500; text-align: left; }
  .table-stack td:not([data-label])::before { content: none; }
  .table-stack td[data-label="Projet"], .table-stack td[data-label="Utilisateur"] { display: block; text-align: left; }
  .table-stack td[data-label="Projet"]::before, .table-stack td[data-label="Utilisateur"]::before { content: none; }
  .table-stack .cell-actions { justify-content: flex-end; }
  .table-stack tbody tr:hover td { background: none; }
  .chart { min-width: 32rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Module UGC : textes longs (scripts, notes) affichés avec leurs retours à la ligne */
.text-block { white-space: pre-line; text-align: left; }
.text-block[dir="rtl"] { text-align: right; }
.audio-player { width: 100%; max-width: 32rem; }

/* Studio Drama : images de référence */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; }
.ref-slot { display: grid; gap: .5rem; align-content: start; }
.ref-label { font-weight: 600; font-size: .9rem; }
.ref-img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius-sm); background: var(--sunken); }
.ref-empty { display: grid; place-items: center; aspect-ratio: 9 / 16; border: 1px dashed var(--line, currentColor); border-radius: var(--radius-sm); color: var(--muted); font-size: .9rem; }
.ref-avatar { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: .5rem; }

/* Studio Drama : images et vidéos des scènes */
.scene-media { display: flex; flex-wrap: wrap; gap: 1rem; }
.scene-still, .scene-video { display: block; width: 100%; max-width: 15rem; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius-sm); background: var(--sunken); }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Un élément marqué « hidden » reste caché, même s'il a une classe de bouton */
[hidden] { display: none !important; }

/* Enregistreur de voix */
.rec-timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 600; padding: .2rem .6rem; border-radius: var(--radius-sm); background: var(--sunken); }
.rec-timer.is-over { color: var(--warn); }
.trim { display: grid; gap: .35rem; max-width: 32rem; }
.trim input[type="range"] { width: 100%; }

/* --- écran d'attente pendant une génération (Grok) ------------------------------- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px);
}
.loading-box {
  background: #fff; color: #0f172a; border-radius: 1rem; padding: 1.75rem 2rem;
  min-width: 18rem; max-width: 90vw; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.loading-blocks { position: relative; height: 2.5rem; width: 14rem; margin: 0 auto 1rem; overflow: hidden; }
.loading-block {
  position: absolute; top: .5rem; left: 0; width: 1.5rem; height: 1.5rem; border-radius: .3rem;
  animation: loading-slide 1.8s ease-in-out infinite alternate;
}
.loading-block-0 { background: #ef4444; animation-delay: 0s; }
.loading-block-1 { background: #f59e0b; animation-delay: .15s; }
.loading-block-2 { background: #10b981; animation-delay: .3s; }
.loading-block-3 { background: #3b82f6; animation-delay: .45s; }
.loading-block-4 { background: #a855f7; animation-delay: .6s; }
@keyframes loading-slide {
  0%   { transform: translateX(0) rotate(0deg); }
  50%  { transform: translateX(6rem) translateY(-.4rem) rotate(90deg); }
  100% { transform: translateX(12.5rem) rotate(180deg); }
}
.loading-text { font-weight: 600; margin: 0 0 .35rem; }
.loading-timer { font-size: .85rem; color: #64748b; margin: 0; }
@media (prefers-reduced-motion: reduce) { .loading-block { animation-duration: 6s; } }

/* --- Formation (espace élève) -------------------------------------------------- */
.stack-sm { display: grid; gap: .6rem; align-content: start; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; }
.course-card { overflow: hidden; display: flex; flex-direction: column; }
.course-cover { display: block; aspect-ratio: 16 / 9; background: var(--sunken); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-cover-empty { display: grid; place-items: center; height: 100%; font-size: 2rem; color: var(--muted); }
.course-title { font-size: 1.1rem; margin: 0; }
.course-title a { color: inherit; text-decoration: none; }
.course-title a:hover { text-decoration: underline; }
.progress { height: .55rem; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand, #0f766e); transition: width .3s ease; }
.panel.module, .panel.resource { margin-top: 1.25rem; }
.lesson-list { list-style: none; margin: 0; padding: .4rem 0; }
.lesson-item { display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: .6rem; padding: .65rem 1.25rem; border-top: 1px solid var(--line); }
.lesson-item:first-child { border-top: 0; }
.lesson-check { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--line); font-size: .8rem; }
.lesson-item.is-done .lesson-check { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.lesson-player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.lesson-player iframe, .lesson-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.chip { padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-size: .92rem; }
.chip.is-active { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }

.progress-1 { width: 1%; }
.progress-2 { width: 2%; }
.progress-3 { width: 3%; }
.progress-4 { width: 4%; }
.progress-5 { width: 5%; }
.progress-6 { width: 6%; }
.progress-7 { width: 7%; }
.progress-8 { width: 8%; }
.progress-9 { width: 9%; }
.progress-10 { width: 10%; }
.progress-11 { width: 11%; }
.progress-12 { width: 12%; }
.progress-13 { width: 13%; }
.progress-14 { width: 14%; }
.progress-15 { width: 15%; }
.progress-16 { width: 16%; }
.progress-17 { width: 17%; }
.progress-18 { width: 18%; }
.progress-19 { width: 19%; }
.progress-20 { width: 20%; }
.progress-21 { width: 21%; }
.progress-22 { width: 22%; }
.progress-23 { width: 23%; }
.progress-24 { width: 24%; }
.progress-25 { width: 25%; }
.progress-26 { width: 26%; }
.progress-27 { width: 27%; }
.progress-28 { width: 28%; }
.progress-29 { width: 29%; }
.progress-30 { width: 30%; }
.progress-31 { width: 31%; }
.progress-32 { width: 32%; }
.progress-33 { width: 33%; }
.progress-34 { width: 34%; }
.progress-35 { width: 35%; }
.progress-36 { width: 36%; }
.progress-37 { width: 37%; }
.progress-38 { width: 38%; }
.progress-39 { width: 39%; }
.progress-40 { width: 40%; }
.progress-41 { width: 41%; }
.progress-42 { width: 42%; }
.progress-43 { width: 43%; }
.progress-44 { width: 44%; }
.progress-45 { width: 45%; }
.progress-46 { width: 46%; }
.progress-47 { width: 47%; }
.progress-48 { width: 48%; }
.progress-49 { width: 49%; }
.progress-50 { width: 50%; }
.progress-51 { width: 51%; }
.progress-52 { width: 52%; }
.progress-53 { width: 53%; }
.progress-54 { width: 54%; }
.progress-55 { width: 55%; }
.progress-56 { width: 56%; }
.progress-57 { width: 57%; }
.progress-58 { width: 58%; }
.progress-59 { width: 59%; }
.progress-60 { width: 60%; }
.progress-61 { width: 61%; }
.progress-62 { width: 62%; }
.progress-63 { width: 63%; }
.progress-64 { width: 64%; }
.progress-65 { width: 65%; }
.progress-66 { width: 66%; }
.progress-67 { width: 67%; }
.progress-68 { width: 68%; }
.progress-69 { width: 69%; }
.progress-70 { width: 70%; }
.progress-71 { width: 71%; }
.progress-72 { width: 72%; }
.progress-73 { width: 73%; }
.progress-74 { width: 74%; }
.progress-75 { width: 75%; }
.progress-76 { width: 76%; }
.progress-77 { width: 77%; }
.progress-78 { width: 78%; }
.progress-79 { width: 79%; }
.progress-80 { width: 80%; }
.progress-81 { width: 81%; }
.progress-82 { width: 82%; }
.progress-83 { width: 83%; }
.progress-84 { width: 84%; }
.progress-85 { width: 85%; }
.progress-86 { width: 86%; }
.progress-87 { width: 87%; }
.progress-88 { width: 88%; }
.progress-89 { width: 89%; }
.progress-90 { width: 90%; }
.progress-91 { width: 91%; }
.progress-92 { width: 92%; }
.progress-93 { width: 93%; }
.progress-94 { width: 94%; }
.progress-95 { width: 95%; }
.progress-96 { width: 96%; }
.progress-97 { width: 97%; }
.progress-98 { width: 98%; }
.progress-99 { width: 99%; }
.progress-100 { width: 100%; }
.course-cover { position: relative; }
.course-cover.is-locked img, .course-cover.is-locked .course-cover-empty { filter: grayscale(.7) brightness(.6); }
.course-lock { position: absolute; left: .75rem; bottom: .75rem; display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; background: rgba(0,0,0,.7); color: #fff; font-size: .85rem; font-weight: 600; }
/* --- élèves dans le monde ------------------------------------------------------ */
.world-panel { margin-bottom: 1.25rem; }
.world-scroll { overflow-x: auto; padding: .5rem 1rem 1rem; }
.world-map { display: block; width: 100%; min-width: 36rem; height: auto; }
.world-land circle { fill: var(--line, #d5dbe1); }
.world-spot circle { fill: var(--brand, #0f766e); fill-opacity: .75; stroke: #fff; stroke-width: .8; }
.world-spot.is-online circle { fill: #16a34a; fill-opacity: .9; }
.world-pulse { fill: #16a34a; transform-box: fill-box; transform-origin: center; animation: world-pulse 2s ease-out infinite; }
@keyframes world-pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(2.6); opacity: 0; } }
.live-dot { display: inline-block; width: .6rem; height: .6rem; margin-right: .4rem; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: live-dot 1.8s infinite; vertical-align: middle; }
@keyframes live-dot { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.6); } 70% { box-shadow: 0 0 0 .5rem rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.spot-key { display: inline-block; width: .6rem; height: .6rem; margin: 0 .3rem 0 .6rem; border-radius: 50%; background: var(--brand, #0f766e); vertical-align: middle; }
.world-grid { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.world-grid > .panel { grid-column: auto; }
@media (prefers-reduced-motion: reduce) { .world-pulse, .live-dot { animation: none; } }
/* carte interactive : zoom, déplacement, clic */
.world-map { touch-action: none; cursor: grab; user-select: none; }
.world-map.is-dragging { cursor: grabbing; }
.world-country { fill: #e3e8ee; stroke: #fff; stroke-width: .35; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s; }
.world-country.level-1 { fill: #c7e6df; }
.world-country.level-2 { fill: #8fcfc1; }
.world-country.level-3 { fill: #4fb19d; }
.world-country.level-4 { fill: #1f8f7a; }
.world-country.level-5 { fill: #0f766e; }
.world-country:hover, .world-country:focus, .world-country.is-selected { fill: #f59e0b; outline: none; }
.world-spot { cursor: pointer; }
.world-spot .world-dot { vector-effect: non-scaling-stroke; }
.world-spot.is-selected .world-dot { fill: #f59e0b; }
.world-info { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; margin: 0 1rem 1rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--sunken); }
/* --- lives, questions, notifications ------------------------------------------- */
.live-list, .notif-list, .thread { list-style: none; margin: 0; padding: 0; }
.live-item { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1.25rem; border-top: 1px solid var(--line); }
.live-item:first-child { border-top: 0; }
.live-item.is-live { background: var(--ok-soft); }
.live-date { display: grid; justify-items: center; padding: .35rem 0; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); line-height: 1.1; }
.live-date strong { font-size: 1.25rem; }
.live-date span { font-size: .75rem; text-transform: uppercase; }
.thread { display: grid; gap: .9rem; margin-bottom: 1.25rem; }
.thread-item { padding: .9rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.thread-item.is-helper { background: var(--brand-soft); border-color: transparent; margin-left: 2rem; }
.thread-item.is-student { margin-right: 2rem; }
.thread-meta { margin: 0 0 .4rem; }
.notif-item { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; border-top: 1px solid var(--line); }
.notif-item:first-child { border-top: 0; }
.notif-item.is-unread { background: var(--brand-soft); font-weight: 600; }
.nav-badge { margin-left: auto; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: #ef4444; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.4rem; text-align: center; }
@media (max-width: 40rem) { .live-item { grid-template-columns: 2.8rem 1fr; } .live-item .row-actions { grid-column: 2; } .thread-item.is-helper { margin-left: .75rem; } .thread-item.is-student { margin-right: .75rem; } }
