/* imm : feuille de style de l'application.

   Le socle visuel (boutons, champs, tableaux, badges, modales, toasts, onglets,
   squelettes, progression...) vient d'Oat (static/vendor/oat/oat.min.css,
   charge AVANT cette feuille). Ici ne reste que :
     1. la surcharge des variables d'Oat (marque, palette, polices, rayons,
        ombres) ;
     2. des finitions rangees DANS les couches d'Oat (`@layer base`,
        `@layer components`) : placees apres les siennes, elles l'emportent a
        specificite egale, mais les variantes d'Oat (`.outline`,
        `[data-variant]`...), plus specifiques, continuent de s'appliquer ;
     3. ce qu'Oat ne connait pas : la coquille de navigation, la grille
        d'affiches, le calendrier, les etageres, la fiche d'un titre...

   Les regles hors couche (tout le 3.) l'emportent toujours sur Oat, quelle
   que soit leur specificite. */

/* --- Typographie ----------------------------------------------------------
   Deux familles, servies par imm lui-meme (aucun appel a un service tiers,
   et l'interface reste complete hors connexion) :

   Inter pour l'interface -- la police des outils actuels, en version
   variable (une seule requete pour toutes les graisses). Ses chiffres
   tabulaires (`tnum`) alignent les scores et les tailles.

   IBM Plex Mono pour tout ce qui est technique et se lit caractere par
   caractere : noms de release, chemins, journaux. */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/plexmono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/plexmono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --- Variables d'Oat : ce qu'imm change ------------------------------------
   Deux themes, choisis par l'appareil (`prefers-color-scheme`, via les
   `light-dark()` d'Oat) : aucun reglage, aucun bouton, l'interface suit le
   telephone ou l'ordinateur.

   Le fond de page est un gris a peine teinte et les cartes sont blanches :
   c'est ce contraste, et non des bordures appuyees, qui separe les blocs.
   La couleur de marque (indigo) se change ici, et nulle part ailleurs. */
:root {
  --primary: light-dark(#5b5bd6, #8e8cff);
  --primary-foreground: light-dark(#ffffff, #0d0c1d);
  --ring: light-dark(#5b5bd6, #8e8cff);
  /* Deuxieme teinte de marque, pour le degrade du logo et des boutons. */
  --primary-2: light-dark(#8b5cf6, #b197fc);

  --background: light-dark(#f6f7f9, #0b0c10);
  --foreground: light-dark(#0f1117, #ededf0);
  --card: light-dark(#ffffff, #121319);
  --card-foreground: var(--foreground);
  --secondary: light-dark(#ffffff, #1a1b23);
  --secondary-foreground: light-dark(#1f2230, #ededf0);
  --muted: light-dark(#f0f1f4, #1a1b23);
  --muted-foreground: light-dark(#646978, #9a9cab);
  --faint: light-dark(#fafafb, #101117);
  --faint-foreground: light-dark(#a3a7b3, #5d6070);
  --accent: light-dark(#eef0f4, #1d1e27);
  --border: light-dark(#e5e7ec, #23252f);
  --input: light-dark(#dadde4, #2e303b);

  --success: light-dark(#15803d, #4ade80);
  --warning: light-dark(#b45309, #fbbf24);
  --danger: light-dark(#dc2626, #f87171);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* imm sert a comparer des lignes, pas a lire un article : corps a 14 px,
     mais un vrai titre de page pour savoir ou l'on est. */
  --text-regular: var(--text-7);
  --text-1: 1.625rem;
  --text-2: 1.0625rem;
  --text-3: 0.9375rem;
  --font-bold: 650;

  --radius-small: .375rem;
  --radius-medium: .625rem;
  --radius-large: .875rem;

  /* Ombres en couches : un trait net au contact, un halo large et diffus.
     En sombre, l'ombre ne se voit plus : c'est la bordure qui travaille. */
  --_sh: light-dark(rgb(15 17 30 / .06), rgb(0 0 0 / .4));
  --_sh2: light-dark(rgb(15 17 30 / .1), rgb(0 0 0 / .55));
  --shadow-small: 0 1px 2px var(--_sh);
  --shadow-medium: 0 1px 2px var(--_sh), 0 4px 14px -4px var(--_sh2);
  --shadow-large: 0 1px 3px var(--_sh), 0 16px 40px -12px var(--_sh2);

  /* Largeur de la barre laterale (ordinateur). */
  --sidebar-w: 232px;
}

/* --- Finitions des composants d'Oat --------------------------------------- */
@layer base {
  body { font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility; }
  h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.02em; }
  h1 { letter-spacing: -.028em; }
  ::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }

  /* Boutons plats : Oat dessine un relief (bordure claire en haut, sombre en
     bas) qui date l'interface. On le remplace par un fin reflet interne et
     une ombre douce ; le bouton principal prend un leger degrade de marque. */
  :is(button, [type=submit], [type=reset], [type=button], a.button) {
    --_hov: color-mix(in srgb, var(--primary), black 8%);
    border-color: transparent;
    border-radius: var(--radius-medium);
    font-weight: 550;
    letter-spacing: -.005em;
    background-image: linear-gradient(180deg, rgb(255 255 255 / .1), rgb(255 255 255 / 0));
    box-shadow: 0 1px 2px var(--_sh), inset 0 1px 0 rgb(255 255 255 / .14);
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast),
      border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  }
  :is(button, [type=submit], [type=reset], [type=button], a.button):active:not(:disabled) { transform: translateY(.5px); }
  /* Secondaire : une carte blanche bordee, comme les boutons de Linear. */
  :is(button, [type=submit], [type=reset], [type=button], a.button)[data-variant=secondary] {
    --_hov: var(--accent);
    border-color: var(--border);
    background-image: none;
    box-shadow: 0 1px 2px var(--_sh);
  }
  :is(button, [type=submit], [type=reset], [type=button], a.button):is(.outline, .ghost) {
    background-image: none; box-shadow: none;
  }

  /* Champs : un peu plus hauts, et un anneau de focus colore plutot qu'un
     simple changement de bordure. */
  :where(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color]), textarea, select) {
    background-color: var(--card);
    border-color: var(--input);
    border-radius: var(--radius-medium);
    padding-block: .5625rem;
    box-shadow: 0 1px 2px var(--_sh);
  }
  :where(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color]), textarea, select):focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent);
    outline: none;
  }
  input[type=checkbox], input[type=radio] { accent-color: var(--primary); }

  /* Tableaux : en-tete en petites capitales grises, lignes aerees. */
  th {
    font-size: var(--text-8); font-weight: 600; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted-foreground);
  }
  thead { border-bottom-color: var(--border); }
  tbody tr:hover { background-color: color-mix(in srgb, var(--muted) 60%, transparent); }

  progress, meter { --bar-height: .375rem; }
}

@layer components {
  .card {
    border-color: var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
  }

  /* Pastilles teintees (fond de la couleur a 12 %, texte de la couleur),
     plutot que des pastilles pleines qui crient toutes en meme temps. */
  .badge {
    background-color: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-weight: 600;
    padding-block: .125rem;
  }
  .badge[data-variant=secondary] { background-color: var(--muted); color: var(--secondary-foreground); }

  dialog {
    border-color: var(--border);
    border-radius: calc(var(--radius-large) + 4px);
    box-shadow: var(--shadow-large), 0 0 0 1px light-dark(transparent, rgb(255 255 255 / .04));
  }
  dialog::backdrop { background: rgb(8 9 14 / .45); backdrop-filter: blur(4px); }
  [popover]:not(.toast-container) {
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-large);
  }

  details { border-radius: var(--radius-large); background: var(--card); }

  [role=tablist] { border-radius: var(--radius-medium); padding: 3px; }
  [role=tab] { border-radius: calc(var(--radius-medium) - 3px); }
  [role=tab][aria-selected=true] { background-color: var(--card); box-shadow: var(--shadow-small); }

  .toast { border-radius: var(--radius-large); box-shadow: var(--shadow-large); }
  [role=alert] { border-radius: var(--radius-large); }
}

/* --- Socle ---------------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0 0 var(--space-2); }

/* L'attribut `hidden` doit toujours cacher. Oat donne un `display` aux
   boutons, aux pieds de fenetre, etc. dans une couche plus tardive que sa
   propre regle `[hidden]` : sans ceci, un bouton `hidden` resterait visible. */
[hidden] { display: none !important; }
/* Un bloc de resultats encore vide ne doit pas ajouter un ecart de plus. */
#results:empty { display: none; }

/* Le fond defile derriere une fenetre ouverte : on le fige. */
body:has(dialog[open]) { overflow: hidden; }

/* Lien d'evitement : premier element focalisable de la page, invisible tant
   qu'il n'a pas le focus. */
.skip-link {
  position: absolute; left: var(--space-2); top: -48px; z-index: 300;  /* hors ecran tant qu'il n'a pas le focus */
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-medium);
  background: var(--card); border: 1px solid var(--border);
  color: var(--foreground); font-weight: 600; transition: top .12s ease;
}
.skip-link:focus { top: var(--space-2); }

/* Texte reserve aux lecteurs d'ecran : annonce "Chargement..." sans rien
   dessiner a l'ecran, ou les squelettes disent deja la meme chose. */
.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;
}

/* --- Icones ---------------------------------------------------------------
   Le sprite lui-meme ne s'affiche pas : il ne contient que des <symbol>.
   Une icone prend la taille et la couleur du texte qu'elle accompagne, avec
   un trait constant quelle que soit la taille. */
.icon-sprite { display: none; }
.ico {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.18em;
}

/* Les pastilles d'Oat sont larges (16 px de marge) : dans un tableau dense ou
   sur une affiche, on resserre a la densite d'imm. */
.badge { padding-inline: var(--space-2); }

/* Petits utilitaires de mise en page qu'Oat n'a pas. */
.grow { flex: 1; min-width: 0; }
.num { text-align: end; font-variant-numeric: tabular-nums; }

/* Bouton occupe : Oat dessine la roue (`aria-busy`) avec la couleur du
   bouton, invisible sur un bouton plein. On la prend dans la couleur du texte
   et a la taille de celui-ci. */
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::before {
  width: 1em; height: 1em;
  border-color: currentColor; border-top-color: transparent;
}

/* --- Coquille : navigation --------------------------------------------------
   Un seul balisage, deux formes. Sur ordinateur, `nav[data-topnav]` devient
   une barre laterale fixe (marque en haut, ecrans au milieu, etat des
   services en bas) ; sur telephone (voir plus bas), une barre du haut reduite
   plus la navigation basse. Les liens sont des boutons fantomes d'Oat, l'ecran
   courant porte `aria-current`. */
.topbar { gap: var(--space-4); min-height: 56px; }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: var(--text-4); letter-spacing: -.025em; }
/* La marque : le logotype « imm » en traits arrondis, avec le triangle de
   lecture. Les lettres suivent la couleur du texte (encre en clair, papier en
   sombre) et le triangle l'indigo de la marque : les deux variantes du logo
   (#5B5BD6 sur fond clair, #8E8CFF sur fond sombre) sont celles de --primary. */
.brand-logo { display: inline-flex; flex: none; color: var(--foreground); }
.brand-logo svg { height: 26px; width: auto; display: block; overflow: visible; }
.logo-play { fill: var(--primary); stroke: var(--primary); stroke-width: 8; stroke-linejoin: round; }
.logo-word { fill: none; stroke: currentColor; stroke-width: 22; stroke-linecap: round; }
.nav { display: flex; gap: var(--space-1); flex: 1; overflow-x: auto; }
.nav a { white-space: nowrap; gap: var(--space-2); color: var(--muted-foreground); font-weight: 500; }
.nav a:hover { color: var(--foreground); }
.nav a .ico { width: 17px; height: 17px; vertical-align: 0; }
.nav a[aria-current] { background-color: var(--card); color: var(--foreground); box-shadow: var(--shadow-small), 0 0 0 1px var(--border); }
.nav a[aria-current] .ico { color: var(--primary); }
/* Compteur d'un ecran (file, a confirmer) : pousse a droite, plein. */
.nav a .badge { margin-left: auto; background: var(--primary); color: var(--primary-foreground); min-width: 20px; }

@media (min-width: 721px) {
  body { padding-left: var(--sidebar-w); }
  .topbar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
    flex-direction: column; align-items: stretch; gap: var(--space-1);
    padding: var(--space-5) var(--space-3) var(--space-3);
    background: var(--background); border-bottom: 0; box-shadow: none;
    border-right: 1px solid var(--border);
  }
  .topbar .brand { padding: 0 var(--space-2) var(--space-5); }
  .topbar .nav { flex-direction: column; flex: 1; overflow-x: visible; overflow-y: auto; gap: 2px; }
  .topbar .nav a { justify-content: flex-start; padding: var(--space-2) var(--space-3); font-size: var(--text-7); }
  /* Etat des services (ou compte, sur /demandes) : pied de la barre. */
  .topbar > .health {
    margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--border);
  }
  .topbar > .health .health-btn { width: 100%; justify-content: flex-start; gap: var(--space-2); color: var(--muted-foreground); }
  .topbar > .account-bar { flex-direction: column; align-items: stretch; gap: var(--space-2); white-space: normal; padding-inline: var(--space-2); }
  .topbar > .account-bar > .account-name { max-width: none; order: -1; color: var(--foreground); font-weight: 600; }
  main.container { max-width: 1240px; padding-inline: var(--space-8); }
}

/* Liste des raccourcis. */
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-6); margin: 0; }
.shortcuts > div { display: contents; }
.shortcuts dt { display: flex; align-items: center; gap: var(--space-1); }
.shortcuts dd { margin: 0; color: var(--muted-foreground); }
kbd {
  font-family: var(--font-mono); font-size: var(--text-8);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: var(--radius-small); padding: 1px var(--space-1);
  background: var(--card); color: var(--foreground);
}

/* --- Temoin de sante ------------------------------------------------------
   Muet quand tout va bien : un point vert et un mot. Il ne prend la parole
   (couleur et libelle) que lorsqu'un service manque. Le detail s'ouvre dans
   le menu deroulant d'Oat (`ot-dropdown`, popover natif). */
.health { display: flex; align-items: center; font-size: var(--text-7); color: var(--muted-foreground); }
/* Pousse le temoin a droite de la barre d'administration. */
#health { margin-left: auto; }
/* Barre du compte (page /demandes) : quota, nom, deconnexion. Espacee, sur
   une ligne, et le nom se tronque plutot que de pousser le reste hors ecran. */
.account-bar { gap: var(--space-4); margin-left: auto; white-space: nowrap; }
.account-bar > * { flex: none; }
.account-bar > .account-name { flex: 0 1 auto; min-width: 3ch; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.health.down .health-btn { color: var(--danger); }
.health-panel { min-width: 260px; padding: var(--space-2); }
.health-line {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2); border-radius: var(--radius-small); color: var(--foreground);
}
.health-line .text-light { margin-left: auto; text-align: right; font-size: var(--text-8); }
a.health-line { color: var(--muted-foreground); border-top: 1px solid var(--border); border-radius: 0; margin-top: var(--space-1); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint-foreground); flex: none; }
.dot.ok { background: var(--success); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }

