:root {
  --fond: #f5f6f8; --carte: #ffffff; --texte: #1d2129; --doux: #5b6472; --trait: #dde1e7;
  --accent: #2f5bd3; --accent-doux: #e8eefc; --ok: #1f7a3f; --ok-doux: #e5f4ea;
  --alerte: #a15c00; --alerte-doux: #fdf1dc; --erreur: #b3261e; --erreur-doux: #fbe7e6;
  --actif-texte: #ffffff; --vif: #2e9e5b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #14161a; --carte: #1d2026; --texte: #e8eaee; --doux: #a3abb8; --trait: #2f343c;
    --accent: #7c9cf0; --accent-doux: #243152; --ok: #6fcf97; --ok-doux: #1e3a2a;
    --alerte: #f2b35b; --alerte-doux: #3d2f16; --erreur: #f28b82; --erreur-doux: #3d1f1d;
    --actif-texte: #0f1115; --vif: #6fcf97;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--trait); background: var(--carte); border-radius: 8px; padding: 8px 12px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, li:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.principal { background: var(--accent); border-color: var(--accent); color: var(--actif-texte); font-weight: 600; }
button.discret { border: 0; background: transparent; color: var(--accent); padding: 4px 6px; white-space: nowrap; }

.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--carte); border-bottom: 1px solid var(--trait); }
.marque { font-weight: 700; font-size: 17px; }
.marque span { font-weight: 400; color: var(--doux); }
.entete-droite { display: flex; align-items: center; gap: 10px; min-width: 0; }
.envoi { font-size: 12px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.envoi.attente { color: var(--alerte); }
.envoi.erreur { color: var(--erreur); }
.direct { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--doux); white-space: nowrap; }
.direct .point { width: 9px; height: 9px; border-radius: 50%; background: var(--doux); flex: none; }
.direct.ok .point { background: var(--vif); animation: pouls 2s ease-in-out infinite; }
.direct.attente .point { background: var(--alerte); }
@keyframes pouls { 50% { opacity: .35; } }

.accueil { max-width: 440px; margin: 32px auto; padding: 22px 16px; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; }
.accueil h1 { margin: 0 0 8px; font-size: 22px; }
.accueil label { display: block; margin: 14px 0; font-weight: 600; font-size: 14px; }
.accueil input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 8px; background: var(--fond); }
.accueil .principal { width: 100%; padding: 12px; margin-top: 6px; }
.msg { min-height: 1.4em; color: var(--erreur); }

.app { display: grid; grid-template-columns: 360px 1fr; gap: 14px; padding: 14px; align-items: start; }
.liste { position: sticky; top: 64px; height: calc(100vh - 78px); display: flex; flex-direction: column; background: var(--carte);
  border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; }
.panneau { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.progression { padding: 9px 12px 7px; border-bottom: 1px solid var(--trait); font-size: 13px; }
.prog-titre b { font-size: 15px; }
.barre { height: 7px; border-radius: 4px; background: var(--fond); border: 1px solid var(--trait); overflow: hidden; margin: 5px 0 4px; }
.barre span { display: block; height: 100%; background: var(--vif); transition: width .6s ease; }
.progression summary { cursor: pointer; color: var(--accent); font-size: 12px; padding: 2px 0; }
.prog-pers { list-style: none; margin: 4px 0 2px; padding: 0; font-size: 12px; color: var(--doux); max-height: 132px; overflow: auto; }
.prog-pers li { padding: 2px 0; }
.prog-pers b { color: var(--texte); font-weight: 600; }

.onglets { display: flex; border-bottom: 1px solid var(--trait); }
.onglets button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--doux); padding: 10px 6px; font-weight: 600; }
.onglets button.actif { background: transparent; border-color: transparent; color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.nouveaux { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--erreur); color: #fff;
  font-size: 11px; line-height: 18px; margin-left: 4px; }

