/*
 * Zenstream : feuille de style du back-office.
 *
 * Charte reprise du thème « znkstudio » du back-office Zencast (projet Dédales) :
 * simple, clair, rapide, inspiré d'Apple, sans framework ni étape de build.
 * Référence complète : docs/architecture/charte-backoffice.md
 *
 *  1. Jetons (clair, sombre, automatique)
 *  2. Base
 *  3. Coquille : menu latéral, barre du haut, contenu
 *  4. Composants : boutons, cartes, chiffres, pastilles, alertes, tableaux
 *  5. Pages hors coquille (erreurs, connexion)
 *  6. Formulaires : champs, libellés, erreurs, cases
 *  7. Menus déroulants et tiroir (sans JavaScript : <details>), sélecteur de média
 *
 * Règles :
 *  - Toute couleur passe par un jeton : jamais de valeur en dur dans un composant.
 *  - Le violet (--ai) est réservé aux fonctions d'IA (relecture des sous-titres, lot 11).
 *  - Mode sombre : choix de l'utilisateur enregistré dans son profil et posé côté serveur
 *    (html[data-theme]), sans stockage navigateur. « Automatique » suit le réglage du système.
 */

/* 1. Jetons ------------------------------------------------------------------------------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F5F5F7; --surface: #FFFFFF; --surface-2: #F9F9FB; --sidebar: #EFEFF2;
  --fg: #1D1D1F; --fg-2: #5F5F65; --line: rgba(0,0,0,.08); --line-2: rgba(0,0,0,.14); --hover: rgba(0,0,0,.05);
  --accent: #1D1D1F; --accent-fg: #FFFFFF; --accent-text: #1D1D1F; --accent-soft: rgba(0,0,0,.06);
  --ok: #1E7B34; --ok-soft: rgba(48,176,80,.15);
  --warn: #8A5000; --warn-soft: rgba(255,159,10,.18);
  --danger: #C4001A; --danger-soft: rgba(255,59,48,.12); --danger-fill: #D70015;
  --info: #0B5CAD; --info-soft: rgba(10,132,255,.12);
  --ai: #534AB7; --ai-soft: #EEEDFE; --ai-line: #CECBF6;
  --on: #34C759;

  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.03);
  --shadow-md: 0 6px 20px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);

  --r: 8px; --r-lg: 14px; --r-xl: 16px;
  --sidebar-w: 248px; --topbar-h: 56px; --content-w: 1240px;
  color-scheme: light;
}

/* Valeurs du mode sombre, partagées par le choix explicite et le réglage du système. */
:root[data-theme="dark"] {
  --bg: #0F0F11; --surface: #1C1C1E; --surface-2: #232326; --sidebar: #151517;
  --fg: #F5F5F7; --fg-2: #A3A3A9; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.16); --hover: rgba(255,255,255,.07);
  --accent: #F5F5F7; --accent-fg: #1C1C1E; --accent-text: #F5F5F7; --accent-soft: rgba(255,255,255,.09);
  --ok: #5CD679; --ok-soft: rgba(48,209,88,.16);
  --warn: #FFB340; --warn-soft: rgba(255,159,10,.18);
  --danger: #FF6961; --danger-soft: rgba(255,69,58,.18);
  --info: #64B5FF; --info-soft: rgba(10,132,255,.18);
  --ai: #B9B3F0; --ai-soft: rgba(127,119,221,.18); --ai-line: rgba(175,169,236,.30);
  --on: #30D158;
  --shadow: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0F0F11; --surface: #1C1C1E; --surface-2: #232326; --sidebar: #151517;
    --fg: #F5F5F7; --fg-2: #A3A3A9; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.16); --hover: rgba(255,255,255,.07);
    --accent: #F5F5F7; --accent-fg: #1C1C1E; --accent-text: #F5F5F7; --accent-soft: rgba(255,255,255,.09);
    --ok: #5CD679; --ok-soft: rgba(48,209,88,.16);
    --warn: #FFB340; --warn-soft: rgba(255,159,10,.18);
    --danger: #FF6961; --danger-soft: rgba(255,69,58,.18);
    --info: #64B5FF; --info-soft: rgba(10,132,255,.18);
    --ai: #B9B3F0; --ai-soft: rgba(127,119,221,.18); --ai-line: rgba(175,169,236,.30);
    --on: #30D158;
    --shadow: 0 1px 2px rgba(0,0,0,.5);
    --shadow-md: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
    --shadow-lg: 0 24px 64px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
    color-scheme: dark;
  }
}

