:root {
  --fond: #f4f1ec; --surface: #ffffff; --surface-2: #ebe6de; --bord: #d9d2c6;
  --texte: #1f1b16; --doux: #6e665b; --accent: #b4532a; --accent-fond: #f6e3d8;
  --vert: #2f7a4f; --vert-fond: #e3f1e8; --rouge: #b23a3a; --rouge-fond: #f7e1e1;
  --ombre: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #121214; --surface: #1b1b1f; --surface-2: #26262b; --bord: #33333a;
    --texte: #ece9e4; --doux: #9c978f; --accent: #e3864f; --accent-fond: #3a261b;
    --vert: #6cc596; --vert-fond: #1b2e23; --rouge: #ef8080; --rouge-fond: #3a1f1f;
    --ombre: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --fond: #121214; --surface: #1b1b1f; --surface-2: #26262b; --bord: #33333a;
  --texte: #ece9e4; --doux: #9c978f; --accent: #e3864f; --accent-fond: #3a261b;
  --vert: #6cc596; --vert-fond: #1b2e23; --rouge: #ef8080; --rouge-fond: #3a1f1f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 15px/1.5 Inter, system-ui, sans-serif; }
h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; }
.doux { color: var(--doux); }
.compte { font: 500 13px Inter, sans-serif; color: var(--doux); }
[hidden] { display: none !important; }

.btn { font: 500 14px Inter, sans-serif; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--bord);
  background: var(--surface); color: var(--texte); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn.discret { background: none; border-color: transparent; color: var(--doux); }
.btn.discret:hover { color: var(--texte); }
.btn.petit { padding: 4px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.carte-connexion { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 14px; padding: 28px; box-shadow: var(--ombre); display: grid; gap: 14px; }
.carte-connexion label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
input { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--bord); background: var(--fond); color: var(--texte); }
.erreur { color: var(--rouge); margin: 0; }

/* page */
.entete { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--bord);
  background: var(--surface); position: sticky; top: 0; z-index: 5; }
.entete h1 { flex: 1; font-size: 20px; }
main { max-width: 1200px; margin: 0 auto; padding: 8px 24px 64px; }
.bloc { margin-top: 28px; }
.bloc > .doux { margin: 0 0 14px; }
.exceptions { background: var(--rouge-fond); border-radius: 14px; padding: 18px 20px; }
.a-confirmer { background: var(--accent-fond); border-radius: 14px; padding: 18px 20px; }

/* import */
.import { display: grid; grid-template-columns: minmax(260px, 1fr) 1.3fr; gap: 20px; margin-top: 12px; }
.depot { border: 2px dashed var(--bord); border-radius: 14px; padding: 28px 20px; display: grid; gap: 4px;
  place-items: center; text-align: center; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.depot:hover, .depot.survol { border-color: var(--accent); background: var(--accent-fond); }
.depot input { display: none; }
.aide p { margin: 0 0 8px; font-size: 14px; }
.etat { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--bord); }
.etat.ok { background: var(--vert-fond); border-color: transparent; }
.etat.ko { background: var(--rouge-fond); border-color: transparent; }
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--doux); font-size: 14px; }
table { border-collapse: collapse; margin-top: 8px; font-size: 14px; width: 100%; }
td { padding: 6px 10px; border-bottom: 1px solid var(--bord); }

/* outils */
.titre-outils { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.outils { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.outils input { min-width: 220px; }
.filtres { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.filtre { font: 500 13px Inter, sans-serif; border: 0; background: none; color: var(--doux); padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.filtre.actif { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.barre-selection { position: sticky; top: 60px; z-index: 4; display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 8px 12px; margin-top: 12px; box-shadow: var(--ombre); }
.barre-selection span { flex: 1; font-weight: 500; }

/* grilles d'affiches */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 14px; margin-top: 16px; }
.grille.petite { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.rangee { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.rangee .film { width: 120px; flex: none; }
.film { position: relative; display: grid; gap: 6px; }
.affiche { aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); box-shadow: var(--ombre); position: relative; }
.affiche img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.affiche .sans { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center;
  font: 600 13px Fraunces, serif; color: var(--doux); }
.film .nom { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.film .meta { font-size: 12px; color: var(--doux); }
.pastille { position: absolute; top: 6px; left: 6px; font: 600 10.5px Inter, sans-serif; padding: 2px 6px; border-radius: 5px;
  background: rgba(0,0,0,.62); color: #fff; }
.selection .film { cursor: pointer; }
.selection .film .affiche::after { content: ""; z-index: 2; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.35); }
.selection .film.choisi .affiche { outline: 3px solid var(--rouge); outline-offset: -3px; }
.selection .film.choisi .affiche::after { background: var(--rouge); border-color: var(--rouge);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10l3 3 7-7' stroke='white' stroke-width='2.5' fill='none'/%3E%3C/svg%3E"); }
.film .btn { justify-self: start; }
.btn.discret-bord { color: var(--doux); font-size: 12px; padding: 3px 8px; }
.pastille { z-index: 2; }

/* à confirmer */
.liste-confirmer { display: grid; gap: 10px; }
.duo { display: flex; gap: 14px; align-items: center; background: var(--surface); border-radius: 12px; padding: 10px 14px; flex-wrap: wrap; }
.duo .affiche { width: 54px; flex: none; }
.duo .txt { flex: 1; min-width: 200px; font-size: 14px; }
.duo .actions { display: flex; gap: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--texte); color: var(--fond);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--ombre); z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .entete { padding: 12px 16px; }
  main { padding: 4px 16px 48px; }
  .import { grid-template-columns: 1fr; }
  .outils input { min-width: 0; flex: 1; }
  .filtres { width: 100%; overflow-x: auto; }
  .grille { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 10px; }
  .barre-selection { top: 54px; flex-wrap: wrap; }
}

.pastille-texte { display: inline-block; font: 600 11.5px Inter, sans-serif; padding: 2px 8px; border-radius: 6px; background: var(--rouge-fond); color: var(--rouge); margin-bottom: 4px; }
#vue-coherence .duo { background: var(--surface); border: 1px solid var(--bord); }
#vue-coherence .duo .affiche { width: 70px; }
a.btn { text-decoration: none; display: inline-block; }
.txt a, .aide a { color: var(--accent); }
.selection .film .btn { display: none; }