/* --- Structure ---------------------------------------------------------- */
main { padding-block: var(--space-8) var(--space-16); }
.card { padding: var(--space-5); }

/* Bandeau de faits : ce que la mediatheque contient, en une ligne, au-dessus
   du calendrier. Chaque fait est un lien : un chiffre qui ne mene nulle part
   n'est qu'une decoration. */
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) 0; }
.fact {
  display: inline-flex; align-items: baseline; gap: var(--space-1);
  padding: var(--space-2) var(--space-4); color: var(--muted-foreground); font-size: var(--text-7);
  line-height: 1.2; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-full); box-shadow: var(--shadow-small);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.facts { gap: var(--space-2); }
.fact b { font-size: var(--text-5); font-weight: 650; letter-spacing: -.02em; color: var(--foreground); font-variant-numeric: tabular-nums; }
.fact:hover { color: var(--foreground); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow-medium); transform: translateY(-1px); }
.fact:hover b { color: var(--primary); }
.fact.ok b { color: var(--success); }
.fact.err b { color: var(--danger); }
.fact.info b, .fact.accent b { color: var(--primary); }

/* Un ecran vide dit ce qu'il n'y a pas, pourquoi, et ce qu'on peut faire. */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  text-align: center; padding: var(--space-8) var(--space-4); color: var(--muted-foreground);
}
/* Dans un etat vide, l'icone est un reperage, pas une illustration : discrete
   et de la taille d'un titre, jamais un gros dessin centre. */
.empty .ico {
  width: 44px; height: 44px; padding: 11px; stroke-width: 1.6; vertical-align: 0; box-sizing: border-box;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); border-radius: var(--radius-large);
}
.empty-msg { color: var(--foreground); font-weight: 600; margin-top: var(--space-1); }
.empty-hint { font-size: var(--text-7); max-width: 46ch; }
.empty-action { margin-top: var(--space-1); }

/* Squelettes : ils gardent la forme de ce qui arrive (grille d'affiches,
   lignes), pour que la page ne saute pas quand le contenu s'affiche. */
.poster-grid .skeleton { margin: 0; aspect-ratio: 2 / 3; border-radius: var(--radius-large); }
.sk-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* --- Grille d'affiches -------------------------------------------------- */
.poster-grid {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
}
.poster {
  position: relative; cursor: pointer;
  border-radius: var(--radius-large); overflow: hidden;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-small);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, border-color .2s ease;
}
.poster:hover { transform: translateY(-4px); box-shadow: var(--shadow-large); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.poster img { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.poster:hover img { transform: scale(1.03); }
.poster img { display: block; width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--muted); }
.poster .no-art {
  display: flex; align-items: center; justify-content: center; text-align: center;
  aspect-ratio: 2/3; padding: var(--space-2); color: var(--muted-foreground); font-size: var(--text-7);
}
.poster .meta { position: relative; padding: var(--space-2) var(--space-3) var(--space-3); background: var(--card); }
.poster .title {
  font-size: var(--text-7); font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poster .year { color: var(--muted-foreground); font-size: var(--text-8); }
/* Une pastille posee sur une image : un fond de carte derriere sa teinte, pour
   qu'elle reste lisible sur n'importe quelle affiche, en clair comme en sombre. */
.poster .corner { position: absolute; z-index: 1; top: var(--space-2); right: var(--space-2); display: flex; background: var(--card); border-radius: var(--radius-full); box-shadow: var(--shadow-medium); }

/* Multi-selection (Medias). */
.poster.selectable .check-mark {
  position: absolute; top: var(--space-2); left: var(--space-2); width: 22px; height: 22px;
  border-radius: var(--radius-small); border: 2px solid #fff; background: rgb(0 0 0 / .35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-foreground); font-size: var(--text-7); font-weight: 700; z-index: 2;
}
.poster.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.poster.selected .check-mark { background: var(--primary); border-color: var(--primary); }
.poster.selected img, .poster.selected .no-art { opacity: .75; }
.bulk-bar {
  position: sticky; top: var(--bulk-top, 16px); z-index: 4;
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-2) var(--space-4);
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px);
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border)); border-radius: var(--radius-large);
  box-shadow: var(--shadow-large);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .count { font-weight: 650; margin-right: var(--space-2); }
.bulk-bar select { width: auto; margin: 0; }
.bulk-bar .spacer { flex: 1; }

/* --- Formulaires ---------------------------------------------------------
   Les champs viennent d'Oat (`[data-field]`). Dans une rangee (`.row`, la
   grille d'Oat) le libelle prend la hauteur restante : les champs d'une meme
   ligne restent alignes meme quand un libelle passe sur deux lignes. */
.row { --grid-gap: var(--space-4); }
.row > [data-field] { display: flex; flex-direction: column; margin-block-end: 0; }
.row > [data-field] > label { flex: 1 0 auto; }
/* Oat donne aux aides `flex-basis: 100%` (prevu pour une ligne, pas une colonne). */
.row > [data-field] > [data-hint] { flex: none; min-inline-size: 0; }