/* 2. Base --------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; letter-spacing: -.003em; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
img, svg, video { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:where(a) { color: var(--accent-text); text-underline-offset: 3px; }
:where(a:hover) { text-decoration-thickness: 2px; }
/* Le focus reste toujours visible au clavier (accessibilité) : ne jamais le supprimer. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: .92em; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Typographie */
.t-1 { font-size: 28px; font-weight: 700; letter-spacing: -.022em; line-height: 1.15; }
.t-2 { font-size: 20px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
.t-3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.t-h { font-size: 15px; font-weight: 600; }
.t-sub { font-size: 13px; color: var(--fg-2); }
.t-cap { font-size: 12px; color: var(--fg-2); }
.t-warn { color: var(--warn); }
.tab-num { font-variant-numeric: tabular-nums; }

.zs-icon { width: 18px; height: 18px; flex: none; }

/* 3. Coquille ----------------------------------------------------------------------------- */
.zs-app { display: flex; min-height: 100vh; }

.zs-sidebar { position: sticky; top: 0; height: 100vh; flex: none; width: var(--sidebar-w); display: flex; flex-direction: column; gap: 2px; padding: 12px 10px 10px; background: var(--sidebar); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.zs-sb-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; }
.zs-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; color: var(--fg); text-decoration: none; }
.zs-brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-fg); }
.zs-brand-mark .zs-icon { width: 16px; height: 16px; fill: currentColor; }
.zs-brand-name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.zs-brand-name b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zs-brand-name span { font-size: 11.5px; color: var(--fg-2); font-weight: 500; }

