/*
 * Opus Libre — interface de l'expert.
 * Palette pastel (maquette validée) : fond crème, en-tête bleu lavande, cartes blanches très
 * arrondies. Les statuts gardent forme et mot en plus de la couleur ; variante sombre
 * pastel par les mêmes variables.
 */
:root {
  --papier: #fbf8f4;
  --surface: #ffffff;
  --surface-2: #f3f0fa;
  --encre: #2f3446;
  --encre-douce: #6b7090;
  --trait: #e3def0;
  --accent: #5b6fb5;
  --accent-fort: #3f4f8f;
  --accent-fond: #e9eefb;
  --sur-accent: #ffffff;
  --bouton: #b9c8f2;
  --bouton-fort: #a3b6ee;
  --sur-bouton: #26305c;
  --entete: #e9eefb;
  --protegee: #25603b;
  --protegee-fond: #dff3e6;
  --domaine: #2c4f8a;
  --domaine-fond: #e6f0ff;
  --indetermine: #7a5a10;
  --indetermine-fond: #fff0c9;
  --profil: #8a4b2a;
  --profil-fond: #fde7d9;
  --alerte: #a1262a;
  --carte-vide: #dcd7ea;
  --ombre: 0 2px 12px rgb(80 90 140 / 0.08);
  --rayon: 0.75rem;
  --rayon-carte: 1.25rem;
  --serif: "Fraunces", "Iowan Old Style", "Charter", Georgia, serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #17181f;
    --surface: #21232f;
    --surface-2: #2a2d3d;
    --encre: #ece9f5;
    --encre-douce: #a7accb;
    --trait: #373b52;
    --accent: #a9b9f0;
    --accent-fort: #c6d1f7;
    --accent-fond: #2b3252;
    --sur-accent: #141735;
    --bouton: #aab9f0;
    --bouton-fort: #c0ccf7;
    --sur-bouton: #1a1f3d;
    --entete: #232842;
    --protegee: #9ee0b6;
    --protegee-fond: #1f3a2a;
    --domaine: #a8c7ff;
    --domaine-fond: #1f2f4d;
    --indetermine: #f5d98a;
    --indetermine-fond: #3d3217;
    --profil: #f6c3a5;
    --profil-fond: #4a2e1e;
    --alerte: #ff9a9d;
    --carte-vide: #3a3e56;
    --ombre: 0 2px 12px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #17181f;
  --surface: #21232f;
  --surface-2: #2a2d3d;
  --encre: #ece9f5;
  --encre-douce: #a7accb;
  --trait: #373b52;
  --accent: #a9b9f0;
  --accent-fort: #c6d1f7;
  --accent-fond: #2b3252;
  --sur-accent: #141735;
  --bouton: #aab9f0;
  --bouton-fort: #c0ccf7;
  --sur-bouton: #1a1f3d;
  --entete: #232842;
  --protegee: #9ee0b6;
  --protegee-fond: #1f3a2a;
  --domaine: #a8c7ff;
  --domaine-fond: #1f2f4d;
  --indetermine: #f5d98a;
  --indetermine-fond: #3d3217;
  --profil: #f6c3a5;
  --profil-fond: #4a2e1e;
  --alerte: #ff9a9d;
  --carte-vide: #3a3e56;
  --ombre: 0 2px 12px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 1rem/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; text-wrap: balance; margin: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 0.25rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 0.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aide { color: var(--encre-douce); font-size: 0.9rem; }
.erreur { color: var(--alerte); font-weight: 500; }
.saut { position: absolute; left: 1rem; top: -4rem; background: var(--bouton); color: var(--sur-bouton); padding: 0.6rem 1rem; z-index: 100; border-radius: var(--rayon); }
.saut:focus { top: 0.75rem; }

/* ------------------------------------------------------------ entête et navigation */
.entete {
  position: sticky; top: 0; z-index: 20;
  background: var(--entete);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait);
}
.entete-interieur {
  max-width: 80rem; margin: 0 auto; padding: 0.6rem 1rem;
  display: flex; gap: 0.75rem 1.5rem; align-items: center; flex-wrap: wrap;
}
.marque { display: flex; flex-direction: column; line-height: 1.1; margin-right: auto; }
.marque strong { font-family: var(--serif); font-size: 1.5rem; letter-spacing: 0.01em; color: var(--accent-fort); }
.marque span { font-size: 0.75rem; color: var(--encre-douce); letter-spacing: 0.04em; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; order: 3; width: 100%; }
@media (min-width: 62rem) { .nav { order: 0; width: auto; } }
.nav button {
  background: transparent; color: var(--encre-douce); border: 0;
  border-radius: 999px; padding: 0.55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 2.75rem;
}
.nav button:hover { color: var(--encre); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nav button[aria-current="page"] { color: var(--accent-fort); background: var(--surface); font-weight: 700; }
.nav button.profil, .bouton-profil { background: var(--profil-fond); color: var(--profil); font-weight: 700; }
.nav button.profil:hover { background: var(--profil-fond); color: var(--profil); filter: brightness(0.97); }
.nav button.profil[aria-current="page"] { outline: 2px solid var(--profil); }
.outils { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.compte { font-size: 0.85rem; color: var(--encre-douce); }

/* ------------------------------------------------------------ mise en page */
main { max-width: 80rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.vue { display: flex; flex-direction: column; gap: 1.5rem; }
.vue > header { display: flex; flex-direction: column; gap: 0.35rem; }
.vue > header p { max-width: 60ch; color: var(--encre-douce); }
.carte {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-carte);
  padding: 1.1rem 1.3rem; min-width: 0;
}
.carte.ombre { box-shadow: var(--ombre); }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.champs { display: grid; gap: 0.85rem 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); align-items: end; }
.rangee { display: flex; gap: 0.5rem 0.75rem; flex-wrap: wrap; align-items: center; }
.pile { display: flex; flex-direction: column; gap: 0.75rem; }

/* ------------------------------------------------------------ formulaires */
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--encre-douce); margin-bottom: 0.2rem; }
input, select, textarea {
  width: 100%; min-height: 2.6rem; padding: 0.45rem 0.65rem; font: inherit; color: var(--encre);
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
}
input:hover, select:hover { border-color: var(--encre-douce); }
input[type="range"] { padding: 0; min-height: 2rem; accent-color: var(--accent); }
fieldset { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 0.85rem 1rem 1rem; margin: 0; min-width: 0; }
legend { padding: 0 0.4rem; font-family: var(--serif); font-weight: 600; }
button, .bouton {
  font: inherit; font-weight: 700; min-height: 2.75rem; padding: 0.4rem 1rem; border-radius: var(--rayon);
  border: 1px solid var(--bouton); background: var(--bouton); color: var(--sur-bouton); cursor: pointer;
}
button:hover { background: var(--bouton-fort); border-color: var(--bouton-fort); }
button.secondaire { background: transparent; color: var(--accent-fort); border-color: var(--trait); }
button.secondaire:hover { background: var(--accent-fond); border-color: var(--accent); }
button.petit { min-height: 2.1rem; padding: 0.15rem 0.65rem; font-size: 0.85rem; }
button.lien { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 0; min-height: 0; font-weight: 500; }
button[disabled] { opacity: 0.55; cursor: progress; }
details > summary { cursor: pointer; font-weight: 600; padding: 0.35rem 0; }
details[open] > summary { margin-bottom: 0.5rem; }

