:root {
  --fond: #f6f7f9; --carte: #ffffff; --texte: #15181d; --doux: #5f6673; --trait: #e3e6eb; --survol: #f0f2f5;
  --accent: #2563eb; --accent-doux: #e8efff; --vert: #15803d; --vert-doux: #e7f6ec; --orange: #b45309; --orange-doux: #fdf1e3;
  --rouge: #b91c1c; --rouge-doux: #fdecec; --violet: #6d28d9; --violet-doux: #f1ebff;
  --ombre: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --rayon: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0f1115; --carte: #171a20; --texte: #e8eaee; --doux: #9aa1ad; --trait: #2a2f38; --survol: #1f232b;
    --accent: #6b9bff; --accent-doux: #1b2740; --vert: #4ade80; --vert-doux: #15291d; --orange: #fbbf6a; --orange-doux: #2e2214;
    --rouge: #f87171; --rouge-doux: #301818; --violet: #b59cff; --violet-doux: #231c38;
    --ombre: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.marque { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.pastille { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; }

.bouton { border: 1px solid var(--trait); background: var(--carte); border-radius: 9px; padding: 7px 12px; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.bouton:hover { background: var(--survol); }
.bouton:active { transform: scale(.97); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.carte-connexion { background: var(--carte); border: 1px solid var(--trait); border-radius: 16px; padding: 28px; width: min(360px, 100%); display: grid; gap: 10px; box-shadow: var(--ombre); }
.carte-connexion .marque { margin-bottom: 8px; font-size: 18px; }
.carte-connexion input { padding: 10px 12px; border: 1px solid var(--trait); border-radius: 9px; background: var(--fond); }
.erreur { color: var(--rouge); min-height: 1em; margin: 0; font-size: 13px; }

/* en-tête */
.entete { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--fond) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--trait); }
.ligne-entete { display: flex; align-items: center; gap: 16px; padding: 10px 16px; max-width: 1100px; margin: 0 auto; flex-wrap: wrap; }
.onglets { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.onglet { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; border-radius: 10px; padding: 6px 12px; cursor: pointer; color: var(--doux); font-weight: 600; white-space: nowrap; }
.onglet:hover { background: var(--survol); }
.onglet[aria-selected="true"] { background: var(--carte); border-color: var(--trait); color: var(--texte); box-shadow: var(--ombre); }
.onglet img { height: 18px; width: auto; max-width: 90px; display: block; }
.onglet .avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-doux); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.onglet .compte { font-size: 12px; background: var(--rouge); color: #fff; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .onglet img { background: #fff; border-radius: 4px; padding: 2px 4px; height: 22px; } }
.outils { display: flex; gap: 8px; }
.outils input { width: 200px; padding: 7px 10px; border: 1px solid var(--trait); border-radius: 9px; background: var(--carte); }
.vues { display: flex; gap: 4px; padding: 0 16px 10px; max-width: 1100px; margin: 0 auto; overflow-x: auto; }
.vue { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--doux); white-space: nowrap; font-weight: 500; }
.vue:hover { background: var(--survol); }
.vue[aria-selected="true"] { background: var(--texte); color: var(--fond); }
.vue .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* liste */
.liste { max-width: 1100px; margin: 0 auto; padding: 14px 16px 80px; display: grid; gap: 10px; }
.vide { text-align: center; color: var(--doux); padding: 60px 16px; }
.contact { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px 14px; box-shadow: var(--ombre); display: grid; gap: 8px; }
.contact.chaud { border-left: 4px solid var(--vert); }
.contact.tiede { border-left: 4px solid var(--orange); }
.haut { display: flex; gap: 12px; align-items: flex-start; }
.qui { flex: 1; min-width: 0; }
.nom { font-weight: 700; font-size: 16px; cursor: pointer; }
.nom:hover { text-decoration: underline; }
.sous { color: var(--doux); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.sous a { color: var(--accent); text-decoration: none; }
.tel { display: inline-flex; align-items: center; gap: 8px; background: var(--vert); color: #fff; text-decoration: none; border-radius: 10px; padding: 8px 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tel { color: #0f1115; } }
.tel:active { transform: scale(.97); }
.tel.sans { background: var(--survol); color: var(--doux); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12.5px; padding: 2px 8px; border-radius: 99px; background: var(--survol); color: var(--doux); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.vert { background: var(--vert-doux); color: var(--vert); font-weight: 600; }
.badge.orange { background: var(--orange-doux); color: var(--orange); font-weight: 600; }
.badge.rouge { background: var(--rouge-doux); color: var(--rouge); font-weight: 600; }
.badge.bleu { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.badge.violet { background: var(--violet-doux); color: var(--violet); font-weight: 600; }
.details { font-size: 14px; color: var(--doux); white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions .bouton { font-size: 13.5px; padding: 6px 10px; }
.actions .ok { border-color: var(--vert); color: var(--vert); }
.actions .ko { color: var(--rouge); }
.historique { border-top: 1px dashed var(--trait); padding-top: 8px; font-size: 13.5px; display: grid; gap: 4px; }
.historique .ev { display: flex; gap: 8px; }
.historique .quand { color: var(--doux); min-width: 110px; font-variant-numeric: tabular-nums; }
.note-saisie { display: flex; gap: 6px; }
.note-saisie input { flex: 1; padding: 6px 10px; border: 1px solid var(--trait); border-radius: 9px; background: var(--fond); }

/* petite fenêtre de date */
.pop { position: fixed; z-index: 40; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); display: grid; gap: 8px; width: 280px; }
.pop .titre { font-weight: 700; }
.pop .choix { display: flex; flex-wrap: wrap; gap: 6px; }
.pop input { padding: 7px 10px; border: 1px solid var(--trait); border-radius: 9px; background: var(--fond); width: 100%; }
.pop .ligne { display: flex; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: 10px 14px; border-radius: 10px; display: flex; gap: 14px; align-items: center; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

.dialogue { border: 1px solid var(--trait); border-radius: 16px; padding: 20px; background: var(--carte); color: var(--texte); width: min(520px, calc(100% - 32px)); }
.dialogue::backdrop { background: rgba(0,0,0,.35); }
.dialogue h2 { margin: 0 0 12px; font-size: 18px; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grille label { display: grid; gap: 4px; font-size: 13px; color: var(--doux); }
.grille .large { grid-column: 1 / -1; }
.grille input, .grille textarea { padding: 8px 10px; border: 1px solid var(--trait); border-radius: 9px; background: var(--fond); color: var(--texte); }
.actions-dlg { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 720px) {
  .ligne-entete { gap: 10px; }
  .txt-marque { display: none; }
  .outils { width: 100%; }
  .outils input { flex: 1; width: auto; }
  .haut { flex-direction: column; }
  .tel { width: 100%; justify-content: center; padding: 11px 14px; font-size: 17px; }
  .grille { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .bouton:active, .tel:active { transform: none; } }