.zs-nav { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border-radius: 8px; color: var(--fg); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.zs-nav:hover { background: var(--hover); }
.zs-nav.is-active { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.zs-nav .zs-icon { color: var(--fg-2); }
.zs-nav.is-active .zs-icon { color: var(--fg); }
/* Rubrique pas encore disponible : visible mais inactive, avec le lot qui l'apportera. */
.zs-nav.is-soon { color: var(--fg-2); cursor: default; }
.zs-nav.is-soon:hover { background: transparent; }
.zs-soon { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--fg-2); opacity: .8; }
.zs-grp { font-size: 11.5px; font-weight: 600; color: var(--fg-2); padding: 14px 10px 4px; }
.zs-sb-fill { flex: 1 1 auto; min-height: 16px; }
.zs-sb-foot { padding: 8px 10px 2px; }

.zs-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.zs-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: var(--topbar-h); padding: 10px 32px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.zs-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); margin-right: auto; min-width: 0; }
.zs-crumbs a { color: var(--fg-2); text-decoration: none; }
.zs-crumbs a:hover { color: var(--fg); }
.zs-crumbs strong { color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.zs-content { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.zs-content:focus { outline: none; }
.zs-page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px 24px; }
.zs-page-head .t-cap { margin-bottom: 4px; }
.zs-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.zs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* Lien d'évitement : premier élément atteint au clavier. */
.zs-skip { position: absolute; left: 12px; top: -60px; z-index: 3000; padding: 8px 14px; border-radius: var(--r); background: var(--accent); color: var(--accent-fg); font-weight: 600; text-decoration: none; }
.zs-skip:focus { top: 12px; }

/* Téléphone et tablette étroite : le menu devient un tiroir, ouvert par le bouton « Menu » de la
   barre du haut, avant le fil d'Ariane. Le bouton contient une vraie case à cocher (#zs-drawer),
   accessible au clavier ; :has() ouvre le tiroir. Aucun JavaScript. Sur grand écran, ni bouton ni
   tiroir : le menu est toujours visible. */
.zs-topbar .zs-drawer-btn, .zs-scrim { display: none; }
.zs-drawer-btn { position: relative; }
.zs-drawer-toggle { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.zs-drawer-btn:has(.zs-drawer-toggle:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .zs-app { flex-direction: column; }
  .zs-topbar .zs-drawer-btn { display: inline-grid; margin-left: -6px; }
  .zs-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(var(--sidebar-w), 86vw); box-shadow: var(--shadow-lg); transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility .25s; }
  .zs-app:has(#zs-drawer:checked) .zs-sidebar { transform: none; visibility: visible; }
  .zs-app:has(#zs-drawer:checked) .zs-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.3); }
  .zs-topbar { padding: 8px 16px; }
  .zs-content { padding: 20px 16px 48px; }
  .t-1 { font-size: 26px; }
  .zs-page-head { grid-template-columns: minmax(0, 1fr); }
  .zs-actions { justify-content: flex-start; }
}

/* 4. Composants --------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: var(--r); border: 1px solid transparent; background: var(--surface); color: var(--fg); font: 600 13.5px/1 var(--font); letter-spacing: -.005em; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn .zs-icon { width: 16px; height: 16px; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--bg)); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 10px; }
.btn-plain:hover { background: var(--hover); }
.btn-danger { background: var(--danger-fill); color: #fff; }
.btn-danger:hover { background: #B80012; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border-radius: var(--r); border: 0; background: transparent; color: var(--fg-2); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 15px; border-radius: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.card-b { padding: 4px 18px 18px; }
.group-t { font-size: 13px; font-weight: 600; color: var(--fg-2); padding: 0 4px 8px; }

/* Carte de chiffre : libellé en haut, valeur en bas, alignée d'une carte à l'autre. */
.stat { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-l { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; line-height: 1.35; color: var(--fg-2); font-weight: 500; }
.stat-l .zs-icon { width: 16px; height: 16px; margin-top: 1px; }
.stat > .stat-v { margin-top: auto; padding-top: 10px; }
.stat-v { font-size: 30px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap; background: var(--hover); color: var(--fg-2); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-ai { background: var(--ai-soft); color: var(--ai); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--hover); color: var(--fg); font-size: 14px; }
.alert .zs-icon { margin-top: 1px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--fg-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child > * { border-bottom: 0; }
/* Tableau de propriétés (en-têtes de ligne) : libellé en colonne étroite. */
.table tbody th { width: 1%; padding-right: 32px; }
.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 5. Pages hors coquille ------------------------------------------------------------------ */
.zs-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.zs-auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-md); }
.zs-auth-card .zs-brand-mark { margin-bottom: 12px; }

/* 6. Formulaires -------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.input, .select { display: block; width: 100%; min-height: 34px; padding: 6px 11px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font-size: 14px; line-height: 1.4; }
.input:focus, .select:focus { outline: 3px solid var(--accent-soft); outline-offset: 0; border-color: var(--accent-text); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-code { font-family: var(--font-mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.select-sm { min-height: 28px; padding: 2px 28px 2px 8px; font-size: 13px; background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px; }
.hint { font-size: 12px; color: var(--fg-2); }
.error { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 200px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-block { width: 100%; }
.link { color: var(--fg-2); font-size: 13px; text-decoration: none; }
.link:hover { color: var(--fg); text-decoration: underline; }
.inline { display: inline; }
button.btn-plain { border: 0; }

/* Codes de secours et QR code de la double authentification */
.qr { display: inline-grid; padding: 12px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.qr svg { width: 180px; height: 180px; display: block; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(22ch, 1fr)); white-space: nowrap; gap: 6px 16px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 13.5px; }
.secret { font-family: var(--font-mono); font-size: 13px; word-break: break-all; padding: 8px 10px; border-radius: var(--r); background: var(--surface-2); }
.steps { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; color: var(--fg-2); }

/* Listes en tableau dans une carte */
.card .table th:first-child, .card .table td:first-child { padding-left: 18px; }
.card .table th:last-child, .card .table td:last-child { padding-right: 18px; }
/* Tableau dans le corps d'une carte : aligné sur le texte de la carte, sans retrait
   (après les règles .card .table, de même priorité). */
.card-b .table th:first-child, .card-b .table td:first-child { padding-left: 0; }
.card-b .table th:last-child, .card-b .table td:last-child { padding-right: 0; }
.table .t-sub { display: block; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
/* Dans une cellule, rester une cellule de tableau : en display: flex, la cellule sort de la
   mise en page du tableau (bordure de ligne décalée, bouton mal centré verticalement). */
td.table-actions { display: table-cell; text-align: right; }
td.table-actions > .btn { margin: 2px 0 2px 4px; }
.empty { padding: 20px 18px; color: var(--fg-2); }
.pagination { display: flex; gap: 8px; justify-content: center; }

/* 7. Menus déroulants et tiroir ----------------------------------------------------------- */
.zs-menu-wrap { position: relative; }
.zs-menu-wrap > summary { list-style: none; cursor: pointer; }
.zs-menu-wrap > summary::-webkit-details-marker { display: none; }
.zs-menu { position: absolute; z-index: 60; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); }
.zs-menu-up { bottom: calc(100% + 6px); left: 0; right: 0; }
.zs-menu a, .zs-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--fg); text-decoration: none; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.zs-menu a:hover, .zs-menu button:hover { background: var(--hover); }
.zs-menu .zs-icon { width: 17px; height: 17px; color: var(--fg-2); }
.zs-menu .is-danger, .zs-menu .is-danger .zs-icon { color: var(--danger); }
.zs-menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.zs-menu-h { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--fg-2); }
.zs-seg-row { display: flex; gap: 2px; padding: 3px; margin: 2px 4px 4px; border-radius: 9px; background: var(--hover); }
.zs-seg-row button { flex: 1; justify-content: center; padding: 5px 4px; font-size: 12.5px; }
.zs-seg-row button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

.zs-me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; color: var(--fg); }
.zs-me:hover, .zs-menu-wrap[open] > .zs-me { background: var(--hover); }
.zs-me-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.zs-me-txt b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zs-me-txt span { font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--fg); color: var(--bg); flex: none; }