/* Champ de recherche avec sa croix d'effacement, posee dans le champ. */
.search-field { position: relative; display: flex; flex: 1; min-width: 0; }
.search-field input { margin: 0; padding-right: var(--space-12); }
/* Au focus, Oat monte le champ (`z-index: 1`) ; la croix doit rester au-dessus. */
.search-clear { position: absolute; z-index: 2; right: var(--space-1); top: 50%; transform: translateY(-50%); height: 2rem; }
.search-clear[hidden] { display: none; }
.req-search input { flex: 1; min-width: 0; }
.filter { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-7); }
.filter > span { color: var(--muted-foreground); }
.filter select { width: auto; min-width: 118px; margin: 0; }
.filter.check { flex-direction: row; align-items: center; gap: var(--space-2); color: var(--muted-foreground); }
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
  padding-bottom: var(--space-4); margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

/* --- Tableaux ----------------------------------------------------------- */
tr.rejected td { opacity: .45; }
.release-title { font-family: var(--font-mono); font-size: var(--text-8); word-break: break-all; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }
.score.high { color: var(--success); }
.score.mid { color: var(--warning); }
.score.low { color: var(--muted-foreground); }
.score-pill { font-variant-numeric: tabular-nums; font-weight: 700; }
.score-pill.high { color: var(--success); }
.score-pill.mid { color: var(--warning); }
.score-pill.low { color: var(--muted-foreground); }
.score-pill.unknown { color: var(--muted-foreground); font-weight: 500; }
.delta { font-size: var(--text-8); font-weight: 650; line-height: 1.2; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.same { color: var(--muted-foreground); }
.size-pill { font-variant-numeric: tabular-nums; }
.err-text { color: var(--danger); }

/* Detail du score : l'information qui justifie de preferer une release a une
   autre. Repliee par defaut pour garder la liste dense, jamais tronquee. Le
   bloc depliable d'Oat est trop massif pour une cellule de tableau : on le
   reduit a une ligne. */
.why, .more { border: 0; border-radius: 0; overflow: visible; margin-top: var(--space-1); }
.why > summary, .more > summary {
  display: inline-flex; justify-content: flex-start; gap: var(--space-1);
  padding: 0; font-size: var(--text-7); font-weight: 400; color: var(--muted-foreground);
  width: fit-content;
}
.why > summary:hover, .more > summary:hover { background: none; color: var(--foreground); }
.why[open] > summary, .more[open] > summary { border-bottom: 0; }
.why > :not(summary), .more > :not(summary) { margin: var(--space-1) 0 0; }
/* Aide d'un bloc de configuration : une phrase reste visible, le
   fonctionnement interne attend qu'on le demande. */
.more > summary { color: var(--primary); }
.more > p { max-width: 78ch; font-size: var(--text-7); }
.why-list {
  display: grid; grid-template-columns: 1fr auto; gap: 0 var(--space-4);
  font-size: var(--text-7);
}
.why-list > div { display: contents; }
.why-list dt { color: var(--muted-foreground); padding: 2px 0; }
.why-list dd { margin: 0; padding: 2px 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.why-list dd.up { color: var(--success); }
.why-list dd.down { color: var(--danger); }
.why-total dt, .why-total dd {
  border-top: 1px solid var(--border); margin-top: var(--space-1);
  padding-top: var(--space-1); color: var(--foreground); font-weight: 700;
}

/* Editeur de regles d'un profil. */
.rules-table td { padding: var(--space-1); }
.rules-table input { margin: 0; padding: var(--space-1) var(--space-2); font-size: var(--text-8); }
.rules-table input.pattern { font-family: var(--font-mono); }
.rules-table td.num-cell { width: 90px; }
.rule-test { margin-top: var(--space-4); padding: var(--space-4); background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-medium); }
.rule-test .result { margin-top: var(--space-2); font-size: var(--text-7); }
.rule-test .result .hit { display: flex; justify-content: space-between; gap: var(--space-4); padding: 2px 0; border-bottom: 1px solid var(--border); }
.profile-row {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-medium);
}
.profile-row .name { font-weight: 600; }
.profile-section { margin-top: var(--space-4); }
.profile-section h3 { margin-bottom: var(--space-1); }

/* --- Journaux ----------------------------------------------------------- */
.logs { font-family: var(--font-mono); font-size: var(--text-8); }
.logs .line { display: flex; gap: var(--space-3); padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border); border-radius: var(--radius-small); }
.logs .line:hover { background: var(--faint); }
.logs .lvl { color: var(--muted-foreground); display: flex; align-items: center; flex: none; }
.logs .line.warn .lvl, .logs .line.warn .msg { color: var(--warning); }
.logs .line.error .lvl, .logs .line.error .msg { color: var(--danger); }
.logs .ts { color: var(--muted-foreground); white-space: nowrap; }
.logs .src { color: var(--primary); min-width: 84px; }

/* --- Calendrier des sorties --------------------------------------------- */
.cal-head { display: flex; align-items: center; gap: var(--space-2); }
.cal-title { font-weight: 650; font-size: var(--text-5); letter-spacing: -.02em; min-width: 140px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-1); }
.cal-dow {
  text-align: center; font-size: var(--text-8); letter-spacing: .04em;
  color: var(--muted-foreground); text-transform: uppercase; padding: var(--space-1) 0;
}
.cal-day {
  min-height: 48px; padding: var(--space-1); cursor: pointer;
  background: var(--faint); border: 1px solid transparent; border-radius: var(--radius-medium);
  overflow: hidden; transition: border-color .12s ease, background .12s ease;
}
.cal-day:hover { border-color: var(--border); background: var(--card); }
.cal-day.out { opacity: .3; }
.cal-day.today { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.cal-day.selected { background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: var(--primary); }
.cal-day .num { font-size: var(--text-8); color: var(--muted-foreground); text-align: start; }
.cal-day.today .num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px;
  color: var(--primary-foreground); background: var(--primary); border-radius: var(--radius-full); font-weight: 700;
}
.cal-chip {
  display: block; margin-top: 2px; padding: 1px 6px; border-radius: 5px; font-weight: 500;
  font-size: var(--text-8); line-height: 1.35; color: var(--foreground);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.episode, .cal-legend i.episode { --_c: var(--primary); }
.cal-chip.vod, .cal-legend i.vod { --_c: var(--muted-foreground); }
.cal-chip.bluray, .cal-legend i.bluray { --_c: var(--success); }
.cal-chip.cinema, .cal-legend i.cinema { --_c: var(--warning); }
.cal-chip { background: color-mix(in srgb, var(--_c) 14%, transparent); box-shadow: inset 2px 0 0 var(--_c); }
.cal-chip.done { opacity: .45; }
.cal-more { font-size: var(--text-8); color: var(--muted-foreground); margin-top: 1px; }
.cal-legend { display: flex; gap: var(--space-3); flex-wrap: wrap; font-size: var(--text-8); color: var(--muted-foreground); }
.cal-legend i { display: inline-block; width: 8px; height: 8px; border-radius: var(--radius-full); margin-right: var(--space-1); background: var(--_c); }
.cal-detail { margin-top: var(--space-4); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.cal-event { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1); border-radius: var(--radius-medium); cursor: pointer; }
.cal-event:hover { background: var(--muted); }
.cal-event img { width: 30px; border-radius: 5px; flex: none; }
.cal-event .name { font-weight: 550; }

/* --- Fenetres (dialog natif, style d'Oat) ---------------------------------
   Une fenetre = <dialog class="modal"> avec <header>, un <div> (le corps, qui
   defile) et <footer>. `showModal()` gere le focus, Tab en boucle et Echap. */
dialog.modal { width: min(100% - 2rem, 34rem); max-height: 92dvh; }
dialog.modal.wide { width: min(100% - 2rem, 1000px); }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal > header {
  flex: none; flex-direction: row; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-5); border-bottom: 1px solid var(--border);
}
dialog.modal > header h2 { min-width: 0; overflow-wrap: anywhere; }
dialog.modal > div { flex: 1; min-height: 0; padding: var(--space-5); }
dialog.modal > footer { flex: none; flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); background: var(--faint); }

/* Feuille "Plus" de la navigation basse. */
.sheet-links { display: flex; flex-direction: column; }
.sheet-link {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-3) var(--space-1); min-height: 48px;
  color: var(--foreground); font-weight: 550;
  border-bottom: 1px solid var(--border);
}
.sheet-link:last-child { border-bottom: 0; color: var(--muted-foreground); }

/* Ligne de metadonnees d'une fiche. */
.meta-line {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  color: var(--muted-foreground); margin-top: var(--space-1);
}
.meta-line .sep { color: var(--border); }
.current-file { margin-top: var(--space-1); }

