:root {
  --page: #FAFAF8; --surface: #FFFFFF; --discret: #F3F2EE; --survol: #EEEDE8;
  --trait: #E6E4DE; --trait-fort: #D6D3CB;
  --t1: #18181B; --t2: #55555E; --t3: #8A8A93; --inv: #FFFFFF;
  --laiton: #9A7628; --laiton-n: #C7A253; --laiton-doux: #F6EFDD;
  --s-nouveau: #C7A253; --s-a_faire: #8A8A93; --s-en_cours: #2F6FEB; --s-revue: #7C5CD6; --s-fait: #2E8A57;
  --p0: #D04A3A; --p1: #C98A1B; --p2: #A1A1AA;
  --g-bleu: #E7EEFC; --g-vert: #E4F2EA; --g-rose: #FBE8EC; --g-sable: #F4EEE2; --g-violet: #EEE9FB; --g-gris: #EFEFF1;
  --ombre: 0 1px 2px rgba(24,24,27,.04), 0 8px 24px rgba(24,24,27,.06);
  --ombre-forte: 0 12px 48px rgba(24,24,27,.16);
  --r: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #111113; --surface: #18181B; --discret: #1F1F23; --survol: #26262B;
    --trait: #2A2A30; --trait-fort: #3A3A42;
    --t1: #EDEDEF; --t2: #A6A6AE; --t3: #75757E; --inv: #111113;
    --laiton: #D2AE5E; --laiton-n: #C7A253; --laiton-doux: #2A2415;
    --g-bleu: #1C2433; --g-vert: #19281F; --g-rose: #301C21; --g-sable: #2A2519; --g-violet: #241F35; --g-gris: #26262B;
    --ombre: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    --ombre-forte: 0 12px 48px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--t1);
  font: 14px/20px -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: var(--laiton-doux); }
:focus-visible { outline: 2px solid var(--laiton-n); outline-offset: 2px; }

/* ─── boutons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid transparent; font-weight: 550; white-space: nowrap;
  background: var(--t1); color: var(--inv);
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sec { background: var(--surface); color: var(--t1); border-color: var(--trait-fort); }
.btn-sec:hover { background: var(--discret); opacity: 1; }
.btn-nu { background: none; color: var(--t2); border: 0; padding: 0 10px; }
.btn-nu:hover { background: var(--survol); color: var(--t1); opacity: 1; }
.btn-laiton { background: var(--laiton); color: #fff; }
.btn-danger { background: none; border: 0; color: var(--p0); padding: 0 10px; }
.btn-petit { height: 28px; padding: 0 10px; font-size: 13px; }
.kbd { font-size: 11px; color: var(--t3); border: 1px solid var(--trait-fort); border-radius: 4px; padding: 0 4px; line-height: 16px; }
.btn .kbd { color: inherit; opacity: .6; border-color: currentColor; }

.champ {
  width: 100%; height: 36px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--trait-fort); background: var(--surface); outline: none;
}
.champ:focus { border-color: var(--laiton-n); box-shadow: 0 0 0 3px var(--laiton-doux); }
textarea.champ { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 21px; }
label.etiquette { display: block; font-size: 12px; font-weight: 600; color: var(--t2); margin: 14px 0 6px; }

/* ─── pastilles ─── */
.statut { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--t2); white-space: nowrap; }
.pastille { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1.6px solid var(--c); background: var(--fond, transparent); }
.pastille[data-s="nouveau"] { --c: var(--s-nouveau); background: radial-gradient(var(--c) 0 2.5px, transparent 3px); }
.pastille[data-s="a_faire"] { --c: var(--s-a_faire); }
.pastille[data-s="en_cours"] { --c: var(--s-en_cours); background: conic-gradient(var(--c) 0 50%, transparent 50%); }
.pastille[data-s="revue"] { --c: var(--s-revue); background: conic-gradient(var(--c) 0 75%, transparent 75%); }
.pastille[data-s="fait"] { --c: var(--s-fait); background: var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.3 6.2l1.8 1.8 3.6-3.8' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%; }

.prio { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex: none; }
.prio i { width: 3px; border-radius: 1px; background: var(--trait-fort); }
.prio i:nth-child(1) { height: 5px; } .prio i:nth-child(2) { height: 8px; } .prio i:nth-child(3) { height: 11px; }
.prio[data-p="P2"] i:nth-child(1) { background: var(--p2); }
.prio[data-p="P1"] i:nth-child(-n+2) { background: var(--p1); }
.prio[data-p="P0"] i { background: var(--p0); }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--t2); background: var(--g-sable); white-space: nowrap; }
.tag[data-c="bleu"] { background: var(--g-bleu); } .tag[data-c="vert"] { background: var(--g-vert); }
.tag[data-c="rose"] { background: var(--g-rose); } .tag[data-c="violet"] { background: var(--g-violet); }
.tag[data-c="gris"] { background: var(--g-gris); }
.tag button { border: 0; background: none; padding: 0 0 0 4px; color: var(--t3); line-height: 1; }

