/* App GL Dental · reprend le système de lms-augmentes (DESIGN.md « La salle et le foyer ») :
   papier chaud, cartes blanches de 22 px, encre noir chaud, jaune qui éclaire sans écrire sur le clair,
   barre latérale noire à compteurs jaunes, Inter et JetBrains Mono pour ce qui se compte. */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/polices/inter.woff2) format("woff2-variations"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 800; src: url(/polices/mono.woff2) format("woff2-variations"); }
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f3f2ec; --sunken: #ecebe5; --hover: #f1f0ea; --accent-soft: #f1efe6;
  --ink: #17150f; --ink-2: #4a4a44; --ink-3: #6a6961; --ink-4: #9a9890;
  --line: #e7e6e0; --line-strong: #d9d8d0; --control-line: #85837a;
  --primary: #17150f; --on-accent: #ffffff; --accent-hover: #2e2b24;
  --focus: rgb(255 194 61 / 55%);
  --jaune: #ffc23d; --on-jaune: #17150f; --jaune-survol: #ffd470; --jaune-voile: #fff1c9;
  --success: #2d7a4b; --success-text: #22633c; --warn: #c98a12; --warn-text: #86590a; --error: #c0392b; --error-soft: #fbeae8;
  --toast: #17150f; --on-toast: #f2f2f0;
  --barre: #17150f; --barre-actif: #2a2720; --barre-ink: #cfc8b6; --barre-ink-3: #9a927f; --barre-line: #2a2722;
  --ombre: 0 1px 2px rgb(23 21 15 / 4%), 0 4px 16px rgb(23 21 15 / 4%);
  --r-carte: 22px; --r-panneau: 18px; --r-controle: 12px; --r-md: 10px;
  --page: clamp(18px, 4vw, 40px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100f0d; --surface: #1a1916; --surface-2: #141310; --sunken: #0c0b09; --hover: #23211d; --accent-soft: #26231b;
    --ink: #f2f2f0; --ink-2: #cfc8b6; --ink-3: #9a927f; --ink-4: #6b665a;
    --line: #2a2722; --line-strong: #3a362c; --control-line: #7a7466;
    --primary: #ffc23d; --on-accent: #17150f; --accent-hover: #ffd470;
    --focus: rgb(255 194 61 / 30%);
    --jaune-voile: #2f2819;
    --success: #5ccb8b; --success-text: #5ccb8b; --warn: #f0b54a; --warn-text: #f0b54a; --error: #ff7b6b; --error-soft: #361614;
    --toast: #23211d;
    --barre: #0c0b09; --barre-actif: #2a2722;
    --ombre: inset 0 1px 0 rgb(255 255 255 / 4%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
::selection { background: var(--focus); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chiffre { font-family: var(--mono); font-feature-settings: "tnum"; }

/* Logo : « GL » dans un carré encre, coin jaune (même geste que le glyphe d'augmentes) */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1875rem; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.logo-marque { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: currentColor; flex: none; }
.logo-marque span { color: var(--bg); font-size: 12px; font-weight: 800; letter-spacing: -0.03em; }
.logo-marque::after { content: ""; position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 3px; background: var(--jaune); }

/* Coquille : barre latérale noire à partir de 880 px, barre d'onglets en bas au téléphone */
.coquille { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.barre { display: none; }
.contenu { min-width: 0; padding: var(--page); padding-bottom: calc(88px + env(safe-area-inset-bottom)); max-width: 1240px; width: 100%; margin: 0 auto; }
.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.onglets a { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: var(--r-controle); text-decoration: none; color: var(--ink-3); font-size: 0.75rem; font-weight: 500; }
.onglets a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.onglets svg { width: 22px; height: 22px; }
.tete-mobile { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
@media (min-width: 880px) {
  .coquille { grid-template-columns: 232px 1fr; }
  .barre { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; background: var(--barre); color: #f2f2f0; padding: 22px 14px 14px; }
  .barre .logo { padding: 0 8px 4px; }
  .barre .logo-marque span { color: var(--barre); }
  .barre .espace { margin: 0 0 18px 48px; font-size: 0.8125rem; color: var(--barre-ink-3); }
  .barre nav { display: grid; gap: 2px; }
  .barre nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--r-md); text-decoration: none; color: var(--barre-ink); font-size: 0.90625rem; font-weight: 500; }
  .barre nav a:hover { background: var(--barre-actif); color: #f2f2f0; }
  .barre nav a[aria-current="page"] { background: var(--barre-actif); color: #f2f2f0; }
  .barre nav svg { width: 18px; height: 18px; flex: none; }
  .compteur { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--jaune); color: var(--on-jaune); font: 500 0.75rem/20px var(--mono); text-align: center; }
  .barre .pied { margin-top: auto; border-top: 1px solid var(--barre-line); padding: 12px 8px 0; display: flex; align-items: center; gap: 10px; }
  .barre .pied .nom { font-size: 0.875rem; color: #f2f2f0; font-weight: 500; }
  .barre .pied button { background: none; border: 0; padding: 0; color: var(--barre-ink-3); font-size: 0.8125rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
  .onglets, .tete-mobile .compte-mobile { display: none; }
  .tete-mobile { display: none; }
  .contenu { padding-bottom: 48px; }
}
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--jaune); color: var(--on-jaune); display: grid; place-items: center; font-size: 0.8125rem; font-weight: 600; flex: none; }
.compte-mobile { display: flex; align-items: center; gap: 8px; }
.compte-mobile button { background: none; border: 0; padding: 0; color: var(--ink-3); font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Titres */
.entete { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin: 4px 0 22px; }
h1 { font-size: clamp(1.5rem, 0.6vw + 1.2rem, 1.875rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.025em; margin: 0; }
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.sous-titre { color: var(--ink-3); font-size: 0.9375rem; margin: 6px 0 0; max-width: 68ch; }
.surligne { background: linear-gradient(transparent 55%, var(--jaune) 55%, var(--jaune) 90%, transparent 90%); padding: 0 2px; }
@media (prefers-color-scheme: dark) { .surligne { background: linear-gradient(transparent 55%, rgb(255 194 61 / 38%) 55%, rgb(255 194 61 / 38%) 90%, transparent 90%); } }
.meta { font-size: 0.8125rem; color: var(--ink-3); }

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-carte); box-shadow: var(--ombre); padding: clamp(18px, 3vw, 26px); }
.grille-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tuile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panneau); padding: 16px 18px; text-decoration: none; display: grid; gap: 6px; }
a.tuile:hover { background: var(--hover); }
.tuile .valeur { font: 500 2rem/1 var(--mono); letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.tuile .libelle { font-size: 0.8125rem; color: var(--ink-3); }
.progression { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 14px 0 8px; }
.progression i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s cubic-bezier(.2,.7,.2,1); }
.bloc { display: grid; gap: 14px; }
@media (min-width: 1040px) { .deux { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; } }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.liste-simple li:first-child { border-top: 0; }
.liste-simple a { text-decoration: none; font-weight: 500; }
.liste-simple a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* État : point de 7 px puis un mot */
.etat { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; white-space: nowrap; color: var(--ink); }
.etat i { width: 7px; height: 7px; border-radius: 999px; flex: none; }
.etat.succes i { background: var(--success); }
.etat.attention i { background: var(--warn); }
.etat.creux i { border: 1.5px solid var(--ink-3); }
.etat.neutre i { background: var(--ink-3); }

/* Boutons et champs (pastilles) */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; font-size: 0.90625rem; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap; }
.bouton.principal { background: var(--primary); color: var(--on-accent); }
.bouton.principal:hover { background: var(--accent-hover); }
.bouton.contour { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.bouton.contour:hover { background: var(--hover); }
.bouton.discret { background: transparent; color: var(--ink-2); }
.bouton.discret:hover { background: var(--hover); color: var(--ink); }
.bouton:disabled { opacity: .5; cursor: default; }
.champ, select.champ { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-controle); border: 1px solid var(--control-line); background: var(--surface); color: var(--ink); font-size: 1rem; }
select.champ { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236a6961' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.recherche { position: relative; flex: 1 1 260px; }
.recherche svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.recherche .champ { padding-left: 42px; }

/* Contrôle segmenté */
.segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-controle); background: var(--sunken); }
.segments button { height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 0.875rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(23 21 15 / 8%); }
.segments .n { font: 500 0.75rem/1 var(--mono); color: var(--ink-3); }
.barre-outils { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }

/* Lignes de cabinets */
.lignes { display: grid; gap: 12px; }
.ligne { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panneau); padding: 16px 18px; display: grid; gap: 12px; }
.ligne.eclaire { animation: eclairer 1.6s ease-out; }
@keyframes eclairer { from { background: var(--jaune-voile); } to { background: var(--surface); } }
.ligne-haut { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.ligne .nom { font-weight: 600; letter-spacing: -0.01em; }
.ligne .docs { font-size: 0.8125rem; color: var(--ink-3); margin-top: 2px; }
.groupe { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-controle); background: var(--surface-2); font-size: 0.9375rem; }
.groupe svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.groupe .qui { margin-left: auto; font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .champ { flex: 1 1 220px; }
.msg { font-size: 0.8125rem; min-height: 0; }
.msg.ko { color: var(--error); }
.vide { text-align: center; padding: 48px 16px; color: var(--ink-3); }
.vide .tuile-vide { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); display: grid; place-items: center; margin: 0 auto 12px; }
@media (min-width: 720px) {
  .ligne { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr); align-items: center; column-gap: 20px; }
  .ligne .msg { grid-column: 1 / -1; }
  .ligne .actions { grid-column: 2; }
  .ligne .groupe { grid-column: 2; grid-row: 1; }
  .ligne .ligne-haut { grid-column: 1; grid-row: 1 / span 2; flex-direction: column; justify-content: center; gap: 8px; }
}

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; transition: opacity .2s, transform .2s; background: var(--toast); color: var(--on-toast); border-radius: 14px; padding: 12px 16px; font-size: 0.875rem; display: flex; align-items: center; gap: 10px; z-index: 20; max-width: calc(100vw - 32px); }
.toast svg { width: 18px; height: 18px; color: var(--jaune); flex: none; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 880px) { .toast { bottom: 28px; left: calc(50% + 116px); } }

/* Connexion */
.page-connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.page-connexion .carte { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.page-connexion h1 { margin: 10px 0 2px; }
.page-connexion label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); display: grid; gap: 6px; }
.page-connexion .bouton { height: 46px; margin-top: 4px; }
.erreur { color: var(--error); background: var(--error-soft); border-radius: var(--r-controle); padding: 10px 12px; font-size: 0.875rem; margin: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
[hidden] { display: none !important; }