/* --- Vue de demande de medias -------------------------------------------- */
.req-item { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.req-item:last-child { border-bottom: 0; }
.req-art { flex: none; width: 56px; }
.req-art img { width: 56px; border-radius: var(--radius-medium); box-shadow: var(--shadow-small); display: block; aspect-ratio: 2/3; object-fit: cover; }
.req-noart { width: 56px; aspect-ratio: 2/3; border-radius: var(--radius-medium); background: var(--muted); }
.req-title { font-weight: 600; }
.req-meta { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin: var(--space-1) 0; }
.req-overview { color: var(--muted-foreground); font-size: var(--text-7); line-height: 1.45; }
.req-eta { font-size: var(--text-7); font-weight: 550; color: var(--primary); }
.req-action { flex: none; display: flex; align-items: center; min-height: 40px; }
/* Ligne entierement cliquable ("Demandes") : c'est la ligne qui ouvre la
   fiche, pas seulement la jaquette. */
.card-clickable { cursor: pointer; border-radius: var(--radius-large); transition: background .12s ease; }
.card-clickable:hover { background: var(--muted); }
.card-clickable:hover .req-title { color: var(--primary); }
.clickable { cursor: pointer; }
.clickable:hover { opacity: .85; }

/* Etageres de la page de demandes (tendances, ajouts recents). */
.shelf-row {
  display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
  /* Le defilement horizontal reste dans l'etagere : la page elle-meme ne
     doit jamais defiler lateralement. */
  scrollbar-width: thin;
}
.shelf-card { flex: none; width: 132px; scroll-snap-align: start; }
.shelf-art { position: relative; border-radius: var(--radius-large); overflow: hidden; background: var(--muted); box-shadow: var(--shadow-small); transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease; }
.shelf-art img { width: 100%; display: block; aspect-ratio: 2/3; object-fit: cover; }
.shelf-art .req-noart { width: 100%; }
.shelf-art.clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-large); }
.shelf-flag { position: absolute; top: var(--space-2); left: var(--space-2); display: flex; background: var(--card); border-radius: var(--radius-full); box-shadow: var(--shadow-medium); }
.shelf-title { margin-top: var(--space-2); font-size: var(--text-7); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-sub { font-size: var(--text-8); }
.shelf-ask { margin-top: var(--space-1); width: 100%; }
/* Carte "Voir plus" en bout d'etagere : meme largeur qu'une affiche, pour se
   lire comme la suite de la rangee. */
.shelf-more {
  flex: none; align-self: flex-start; width: 132px; aspect-ratio: 2/3;
  flex-direction: column; gap: var(--space-2);
  border: 1px dashed var(--input); border-radius: var(--radius-large);
  background: var(--faint); color: var(--muted-foreground); box-shadow: none; background-image: none;
  scroll-snap-align: start;
}
.shelf-more:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* Fiche detaillee d'un titre. */
.detail-tagline { font-style: italic; color: var(--muted-foreground); margin-bottom: var(--space-2); }
.detail-overview { line-height: 1.55; margin: var(--space-3) 0; }
.detail-state { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.detail-h3 { margin: var(--space-6) 0 var(--space-2); }
.cast-row { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); scrollbar-width: thin; }
.cast-card { flex: none; width: 92px; }
.cast-card img, .cast-noart { width: 92px; height: 122px; border-radius: var(--radius-large); object-fit: cover; display: block; background: var(--muted); }
.cast-name { font-size: var(--text-7); font-weight: 550; margin-top: var(--space-1); line-height: 1.25; }
.cast-role { font-size: var(--text-8); line-height: 1.25; }

/* Saisons a demander : depliables, comme sur la fiche d'un media. La case
   choisit la saison sans la deplier ; une saison deja possedee ou demandee
   reste consultable mais n'est plus cochable. */
.season-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.season-head .detail-h3 { margin-bottom: var(--space-2); }
.season-item > summary { justify-content: flex-start; gap: var(--space-3); padding: var(--space-2) var(--space-3); }
.season-item > summary::after { margin-inline-start: auto; }
.season-item.done > summary { opacity: .6; }
/* La case reste cliquable seule : sans cette zone propre, un clic a cote
   deplierait la saison au lieu de la cocher. */
.season-check { display: flex; align-items: center; margin: 0; padding: 2px; flex: none; }
.season-item .grow { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.season-name { font-weight: 600; }
.season-item > .season-episodes { margin: 0; padding: 2px var(--space-3) var(--space-3); }
.season-overview { color: var(--muted-foreground); font-size: var(--text-7); line-height: 1.5; margin: var(--space-3) 0 var(--space-1); }
.season-empty { padding: var(--space-3) var(--space-1); }
.ep { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-1); border-bottom: 1px solid var(--border); }
.ep:last-child { border-bottom: 0; }
.ep-num { flex: none; width: 2.6rem; font-variant-numeric: tabular-nums; font-size: var(--text-7); color: var(--muted-foreground); padding-top: 2px; }
.ep-head { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.ep-title { font-weight: 600; }
.ep.has-file .ep-title { color: var(--success); }
.ep-meta { font-size: var(--text-7); margin-top: 2px; }
.ep-overview { color: var(--muted-foreground); font-size: var(--text-7); line-height: 1.5; margin: var(--space-1) 0 0; }
/* Choix des saisons d'une serie a l'ajout manuel (administration). */
.season-picker { --grid-gap: var(--space-2) var(--space-4); }

/* --- Navigation basse (telephone) ---------------------------------------- */
/* Masquee par defaut : sur grand ecran la barre du haut suffit. */
.tabbar { display: none; }

/* --- Presentation de la nouvelle version --------------------------------- */
.tour-modal { width: min(100% - 2rem, 560px); }
.tour-body { text-align: center; }
.tour-text { color: var(--muted-foreground); line-height: 1.6; margin: var(--space-4) 0 0; text-align: left; }
.tour-text b { color: var(--foreground); }
.tour-foot-bar { justify-content: space-between; align-items: center; }
.tour-dots { display: flex; gap: var(--space-1); }
.tour-dots span { width: 6px; height: 6px; border-radius: 999px; background: var(--border); transition: background .15s ease, width .15s ease; }
.tour-dots span.on { width: 18px; background: var(--primary); }
/* Illustrations : de fausses captures, faites en HTML. Elles ne montrent
   aucune donnee reelle et n'ont donc rien a charger. */
.tour-frame, .tour-hero {
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-medium);
  padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); text-align: left;
}
.tour-search {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-medium);
  font-size: var(--text-7);
}
.tour-btn { padding: var(--space-1) var(--space-3); border-radius: var(--radius-medium); font-size: var(--text-7); font-weight: 600; background: var(--muted); flex: none; }
.tour-btn.primary { background: var(--primary); color: var(--primary-foreground); }
.tour-row { display: flex; align-items: center; gap: var(--space-3); }
.tour-poster { width: 34px; height: 50px; border-radius: var(--radius-small); flex: none; background: linear-gradient(135deg, var(--muted), var(--border)); }
.tour-poster.sm { width: 26px; height: 38px; }
.tour-line { height: 8px; border-radius: 999px; background: var(--border); margin: var(--space-1) 0; }
.tour-line.faint-line { background: var(--muted); }
.tour-line.w40 { width: 40%; } .tour-line.w50 { width: 50%; }
.tour-line.w60 { width: 60%; } .tour-line.w70 { width: 70%; }
.tour-chips { display: flex; gap: var(--space-1); margin-top: var(--space-1); }
.tour-toast { align-self: flex-end; font-size: var(--text-7); padding: var(--space-2) var(--space-3); border: 1px solid var(--success); border-radius: var(--radius-medium); background: var(--muted); }
.tour-season { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-7); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-medium); }
.tour-season.open { display: block; border-color: var(--primary); }
.tour-season-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-7); }
.tour-check { width: 14px; height: 14px; border-radius: var(--radius-small); flex: none; border: 1px solid var(--border); }
.tour-check.on { background: var(--primary); border-color: var(--primary); }
.tour-ep { display: flex; gap: var(--space-2); font-size: var(--text-7); padding: var(--space-1) 0 var(--space-1) var(--space-6); border-top: 1px solid var(--border); margin-top: var(--space-2); }
.tour-ep span:nth-child(2) { flex: 1; font-weight: 550; }
.tour-frame .tour-foot { display: flex; justify-content: flex-end; }
.tour-hero { align-items: center; text-align: center; padding: var(--space-4); }
.tour-badge { font-size: var(--text-8); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-foreground); background: var(--primary); padding: var(--space-1) var(--space-2); border-radius: 999px; }
.tour-speed { width: 100%; display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-1); }
.tour-speed-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-7); }
.tour-speed-row span:first-child { width: 88px; text-align: left; flex: none; }
.tour-bar { height: 10px; border-radius: 999px; }
.tour-bar.old { width: 22%; background: var(--border); }
.tour-bar.new { width: 88%; background: var(--primary); }
.tour-speed-note { font-size: var(--text-7); line-height: 1.5; }
.tour-phone { display: flex; justify-content: center; padding: var(--space-2) 0; }
.tour-phone-screen { width: 132px; height: 200px; border-radius: var(--radius-large); border: 2px solid var(--border); background: var(--background); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); }
.tour-app-icon { width: 54px; height: 54px; border-radius: var(--radius-large); color: var(--primary-foreground); background: #0B0C10; display: flex; align-items: center; justify-content: center; font-size: var(--text-1); font-weight: 700; line-height: 1; }
.tour-app-name { font-size: var(--text-7); font-weight: 600; }

/* --- Pages de connexion ------------------------------------------------- */
.auth-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--space-6);
  background:
    radial-gradient(60rem 30rem at 50% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 70%),
    radial-gradient(40rem 24rem at 90% 110%, color-mix(in srgb, var(--primary-2) 12%, transparent), transparent 70%);
}
.auth-card { width: 100%; max-width: 400px; padding: var(--space-8); border-radius: calc(var(--radius-large) + 4px); box-shadow: var(--shadow-large); }
.auth-card .brand { justify-content: center; margin-bottom: var(--space-6); font-size: var(--text-3); }
.auth-card .brand-logo svg { height: 44px; }
.tour-app-icon { overflow: hidden; border-radius: 22%; }
.tour-app-icon svg { width: 100%; height: 100%; display: block; }
.auth-card button[type=submit] { margin-top: var(--space-2); padding-block: .625rem; }

/* =========================================================================
   Briques d'interface (components.js) et ecrans refaits.
   ========================================================================= */

/* --- Entree d'ecran --------------------------------------------------------
   Un fondu court a chaque changement d'ecran (pas a chaque rafraichissement :
   la classe n'est reposee que par le routeur). */
@keyframes view-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#view.view-enter > * { animation: view-in .28s cubic-bezier(.2, .8, .2, 1) both; }
#view.view-enter > *:nth-child(2) { animation-delay: .03s; }
#view.view-enter > *:nth-child(3) { animation-delay: .06s; }
#view.view-enter > *:nth-child(n+4) { animation-delay: .09s; }