.filtres { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-bottom: 1px solid var(--trait); }
.filtres input { grid-column: 1 / -1; }
.filtres input, .filtres select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--trait); border-radius: 8px; background: var(--fond); }
#panneauActivite .filtres { grid-template-columns: 1fr; }
.pastille-couleur { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; flex: none; }
.nb { padding: 4px 10px; font-size: 12px; color: var(--doux); border-bottom: 1px solid var(--trait); }
.items { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.items li { padding: 8px 10px 8px 8px; border-bottom: 1px solid var(--trait); border-left: 6px solid transparent; cursor: pointer; }
.items li:hover { filter: brightness(0.97); }
.items li.courant { outline: 2px solid var(--accent); outline-offset: -2px; }
.items li.vide-liste { cursor: default; color: var(--doux); }
.ligne1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.num { font-size: 12px; color: var(--doux); min-width: 3.4em; font-variant-numeric: tabular-nums; flex: none; }
.items .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--fond); color: var(--doux); white-space: nowrap; }
.puces { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 0 calc(3.4em + 8px); }
.puce { display: inline-flex; align-items: center; max-width: 100%; font-size: 12px; padding: 1px 8px 1px 6px; border-radius: 10px;
  background: var(--carte); border: 1px solid var(--trait); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.puce .pastille-couleur { width: 8px; height: 8px; }
.puce.moi { border-color: var(--ok); background: var(--ok-doux); }
.puce.attente { border-style: dashed; }
.journal .qui { flex: 1; }
.quand { margin-left: auto; font-size: 12px; color: var(--doux); white-space: nowrap; }
.valeurs { font-size: 13px; }
.com { color: var(--doux); font-style: italic; overflow-wrap: anywhere; }
.plus { margin: 8px; }
li.neuf, .annots li.neuf { animation: neuf 2.4s ease-out 3; }
@keyframes neuf { 0% { box-shadow: inset 0 0 0 999px var(--alerte-doux); } 100% { box-shadow: inset 0 0 0 999px transparent; } }

.fiche { min-width: 0; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.retour { display: none; margin-bottom: 8px; }
.titre-artiste { font-size: 22px; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.sous { color: var(--doux); font-size: 13px; }
.connu { margin: 8px 0 0; font-size: 14px; }
.bloc { margin-top: 14px; }
.bloc h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); }
.annots { list-style: none; margin: 0; padding: 0; }
.annots li { padding: 7px 10px; border-radius: 8px; margin-bottom: 5px; background: var(--fond); overflow-wrap: anywhere; }
.annots li.moi { background: var(--ok-doux); }
.grille-genres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grille-genres button, .boutons-fr button { padding: 9px 8px; font-weight: 600; min-height: 46px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; }
.etiq { overflow-wrap: anywhere; text-align: center; }
.boutons-fr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 420px; }
button.actif { background: var(--accent); border-color: var(--accent); color: var(--actif-texte); }
.marques { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; font-size: 11px; font-weight: 400; min-height: 0; }
.marques:empty { display: none; }
.marques .pastille-couleur { width: 9px; height: 9px; margin: 0; }
button.actif .marques .pastille-couleur { box-shadow: 0 0 0 1.5px var(--actif-texte); }
textarea { width: 100%; min-height: 60px; padding: 8px 10px; border: 1px solid var(--trait); border-radius: 8px; background: var(--fond); resize: vertical; }
.etat-fiche { margin-top: 10px; font-size: 13px; }
.etat-fiche.ok { color: var(--ok); }
.etat-fiche.attente { color: var(--alerte); }
.nav { display: flex; gap: 8px; margin-top: 14px; }
.nav button { flex: 1; }
.aide { margin-top: 8px; font-size: 12px; color: var(--doux); }
.lecteur h3 { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; font-size: 14px; }
.lecteur a { color: var(--accent); font-weight: 400; font-size: 13px; }
iframe { width: 100%; border: 0; border-radius: 10px; background: var(--fond); display: block; }
.cadre-spotify { height: 352px; }
.cadre-bandcamp { height: 472px; }
.vide { padding: 16px; text-align: center; color: var(--doux); border: 1px dashed var(--trait); border-radius: 10px; }
.bandeau { padding: 10px 14px; border-radius: 10px; background: var(--alerte-doux); color: var(--alerte); margin-bottom: 14px; font-size: 14px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; padding: 10px 16px 16px; }
  .liste { position: static; height: auto; max-height: none; }
  .items { max-height: none; overflow: visible; }
  body.fiche-ouverte .liste { display: none; }
  body:not(.fiche-ouverte) .fiche { display: none; }
  .retour { display: inline-block; }
  .grille-genres { grid-template-columns: 1fr 1fr; }
  .cadre-spotify { height: 232px; }
  .cadre-bandcamp { height: 400px; }
  .aide { display: none; }
  .marque span { display: none; }
  .envoi { max-width: 40vw; }
  .direct .txt { display: none; }
  .puces { margin-left: 0; }
  .prog-pers { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .direct.ok .point, li.neuf, .annots li.neuf { animation: none; }
  .barre span { transition: none; }
}
