:root {
  --fond: #16171a; --surface: #1c1e22; --surface2: #23262b; --bordure: #2a2d33;
  --texte: #e4e5e7; --discret: #8b8f98; --ambre: #f2a84b; --ambre-doux: #3a2e1c;
  --rouge: #e5484d; --vert: #46a758; --bleu: #5b9cf5;
  --rayon: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--texte); font-size: 15px; line-height: 1.5; }
a { color: var(--ambre); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font-size: 11px; border: 1px solid var(--bordure); border-radius: 5px; padding: 1px 5px; color: var(--discret); }

/* Connexion */
.connexion { display: grid; place-items: center; min-height: 100vh; }
.connexion form { display: grid; gap: 12px; width: min(320px, 86vw); text-align: center; }
.connexion h1 { margin: 0 0 8px; font-weight: 600; }
.avatar-grand { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto; }
.connexion input, .champ { background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 10px 12px; outline: none; }
.connexion input:focus, .champ:focus { border-color: var(--ambre); }
.bouton, .connexion button { background: var(--ambre); color: #16171a; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.erreur { color: var(--rouge); min-height: 1.5em; margin: 0; }
.discret { background: none; border: 0; color: var(--discret); padding: 6px 8px; border-radius: 8px; }
.discret:hover { background: var(--surface2); color: var(--texte); }

/* Barre du haut */
#appli { display: flex; flex-direction: column; height: 100vh; }
.barre { display: flex; align-items: center; gap: 18px; padding: 10px 20px; border-bottom: 1px solid var(--bordure); background: var(--fond); }
.marque { display: flex; align-items: center; gap: 10px; color: var(--texte); font-weight: 600; font-size: 16px; }
.marque img { width: 28px; height: 28px; border-radius: 50%; }
.marque:hover { text-decoration: none; }
.barre nav { display: flex; gap: 4px; }
.barre nav a { color: var(--discret); padding: 6px 12px; border-radius: 8px; }
.barre nav a:hover { color: var(--texte); background: var(--surface2); text-decoration: none; }
.barre nav a.actif { color: var(--texte); background: var(--surface2); }
.recherche-bouton { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--bordure); color: var(--discret); border-radius: 10px; padding: 6px 10px; min-width: 200px; }
main { flex: 1; min-height: 0; }
.vue { height: 100%; }

/* Accueil */
.accueil { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; padding: 20px; max-width: 1400px; margin: 0 auto; }
.colonne { overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding-right: 4px; }
.carte { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 18px 20px; }
.jour h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.jour .meteo { color: var(--discret); margin: 2px 0 14px; }
.jour .meteo b { color: var(--texte); font-weight: 600; }
.jour .blocs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.titre-bloc { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--discret); margin: 0 0 10px; font-weight: 600; }
.evenement { display: flex; gap: 12px; padding: 6px 0; align-items: baseline; }
.evenement .heure { color: var(--ambre); font-variant-numeric: tabular-nums; min-width: 46px; font-weight: 600; }
.evenement .sous { color: var(--discret); font-size: 13px; }
.evenement.passe { opacity: .45; }
.vide { color: var(--discret); }