/* --- En-tete d'ecran ------------------------------------------------------- */
.page-head, main > .hstack:first-child {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3) var(--space-4); flex-wrap: wrap;
}
.page-title { min-width: 0; }
.page-title h1 { margin-bottom: 2px; }
.page-sub { max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* --- Boutons icone seule --------------------------------------------------- */
button.icon-only, a.button.icon-only { padding-inline: var(--space-2); min-width: 2.25rem; }
button.icon-only .ico { margin: 0; }
.show-mobile { display: none !important; }

/* Bouton d'une demande deja partie (retour immediat). */
button.is-done { background: var(--success); color: #fff; opacity: 1; }

/* --- Menu d'actions -------------------------------------------------------- */
.action-menu { display: inline-flex; }
.menu-panel {
  min-width: 240px; max-width: 320px; margin: 0; padding: var(--space-1);
  list-style: none; border: 1px solid var(--border); background: var(--card);
}
.menu-panel .menu-title {
  padding: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--text-8); font-weight: 600; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .05em;
}
.menu-panel hr { margin: var(--space-1) 0; }
.menu-panel [role=menuitem] {
  display: flex; align-items: flex-start; gap: var(--space-3); width: 100%;
  padding: var(--space-2) var(--space-3); text-align: left; white-space: normal;
  background: transparent; background-image: none; box-shadow: none; border: 0;
  color: var(--foreground); border-radius: var(--radius-medium); font-weight: 500;
}
.menu-panel [role=menuitem]:hover:not(:disabled),
.menu-panel [role=menuitem]:focus-visible { background: var(--accent); outline: none; }
.menu-panel [role=menuitem] .ico { margin-top: 2px; color: var(--muted-foreground); }
.menu-panel [role=menuitem].danger, .menu-panel [role=menuitem].danger .ico { color: var(--danger); }
.menu-panel [role=menuitem].danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.menu-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-hint { font-size: var(--text-8); font-weight: 400; color: var(--muted-foreground); line-height: 1.4; }

/* --- Aide qu'on peut toucher ---------------------------------------------- */
.tip { display: inline-block; position: relative; border: 0; background: none; overflow: visible; vertical-align: middle; }
.tip > summary {
  display: inline-flex; padding: 2px; border-radius: var(--radius-full);
  color: var(--muted-foreground); background: none;
}
.tip > summary::after { display: none; }
.tip > summary:hover { color: var(--primary); background: none; }
.tip[open] > summary { border: 0; color: var(--primary); }
.tip-body {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(300px, 80vw); padding: var(--space-2) var(--space-3);
  font-size: var(--text-8); line-height: 1.5; color: var(--foreground);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-medium);
  box-shadow: var(--shadow-large);
}

/* --- Onglets --------------------------------------------------------------- */
.tabs {
  display: flex; width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] { flex: none; gap: var(--space-2); text-decoration: none; }
a[role=tab][aria-selected=false] { color: var(--muted-foreground); }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--muted); color: var(--muted-foreground);
}
[role=tab][aria-selected=true] .tab-count { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }

/* --- A faire (tableau de bord) --------------------------------------------- */
.todo { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.todo-item {
  --_c: var(--warning);
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); color: var(--foreground); text-decoration: none;
  background: color-mix(in srgb, var(--_c) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--_c) 28%, var(--border)); border-radius: var(--radius-large);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.todo-item.danger { --_c: var(--danger); }
.todo-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-medium); }
.todo-icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: var(--radius-medium);
  color: var(--_c); background: color-mix(in srgb, var(--_c) 14%, transparent);
}
.todo-item strong { display: block; font-weight: 600; }
.todo-hint { display: block; font-size: var(--text-8); color: var(--muted-foreground); line-height: 1.4; }
.todo-go { font-size: 1.4rem; color: var(--muted-foreground); line-height: 1; }

/* --- Barre d'outils : recherche + tri, puis pastilles ---------------------- */
.toolbar { display: flex; align-items: center; gap: var(--space-2); }
.toolbar .search-field { flex: 1; }
.search-ico {
  position: absolute; z-index: 2; left: var(--space-3); top: 50%; transform: translateY(-50%);
  display: flex; color: var(--muted-foreground); pointer-events: none;
}
.search-field:has(.search-ico) input { padding-left: 2.35rem; padding-right: var(--space-3); }
.sort-field {
  position: relative; display: flex; align-items: center; flex: none; margin: 0;
  font-weight: 400; color: var(--muted-foreground);
}
.sort-field > .ico { position: absolute; left: var(--space-3); pointer-events: none; }
.sort-field select { margin: 0; width: auto; padding-left: 2.2rem; }
.select-compact { width: auto; margin: 0; }

.chip-row {
  display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none;
  padding: 1px; margin: calc(var(--space-2) * -1) -1px 0;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row + .chip-row { margin-top: calc(var(--space-2) * -1); }
.chip {
  flex: none; padding: .3125rem var(--space-3); border-radius: var(--radius-full);
  font-size: var(--text-7); font-weight: 500;
  background: var(--card); background-image: none; color: var(--muted-foreground);
  border: 1px solid var(--border); box-shadow: none;
}
.chip:hover { --_hov: var(--card); color: var(--foreground); border-color: var(--input); }
.chip[aria-pressed=true] {
  --_hov: var(--foreground);
  background: var(--foreground); color: var(--background); border-color: var(--foreground);
}

/* --- Lignes a vignette (a confirmer, ajout manuel) ------------------------- */
.media-rows td { vertical-align: top; }
.media-rows .cell-thumb { width: 60px; padding-right: 0; }
.media-rows .cell-thumb img, .thumb-empty {
  display: block; width: 48px; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: var(--radius-small); background: var(--muted); box-shadow: var(--shadow-small);
}
.media-rows .cell-main .badge { margin-left: var(--space-1); }
.media-rows .cell-actions { width: 1%; white-space: nowrap; text-align: right; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }

/* --- File d'attente -------------------------------------------------------- */
.live-dot { display: inline-flex; align-items: center; gap: var(--space-2); }
.live-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent);
  animation: live 2s infinite;
}
@keyframes live { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.queue-table .q-release { max-width: 340px; }
.queue-table .q-progress .text-light { font-size: var(--text-8); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* --- Configuration --------------------------------------------------------- */
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: var(--space-3) var(--space-4); margin-bottom: var(--space-5);
}
.card-head h2 { margin-bottom: 2px; }
.card-tools { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.savebar {
  position: fixed; z-index: 70; left: 50%; bottom: var(--space-5); transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--foreground); color: var(--background);
  border-radius: var(--radius-full); box-shadow: var(--shadow-large);
  animation: view-in .2s ease both;
}
.savebar-text { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-7); font-weight: 500; margin-right: var(--space-2); }
.savebar .ghost { color: var(--background); --_hov: color-mix(in srgb, var(--background) 14%, transparent); }
.savebar button:not(.ghost) { border-radius: var(--radius-full); }
@media (min-width: 721px) { .savebar { left: calc(50% + var(--sidebar-w) / 2); } }
body.has-savebar main { padding-bottom: calc(var(--space-16) + 40px); }

/* --- Fiche d'un media (feuille) -------------------------------------------- */
dialog.media-sheet { padding: 0; }
dialog.modal.media-sheet > header.sheet-float {
  position: absolute; z-index: 5; top: var(--space-3); right: var(--space-3);
  padding: 0; border: 0; background: none;
}
.sheet-close {
  width: 36px; height: 36px; padding: 0; border-radius: var(--radius-full);
  color: #fff; background: rgb(10 10 16 / .45); background-image: none;
  backdrop-filter: blur(10px); border: 1px solid rgb(255 255 255 / .18);
}
.sheet-close:hover { --_hov: rgb(10 10 16 / .65); }
dialog.modal.media-sheet > div.sheet-body { padding: 0 var(--space-6) var(--space-6); overflow-y: auto; }
.detail-banner {
  position: relative; isolation: isolate; overflow: hidden;
  margin: 0 calc(var(--space-6) * -1) var(--space-5); padding: var(--space-10) var(--space-6) var(--space-6);
  background: var(--muted);
}
.detail-backdrop {
  position: absolute; inset: -20px; z-index: -2;
  background-size: cover; background-position: center 30%;
  filter: blur(2px) saturate(1.1); transform: scale(1.04);
}
.detail-banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--card) 30%, transparent) 0%, var(--card) 92%);
}
.detail-banner-inner { display: flex; gap: var(--space-6); align-items: flex-end; }
.detail-cover {
  width: 150px; flex: none; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: var(--radius-large); box-shadow: var(--shadow-large), 0 0 0 1px rgb(255 255 255 / .08);
}
.detail-id { min-width: 0; flex: 1; }
.detail-id h2 { font-size: var(--text-1); letter-spacing: -.03em; line-height: 1.15; margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.detail-year { font-weight: 400; color: var(--muted-foreground); }
.detail-cta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.action-hint { margin: var(--space-2) 0 0; font-size: var(--text-8); color: var(--muted-foreground); max-width: 60ch; }
.detail-panel { margin-top: var(--space-4); }
.detail-overview { color: var(--muted-foreground); line-height: 1.6; max-width: 75ch; margin-bottom: var(--space-5); }
.path-box {
  margin-top: var(--space-1); padding: var(--space-2) var(--space-3);
  background: var(--faint); border: 1px solid var(--border); border-radius: var(--radius-medium);
}
.season-note { margin-bottom: var(--space-3); font-size: var(--text-7); }

/* Fiche d'un titre, page Demandes : meme banniere que la fiche d'un media. */
.detail-genres { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.detail-banner .detail-state { margin: var(--space-3) 0 0; }
.detail-banner .detail-cta[hidden] { display: none; }
.detail-cover.skeleton, .detail-cover.req-noart { width: 150px; aspect-ratio: 2 / 3; margin: 0; border-radius: var(--radius-large); }
.detail-tagline { font-style: italic; color: var(--muted-foreground); margin: 0 0 var(--space-2); }
.detail-credits { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-2); font-size: var(--text-7); }
.detail-credits > div { display: contents; }
.detail-credits dt { color: var(--muted-foreground); }
.detail-credits dd { margin: 0; }
.request-sheet #overview-more { margin: calc(var(--space-3) * -1) 0 var(--space-3); padding-inline: 0; }

/* Saisons : une ligne lisible, les actions a l'interieur. */
details.season { background: var(--card); }
details.season.off > summary { opacity: .6; }
details.season > summary { gap: var(--space-3); padding: var(--space-3) var(--space-4); }
details.season > summary::after { margin-inline-start: 0; }
.season-progress { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-8); font-weight: 400; }
.season-bar { flex: 0 1 140px; height: 6px; border-radius: var(--radius-full); background: var(--muted); overflow: hidden; }
.season-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.season-body { padding: var(--space-3) var(--space-4) var(--space-2); }
.season-tools { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); font-size: var(--text-7); }
.ep-table .ep-code { font-variant-numeric: tabular-nums; color: var(--muted-foreground); white-space: nowrap; }
.ep-table tr.has-file .ep-name { color: var(--foreground); }
.ep-table .ep-action { width: 1%; white-space: nowrap; }

