/* Thème sombre (seul thème du site) */
:root {
  color-scheme: dark;
  --fond: #111318; --barre: #14171d; --carte: #181b22; --surface-2: #1f232c; --survol: #222732; --choisi: #1c2533; --champ: #14171d;
  --texte: #e7e9ee; --doux: #a0a7b4; --tres-doux: #6e7685; --ligne: #2a2f3b; --bord-fort: #363c4a;
  --accent: #8ab4f8; --accent-fond: rgba(138,180,248,.13); --sur-accent: #0d1b2e;
  --echu: #f28b82; --echu-fond: rgba(242,139,130,.12);
  --moyenne: #f2c26b; --moyenne-fond: rgba(242,194,107,.12);
  --basse: #81c995; --basse-fond: rgba(129,201,149,.11);
  --violet: #c3a6ff; --violet-fond: rgba(195,166,255,.12);
  --depose: #8ab4f8; --selectionne: #81c995; --refuse: #d9a07c; --ignore: #8f96a3; --annule: #8f96a3; --rate: #f28b82;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; background: var(--fond); color: var(--texte); }
a { color: var(--accent); }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; }
h2 { font-size: 1.05rem; margin: 28px 0 8px; display: flex; align-items: baseline; gap: 8px; }
h2 .compte { color: var(--doux); font-weight: 400; font-size: .9rem; }