/* ------------------------------------------------------------ pastilles de statut */
.statut {
  display: inline-flex; gap: 0.4rem; align-items: center; font-weight: 700; font-size: 0.9rem;
  padding: 0.12rem 0.6rem 0.12rem 0.5rem; border-radius: 999px; white-space: nowrap;
}
.statut::before { content: ""; width: 0.7rem; height: 0.7rem; background: currentColor; flex: none; }
.pastille.protegee { color: var(--protegee); background: var(--protegee-fond); border-color: transparent; }
.pastille.domaine_public { color: var(--domaine); background: var(--domaine-fond); border-color: transparent; }
.pastille.indetermine { color: var(--indetermine); background: var(--indetermine-fond); border-color: transparent; }
.statut.protegee { color: var(--protegee); background: var(--protegee-fond); }
.statut.protegee::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }       /* triangle */
.statut.domaine_public { color: var(--domaine); background: var(--domaine-fond); }
.statut.domaine_public::before { border-radius: 50%; }                            /* disque */
.statut.indetermine { color: var(--indetermine); background: var(--indetermine-fond); }
.statut.indetermine::before { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); } /* losange */
.statut.aucun { color: var(--encre-douce); background: var(--surface-2); }
.statut.aucun::before { border: 2px solid currentColor; background: none; }
.confiance { font-size: 0.85rem; color: var(--encre-douce); }
.confiance b { color: var(--encre); font-weight: 600; }
.res { font-weight: 600; }
.res.concordant { color: var(--domaine); }
.res.ecart_comptage, .res.compatible { color: var(--indetermine); }
.res.ecart, .res.divergent { color: var(--protegee); }
.res.non_comparable { color: var(--encre-douce); }