/* --- Agenda (calendrier sur telephone) ------------------------------------- */
.agenda-past { margin-bottom: var(--space-2); color: var(--primary); }
.agenda-day + .agenda-day { margin-top: var(--space-4); }
.agenda-date {
  position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 1; padding: var(--space-1) 0;
  font-size: var(--text-8); font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted-foreground); background: var(--card);
}
.agenda-day.today .agenda-date { color: var(--primary); }
.agenda-item {
  --_c: var(--primary);
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  padding: var(--space-2); margin-top: var(--space-1); text-align: left; white-space: normal;
  color: var(--foreground); font-weight: 400;
  background: var(--faint); background-image: none; box-shadow: inset 3px 0 0 var(--_c);
  border: 0; border-radius: var(--radius-medium);
}
.agenda-item.vod { --_c: var(--muted-foreground); }
.agenda-item.bluray { --_c: var(--success); }
.agenda-item.cinema { --_c: var(--warning); }
.agenda-item.done { opacity: .55; }
.agenda-item img, .agenda-item .thumb-empty { width: 36px; flex: none; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 5px; }
.agenda-title { display: block; font-weight: 600; line-height: 1.3; }
.agenda-sub { display: block; font-size: var(--text-8); color: var(--muted-foreground); }
.agenda-kind {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--text-8); font-weight: 600; color: var(--_c);
}

/* --- Recherche globale ----------------------------------------------------- */
.palette-btn {
  justify-content: flex-start; gap: var(--space-2); width: 100%;
  margin-bottom: var(--space-3); padding: var(--space-2) var(--space-3);
  color: var(--muted-foreground); font-weight: 400;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-small);
}
.palette-btn:hover { color: var(--foreground); }
.palette-btn .palette-btn-label { flex: 1; text-align: left; }
.palette-btn kbd { font-size: 10px; }
dialog.palette-modal {
  width: min(100% - 2rem, 600px); margin-top: 12vh; max-height: 70vh;
}
dialog.palette-modal[open] { display: flex; flex-direction: column; }
dialog.modal.palette-modal > .palette-search {
  flex: none;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
}
.palette-search > .ico { color: var(--muted-foreground); width: 20px; height: 20px; }
.palette-search input {
  flex: 1; margin: 0; padding: var(--space-2) 0; border: 0; box-shadow: none; background: none;
  font-size: var(--text-5);
}
.palette-search input:focus { box-shadow: none; }
dialog.modal.palette-modal > .palette-list { flex: 1; overflow-y: auto; padding: var(--space-2); min-height: 120px; }
.pal-group {
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: var(--text-8); font-weight: 600; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .05em;
}
.pal-item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  padding: var(--space-2) var(--space-3); text-align: left; white-space: normal;
  color: var(--foreground); font-weight: 400;
  background: transparent; background-image: none; box-shadow: none; border: 0; border-radius: var(--radius-medium);
}
.pal-item[aria-selected=true] { background: var(--accent); }
.pal-item img { width: 28px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; flex: none; }
.pal-icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: var(--radius-small);
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.pal-label { display: block; font-weight: 500; }
.pal-hint { display: block; font-size: var(--text-8); color: var(--muted-foreground); }
.pal-enter { color: var(--muted-foreground); opacity: 0; }
.pal-item[aria-selected=true] .pal-enter { opacity: 1; }
.pal-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--muted-foreground); }

/* --- Tirer pour rafraichir ------------------------------------------------- */
.ptr {
  position: fixed; z-index: 80; top: calc(env(safe-area-inset-top) + 8px); left: 50%;
  transform: translate(-50%, 0); opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  color: var(--muted-foreground); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-full); box-shadow: var(--shadow-medium);
}
.ptr.ready { color: var(--primary); }
.ptr.loading { opacity: 1; color: var(--primary); }
.ptr.loading .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Telephone
   ========================================================================= */
@media (max-width: 720px) {
  body { overscroll-behavior-y: contain; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }

  /* En-tete : titre sur sa ligne, actions dessous a parts egales. */
  .page-head { align-items: stretch; flex-direction: column; gap: var(--space-3); }
  .page-title h1 { font-size: 1.5rem; }
  .page-actions { width: 100%; flex-wrap: nowrap; }
  .page-actions > button, .page-actions > a.button, .page-actions > select { flex: 1; min-width: 0; }
  .page-actions > .action-menu { flex: none; }

  /* Les menus deviennent des feuilles qui remontent du bas de l'ecran. Le
     script d'Oat les positionne sous leur bouton : on reprend la main. */
  .menu-panel:popover-open {
    position: fixed; inset: auto 0 0 0 !important; top: auto !important; left: 0 !important;
    width: 100%; max-width: none; margin: 0;
    padding: var(--space-2) var(--space-2) calc(var(--space-3) + env(safe-area-inset-bottom));
    border-radius: calc(var(--radius-large) + 4px) calc(var(--radius-large) + 4px) 0 0;
    border-width: 1px 0 0; box-shadow: 0 -12px 40px -12px rgb(0 0 0 / .35);
    animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1);
  }
  .menu-panel:popover-open::before {
    content: ""; display: block; width: 36px; height: 4px; margin: 2px auto var(--space-2);
    border-radius: var(--radius-full); background: var(--border);
  }
  .menu-panel::backdrop { background: rgb(8 9 14 / .35); }
  .menu-panel [role=menuitem] { padding: var(--space-3); min-height: 52px; }

  .tip-body { position: fixed; left: var(--space-4); right: var(--space-4); top: auto; transform: none; max-width: none; width: auto; margin-top: var(--space-2); }

  .tabs { width: auto; }

  .todo { grid-template-columns: 1fr; }
  .facts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-4)); padding: 2px var(--space-4); }
  .facts::-webkit-scrollbar { display: none; }
  .fact { flex: none; }

  .chip-row { margin-inline: calc(-1 * var(--space-4)); padding-inline: var(--space-4); }
  .sort-field select { max-width: 150px; }
  .chip, .tabs [role=tab] { min-height: 38px; }

  /* Tableaux empiles : chaque ligne devient une carte. Le titre en tete, les
     valeurs chiffrees en ligne avec leur intitule, l'action en bas. */
  .stack { min-width: 0; overflow: visible; }
  .stack table, .stack tbody, .stack tr, .stack td { display: block; width: auto; }
  .stack thead { display: none; }
  .stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .stack tr:hover { background: none; }
  .stack tr:last-child { border-bottom: 0; }
  .stack td { padding: 0; border: 0; text-align: left; }
  .stack td.cell-title, .stack td.cell-sub, .stack td.cell-wide, .stack td.cell-first { flex: 1 1 100%; }
  .stack td.cell-first { order: -1; }
  .stack td.cell-sub { font-size: var(--text-8); color: var(--muted-foreground); }
  .stack td.cell-wide:empty, .stack td[data-col]:empty { display: none; }
  .stack td[data-col] { font-size: var(--text-7); color: var(--foreground); }
  .stack td[data-col]::before {
    content: attr(data-col); display: block;
    font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted-foreground);
  }
  .stack td.cell-actions { flex: 1 1 100%; margin-top: var(--space-2); }
  .stack td.cell-actions button { width: 100%; }

  /* File : la barre de progression prend toute la largeur. */
  .queue-table .q-release { max-width: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .queue-table .q-progress { display: flex; align-items: center; gap: var(--space-3); }
  .queue-table .q-progress progress { flex: 1; }
  .queue-table .q-progress .text-light { margin: 0; font-weight: 600; color: var(--foreground); }

  /* Episodes : code et titre sur une ligne, etat et loupe a droite. */
  .ep-table tr { flex-wrap: nowrap; align-items: center; gap: var(--space-3); }
  .ep-table td.ep-code { flex: none; font-size: var(--text-8); }
  .ep-table td.ep-name { flex: 1; min-width: 0; font-weight: 500; }
  .ep-table td[data-col] { display: none; }
  .ep-table td.ep-state { flex: none; }
  .ep-table td.ep-action { flex: none; }
  .ep-table td.ep-action button { min-height: 38px; min-width: 38px; padding: 0; justify-content: center; }
  .season-body { padding-inline: var(--space-3); }
  .season-tools button { flex: 1; }
  .season-bar { flex-basis: 64px; }
  details.season > summary { padding: var(--space-3); min-height: 52px; }

  /* Lignes a vignette : l'action passe sous le texte. */
  .media-rows table, .media-rows tbody { display: block; }
  .media-rows tr.media-row { display: grid; grid-template-columns: 56px 1fr; gap: var(--space-1) var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .media-rows td { display: block; padding: 0; border: 0; }
  .media-rows .cell-thumb { grid-row: span 2; width: auto; }
  .media-rows .cell-actions { grid-column: 2; text-align: left; }
  .media-rows .cell-actions button { width: 100%; }

  /* Fiche : feuille plein ecran, banniere bord a bord. */
  dialog.modal.media-sheet > header.sheet-float { padding: 0; top: calc(var(--space-3) + env(safe-area-inset-top)); }
  /* Rond de 44 px : la hauteur minimale des boutons au doigt (44 px) l'etirait
     en ovale quand il ne faisait que 36 px de large. */
  .sheet-close { width: 44px; height: 44px; min-height: 44px; min-width: 44px; }
  dialog.modal.media-sheet > div.sheet-body { padding: 0 var(--space-4) calc(var(--space-8) + env(safe-area-inset-bottom)); }
  .detail-banner { margin-inline: calc(var(--space-4) * -1); padding: calc(var(--space-12) + env(safe-area-inset-top)) var(--space-4) var(--space-5); }
  .detail-banner-inner { flex-direction: column; align-items: center; text-align: center; gap: var(--space-4); }
  .detail-cover { width: 132px; }
  .detail-cover.skeleton, .detail-cover.req-noart { width: 132px; }
  .detail-genres { justify-content: center; }
  .request-sheet > footer { background: var(--card); }
  .detail-id { width: 100%; }
  .detail-id .meta-line { justify-content: center; }
  .detail-cta { flex-wrap: nowrap; }
  .detail-cta > button { flex: 1; }
  .action-hint { margin-inline: auto; }
  .detail-panel .row > [data-field] { margin-bottom: var(--space-3); }

  /* Recherche globale : en haut de l'ecran, pleine largeur. */
  .palette-btn { width: auto; margin: 0 0 0 auto; padding: var(--space-2); border: 0; box-shadow: none; background: none; }
  .palette-btn .palette-btn-label, .palette-btn kbd { display: none; }
  .topbar .palette-btn + .nav + #health, .topbar .palette-btn ~ #health { margin-left: 0; }
  dialog.palette-modal { width: 100%; max-width: none; margin: 0; max-height: 85dvh; border-radius: 0 0 calc(var(--radius-large) + 4px) calc(var(--radius-large) + 4px); padding-top: env(safe-area-inset-top); }
  .palette-search kbd { display: none; }
  .pal-item { min-height: 48px; }

  /* Barre d'enregistrement : au-dessus de la navigation basse. */
  .savebar { left: var(--space-3); right: var(--space-3); transform: none; bottom: calc(68px + env(safe-area-inset-bottom)); border-radius: var(--radius-large); }
  .savebar-text { flex: 1; margin: 0; }
  body.has-savebar main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

  /* Onglet "Valider" : il ne prend sa place que lorsqu'il sert. */
  .tabbar a[hidden] { display: none; }
}

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }



/* =========================================================================
   Statistiques
   Couleurs de graphique validees (script dataviz, deux themes) : indigo de
   la marque, un cran plus sombre en theme sombre pour rester dans la bande
   de luminosite ; orange en seconde serie. Le texte ne prend jamais la
   couleur d'une serie.
   ========================================================================= */
:root {
  --viz-1: light-dark(#5b5bd6, #7c79f2);
  --viz-2: light-dark(#eb6834, #d95926);
  --viz-grid: light-dark(#eceef2, #23252f);
}

.stats-panel { display: flex; flex-direction: column; gap: var(--space-4); }
.stats-panel[hidden] { display: none; }

.stat-tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat-tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--space-4); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-large); box-shadow: var(--shadow-small);
}
.stat-tile.hero { grid-column: span 2; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--card)), var(--card) 70%); }
.tile-label { font-size: var(--text-8); font-weight: 500; color: var(--muted-foreground); }
.tile-value { font-size: 1.625rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.2; color: var(--foreground); overflow-wrap: anywhere; }
.stat-tile.hero .tile-value { font-size: 2.75rem; }
.tile-value small { font-size: .55em; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }
.tile-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-8); color: var(--muted-foreground); }
.tile-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-delta.up { color: var(--success); }
.tile-delta.down { color: var(--danger); }

.viz-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.viz-card { min-width: 0; }
.viz-card.wide { grid-column: 1 / -1; }
.viz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.viz-head h2 { margin-bottom: 2px; }
.viz-sub { font-size: var(--text-8); }
.viz-note { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-8); margin: 0; }
.small-link { font-size: var(--text-8); white-space: nowrap; }
.viz-empty { padding: var(--space-6) 0; text-align: center; color: var(--muted-foreground); font-size: var(--text-7); }
.viz-error { display: flex; gap: var(--space-3); align-items: flex-start; border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.viz-error > .ico { color: var(--warning); width: 22px; height: 22px; flex: none; }
.viz-error .text-light { font-size: var(--text-8); margin-top: 2px; }

.viz-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-3); font-size: var(--text-8); color: var(--muted-foreground); }
.viz-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: var(--space-1); vertical-align: -1px; }
.viz-legend i.s1 { background: var(--viz-1); }
.viz-legend i.s2 { background: var(--viz-2); }

/* Colonnes : echelle a gauche, grille en filets, barres fines a bout arrondi. */
.colchart { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2); height: 220px; }
.colchart .yaxis {
  display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px;
  font-size: 10px; color: var(--muted-foreground); text-align: right; font-variant-numeric: tabular-nums;
}
.colchart .yaxis span { transform: translateY(-50%); }
.colchart .yaxis span:last-child { transform: translateY(0); }
.colchart .plot { position: relative; display: flex; flex-direction: column; min-width: 0; }
.colchart .grid { position: absolute; inset: 0 0 22px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.colchart .grid i { display: block; height: 1px; background: var(--viz-grid); }
.colchart .grid i:last-child { background: var(--input); }
.colchart .cols { position: relative; flex: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); align-items: end; }
.colchart .col { height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; cursor: default; outline: none; }
.colchart .col:hover, .colchart .col:focus-visible { background: color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 4px 4px 0 0; }
.colchart .stack { width: 100%; max-width: 24px; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.colchart .seg { display: block; width: 100%; min-height: 2px; }
.colchart .seg.s1 { background: var(--viz-1); }
.colchart .seg.s2 { background: var(--viz-2); }
.colchart .stack .seg:last-child { border-radius: 4px 4px 0 0; }
.colchart .xaxis { display: grid; grid-template-columns: repeat(var(--n), 1fr); height: 22px; align-items: end; font-size: 10px; color: var(--muted-foreground); }
.colchart .xaxis span { white-space: nowrap; overflow: visible; text-align: center; }

/* Barres horizontales : libelle et valeur au-dessus, piste fine dessous. */
.hbars { display: flex; flex-direction: column; gap: var(--space-3); }
.hbar { display: flex; align-items: center; gap: var(--space-3); border-radius: var(--radius-medium); }
.hbar.clickable { cursor: pointer; }
.hbar.clickable:hover .hbar-label { color: var(--primary); }
.hbar img, .hbar .thumb-empty { width: 30px; flex: none; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; }
.hbar-main { flex: 1; min-width: 0; }
.hbar-text { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-7); }
.hbar-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; margin-top: 4px; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--viz-1) 10%, transparent); }
.hbar-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--viz-1); }
.hbar-sub { margin-top: 3px; font-size: var(--text-8); color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Carte de chaleur : une teinte, du fond a la couleur pleine. */
.heatmap { overflow-x: auto; }
.hm-grid { display: grid; grid-template-columns: 34px repeat(24, minmax(12px, 1fr)); gap: 2px; min-width: 420px; }
.hm-day { font-size: 10px; color: var(--muted-foreground); align-self: center; }
.hm-cell { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--viz-1) calc(var(--l) * 100%), var(--muted)); }
.hm-grid > span:not(.hm-day):not(.hm-cell) { font-size: 10px; color: var(--muted-foreground); white-space: nowrap; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: var(--space-3); font-size: 10px; color: var(--muted-foreground); }
.hm-legend i { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--viz-1) calc(var(--l) * 100%), var(--muted)); }
.hm-legend span { margin: 0 var(--space-1); }

.disk-meter .viz-head { align-items: baseline; margin-bottom: var(--space-3); }
.meter { height: 12px; border-radius: var(--radius-full); background: color-mix(in srgb, var(--viz-1) 12%, var(--muted)); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--viz-1); border-radius: var(--radius-full); }
.disk-meter .viz-sub { margin-top: var(--space-2); }

/* Comptes. */
.user-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.user-card { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--faint); }
.user-card.idle { opacity: .6; }
.user-head { display: flex; align-items: center; gap: var(--space-3); }
.user-head .text-light { font-size: var(--text-8); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: var(--radius-full);
  font-weight: 650; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.user-time { font-weight: 650; font-size: var(--text-5); letter-spacing: -.02em; white-space: nowrap; }
.user-facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-top: var(--space-3); font-size: var(--text-8); color: var(--muted-foreground); }
.user-facts b { color: var(--foreground); font-weight: 600; }
.user-facts .ico { margin-right: 2px; }
.user-top { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.user-title { font-size: var(--text-8); padding: 2px var(--space-2); border-radius: var(--radius-full); background: var(--card); border: 1px solid var(--border); }
.user-title em { font-style: normal; color: var(--muted-foreground); }
.user-title.clickable { cursor: pointer; }
.user-title.clickable:hover { border-color: var(--primary); }
.user-card.clickable { cursor: pointer; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.user-card.clickable:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow-small); }

/* Journal des lectures : une ligne par film ou episode lance. */
.journal-filter { margin: 0 0 var(--space-3); }
.journal-day + .journal-day { margin-top: var(--space-4); }
.journal-date {
  position: sticky; top: 0; z-index: 1; padding: var(--space-1) 0; background: var(--card);
  font-size: var(--text-8); font-weight: 600; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .05em;
}
.journal-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); margin: 0 calc(var(--space-2) * -1); border-radius: var(--radius-medium); }
.journal-row.clickable { cursor: pointer; }
.journal-row.clickable:hover { background: var(--accent); }
.journal-row img, .journal-row .thumb-empty { width: 30px; flex: none; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; }
.journal-main { min-width: 0; }
.journal-main strong { display: block; font-weight: 550; font-size: var(--text-7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-main .text-light { font-size: var(--text-8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.journal-side .text-light { font-size: var(--text-8); white-space: nowrap; }
.journal-more { margin-top: var(--space-3); }

/* Listes de medias (plus gros, jamais regardes). */
.stat-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; margin: 0 calc(var(--space-2) * -1); }
.stat-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border-radius: var(--radius-medium); }
.stat-row.clickable { cursor: pointer; }
.stat-row.clickable:hover { background: var(--accent); }
.stat-row img, .stat-row .thumb-empty { width: 30px; flex: none; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; }
.stat-row strong { display: block; font-weight: 550; font-size: var(--text-7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row .text-light { font-size: var(--text-8); }
.stat-num { font-weight: 600; font-size: var(--text-7); font-variant-numeric: tabular-nums; white-space: nowrap; }

.viz-table { margin-top: var(--space-3); border: 0; background: none; overflow: visible; }
.viz-table > summary { display: inline-flex; padding: 0; font-size: var(--text-8); font-weight: 400; color: var(--muted-foreground); }
.viz-table > summary::after { display: none; }
.viz-table > summary:hover { background: none; color: var(--foreground); }
.viz-table[open] > summary { border: 0; margin-bottom: var(--space-2); }
.viz-table .table { max-height: 260px; overflow-y: auto; }

#viz-tip {
  position: fixed; z-index: 400; pointer-events: none; opacity: 0;
  max-width: 260px; padding: var(--space-1) var(--space-2);
  font-size: var(--text-8); font-weight: 500; line-height: 1.4;
  color: var(--background); background: var(--foreground); border-radius: var(--radius-small);
  box-shadow: var(--shadow-medium); transition: opacity .1s;
}
#viz-tip.on { opacity: 1; }

@media (max-width: 720px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .stat-tile { padding: var(--space-3); }
  .stat-tile.hero .tile-value { font-size: 2.25rem; }
  .tile-value { font-size: 1.375rem; }
  .viz-grid { grid-template-columns: 1fr; }
  .colchart { height: 180px; }
  .user-cards { grid-template-columns: 1fr; }
  .journal-where { display: none; }
  .journal-date { top: calc(52px + env(safe-area-inset-top)); }
}


/* --- Notifications ---------------------------------------------------------- */
.notif-btn { gap: var(--space-2); color: var(--muted-foreground); }
.notif-btn:hover { color: var(--foreground); }
@media (min-width: 721px) {
  .topbar > .notif-btn { justify-content: flex-start; width: 100%; margin-top: var(--space-2); padding: var(--space-2) var(--space-3); font-weight: 500; }
  .topbar > .notif-btn .ico { width: 17px; height: 17px; }
}
@media (max-width: 720px) {
  .notif-btn { padding-inline: var(--space-2); min-width: 40px; justify-content: center; }
  .notif-btn .notif-label { display: none; }
  .topbar > .notif-btn { margin-left: 0; }
}
.push-state { display: flex; gap: var(--space-3); align-items: flex-start; margin-bottom: var(--space-4); }
.push-state > .ico {
  flex: none; width: 36px; height: 36px; padding: 8px; box-sizing: border-box;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); border-radius: var(--radius-medium);
}
.push-state p { margin: var(--space-1) 0 0; font-size: var(--text-7); }
.push-on { display: flex; align-items: center; gap: var(--space-2); color: var(--success); font-weight: 500; }
.push-prefs { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-large); }
.push-pref {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-3) var(--space-4); font-weight: 400; cursor: pointer;
}
.push-pref + .push-pref { border-top: 1px solid var(--border); }
.push-pref > span { display: flex; flex-direction: column; gap: 2px; }
.push-pref .text-light { font-size: var(--text-8); }
.push-pref input { flex: none; margin: 0; }
.push-actions { margin-top: var(--space-4); }