/* Tâches */
.groupe + .groupe { margin-top: 18px; }
.groupe summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.groupe summary::-webkit-details-marker { display: none; }
.groupe summary .titre-bloc { margin: 0; }
.groupe summary::before { content: "▸"; color: var(--discret); font-size: 11px; transition: transform .15s; }
.groupe[open] summary::before { transform: rotate(90deg); }
.compte { background: var(--surface2); color: var(--discret); border-radius: 20px; padding: 0 8px; font-size: 12px; }
.groupe.retard .titre-bloc, .groupe.retard .compte { color: var(--rouge); }
.tache { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; border-bottom: 1px solid var(--bordure); }
.tache:last-child { border-bottom: 0; }
.case { appearance: none; flex: none; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--discret); border-radius: 5px; cursor: pointer; display: grid; place-items: center; }
.case:hover { border-color: var(--ambre); }
.case:checked { background: var(--ambre); border-color: var(--ambre); }
.case:checked::after { content: "✓"; color: #16171a; font-size: 12px; font-weight: 700; }
.tache .corps { flex: 1; min-width: 0; }
.tache .meta { font-size: 12.5px; color: var(--discret); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1px; }
.tache .meta a { color: var(--discret); }
.tache .meta a:hover { color: var(--ambre); }
.tache.faite .corps { text-decoration: line-through; opacity: .45; }
.ajout { display: flex; gap: 8px; margin-top: 14px; }
.ajout .champ { flex: 1; }
.ajout input[type=date] { flex: none; width: 150px; }

/* Puces */
.puce { display: inline-block; background: var(--surface2); border-radius: 6px; padding: 0 6px; font-size: 12.5px; color: var(--discret); white-space: nowrap; }
.puce.retard { color: var(--rouge); }
.puce.auj { color: var(--ambre); }

/* Chat */
.chat-cadre { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-tete { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--bordure); }
.chat-tete img { width: 32px; height: 32px; border-radius: 50%; }
.chat-tete .etat { font-size: 12px; color: var(--discret); }
.point { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--discret); margin-right: 4px; }
.point.ok { background: var(--vert); }
.fil { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.bulle { max-width: 86%; padding: 8px 12px; border-radius: 14px; background: var(--surface2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.bulle.kevin { align-self: flex-end; background: var(--ambre-doux); border-bottom-right-radius: 4px; }
.bulle.ginette { align-self: flex-start; border-bottom-left-radius: 4px; }
.bulle img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: 4px 0; cursor: zoom-in; }
.bulle .transcription { font-style: italic; color: #e4e5e7cc; font-size: 14px; line-height: 1.4; margin-top: 2px; }
.bulle .transcription.attente { color: var(--discret); font-style: normal; font-size: 13px; }
.lecteur { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 2px 0; white-space: normal; }
.lecture { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; background: var(--ambre); color: #16171a; font-size: 13px; }
.piste { flex: 1; height: 4px; border-radius: 2px; background: #ffffff26; cursor: pointer; position: relative; }
.piste i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ambre); border-radius: 2px; }
.lecteur .temps { font-size: 12px; color: var(--discret); min-width: 32px; text-align: right; }
.bulle.non-envoye { opacity: .75; outline: 1px solid #e5484d99; }
.statut-envoi { align-self: flex-end; display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--discret); margin: 0 2px 6px; }
.statut-envoi .rouge { color: var(--rouge); margin-right: 4px; }
.discret.ambre { color: var(--ambre); }
.barre-vocal { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--bordure); }
.pastille-vocal { flex: 1; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 22px; background: var(--surface2); min-width: 0; }
.point-rouge { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--rouge); animation: pulse 1.4s infinite; }
.pastille-vocal .temps { font-variant-numeric: tabular-nums; min-width: 34px; }
.ondes { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; min-width: 0; }
.ondes i { flex: 1; height: 10%; background: var(--ambre); opacity: .85; border-radius: 2px; transition: height 80ms linear; }
.rond.envoyer.gros { width: 48px; height: 48px; font-size: 19px; animation: grossir 1.4s ease-in-out infinite; }
@keyframes grossir { 50% { transform: scale(1.07); } }
.bulle .fichier { display: block; }
.heure-msg { font-size: 11px; color: var(--discret); margin: 0 4px 6px; }
.heure-msg.kevin { align-self: flex-end; }
.separateur-jour { align-self: center; font-size: 12px; color: var(--discret); margin: 10px 0 4px; }
.ecrit { color: var(--discret); font-size: 13px; padding: 0 16px 6px; min-height: 22px; }
.permission { align-self: stretch; border: 1px solid var(--ambre); background: var(--ambre-doux); border-radius: 12px; padding: 10px 12px; }
.permission .actions { display: flex; gap: 8px; margin-top: 8px; }
.permission pre { white-space: pre-wrap; font-size: 12px; max-height: 160px; overflow: auto; background: var(--fond); padding: 8px; border-radius: 8px; }
.saisie { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--bordure); }
.saisie textarea { flex: 1; resize: none; max-height: 160px; background: var(--surface2); border: 1px solid transparent; border-radius: 18px; padding: 8px 14px; outline: none; }
.saisie textarea:focus { border-color: var(--bordure); }
.rond { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; background: none; color: var(--discret); font-size: 17px; }
.rond:hover { background: var(--surface2); color: var(--texte); }
.rond.envoyer { background: var(--ambre); color: #16171a; }
.rond.enreg { background: var(--rouge); color: white; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.pieces { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px; }
.pieces span { background: var(--surface2); border-radius: 8px; padding: 3px 8px; font-size: 12.5px; cursor: pointer; }
.fil.depot { outline: 2px dashed var(--ambre); outline-offset: -8px; }

.chat-flottant { position: fixed; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--ambre); padding: 0; overflow: hidden; background: var(--surface); box-shadow: 0 6px 24px #0008; }
.chat-flottant img { width: 100%; height: 100%; }
.chat-flottant .pastille { position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--rouge); }
.chat-panneau { position: fixed; right: 20px; bottom: 88px; width: 400px; height: min(640px, calc(100vh - 140px)); z-index: 20; display: flex; box-shadow: 0 10px 40px #000a; border-radius: var(--rayon); }
.chat-panneau .chat-cadre { flex: 1; }

/* Coffre */
.coffre { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.arbre { border-right: 1px solid var(--bordure); overflow-y: auto; padding: 12px 8px; font-size: 14px; }
.arbre details summary { list-style: none; cursor: pointer; padding: 4px 8px; border-radius: 6px; color: var(--texte); display: flex; gap: 6px; align-items: center; user-select: none; }
.arbre details summary::-webkit-details-marker { display: none; }
.arbre details summary:hover { background: var(--surface2); }
.arbre details summary .compte { margin-left: auto; }
.arbre a { display: block; padding: 3px 8px 3px 30px; border-radius: 6px; color: var(--discret); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arbre a.racine { padding-left: 8px; }
.arbre a:hover { background: var(--surface2); color: var(--texte); text-decoration: none; }
.arbre a.actif { background: var(--ambre-doux); color: var(--texte); }
.note { overflow-y: auto; padding: 28px clamp(20px, 5vw, 64px) 60px; }
.note-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.note-tete .chemin { color: var(--discret); font-size: 13px; }
.note-tete .boutons { margin-left: auto; display: flex; gap: 6px; }
.contenu { max-width: 760px; }
.contenu h1 { font-size: 30px; font-weight: 600; margin: 4px 0 16px; letter-spacing: -0.01em; }
.contenu h2 { font-size: 19px; margin: 28px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--bordure); }
.contenu h3 { font-size: 16px; margin: 20px 0 6px; }
.contenu ul { padding-left: 22px; }
.contenu li { margin: 3px 0; }
.contenu li:has(> input[type=checkbox]) { list-style: none; margin-left: -22px; display: flex; gap: 8px; align-items: flex-start; }
.contenu li > input[type=checkbox] { appearance: none; flex: none; width: 17px; height: 17px; margin-top: 3px; border: 1.5px solid var(--discret); border-radius: 5px; cursor: pointer; display: grid; place-items: center; }
.contenu li > input[type=checkbox]:checked { background: var(--ambre); border-color: var(--ambre); cursor: default; }
.contenu li > input[type=checkbox]:checked::after { content: "✓"; color: #16171a; font-size: 11px; font-weight: 700; }
.contenu li:has(> input:checked) { color: var(--discret); text-decoration: line-through; }
.contenu code { background: var(--surface2); padding: 1px 5px; border-radius: 5px; font-size: 13.5px; }
.contenu pre { background: var(--surface); border: 1px solid var(--bordure); padding: 12px; border-radius: 10px; overflow: auto; }
.contenu pre code { background: none; padding: 0; }
.contenu blockquote { border-left: 3px solid var(--ambre); margin: 10px 0; padding: 2px 14px; color: var(--discret); }
.contenu table { border-collapse: collapse; }
.contenu th, .contenu td { border: 1px solid var(--bordure); padding: 5px 10px; }
.contenu a.interne { color: var(--ambre); border-bottom: 1px dashed #f2a84b66; }
.contenu a.interne.absent { color: var(--discret); }
.frontmatter { color: var(--discret); font-size: 13px; margin-bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.entrants { max-width: 760px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--bordure); }
.entrants a { display: inline-block; margin: 0 6px 6px 0; background: var(--surface); border: 1px solid var(--bordure); padding: 3px 10px; border-radius: 8px; font-size: 13.5px; }
.editeur { width: 100%; max-width: 900px; min-height: 70vh; background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 16px; font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 14px; line-height: 1.6; outline: none; resize: vertical; }
.editeur:focus { border-color: var(--ambre); }
.bouton.second { background: var(--surface2); color: var(--texte); }

/* Graphe */
.graphe { position: relative; overflow: hidden; }
#graphe { position: absolute; inset: 0; }
.graphe-outils { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 10px; }
.graphe-outils input { background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 7px 12px; outline: none; width: 220px; }
.legende { background: #1c1e22cc; border: 1px solid var(--bordure); border-radius: 10px; padding: 8px 12px; font-size: 13px; display: grid; gap: 3px; }
.legende span { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.legende span.off { opacity: .35; }
.legende i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Recherche */
.recherche { position: fixed; inset: 0; background: #0009; display: grid; place-items: start center; padding-top: 12vh; z-index: 50; }
.recherche-boite { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); overflow: hidden; box-shadow: 0 20px 60px #000c; }
.recherche-boite input { width: 100%; border: 0; border-bottom: 1px solid var(--bordure); background: none; padding: 14px 16px; font-size: 16px; outline: none; }
.recherche-boite ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.recherche-boite li { padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; }
.recherche-boite li small { color: var(--discret); margin-left: auto; }
.recherche-boite li.sel { background: var(--surface2); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--bordure); padding: 8px 16px; border-radius: 10px; z-index: 60; }
.visionneuse { position: fixed; inset: 0; background: #000d; display: grid; place-items: center; z-index: 70; cursor: zoom-out; }
.visionneuse img { max-width: 94vw; max-height: 94vh; }

/* Téléphone */
@media (max-width: 900px) {
  .barre { gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
  .marque span, .recherche-bouton span, .recherche-bouton kbd { display: none; }
  .recherche-bouton { min-width: 0; }
  .accueil { grid-template-columns: 1fr; padding: 12px; height: auto; }
  .accueil .chat-cadre { height: 70vh; }
  .vue.accueil { overflow-y: auto; }
  .coffre { grid-template-columns: 1fr; }
  .arbre { border-right: 0; }
  .coffre.lecture .arbre { display: none; }
  .coffre:not(.lecture) .note { display: none; }
  .chat-panneau { inset: 60px 8px 80px 8px; width: auto; height: auto; }
}