/* ------------------------------------------------------------ verdict */
.verdict { display: flex; flex-direction: column; gap: 0.5rem; }
.verdict-tete { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.verdict-pays { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.verdict-pays small { font-family: var(--sans); font-weight: 500; color: var(--encre-douce); margin-left: 0.35rem; }
.verdict-date { font-family: var(--serif); font-size: 1.45rem; line-height: 1.2; text-wrap: balance; }
.verdict-date small { display: block; font-family: var(--sans); font-size: 0.8rem; color: var(--encre-douce); font-weight: 500; }
.liste-simple { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.trace { max-height: 22rem; overflow: auto; background: var(--surface-2); padding: 0.75rem; border-radius: var(--rayon); font: 0.78rem/1.45 var(--mono); }

/* ------------------------------------------------------------ tableaux */
.defile { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
caption { text-align: left; padding: 0.6rem 0.8rem; color: var(--encre-douce); font-size: 0.85rem; }
th, td { padding: 0.55rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
thead th { background: var(--surface-2); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--encre-douce); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-fond) 55%, transparent); }
td.num, th.num { white-space: nowrap; }
.vide { text-align: center; padding: 2rem 1rem; color: var(--encre-douce); }

/* ------------------------------------------------------------ carte du monde */
.carte-monde { width: 100%; height: auto; background: var(--surface-2); border-radius: var(--rayon); display: block; }
.carte-monde path { stroke: var(--surface-2); stroke-width: 0.4; }
.carte-monde path.couvert { cursor: pointer; stroke-width: 0.7; }
.carte-monde path.couvert:hover { stroke: var(--encre); }
.carte-monde path:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; }
.legende { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.85rem; }
.legende span { display: inline-flex; gap: 0.4rem; align-items: center; }
.legende i { width: 0.9rem; height: 0.9rem; border: 1px solid var(--encre-douce); display: inline-block; background: var(--c); }
.curseur { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; }
.curseur input { flex: 1; min-width: 12rem; }
.curseur output { font-family: var(--serif); font-size: 1.4rem; min-width: 4ch; }

/* ------------------------------------------------------------ divers */
.segments { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--trait); border-radius: 999px; overflow: hidden; }
.segments button { background: var(--surface); color: var(--encre-douce); border: 0; border-radius: 0; min-height: 2.75rem; font-weight: 600; }
.segments button[aria-pressed="true"] { background: var(--bouton); color: var(--sur-bouton); font-weight: 700; }
.synthese { display: flex; gap: 0.5rem 1.25rem; flex-wrap: wrap; }
.synthese div { display: flex; flex-direction: column; min-width: 7rem; }
.synthese strong { font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; }
.synthese span { font-size: 0.8rem; color: var(--encre-douce); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; max-width: min(24rem, calc(100vw - 2rem)); }
.toast { background: var(--accent-fort); color: var(--surface); padding: 0.65rem 0.9rem; border-radius: var(--rayon); box-shadow: var(--ombre); }
.toast.erreur { background: var(--alerte); color: #fff; }
.connexion { max-width: 26rem; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 1.25rem; }
.connexion h1 { font-size: 2rem; }
.attente { color: var(--encre-douce); display: flex; gap: 0.6rem; align-items: center; }
.attente::before { content: ""; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--trait); border-top-color: var(--accent); animation: tourne 0.8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .attente::before { animation: none; } * { scroll-behavior: auto !important; } }

.carte-monde path.choisi { stroke: var(--encre); stroke-width: 1.6; vector-effect: non-scaling-stroke; }

.pied { padding: 1rem var(--gouttiere, 16px); text-align: center; font-size: 0.8rem; color: var(--muted, inherit); opacity: .75; }

/* ------------------------------------------------------------ fiches auteur et œuvre */
.fiche-dl { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 0.35rem 1rem; margin: 0; }
.fiche-dl dt { color: var(--encre-douce); font-size: 0.9rem; }
.fiche-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 30rem) { .fiche-dl { grid-template-columns: 1fr; } .fiche-dl dd { margin-bottom: 0.4rem; } }
.bio p { max-width: 70ch; }
textarea { min-height: 8rem; resize: vertical; }
.colonnes { columns: 16rem; display: block; padding-left: 1.1rem; }
.colonnes li { break-inside: avoid; margin-bottom: 0.2rem; }
a.bouton { display: inline-block; text-decoration: none; padding-top: 0.5rem; }
a.bouton.petit-lien { min-height: 2.1rem; padding: 0.3rem 0.65rem; font-size: 0.85rem; background: transparent; color: var(--accent-fort); border-color: var(--trait); }
a.bouton.petit-lien:hover { background: var(--accent-fond); border-color: var(--accent); }
.manquants { list-style: none; padding: 0; margin: 0; }
.impact { font-size: 0.8rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--encre-douce); }
.impact.decisif { background: var(--protegee-fond); color: var(--protegee); }
.contributeurs a, .contributeurs button { overflow-wrap: anywhere; }
.vue > *, #revue-liste, #r-catalogue, #auteur-contenu, #oeuvre-contenu { min-width: 0; max-width: 100%; }
td.aide { min-width: 9rem; }
#completer-liste, #completer-liste ul, #completer-liste li, #completer-liste .rangee > * { min-width: 0; max-width: 100%; }
#completer-liste strong, .lien-auteur { overflow-wrap: anywhere; }

