/* =====================================================================
   Le manager du cabinet dentaire — feuille de style commune
   Couleurs et espacements centralisés dans :root.
   ===================================================================== */
:root {
  --fond: #f5f7fb;
  --surface: #ffffff;
  --texte: #1b2333;
  --texte-doux: #5c667a;
  --bord: #e2e7f0;
  --primaire: #2f5bd8;
  --primaire-fonce: #2148b3;
  --primaire-clair: #e9effd;
  --accent: #7b4fd6;
  --ok: #1d8a5c;        --ok-fond: #e6f5ee;
  --attention: #a86400; --attention-fond: #fff3df;
  --alerte: #c0352b;    --alerte-fond: #fdeceb;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(20, 30, 60, .06);
  --nav-largeur: 220px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11151d; --surface: #1a2029; --texte: #e8ecf3; --texte-doux: #9aa4b6; --bord: #2b3340;
    --primaire: #6e93f5; --primaire-fonce: #8aa8f7; --primaire-clair: #1f2a44;
    --ok-fond: #12372a; --attention-fond: #3a2b10; --alerte-fond: #3d1a17;
    --ok: #5fd0a0; --attention: #f0b357; --alerte: #f08a80;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; background: var(--fond); color: var(--texte); font-size: 15px; line-height: 1.5; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .75rem; }
h4 { font-size: .9rem; margin: 1rem 0 .3rem; }
.carte h4:first-of-type { margin-top: .25rem; }
.carte p { margin: .25rem 0 .5rem; }
a { color: var(--primaire); }

/* ---------- Coque ---------- */
.barre { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
  height: 56px; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--bord); }
.marque { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.logo-pastille { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primaire), var(--accent)); color: #fff; font-weight: 700; }
.barre-droite { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.cabinet-nom { color: var(--texte-doux); font-size: .9rem; }
.btn-menu { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--texte); cursor: pointer; }
.corps { display: flex; min-height: calc(100vh - 56px); }
nav { width: var(--nav-largeur); flex-shrink: 0; padding: 1rem .75rem; background: var(--surface);
  border-right: 1px solid var(--bord); display: flex; flex-direction: column; gap: .25rem; }
nav a { padding: .6rem .8rem; border-radius: 8px; color: var(--texte); text-decoration: none; font-weight: 500; }
nav a:hover { background: var(--fond); }
nav a.actif { background: var(--primaire-clair); color: var(--primaire); }
.nav-pied { margin-top: auto; padding: .5rem; }
main { flex: 1; min-width: 0; padding: 1.5rem; max-width: 1200px; }

/* ---------- Éléments ---------- */
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.1rem 1.2rem;
  box-shadow: var(--ombre); margin-bottom: 1rem; }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .9rem 1rem; }
.kpi .valeur { font-size: 1.6rem; font-weight: 700; }
.kpi .libelle { color: var(--texte-doux); font-size: .85rem; }
.kpi.alerte .valeur { color: var(--alerte); }

.btn { appearance: none; border: 1px solid var(--primaire); background: var(--primaire); color: #fff; border-radius: 8px;
  padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--primaire-fonce); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-secondaire { background: var(--surface); color: var(--primaire); }
.btn-secondaire:hover { background: var(--primaire-clair); }
.btn-danger { background: var(--surface); color: var(--alerte); border-color: var(--alerte); }
.btn-lien { background: none; border: 0; color: var(--texte-doux); padding: .3rem; }
.btn-lien:hover { background: none; color: var(--primaire); }
.btn-petit { padding: .3rem .6rem; font-size: .85rem; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--fond); color: var(--texte-doux); border: 1px solid var(--bord); white-space: nowrap; }
.badge-ok { background: var(--ok-fond); color: var(--ok); border-color: transparent; }
.badge-attention { background: var(--attention-fond); color: var(--attention); border-color: transparent; }
.badge-alerte { background: var(--alerte-fond); color: var(--alerte); border-color: transparent; }

.onglets { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--bord); margin-bottom: 1rem; }
.onglets a { padding: .6rem .9rem; text-decoration: none; color: var(--texte-doux); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; }
.onglets a.actif { color: var(--primaire); border-bottom-color: var(--primaire); }

.table-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: .8rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .03em; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: var(--fond); }

.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { padding: .55rem 0; border-bottom: 1px solid var(--bord); display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.liste-simple li:last-child { border-bottom: 0; }
.fait { text-decoration: line-through; color: var(--texte-doux); }

.definition { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: .4rem 1rem; margin: 0; }
.definition dt { color: var(--texte-doux); }
.definition dd { margin: 0; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: .8rem; }
.champ { display: flex; flex-direction: column; gap: .3rem; }
.champ label { font-weight: 500; font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--texte); background: var(--surface); border: 1px solid var(--bord);
  border-radius: 8px; padding: .5rem .65rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaire); outline-offset: 0; border-color: transparent; }
.case { display: flex; gap: .5rem; align-items: flex-start; }
.case input { width: auto; margin-top: .25rem; }
.aide { color: var(--texte-doux); font-size: .85rem; margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }

.modale-fond { position: fixed; inset: 0; background: rgba(10, 15, 30, .45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modale { background: var(--surface); border-radius: 12px; padding: 1.25rem; width: min(560px, 100%); max-height: 90vh; overflow: auto; }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  background: var(--texte); color: var(--surface); padding: .7rem 1rem; border-radius: 8px; z-index: 60; max-width: 90vw; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast-erreur { background: var(--alerte); color: #fff; }

.encadre { border-left: 3px solid var(--primaire); background: var(--primaire-clair); padding: .7rem .9rem; border-radius: 0 8px 8px 0; margin: .75rem 0; font-size: .9rem; }
.encadre.attention { border-color: var(--attention); background: var(--attention-fond); }
.vide, .chargement { color: var(--texte-doux); padding: 1rem 0; }
.erreur { color: var(--alerte); }
.ecran-centre { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.connexion { width: min(420px, 100%); }
.connexion .marque { margin-bottom: 1rem; }
.mention { color: var(--texte-doux); font-size: .8rem; text-align: center; margin-top: 1rem; }
.transcription { white-space: pre-wrap; max-height: 360px; overflow: auto; background: var(--fond); padding: .8rem; border-radius: 8px; font-size: .9rem; }
.enregistreur { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.point-rec { width: 12px; height: 12px; border-radius: 50%; background: var(--alerte); animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .2; } }
.niveaux { display: flex; gap: .25rem; }
.niveaux span { width: 22px; height: 8px; border-radius: 4px; background: var(--bord); }
.niveaux span.plein { background: var(--primaire); }
.barre-progression { height: 8px; background: var(--bord); border-radius: 4px; overflow: hidden; min-width: 100px; }
.barre-progression > div { height: 100%; background: var(--primaire); }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .btn-menu { display: block; }
  .cabinet-nom { display: none; }
  nav { position: fixed; top: 56px; bottom: 0; left: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.menu-ouvert nav { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  main { padding: 1rem; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--bord); padding: .5rem 0; }
  td { border: 0; padding: .2rem 0; }
  td::before { content: attr(data-titre) " : "; color: var(--texte-doux); font-size: .8rem; }
  .definition { grid-template-columns: 1fr; gap: .1rem; }
  .definition dd { margin-bottom: .5rem; }
}
