:root {
  --fond: #f6f5f2;
  --surface: #ffffff;
  --texte: #1b1c1f;
  --doux: #6b6e76;
  --ligne: #e3e1dc;
  --accent: #5b3df5;
  --accent-texte: #ffffff;
  --retard: #c2410c;
  --haute: #b91c1c;
  --attente: #a16207;
  --cours: #1d4ed8;
  --brouillon: #6b7280;
  --rayon: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #111214;
    --surface: #1b1c20;
    --texte: #ecebe8;
    --doux: #9a9ca3;
    --ligne: #2c2e33;
    --accent: #8b77ff;
    --accent-texte: #111214;
    --retard: #fb923c;
    --haute: #f87171;
    --attente: #facc15;
    --cours: #60a5fa;
    --brouillon: #9ca3af;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
a { color: inherit; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 12px; line-height: 1.25; }
h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--doux); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
h3 a { text-decoration: none; }

.barre {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ligne); padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.marque { font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.barre nav { display: flex; gap: 4px; overflow-x: auto; }
@media (max-width: 420px) { .marque { display: none; } .barre nav { width: 100%; justify-content: space-between; } }
.barre nav a { text-decoration: none; color: var(--doux); padding: 6px 10px; border-radius: 999px; font-size: 0.9rem; white-space: nowrap; }
.barre nav a.actif { background: var(--surface); color: var(--texte); box-shadow: 0 0 0 1px var(--ligne); }

.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filtre select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--ligne); background: var(--surface); color: var(--texte); }

.bloc { margin: 18px 0; }
.compte { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--ligne); color: var(--texte); font-size: 0.75rem; text-align: center; font-weight: 600; letter-spacing: 0; text-transform: none; }
.compte.q { background: transparent; box-shadow: inset 0 0 0 1px var(--ligne); }

.tache {
  display: flex; gap: 10px; align-items: flex-start; text-decoration: none;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 10px 12px; margin-bottom: 6px; border-left: 4px solid transparent;
}
.tache.niv1 { margin-left: 18px; }
.tache.niv2 { margin-left: 36px; }
.tache.haute { border-left-color: var(--haute); }
.tache.st-en-cours { border-left-color: var(--cours); }
.tache.st-en-attente { border-left-color: var(--attente); }
.tache.st-brouillon { border-left-color: var(--brouillon); border-style: dashed; }
.tache:active { transform: scale(0.99); }
.id { font: 600 0.78rem/1.6 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); flex: none; padding-top: 1px; }
.id.grand { font-size: 1rem; }
.corps { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.texte { overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.8rem; color: var(--doux); }
.dossier { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pastille { padding: 1px 8px; border-radius: 999px; background: var(--ligne); font-size: 0.75rem; color: var(--texte); }
.pastille.retard { background: var(--retard); color: #fff; }
.pastille.haute { background: var(--haute); color: #fff; }
.pastille.st-en-cours { background: var(--cours); color: #fff; }
.pastille.st-en-attente { background: var(--attente); color: #111; }
.pastille.st-brouillon { background: var(--brouillon); color: #fff; }

details { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 4px 12px; margin-bottom: 8px; }
details > summary { cursor: pointer; padding: 8px 0; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { border-bottom: 1px solid var(--ligne); margin-bottom: 8px; }
details .tache { border-left-width: 4px; }

.arbre { list-style: none; padding: 0; margin: 0 0 8px; }
.arbre li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--ligne); }
.arbre li:last-child { border-bottom: 0; }
.arbre li a { flex: 1; text-decoration: none; }
.arbre .prof1 { padding-left: 16px; }
.arbre .prof2 { padding-left: 32px; font-size: 0.92rem; }
.arbre .prof3 { padding-left: 48px; font-size: 0.9rem; }

.fiche-tache h1 { margin-top: 4px; }
.fil { color: var(--doux); font-size: 0.85rem; margin: 0; }
.description { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 4px 14px; margin: 12px 0; }
.description p { margin: 8px 0; }

.bouton, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 1rem/1.2 inherit; text-decoration: none; cursor: pointer;
  border: 0; border-radius: 10px; padding: 11px 16px; background: var(--accent); color: var(--accent-texte);
}
.bouton.principal { width: 100%; margin: 14px 0 4px; padding: 14px; font-size: 1.05rem; }
.secondaire, .bouton.secondaire { background: var(--surface); color: var(--texte); box-shadow: inset 0 0 0 1px var(--ligne); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.statuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.statuts button { flex: 1 1 auto; font-size: 0.9rem; padding: 9px 12px; }
.rangee { display: flex; gap: 8px; }
.empile { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 12px; }
.empile label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--doux); }
.empile label.case { flex-direction: row; align-items: center; color: var(--texte); }
.recherche { margin: 4px 0 8px; }
fieldset.personnes { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.personnes legend { font-size: 0.85rem; color: var(--doux); margin-bottom: 6px; }
.empile label.puce { flex-direction: row; color: var(--texte); gap: 6px; }
.puce { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--fond); border: 1px solid var(--ligne); font-size: 0.85rem; color: var(--texte); }
.reponse { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--rayon); padding: 12px; margin: 14px 0; }
pre.journal { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.8rem/1.45 ui-monospace, "SF Mono", Menlo, monospace; margin: 0 0 8px; }
input[type=text], input[type=search], input[type=date], textarea {
  font: inherit; color: var(--texte); background: var(--fond); border: 1px solid var(--ligne);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; }
.aide { color: var(--doux); font-size: 0.85rem; margin: 6px 0; }
.message { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--rayon); padding: 10px 12px; }
.alerte { color: var(--haute); }
.vide { color: var(--doux); font-style: italic; }
.action-bloc { margin: 0 0 8px; }
.simple { margin: 0; padding-left: 18px; }
.notifs { list-style: none; padding: 0; margin: 0; }
.notifs li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ligne); font-size: 0.9rem; }
.notifs li a { text-decoration: none; }
.notifs time { color: var(--doux); flex: none; font-size: 0.8rem; }

.bouton-flottant {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px;
  border-radius: 50%; background: var(--accent); color: var(--accent-texte); font-size: 30px; line-height: 56px;
  text-align: center; text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
footer { text-align: center; color: var(--doux); font-size: 0.75rem; padding: 12px 16px 24px; }

body.connexion main { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; }
body.connexion h1 { font-size: 2.2rem; margin-bottom: 0; }