/* Sélecteur de média du super-administrateur */
.zs-media-switch { padding: 0 4px 8px; }
.zs-media-switch .select { min-height: 32px; font-size: 13px; }

/* 8. Documentation de l'API (page publique) ------------------------------------------------- */
.doc { max-width: 900px; }
.doc-prose { display: flex; flex-direction: column; gap: 12px; line-height: 1.6; }
.doc-prose h1 { font-size: 28px; font-weight: 700; letter-spacing: -.022em; }
.doc-prose h2 { font-size: 20px; font-weight: 650; margin-top: 20px; }
.doc-prose h3 { font-size: 16px; font-weight: 600; margin-top: 8px; }
.doc-prose ul, .doc-prose ol { margin: 0; padding-left: 22px; }
.doc-prose li + li { margin-top: 4px; }
.doc-prose pre { margin: 0; padding: 14px 16px; overflow-x: auto; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; }
.doc-prose :not(pre) > code { padding: 1px 5px; border-radius: 5px; background: var(--hover); }
.doc-prose blockquote { margin: 0; padding: 10px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--fg); }
.doc-prose table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-prose th, .doc-prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-prose th { font-size: 12px; color: var(--fg-2); }
.doc-op { margin-top: 12px; }
.doc-op h3 { display: flex; align-items: center; gap: 8px; }
.doc-method { font-family: var(--font-mono); }
.doc-get { background: var(--info-soft); color: var(--info); }
.doc-post { background: var(--ok-soft); color: var(--ok); }
.doc-put, .doc-patch { background: var(--warn-soft); color: var(--warn); }
.doc-delete { background: var(--danger-soft); color: var(--danger); }

/* 9. Envoi de vidéos (lot 2) --------------------------------------------------------------- */
.zs-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); text-align: center; cursor: pointer; }
.zs-drop .zs-icon { width: 28px; height: 28px; color: var(--fg-2); }
.zs-drop:hover, .zs-drop.is-over { border-color: var(--accent-text); background: var(--accent-soft); }
.zs-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.zs-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.zs-uploads { display: flex; flex-direction: column; }
.zs-upload { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.zs-upload:first-child { border-top: 0; }
.zs-upload-head, .zs-upload-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
.zs-upload-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zs-upload progress, .zs-progress progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--hover); overflow: hidden; }
.zs-upload progress::-webkit-progress-bar, .zs-progress progress::-webkit-progress-bar { background: var(--hover); }
.zs-upload progress::-webkit-progress-value, .zs-progress progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.zs-upload progress::-moz-progress-bar, .zs-progress progress::-moz-progress-bar { background: var(--accent); }
.zs-upload.is-done progress::-webkit-progress-value { background: var(--ok); }
.zs-upload.is-done progress::-moz-progress-bar { background: var(--ok); }
.zs-upload.is-error [data-status] { color: var(--danger); }