.projet-puce { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--t2); white-space: nowrap; }
.point { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--laiton)); flex: none; }
.compteur { font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; font-weight: 600; background: var(--laiton-doux); color: var(--laiton); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.ref { font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 58px; }
.muet { color: var(--t3); }
.echeance { font-size: 12px; color: var(--t2); white-space: nowrap; }
.echeance.retard { color: var(--p0); }

/* ─── structure admin ─── */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.barre {
  border-right: 1px solid var(--trait); padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
.marque { display: flex; align-items: center; gap: 9px; padding: 4px 10px 16px; font-weight: 650; letter-spacing: -.2px; }
.marque .logo { width: 22px; height: 22px; border-radius: 6px; background: var(--t1); display: grid; place-items: center; }
.marque .logo i { width: 8px; height: 8px; border-radius: 2px; background: var(--laiton-n); }
.marque small { font-weight: 500; color: var(--t3); }
.nav {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px;
  border: 0; background: none; text-align: left; width: 100%; color: var(--t2);
}
.nav:hover { background: var(--survol); color: var(--t1); }
.nav.actif { background: var(--surface); color: var(--t1); box-shadow: 0 0 0 1px var(--trait); font-weight: 550; }
.nav .libelle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-menu { display: none; width: 22px; height: 22px; margin-right: -4px; border-radius: 5px; color: var(--t3); text-align: center; line-height: 20px; flex: none; cursor: pointer; }
.nav:hover .nav-menu, .nav-menu:focus-visible { display: block; }
.nav:hover .nav-menu + .compteur { display: none; }
.nav-menu:hover { background: var(--trait); color: var(--t1); }
.suggestion-dossier { font-size: 12px; color: var(--t3); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.suggestion-dossier:empty { display: none; }
.nav .ico { width: 16px; display: grid; place-items: center; color: var(--t3); flex: none; }
.section { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .5px; text-transform: uppercase; color: var(--t3); }
.section button { border: 0; background: none; color: var(--t3); font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.section button:hover { background: var(--survol); color: var(--t1); }
.pied-barre { margin-top: auto; padding: 14px 10px 4px; font-size: 12px; color: var(--t3); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pied-barre span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pied-barre button { border: 0; background: none; color: var(--t3); padding: 0; font-size: 12px; }
.pied-barre button:hover { color: var(--t1); }

.principal { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.entete {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--trait); min-height: 62px;
}
.entete h1 { font-size: 16px; line-height: 22px; font-weight: 650; margin: 0; letter-spacing: -.2px; display: flex; align-items: center; gap: 9px; min-width: 0; }
.entete h1 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entete .espace { flex: 1; }
.recherche { position: relative; width: 240px; }
.recherche input { padding-left: 32px; height: 34px; background: var(--discret); border-color: transparent; }
.recherche svg { position: absolute; left: 10px; top: 10px; color: var(--t3); }
.recherche .kbd { position: absolute; right: 9px; top: 9px; }
.bascule { display: inline-flex; background: var(--discret); border-radius: var(--r); padding: 3px; }
.bascule button { border: 0; background: none; height: 28px; padding: 0 10px; border-radius: 6px; color: var(--t2); font-size: 13px; font-weight: 500; }
.bascule button.actif { background: var(--surface); color: var(--t1); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.menu-mobile { display: none; }
.btn-nouvelle .plus { display: none; font-size: 20px; font-weight: 400; }
.reglages-projet { color: var(--t3); }

.contenu { flex: 1; overflow: auto; }

/* ajout rapide */
.ajout {
  display: flex; align-items: center; gap: 10px; margin: 16px 24px 4px; padding: 0 12px; height: 42px;
  border: 1px dashed var(--trait-fort); border-radius: var(--r); background: transparent; color: var(--t3);
}
.ajout:focus-within { border-style: solid; border-color: var(--laiton-n); background: var(--surface); box-shadow: 0 0 0 3px var(--laiton-doux); }
.ajout input { flex: 1; border: 0; outline: none; background: none; height: 40px; color: var(--t1); }
.ajout .aide { font-size: 12px; color: var(--t3); white-space: nowrap; }

/* liste */
.groupe { padding: 10px 0 4px; }
.groupe-titre {
  display: flex; align-items: center; gap: 9px; padding: 8px 24px; font-size: 13px; font-weight: 600; color: var(--t1);
  position: sticky; top: 0; background: var(--page); z-index: 1; border: 0; width: 100%; text-align: left;
}
.groupe-titre .compteur { font-weight: 500; }
.groupe-titre .chevron { color: var(--t3); transition: transform .15s; margin-left: -4px; }
.groupe.replie .chevron { transform: rotate(-90deg); }
.groupe.replie .ligne { display: none; }
.ligne {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 24px; cursor: pointer;
  border-bottom: 1px solid var(--trait); background: var(--page);
}
.groupe .ligne:first-of-type { border-top: 1px solid var(--trait); }
.ligne:hover { background: var(--surface); }
.ligne.choisie { background: var(--laiton-doux); }
.ligne .titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .tags { display: flex; gap: 4px; flex: none; max-width: 38%; overflow: hidden; }
.ligne .meta { display: flex; align-items: center; gap: 14px; flex: none; }
.ligne .client { color: var(--laiton); display: inline-flex; }
.ligne .messages { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--t3); }
.statut-btn { border: 0; background: none; padding: 4px; margin: -4px; border-radius: 6px; display: grid; place-items: center; }
.statut-btn:hover { background: var(--survol); }
.vide { text-align: center; color: var(--t3); padding: 64px 24px; }
.vide strong { display: block; color: var(--t1); font-size: 15px; margin-bottom: 4px; }

/* sélection multiple */
.coche {
  appearance: none; width: 16px; height: 16px; margin: 0 -4px 0 -26px; flex: none; border-radius: 4px; cursor: pointer;
  border: 1.5px solid var(--trait-fort); background: var(--surface); opacity: 0; transition: opacity .1s;
}
.ligne:hover .coche, .en-selection .coche, .coche:focus-visible { opacity: 1; }
.coche:checked { background: var(--t1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%; border-color: var(--t1); }
.ligne.selectionnee, .ligne.selectionnee:hover { background: var(--laiton-doux); }
.barre-selection {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 12px; box-shadow: var(--ombre-forte); padding: 6px 6px 6px 14px; animation: fondu .15s;
  max-width: calc(100vw - 24px);
}
.barre-selection .nb { font-size: 13px; font-weight: 600; margin-right: 8px; white-space: nowrap; }
.barre-selection .rouge { color: var(--p0); }
.barre-selection .rouge:hover { color: var(--p0); background: var(--g-rose); }
.btn-rouge { background: var(--p0); color: #fff; }

/* tableau */
.tableau { display: flex; gap: 14px; padding: 16px 24px 24px; height: 100%; min-width: min-content; align-items: flex-start; }
.colonne { width: 288px; flex: none; display: flex; flex-direction: column; max-height: 100%; border-radius: 10px; }
.colonne-titre { display: flex; align-items: center; gap: 8px; padding: 6px 6px 10px; font-size: 13px; font-weight: 600; }
.colonne-titre .espace { flex: 1; }
.colonne-titre button { border: 0; background: none; color: var(--t3); font-size: 16px; padding: 0 6px; border-radius: 5px; }
.colonne-titre button:hover { background: var(--survol); color: var(--t1); }
.cartes { display: flex; flex-direction: column; gap: 8px; min-height: 80px; overflow-y: auto; padding: 2px 2px 12px; border-radius: 10px; }
.colonne.survol .cartes { background: var(--laiton-doux); }
.carte {
  background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; padding: 11px 12px; cursor: grab;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.02);
}
.carte:hover { border-color: var(--trait-fort); }
.carte.glisse { opacity: .4; }
.carte .haut { display: flex; align-items: center; gap: 8px; }
.carte .haut .ref { min-width: 0; flex: 1; }
.carte .titre { font-weight: 500; line-height: 19px; word-break: break-word; }
.carte .bas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.carte .bas .espace { flex: 1; }

/* ─── tiroir de détail ─── */
.voile { position: fixed; inset: 0; background: rgba(17,17,19,.24); z-index: 20; animation: fondu .15s; }
.tiroir {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface);
  box-shadow: var(--ombre-forte); z-index: 21; display: flex; flex-direction: column; animation: glisse .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes glisse { from { transform: translateX(24px); opacity: 0; } }
@keyframes fondu { from { opacity: 0; } }
.tiroir-entete { display: flex; align-items: center; gap: 10px; padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--trait); }
.tiroir-entete .ref { flex: 1; font-size: 13px; }
.tiroir-corps { flex: 1; overflow-y: auto; padding: 20px 24px 24px; }
.titre-edit {
  width: 100%; border: 0; outline: none; background: none; font-size: 20px; line-height: 27px; font-weight: 650;
  letter-spacing: -.3px; resize: none; padding: 0; margin: 0 0 14px; overflow: hidden;
}
.proprietes { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; align-items: center; margin-bottom: 18px; }
.proprietes > .nom { font-size: 13px; color: var(--t3); height: 32px; display: flex; align-items: center; }
.proprietes > .val { min-height: 32px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.select-nu {
  appearance: none; border: 0; background: none; height: 30px; padding: 0 8px; margin-left: -8px; border-radius: 6px; font-size: 13px; color: var(--t1); cursor: pointer; max-width: 100%;
}
.select-nu:hover, .select-nu:focus { background: var(--discret); outline: none; }
.tags-edit { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tags-edit input { border: 0; outline: none; background: none; height: 28px; width: 130px; font-size: 13px; }
.interrupteur { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--t2); cursor: pointer; user-select: none; }
.interrupteur input { appearance: none; width: 30px; height: 18px; border-radius: 999px; background: var(--trait-fort); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.interrupteur input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.interrupteur input:checked { background: var(--laiton); }
.interrupteur input:checked::after { transform: translateX(12px); }
.description {
  width: 100%; border: 1px solid transparent; border-radius: var(--r); padding: 10px 12px; margin: 0 -12px; width: calc(100% + 24px);
  background: none; outline: none; resize: none; line-height: 21px; min-height: 90px; color: var(--t1);
}
.description:hover { background: var(--discret); }
.description:focus { background: var(--surface); border-color: var(--trait-fort); }
.sous-titre { font-size: 12px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--t3); margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.fichiers { display: flex; flex-wrap: wrap; gap: 8px; }
.fichier {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--trait); border-radius: var(--r);
  text-decoration: none; font-size: 13px; max-width: 260px; background: var(--surface);
}
.fichier:hover { border-color: var(--trait-fort); }
.fichier img, .fichier .ext { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; flex: none; background: var(--discret); display: grid; place-items: center; font-size: 10px; font-weight: 650; color: var(--t3); text-transform: uppercase; }
.fichier span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fichier small { display: block; color: var(--t3); font-size: 11px; }

.fil { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 650; background: var(--t1); color: var(--inv); }
.avatar.client { background: var(--laiton-doux); color: var(--laiton); }
.msg .bulle { flex: 1; min-width: 0; }
.msg .qui { font-size: 13px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.msg .qui time { font-size: 12px; color: var(--t3); font-weight: 400; }
.msg .texte { white-space: pre-wrap; word-break: break-word; margin-top: 2px; color: var(--t1); }
.msg.interne .bulle { background: var(--laiton-doux); border-radius: var(--r); padding: 8px 10px; margin: -4px 0; }
.msg.interne .qui::after { content: "Note interne"; font-size: 11px; font-weight: 600; color: var(--laiton); }
.evt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--t3); padding-left: 8px; }
.evt::before { content: ""; width: 10px; height: 1px; background: var(--trait-fort); }

.composeur { border-top: 1px solid var(--trait); padding: 12px 16px 14px 24px; background: var(--surface); }
.composeur textarea { width: 100%; border: 1px solid var(--trait-fort); border-radius: var(--r); padding: 10px 12px; min-height: 70px; max-height: 240px; resize: none; outline: none; background: var(--surface); line-height: 21px; }
.composeur textarea:focus { border-color: var(--laiton-n); box-shadow: 0 0 0 3px var(--laiton-doux); }
.composeur.interne textarea { background: var(--laiton-doux); }
.composeur .actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composeur .actions .espace { flex: 1; }
.joindre { position: relative; overflow: hidden; }
.joindre input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ─── fenêtre (modale) ─── */
.modale {
  position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(560px, calc(100vw - 32px));
  background: var(--surface); border-radius: 14px; box-shadow: var(--ombre-forte); z-index: 31; animation: fondu .15s;
  max-height: 80vh; display: flex; flex-direction: column;
}
.modale + .voile, .voile.haut { z-index: 30; }
.modale-corps { padding: 20px 22px; overflow-y: auto; }
.modale h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.2px; }
.modale p.chapo { margin: 0 0 8px; color: var(--t2); font-size: 13px; }
.modale-pied { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--trait); }
.modale-pied .espace { flex: 1; }
.titre-nouveau { border: 0; outline: none; font-size: 18px; font-weight: 600; width: 100%; background: none; padding: 0; margin: 2px 0 8px; }
.corps-nouveau { border: 0; outline: none; width: 100%; resize: none; background: none; min-height: 110px; line-height: 21px; padding: 0; }
.options-nouveau { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--trait); }
.options-nouveau select, .options-nouveau input[type=date] { height: 30px; border: 1px solid var(--trait-fort); border-radius: 7px; background: var(--surface); padding: 0 8px; font-size: 13px; }
.options-nouveau input.tags-saisie { height: 30px; border: 1px solid var(--trait-fort); border-radius: 7px; padding: 0 8px; font-size: 13px; min-width: 150px; flex: 1; background: var(--surface); }
.urgences { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.urgences label { border: 1px solid var(--trait-fort); border-radius: var(--r); padding: 10px 12px; cursor: pointer; font-size: 13px; }
.urgences label strong { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.urgences label small { display: block; color: var(--t3); margin-top: 2px; font-size: 12px; }
.urgences input { display: none; }
.urgences label:has(input:checked) { border-color: var(--t1); box-shadow: 0 0 0 1px var(--t1); }
.liste-clients { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.liste-clients div { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.liste-clients div span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ligne-champs { display: flex; gap: 8px; }
.couleurs { display: flex; gap: 8px; }
.couleurs label { width: 24px; height: 24px; border-radius: 7px; background: var(--c); cursor: pointer; }
.couleurs input { display: none; }
.couleurs label:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--t1); color: var(--inv);
  padding: 9px 16px; border-radius: 9px; font-size: 13px; z-index: 50; box-shadow: var(--ombre-forte); animation: fondu .15s;
}
.menu-flottant {
  position: fixed; z-index: 40; background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; box-shadow: var(--ombre-forte);
  padding: 4px; min-width: 170px; animation: fondu .1s;
}
.menu-flottant button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; height: 32px; padding: 0 10px; border-radius: 6px; text-align: left; font-size: 13px; }
.menu-flottant button:hover, .menu-flottant button.actif { background: var(--discret); }

/* ─── connexion ─── */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.connexion .boite { width: min(380px, 100%); }
.connexion .marque { padding: 0 0 28px; justify-content: center; font-size: 15px; }
.connexion .carte-cx { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 28px; box-shadow: var(--ombre); }
.connexion h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.3px; }
.connexion p { color: var(--t2); margin: 0 0 20px; }
.connexion .btn { width: 100%; justify-content: center; height: 40px; margin-top: 12px; }
.connexion .champ { height: 40px; }
.connexion .note { font-size: 12px; color: var(--t3); text-align: center; margin-top: 18px; }
.connexion .ok { text-align: center; }
.connexion .ok .rond { width: 44px; height: 44px; border-radius: 50%; background: var(--laiton-doux); color: var(--laiton); display: grid; place-items: center; margin: 0 auto 14px; }

/* ─── portail client ─── */
.portail { min-height: 100vh; }
.portail-entete { border-bottom: 1px solid var(--trait); background: var(--surface); }
.portail-entete .dedans { max-width: 820px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 14px; }
.portail-entete .marque { padding: 0; }
.portail-entete .espace { flex: 1; }
.portail-entete select { border: 1px solid var(--trait-fort); border-radius: var(--r); height: 34px; background: var(--surface); padding: 0 10px; }
.portail-corps { max-width: 820px; margin: 0 auto; padding: 32px 20px 64px; }
.portail h1 { font-size: 24px; letter-spacing: -.5px; margin: 0; line-height: 30px; }
.portail .chapo { color: var(--t2); margin: 6px 0 24px; }
.onglets { display: flex; gap: 20px; border-bottom: 1px solid var(--trait); margin-bottom: 8px; }
.onglets button { border: 0; background: none; padding: 10px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--t2); font-weight: 500; }
.onglets button.actif { color: var(--t1); border-color: var(--t1); }
.ticket {
  display: flex; align-items: center; gap: 14px; padding: 16px 4px; border-bottom: 1px solid var(--trait); cursor: pointer;
}
.ticket:hover { background: var(--surface); }
.ticket .corps { flex: 1; min-width: 0; }
.ticket .corps strong { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .corps small { color: var(--t3); font-size: 12px; }
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; padding: 3px 9px; border-radius: 999px; background: var(--discret); color: var(--t2); white-space: nowrap; }
.etat[data-s="revue"] { background: var(--g-violet); color: var(--s-revue); }
.etat[data-s="en_cours"] { background: var(--g-bleu); color: var(--s-en_cours); }
.etat[data-s="fait"] { background: var(--g-vert); color: var(--s-fait); }
.etat[data-s="nouveau"] { background: var(--laiton-doux); color: var(--laiton); }

.etapes { display: flex; gap: 4px; margin: 4px 0 20px; }
.etapes div { flex: 1; }
.etapes i { display: block; height: 4px; border-radius: 2px; background: var(--trait); }
.etapes .passee i { background: var(--t1); }
.etapes .courante i { background: var(--laiton-n); }
.etapes span { display: block; font-size: 11px; color: var(--t3); margin-top: 6px; }
.etapes .courante span { color: var(--t1); font-weight: 600; }
.bandeau-valider { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--g-violet); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.bandeau-valider p { flex: 1; margin: 0; font-size: 13px; min-width: 180px; }

/* ─── calendrier ─── */
.nav-mois { display: flex; gap: 6px; }
.mois-titre { text-transform: capitalize; }
.cal { padding: 12px 24px 24px; }
.cal-astuce { font-size: 13px; color: var(--t2); margin-bottom: 10px; }
.lien { border: 0; background: none; padding: 0; color: var(--laiton); font-weight: 550; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cal-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--trait); border-top: 1px solid var(--trait); border-radius: 10px; overflow: hidden; background: var(--surface); }
.cal-entete-jour { padding: 8px 10px; font-size: 11px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--t3); border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait); background: var(--page); }
.cal-jour { min-height: 118px; padding: 6px 6px 8px; border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait); display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-jour:hover { background: var(--page); }
.cal-jour.hors { background: var(--page); }
.cal-jour.hors .cal-num { color: var(--t3); opacity: .6; }
.cal-jour.survol { background: var(--laiton-doux); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--t2); padding: 2px 4px; align-self: flex-start; border-radius: 999px; min-width: 22px; text-align: center; }
.cal-jour.auj .cal-num { background: var(--t1); color: var(--inv); }
.cal-evt, .cal-tache, .cal-plus { display: flex; align-items: center; gap: 5px; width: 100%; border: 0; background: none; text-align: left; font-size: 12px; line-height: 16px; padding: 2px 5px; border-radius: 5px; color: var(--t1); min-width: 0; cursor: pointer; }
.cal-evt span, .cal-tache span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-evt::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.cal-evt time { color: var(--t3); font-variant-numeric: tabular-nums; flex: none; }
.cal-evt.journee { background: color-mix(in srgb, var(--c) 16%, transparent); }
.cal-evt.journee::before { display: none; }
.cal-evt:hover, .cal-tache:hover { background: var(--survol); }
.cal-tache { background: var(--laiton-doux); font-weight: 500; cursor: grab; }
.cal-tache .pastille { width: 10px; height: 10px; }
.cal-tache.faite span { text-decoration: line-through; color: var(--t3); }
.cal-plus { color: var(--t3); font-weight: 550; }
.cal-bulle { padding: 12px 14px; min-width: 240px; max-width: 320px; }
.cal-bulle-titre { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 4px; text-transform: none; }
.cal-bulle .muet { font-size: 13px; }
.cal-bulle-liste { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; max-height: 50vh; overflow: auto; }
.cal-bulle .cal-evt, .cal-bulle .cal-tache { height: auto; }
.cal-lignes { display: flex; flex-direction: column; margin: 12px 0 4px; border-top: 1px solid var(--trait); }
.cal-ligne { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--trait); }
.cal-ligne-texte { flex: 1; min-width: 0; }
.cal-ligne-texte strong { display: block; font-size: 13px; }
.cal-ligne-texte small { display: block; font-size: 12px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ligne-texte small.erreur { color: var(--p0); white-space: normal; }
.aide-cal { margin-top: 14px; font-size: 13px; color: var(--t2); }
.aide-cal summary { cursor: pointer; font-weight: 600; color: var(--t1); }
.aide-cal strong { display: block; margin-top: 10px; color: var(--t1); font-size: 13px; }
.aide-cal p { margin: 4px 0 0; line-height: 19px; }
.etapes-raccourci { padding-left: 18px; margin: 8px 0 0; line-height: 19px; }
.etapes-raccourci li { margin-bottom: 6px; }
.jeton-neuf { background: var(--laiton-doux); border-radius: 10px; padding: 12px; margin: 10px 0; }
.jeton-neuf strong { display: block; font-size: 13px; margin-bottom: 8px; }
.jeton-neuf .champ { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.pied-barre { flex-wrap: wrap; }
.cal-liste { padding: 8px 16px 24px; }
.cal-mobile-actions { padding: 12px 16px 0; }
.cal-liste-jour h3 { font-size: 13px; text-transform: capitalize; margin: 18px 0 6px; color: var(--t2); }
.cal-liste-jour.auj h3 { color: var(--laiton); }
.cal-liste-jour.passe { opacity: .6; }
.cal-liste-evt, .cal-liste-tache { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--trait); margin-bottom: 6px; cursor: pointer; }
.cal-liste-evt { border-left: 3px solid var(--c); }
.cal-liste-evt time { font-size: 12px; color: var(--t3); min-width: 48px; font-variant-numeric: tabular-nums; }
.cal-liste-evt > span, .cal-liste-tache > span:not(.pastille):not(.prio) { flex: 1; min-width: 0; }
.cal-liste-evt small { font-size: 11px; color: var(--t3); }
.cal-liste-tache { background: var(--laiton-doux); border-color: transparent; }

/* ─── routines ─── */
.rt { padding: 8px 24px 40px; max-width: 980px; }
.rt section { margin-top: 18px; }
.rt-titre { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.rt-titre h2 { font-size: 15px; margin: 0; letter-spacing: -.2px; }
.rt-titre .muet { font-size: 12px; }
.rt-alerte { color: var(--p1) !important; }
.rt-liste { border: 1px solid var(--trait); border-radius: 10px; background: var(--surface); }
.rt-ligne { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--trait); }
.rt-ligne:last-child { border-bottom: 0; }
.rt-ligne.eteinte .rt-texte { opacity: .55; }
.rt-texte { flex: 1; min-width: 0; cursor: pointer; }
.rt-texte strong { display: flex; align-items: center; font-weight: 550; }
.rt-texte small { display: block; font-size: 12px; color: var(--t3); margin-top: 1px; }
.rt-texte small.erreur { color: var(--p0); }
.rt-resume { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.rt-prochaine { font-size: 12px; color: var(--t2); white-space: nowrap; }
.rt-regle { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--trait); }
.rt-option { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--t2); }
.rt-option .champ { height: 32px; width: auto; }
.rt-jours { display: flex; gap: 4px; }
.rt-jours label { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--trait-fort); display: grid; place-items: center; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--t2); }
.rt-jours input { display: none; }
.rt-jours label:has(input:checked) { background: var(--t1); border-color: var(--t1); color: var(--inv); }