/* --- Ecrans etroits ------------------------------------------------------ */
@media (max-width: 640px) {
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .shelf-card, .shelf-more { width: 108px; }
  .req-item { flex-wrap: wrap; }
  .req-action { width: 100%; }
  .req-action button { width: 100%; }

  /* La presentation n'est pas une fiche : son contenu est court, une feuille
     plein ecran laisserait un grand vide. Elle remonte donc du bas, a la
     hauteur de ce qu'elle a a dire. */
  dialog.modal.tour-modal { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius-large) var(--radius-large) 0 0; border-bottom: 0; }
  .tour-foot-bar { flex-direction: row; }
  .tour-foot-bar .hstack { flex: 1; justify-content: flex-end; }
  .tour-foot-bar button { width: auto; }
}

/* Sur telephone, ce n'est pas un simple retrecissement : la navigation passe
   en bas (a portee de pouce), la fiche devient une feuille plein ecran avec
   son action epinglee, et les cibles tactiles passent a 44 px. */
@media (max-width: 720px) {
  main { padding: var(--space-4) var(--space-4) calc(72px + env(safe-area-inset-bottom)); min-height: 100dvh; }
  /* Sur telephone, l'entree d'ecran n'est qu'un fondu : un deplacement
     faisait redessiner les barres fixes a chaque navigation. */
  #view.view-enter > * { animation-name: view-fade; }

  /* Barre du haut reduite a l'essentiel : identite + compte. La navigation
     descend en bas de l'ecran. */
  /* Barre du haut opaque : translucide, elle laissait passer le contenu qui
     defile sous l'heure et la batterie de l'app installee (PWA), et se
     redessinait a chaque animation. Sa hauteur compte la zone de l'encoche. */
  .topbar {
    min-height: calc(52px + env(safe-area-inset-top)); flex-wrap: nowrap; gap: var(--space-2);
    padding: calc(env(safe-area-inset-top) + var(--space-1)) var(--space-3) var(--space-1);
    background: var(--background); border-bottom: 1px solid var(--border); box-shadow: none;
    transform: translateZ(0);
  }
  .topbar .nav { display: none; }
  .bulk-bar { --bulk-top: calc(64px + env(safe-area-inset-top)); }
  .topbar .brand { flex: none; margin-right: var(--space-2); }
  .topbar .brand-logo svg { height: 22px; }
  /* Le libelle "Services" tombe, le point suffit. */
  .health { flex: none; margin-left: 0; }
  #health { margin-left: auto; }
  .health-btn #health-label { display: none; }
  .health-panel { min-width: 220px; }
  #quota-badge { order: -1; }
  .account-bar { flex: 0 1 auto; min-width: 0; margin-left: auto; gap: var(--space-3); font-size: var(--text-8); }

  /* Navigation basse : cibles larges, au-dessus de la barre systeme. */
  .tabbar {
    display: flex; position: fixed; z-index: 60;
    left: 0; right: 0; bottom: 0;
    /* Opaque et sur son propre calque : floutee, elle se redessinait (et
       semblait sauter) a chaque changement d'ecran sur iPhone. */
    background: var(--card); transform: translateZ(0);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px;
    min-height: 56px; font-size: var(--text-8); font-weight: 600;
    color: var(--muted-foreground);
  }
  .tabbar a[aria-current] { color: var(--primary); }
  .tabbar-icon { display: flex; align-items: center; justify-content: center; line-height: 1; }
  /* La pastille de compte se pose sur l'icone : dans le flux, elle ferait
     grandir la barre entiere. */
  .tabbar a { position: relative; }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 10px); min-width: 18px; padding: 0 var(--space-1); font-size: var(--text-8); background: var(--primary); color: var(--primary-foreground); }
  .tabbar-icon .ico { width: 21px; height: 21px; vertical-align: 0; }

  /* Cibles tactiles : 44 px minimum, et 16 px de police dans les champs
     pour empecher iOS de zoomer automatiquement a la mise au point. */
  button, a.button { min-height: 44px; }
  button.small, a.button.small { min-height: 38px; }
  input:not([type=checkbox], [type=radio]), select, textarea { min-height: 44px; font-size: 16px; }

  .card { padding: var(--space-4); }

  /* Recherche : champ pleine largeur, boutons a parts egales dessous. */
  .req-search { flex-wrap: wrap; gap: var(--space-2); }
  .req-search .search-field { flex: 1 1 100%; }
  .req-search > button { flex: 1 1 0; }

  /* Etageres : jaquettes plus grandes et lisibles, le bouton disparait
     (on touche la jaquette pour ouvrir la fiche, et on demande de la). */
  .shelf-row { gap: var(--space-2); margin: 0 calc(-1 * var(--space-3)); padding: 0 var(--space-3) var(--space-2); scroll-padding-inline: var(--space-3); }
  .shelf-card, .shelf-more { width: 33vw; max-width: 150px; }
  .shelf-ask { display: none; }
  .req-item { gap: var(--space-3); padding: var(--space-3) 0; flex-wrap: wrap; }
  .req-art, .req-art img, .req-noart { width: 60px; }
  .req-overview { display: none; }
  .req-action { width: 100%; margin-top: var(--space-1); }
  .req-action button { width: 100%; }

  /* Fiche : feuille plein ecran. Le corps defile, l'en-tete et l'action
     restent fixes -- c'est la difference avec une simple fenetre reduite. */
  dialog.modal.wide {
    width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
    border: 0; border-radius: 0;
  }
  dialog.modal.wide > header { padding-top: calc(var(--space-3) + env(safe-area-inset-top)); }
  dialog.modal > footer { padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); }
  dialog.modal.wide > footer button { width: 100%; }

  .detail-state { justify-content: center; }
  .detail-overview { font-size: var(--text-7); line-height: 1.6; margin: var(--space-2) 0 var(--space-3); text-align: left; }
  .detail-overview.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
  .cast-row, .detail-recos { margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4) var(--space-2); scroll-padding-inline: var(--space-4); }
  .cast-card { width: 84px; }
  .cast-card img, .cast-noart { width: 84px; height: 112px; }

  /* Une case a cocher de saison doit se viser au doigt. */
  .season-item > summary { padding: var(--space-3); min-height: 48px; }
  .season-item input[type="checkbox"] { width: 20px; height: 20px; }
  .season-item > .season-episodes { padding-inline: var(--space-2); }
  .ep { padding: var(--space-2) 2px; gap: var(--space-2); }
  .ep-num { width: 2.3rem; }

  /* Le survol n'existe pas au doigt : il laissait des etats colles. */
  .shelf-art.clickable:hover { outline: 0; }
  .clickable:hover { opacity: 1; }

  /* Notifications : au-dessus de la navigation basse, sur toute la largeur. */
  .toast-container[data-placement^="bottom"] { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toast-container[data-placement$="right"] { left: var(--space-4); }
  .toast { min-width: 0; max-width: none; width: 100%; }

  /* Choisir une release sur un telephone : la ligne de tableau devient une
     carte. Un tableau a six colonnes n'y tient pas -- il faisait defiler
     horizontalement pendant qu'on lisait un titre coupe lettre par lettre. */
  .release-table, .release-table tbody, .release-table tr, .release-table td { display: block; width: auto; }
  .release-table thead { display: none; }
  .release-table tr { position: relative; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .release-table td { border: 0; padding: 0; }
  .release-table td.score { display: inline-flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-1); text-align: left; }
  .release-table td.score .delta { display: inline; }
  .release-table .release-title { white-space: normal; word-break: break-word; }
  /* Taille, seeders et tracker sur une seule ligne, chacun annonce par son
     intitule -- l'entete du tableau n'est plus la pour le dire. */
  .release-table td[data-col] { display: inline-block; margin: var(--space-2) var(--space-4) 0 0; font-size: var(--text-7); color: var(--muted-foreground); text-align: left; }
  .release-table td[data-col]::before { content: attr(data-col) " "; color: var(--muted-foreground); font-size: var(--text-8); }
  .release-table td:last-child { margin-top: var(--space-3); }
  .release-table td:last-child button { width: 100%; }
}

@media (max-width: 359px) {
  .account-bar > .account-name { display: none; }
}
@media (max-width: 400px) {
  .shelf-card, .shelf-more { width: 38vw; }
}