/* 10. Suivi d'encodage (lot 3) : fiche vidéo et liste ---------------------------------------- */
.zs-progress { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.zs-progress progress { max-width: 480px; }
.zs-progress.is-compact { gap: 4px; }
.zs-progress.is-compact progress { width: 160px; height: 4px; }
.zs-upload.is-done [data-status] { color: var(--ok); }

/* 10. Encodage (lot 3) ---------------------------------------------------------------------- */
.zs-log { margin: 0; max-height: 320px; overflow: auto; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

/* 11. Aperçu des vidéos en ligne (lot 4) ------------------------------------------------------ */
/* Le cadre suit le ratio de la vidéo (attributs width et height de la balise) : une vidéo verticale
   reste verticale, sans bandes noires autour ni recadrage. */
.zs-modes { display: flex; gap: 4px; flex-wrap: wrap; }
.zs-modes .btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.zs-apercu { display: flex; justify-content: center; }
.zs-apercu video { display: block; width: auto; height: auto; max-width: 100%; max-height: 70vh; border-radius: var(--r-lg); background: #000; }
.zs-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.zs-thumbs img { display: block; width: auto; height: 140px; max-width: 100%; border-radius: var(--r); background: var(--hover); }
.zs-break { word-break: break-all; }
/* Vignette de la liste : hauteur fixe, largeur au ratio de la vidéo (72 px au plus), centrée dans
   un emplacement fixe. */
.zs-vignette-slot { display: flex; justify-content: center; align-items: center; width: 72px; height: 40px; flex: none; border-radius: 6px; background: var(--hover); }
.zs-vignette { display: block; width: auto; height: 40px; max-width: 72px; border-radius: 6px; }
.zs-video-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* 12. Réglages du player (lot 5) -------------------------------------------------------------- */
.zs-color { width: 64px; min-height: 34px; padding: 3px; cursor: pointer; }
/* Aperçu du logo sur fond noir, comme dans le player ; jamais étiré par le formulaire (flex). */
.zs-logo-preview { display: block; align-self: flex-start; width: auto; height: 56px; max-width: 240px; object-fit: contain; padding: 8px; border-radius: var(--r); background: #000; }
.zs-code { font-family: var(--font-mono); font-size: 12.5px; }
.zs-embed-preview { display: block; max-width: 100%; border: 0; border-radius: var(--r-lg); background: #000; }

/* 13. Statistiques de la fiche vidéo (lot 7) ------------------------------------------------- */
.zs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.zs-stats .stat { padding: 0; }
.zs-stats .stat-v { font-size: 22px; font-weight: 700; }
.zs-retention { display: block; width: 100%; height: 120px; border-radius: var(--r); background: var(--surface-2); }
.zs-retention rect { fill: var(--fg-2); }

/* 14. Bibliothèque (lot 8) : dossiers, filtres, grille de vignettes ---------------------------- */
.zs-library { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.zs-library-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.zs-folders ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.zs-folders a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; font-size: 13.5px; }
.zs-folders a:hover { background: var(--hover); }
.zs-folders a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.zs-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.zs-filters .field { margin: 0; min-width: 150px; }
.zs-filter-q { flex: 1 1 240px; }
.zs-filter-actions { display: flex; gap: 6px; }
.zs-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.zs-tile { display: flex; flex-direction: column; overflow: hidden; }
.zs-tile-link { display: flex; flex-direction: column; color: var(--fg); text-decoration: none; }
.zs-tile-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.zs-tile-thumb { position: relative; display: flex; align-items: center; justify-content: center; height: 150px; background: #000; color: rgba(255, 255, 255, .5); }
.zs-tile-thumb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.zs-tile-duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; font-weight: 600; }
.zs-tile-title { padding: 10px 12px 4px; font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.zs-tile-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 12px 12px; }
@media (max-width: 900px) {
  .zs-library { grid-template-columns: 1fr; }
  .zs-folders ul { flex-direction: row; flex-wrap: wrap; }
}

/* 15. Fiche vidéo (lot 8) : formulaire en ligne, poster, zone de danger ---------------------- */
.zs-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.zs-poster-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.zs-poster-choice { padding: 0; border: 2px solid transparent; border-radius: var(--r); background: #000; cursor: pointer; line-height: 0; }
.zs-poster-choice img { display: block; height: 110px; width: auto; max-width: 100%; border-radius: calc(var(--r) - 2px); }
.zs-poster-choice:hover, .zs-poster-choice:focus-visible { border-color: var(--accent-text); }
.zs-poster-time { margin-top: 16px; }
.zs-danger { border-color: var(--danger-soft, #f5c2c7); }
.zs-danger .t-h { color: var(--danger); }

/* 16. Écran Statistiques (lot 8) -------------------------------------------------------------- */
.zs-chart { display: block; width: 100%; height: 180px; }
.zs-chart rect { fill: var(--fg-2); }
.zs-chart rect:hover { fill: var(--fg); }
.zs-chart-axis { display: flex; justify-content: space-between; margin-top: 6px; }
th a[aria-sort] { color: var(--fg); }

/* 17. Tableau de bord (lot 8) ---------------------------------------------------------------- */
.zs-dashboard-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.zs-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--hover); }
.zs-tabs a { padding: 7px 12px; border-radius: 9px; color: var(--fg-2); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.zs-tabs a:hover { color: var(--fg); }
.zs-tabs a[aria-current="page"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-weight: 600; }