.entete { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: var(--barre); border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 5; }
.entete .bouton.nouveau { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; padding: 7px 13px; border-radius: 9px; }
.entete .deconnexion { font-size: .85rem; color: var(--tres-doux); }
.entete .logo { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--texte); display: inline-flex; align-items: center; gap: 7px; }
.entete .logo .icone-logo { color: var(--accent); flex: none; }
.entete a.reglages { display: inline-flex; color: var(--doux); padding: 7px; border-radius: 8px; }
.entete a.reglages:hover, .entete a.reglages.actif { color: var(--texte); background: var(--surface-2); }
.reglage { background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; padding: 16px 18px; margin-top: 12px; }
.reglage label.choix { display: block; padding: 6px 0; }
.reglage .exemple { margin-top: 10px; font-size: .9rem; color: var(--doux); }
.entete nav { display: flex; gap: 6px; flex: 1; }
.entete nav a { text-decoration: none; color: var(--doux); padding: 7px 14px; border-radius: 9px; font-size: 1.1rem; font-weight: 500; letter-spacing: -.01em; }
.entete nav a:hover { color: var(--texte); background: var(--surface-2); }
.entete nav a.actif { background: var(--surface-2); color: var(--texte); font-weight: 700; }
.entete nav .paire { display: inline-flex; border: 1px solid var(--bord-fort); border-radius: 10px; padding: 2px; gap: 2px; margin-right: 8px; }
.entete nav .paire a { border-radius: 8px; padding: 5px 14px; }
.entete nav .pastille-nav { display: inline-block; min-width: 1.35em; margin-left: 6px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--sur-accent); font-size: .75rem; font-weight: 700; line-height: 1.45; text-align: center; vertical-align: 2px; }
.entete nav .pastille-nav.alerte { background: var(--echu); color: #111; }
.entete nav .nb { color: var(--tres-doux); font-size: .8rem; font-weight: 500; margin-left: 6px; }

.bouton, button { font: inherit; cursor: pointer; border: 1px solid var(--bord-fort); background: var(--surface-2); color: var(--texte); padding: 6px 12px; border-radius: 6px; text-decoration: none; display: inline-block; }
.bouton.primaire, button.primaire { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; }
.bouton.petit { padding: 4px 10px; font-size: .9rem; white-space: nowrap; }
button.lien { border: 0; background: none; color: var(--doux); padding: 0; }
button.danger { color: var(--echu); border-color: var(--echu); }
button.danger:hover { background: var(--echu); color: #111; }
button:disabled { opacity: .5; cursor: default; }

.outils { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.outils input[type=search] { flex: 1; min-width: 200px; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--ligne); border-radius: 6px; background: var(--champ); color: var(--texte); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fond); }
option { background: var(--carte); color: var(--texte); }
textarea { width: 100%; min-height: 6em; resize: vertical; }

.liste { background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; overflow: hidden; }
.ligne { display: grid; grid-template-columns: 110px 1fr auto; gap: 4px 14px; padding: 10px 14px; border-top: 1px solid var(--ligne); text-decoration: none; color: inherit; align-items: center; }
.ligne:first-child { border-top: 0; }
.ligne:hover { background: var(--surface-2); }
.ligne .date { font-variant-numeric: tabular-nums; }
.ligne .date small { display: block; color: var(--doux); font-size: .8rem; }
.ligne .nom { font-weight: 600; }
.ligne .sous { color: var(--doux); font-size: .88rem; }
.ligne .droite { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.vide { padding: 16px; color: var(--doux); }

.section-echus h2 { color: var(--echu); }
.section-echus .liste { border: 2px solid var(--echu); }
.section-echus .ligne { background: var(--echu-fond); }
.section-echus .ligne:hover { background: rgba(242,139,130,.2); }
.section-echus .explication { color: var(--echu); font-size: .9rem; margin: -4px 0 8px; }

.pastille { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; color: var(--doux); background: var(--surface-2); white-space: nowrap; }
.pastille.echu { color: var(--echu); background: var(--echu-fond); }
.pastille.atraiter { background: var(--accent-fond); color: var(--accent); }
.pastille.depose { color: var(--depose); background: var(--accent-fond); } .pastille.selectionne { color: var(--selectionne); background: var(--basse-fond); }
.pastille.refuse { color: var(--refuse); background: rgba(217,160,124,.12); } .pastille.ignore, .pastille.annule { color: var(--ignore); }
.pastille.rate { color: var(--rate); background: var(--echu-fond); }
.pastille.nonpertinent { background: transparent; color: var(--doux); border: 1px solid var(--bord-fort); }
.pastille.org { background: transparent; color: var(--doux); border: 1px solid var(--ligne); }
.jours { font-size: .8rem; color: var(--doux); }
.jours.proche { color: var(--echu); font-weight: 600; }

.fiche { background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; padding: 16px 18px; margin-top: 12px; }
.fiche.echu { border: 2px solid var(--echu); }
.alerte-echu { background: var(--echu-fond); color: var(--echu); border: 1px solid var(--echu); padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-weight: 600; }
.actions-statut { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.actions-statut button.choisi { outline: 2px solid var(--texte); }
dl.champs { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 12px 0; }
dl.champs dt { color: var(--doux); }
dl.champs dd { margin: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--fond); border: 1px solid var(--ligne); border-radius: 6px; padding: 12px; font-size: .92rem; }
.reserves { list-style: none; padding: 0; margin: 0; }
.reserves li { padding: 4px 0; } .reserves li.fait span { text-decoration: line-through; color: var(--doux); }

form.edition { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; align-items: center; }
form.edition label { color: var(--doux); }
form.edition .double { display: flex; gap: 8px; flex-wrap: wrap; }
form.edition .double > * { flex: 1; min-width: 140px; }
form.edition .pleine { grid-column: 1 / -1; }
.ligne.lien-ligne { grid-template-columns: 1fr 1.3fr auto; align-items: start; }
.lien-ligne .candidats label { display: block; padding: 2px 0; }
.lien-ligne .droite { flex-direction: row; gap: 6px; }
.fiche.groupe { margin-bottom: 12px; }
.suggestion-org { background: var(--accent-fond); border: 1px solid rgba(138,180,248,.3); border-radius: 6px; padding: 8px 12px; margin: 8px 0; font-size: .92rem; }
@media (max-width: 640px) { .ligne.lien-ligne { grid-template-columns: 1fr; } }
.ligne.type-ligne { grid-template-columns: 1fr 190px auto; }
@media (max-width: 640px) { .ligne.type-ligne { grid-template-columns: 1fr; } }
h2 button { margin-left: auto; font-weight: 400; }
.legende-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.legende-types > div { background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; padding: 10px 12px; }
.legende-types dt { margin-bottom: 6px; }
.legende-types dt .etiquette-type { font-size: .85rem; font-weight: 600; color: var(--texte); padding: 2px 8px; }
.legende-types dd { margin: 0; font-size: .9rem; }
.legende-types dd .sous { font-size: .82rem; }
details.aide-types { grid-column: 1 / -1; font-size: .9rem; }
details.aide-types summary { cursor: pointer; color: var(--accent); }
span.lien-externe { display: inline-flex; vertical-align: -2px; color: var(--doux); }
a.lien-externe { display: inline-flex; align-items: center; justify-content: center; vertical-align: -2px; margin-left: 4px; padding: 2px; border-radius: 4px; color: var(--doux); }
a.lien-externe:hover { color: var(--accent); background: var(--fond); }
.etiquette-type { display: inline-block; font-size: .75rem; padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--doux); }
.a-reviser { color: var(--moyenne); font-size: .8rem; }
.choix-oeuvres { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.choix-oeuvres label { color: var(--texte); white-space: nowrap; }
form.edition .boutons { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

details.note-origine { margin-top: 12px; }
details.note-origine summary { cursor: pointer; color: var(--doux); font-size: .9rem; }
details.note-origine .notes { margin-top: 8px; color: var(--doux); }
details.bloc-historique { margin-top: 20px; }
details.bloc-historique summary { cursor: pointer; font-weight: 600; }
ul.historique { list-style: none; padding: 0; margin: 8px 0 0; font-size: .9rem; }
ul.historique > li { border-top: 1px solid var(--ligne); padding: 8px 0; }
ul.historique > li.annulee { opacity: .55; }
ul.historique .entete-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--doux); }
ul.historique ul { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }

ul.verifications { padding-left: 18px; }
ul.verifications li { margin: 6px 0; overflow-wrap: anywhere; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--bord-fort); color: var(--texte); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 30; }
.toast.erreur { background: #3a1f1f; border-color: var(--echu); color: #ffd7d3; }
.toast.avertissement { background: #3a2f17; border-color: var(--moyenne); color: #ffe7b3; max-width: 90vw; }

.connexion { max-width: 340px; margin: 12vh auto; background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; padding: 24px; display: grid; gap: 12px; }

@media (max-width: 640px) {
  .entete { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .entete nav a { font-size: .98rem; padding: 6px 9px; }
  .ligne { grid-template-columns: 1fr auto; }
  .ligne .date { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .ligne .date small { display: inline; }
  dl.champs, form.edition { grid-template-columns: 1fr; }
  dl.champs dt { margin-top: 6px; }
  .entete { gap: 8px; }
}

/* Accueil : tombée dans un mois ou moins (à traiter). */
.ligne.urgent { background: rgba(242,139,130,.07); box-shadow: inset 4px 0 0 rgba(242,139,130,.5); }
.ligne.urgent:hover { background: rgba(242,139,130,.12); }
.ligne.tres-urgent { background: rgba(242,139,130,.13); box-shadow: inset 4px 0 0 var(--echu); }
.ligne.tres-urgent:hover { background: rgba(242,139,130,.18); }
.avis-echus { background: var(--echu-fond); border: 1px solid var(--echu); color: var(--echu); border-radius: 8px; padding: 8px 12px; font-size: .9rem; font-weight: 600; }
.avis-echus button.lien { color: var(--echu); text-decoration: underline; font-weight: 600; }

/* Tombée prolongée par l'organisme */
.prolongee { display: inline-block; font-size: .72rem; font-weight: 600; line-height: 1.4; padding: 0 8px; border-radius: 99px; background: var(--basse-fond); color: var(--basse); border: 0; white-space: nowrap; vertical-align: 1px; }
.ligne .date .prolongee { display: table; margin-top: 3px; }
label.case { display: inline-flex; align-items: center; gap: 5px; font-size: .9rem; }