/* ------------------------------------------------------------ v0.7 : fondement, lots, comptes */
.pastille { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.08rem 0.55rem; border-radius: 999px;
  border: 1px solid currentColor; margin: 0.15rem 0.3rem 0.15rem 0; white-space: nowrap; }
.pastille.societe { color: var(--accent-fort); background: var(--accent-fond); border-color: transparent; }
.pastille.declaration { color: var(--indetermine); background: var(--indetermine-fond); }
.pastille.convention { color: var(--protegee); background: var(--protegee-fond); }
.pastille.revoir { color: var(--alerte); background: var(--surface); }
.periode { font-family: var(--serif); font-weight: 600; white-space: nowrap; }
.case { display: inline-flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; color: var(--encre); margin: 0; }
.case input { width: auto; min-height: 0; }
.confiance-bouton { white-space: nowrap; }
tr.detail > td, tr.derivee > td { background: var(--surface-2); }
.retrait { padding-left: 1.25rem; display: inline-block; }
.etapes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.etape h5 { margin: 0; font-family: var(--serif); font-size: 1rem; }
.etape .statut { margin-left: 0.4rem; }
.regle-ref { font-size: 0.9rem; }
.faits { font-size: 0.92rem; }
.justification .resume { font-family: var(--serif); font-size: 1.15rem; line-height: 1.4; max-width: 70ch; }
.declaration-bloc { background: var(--indetermine-fond); border-color: transparent; }
.fondement { max-width: 70ch; }
.regle-lot .titre-regle { display: inline; margin: 0; font-size: 1rem; color: var(--encre); }
.regle-lot input[type="checkbox"] { width: 1.2rem; min-height: 0; height: 1.2rem; }
tr.inactif td { opacity: 0.65; }
button.danger { background: var(--alerte); border-color: var(--alerte); color: #fff; }
input[type="file"] { padding: 0.35rem; }
@media (max-width: 30rem) {
  .entete-interieur { padding: 0.5rem 0.75rem; }
  .nav button { padding: 0.5rem 0.55rem; font-size: 0.9rem; }
  .carte { padding: 0.85rem; }
  .synthese div { min-width: 5.5rem; }
}
.regle-ref .statut, .regle-ref .aide { margin-left: 0.4rem; }
@media (max-width: 40rem) { .entete { position: static; } }

/* ------------------------------------------------------------ v0.8 : fiches, onglets, profil */
.entete-fiche { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.photo { width: 6rem; height: 6rem; border-radius: 50%; object-fit: cover; background: var(--accent-fond); flex: none; }
.initiales { width: 4rem; height: 4rem; border-radius: 50%; background: var(--accent-fond); color: var(--accent-fort);
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 1.4rem; flex: none; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: var(--accent-fond); color: var(--accent-fort); }
.badge.protegee { background: var(--protegee-fond); color: var(--protegee); }
.badge.domaine_public { background: var(--domaine-fond); color: var(--domaine); }
.badge.indetermine { background: var(--indetermine-fond); color: var(--indetermine); }
.badge.profil { background: var(--profil-fond); color: var(--profil); }
.onglets { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.onglets button { background: var(--surface); color: var(--encre-douce); border: 1px solid var(--trait); border-radius: 999px; }
.onglets button[aria-selected="true"] { background: var(--bouton); color: var(--sur-bouton); border-color: var(--bouton); }
.fiche-photo-fig { margin: 0; display: flex; flex-direction: column; gap: 0.35rem; max-width: 14rem; }
.fiche-photo-fig img { width: 100%; border-radius: var(--rayon-carte); }
.liste-oeuvres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.liste-oeuvres > li { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 0.55rem 0.8rem; background: var(--surface); }
.ligne-oeuvre { display: flex; gap: 0.5rem 0.9rem; align-items: center; flex-wrap: wrap; }
.ligne-oeuvre .titre { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.detail-oeuvre { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--trait); }
.variante { display: inline-flex; gap: 0.35rem; align-items: center; background: var(--surface-2); border-radius: 999px; padding: 0.15rem 0.2rem 0.15rem 0.7rem; }
.variante button { min-height: 1.8rem; padding: 0 0.5rem; }
#nav-comptes { display: none !important; }