/* ─── mobile ─── */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .barre { position: fixed; inset: 0 auto 0 0; width: 272px; background: var(--page); z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--ombre-forte); }
  .app.menu-ouvert .barre { transform: none; }
  .app.menu-ouvert::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 24; }
  .menu-mobile { display: inline-flex; }
  .nav-menu { display: block; }
  .nav-menu + .compteur { display: none; }
  .btn-nouvelle { width: 34px; padding: 0; justify-content: center; }
  .btn-nouvelle .txt { display: none; }
  .btn-nouvelle .plus { display: inline; }
  .entete { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .entete h1 { flex: 1; }
  .entete .espace { display: none; }
  .recherche { order: 5; width: 100%; }
  .recherche .kbd, .btn .kbd, .ajout .aide { display: none; }
  .ajout { margin: 12px 16px 4px; }
  .nav-mois .btn:nth-child(2) { display: none; }
  .entete .btn-cal { display: none; }
  .rt { padding: 4px 16px 32px; }
  .rt-ligne { flex-wrap: wrap; }
  .rt-prochaine { order: 5; width: 100%; padding-left: 42px; }
  .groupe-titre { padding: 8px 16px; }
  .ligne { padding: 0 16px; gap: 10px; height: auto; min-height: 48px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .ligne .ref { display: none; }
  .coche { margin: 0; display: none; }
  .en-selection .coche { display: block; }
  .ligne .titre { white-space: normal; flex-basis: calc(100% - 40px); }
  .ligne .tags { max-width: none; flex-wrap: wrap; margin-left: 24px; }
  .ligne .meta { margin-left: auto; gap: 10px; }
  .tableau { padding: 12px 16px; scroll-snap-type: x mandatory; }
  .colonne { width: 84vw; scroll-snap-align: start; }
  .tiroir-corps { padding: 16px; }
  .tiroir-entete { padding: 10px 12px 10px 16px; }
  .composeur { padding: 10px 12px; }
  .proprietes { grid-template-columns: 96px 1fr; }
  .modale { top: auto; bottom: 0; transform: translateX(-50%); border-radius: 14px 14px 0 0; max-height: 92vh; width: 100vw; }
  .urgences { grid-template-columns: 1fr; }
  .portail-corps { padding: 24px 16px 48px; }
  .portail-entete .dedans { padding: 0 16px; }
  .portail-entete .marque small { display: none; }
}
