@font-face {
  font-family: "Inter";
  src: url("inter-var.woff2") format("woff2-variations"), url("inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --fond: #edf1f6;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --texte: #0f1a24;
  --doux: #58697a;
  --bord: #d9e2ec;
  --accent: #0d8b7f;
  --accent-2: #16b8a6;
  --accent-texte: #ffffff;
  --vert: #12965a;
  --rouge: #d62f42;
  --orange: #cf7a12;
  --bleu: #2f6fed;
  --touche: #e9eef4;
  --halo: rgba(13, 139, 127, .16);
  --ombre: 0 1px 2px rgba(15, 30, 45, .04), 0 14px 34px -16px rgba(15, 30, 45, .22);
  --ombre-forte: 0 2px 4px rgba(15, 30, 45, .05), 0 24px 50px -20px rgba(15, 30, 45, .3);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #070c11;
    --surface: #101a23;
    --surface-2: #142029;
    --texte: #e9f1f7;
    --doux: #93a6b6;
    --bord: #1f2d3a;
    --accent: #2dd4bf;
    --accent-2: #5eead4;
    --accent-texte: #04231f;
    --vert: #34d399;
    --rouge: #f26374;
    --orange: #f0a15a;
    --bleu: #6ea8ff;
    --touche: #1a2833;
    --halo: rgba(45, 212, 191, .14);
    --ombre: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 36px -18px rgba(0, 0, 0, .7);
    --ombre-forte: 0 2px 6px rgba(0, 0, 0, .45), 0 28px 60px -22px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 520px at 12% -12%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(900px 480px at 100% -4%, color-mix(in srgb, var(--bleu) 12%, transparent), transparent 58%),
    var(--fond);
  background-attachment: fixed;
  color: var(--texte);
  font: 16px/1.5 "Inter", "Inter var", "Segoe UI Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.ecran {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------- cartes et formulaires ---------- */
.carte {
  background: var(--surface);
  color: var(--texte);
  border: 1px solid var(--bord);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--ombre);
}
#ecran-connexion { justify-content: center; }
#form-connexion { display: flex; flex-direction: column; gap: 14px; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-texte); display: grid; place-items: center; }
h1 { font-size: 1.35rem; margin: 4px 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--doux); margin-bottom: 10px; }
label.case { flex-direction: row; align-items: center; gap: 10px; color: var(--texte); padding: 4px 0; margin: 0; }
label.case input { flex: 0 0 auto; width: auto; }
input:not([type=checkbox]), select, textarea {
  font: inherit;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: 11px 14px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.erreur { color: var(--rouge); min-height: 1.2em; margin: 0; font-size: .9rem; }
.aide { color: var(--doux); font-size: .85rem; margin: 2px 0 10px 30px; }
.aide.plein { margin-left: 0; }
.groupe { margin-bottom: 6px; }
.lien-discret { color: var(--doux); font-size: .85rem; text-align: center; }

.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.principal { background: var(--accent); color: var(--accent-texte); }
.btn.secondaire { background: var(--touche); color: var(--texte); }
.btn.danger { background: transparent; color: var(--rouge); border: 1px solid var(--rouge); }
.btn.petit { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.ligne-btn { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.ligne-btn.espace { justify-content: space-between; }
.icone-btn { background: none; border: 0; color: var(--doux); padding: 8px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icone-btn.accent { background: var(--accent); color: var(--accent-texte); }

/* ---------- barre du haut ---------- */
.app { padding-bottom: 0; }
.barre { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.titre { font-weight: 700; font-size: 1.15rem; }
.statut {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--touche); color: var(--texte);
  border: 0; border-radius: 999px; padding: 4px 12px; margin-top: 4px;
  font: inherit; font-size: .85rem; cursor: pointer;
}
.point { width: 9px; height: 9px; border-radius: 50%; background: var(--doux); flex: none; }
.statut[data-etat=ok] .point, .point.ok { background: var(--vert); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vert) 25%, transparent); }
.statut[data-etat=pause] .point, .point.pause { background: var(--orange); }
.statut[data-etat=erreur] .point, .point.erreur { background: var(--rouge); }
.point.occupe { background: var(--bleu); }

.bandeau { background: color-mix(in srgb, var(--orange) 15%, var(--surface)); border: 1px solid var(--orange); border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin-bottom: 12px; }
.bandeau.info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 50%, var(--bord)); }

.en-attente { align-self: flex-start; background: color-mix(in srgb, var(--bleu) 14%, var(--surface)); color: var(--texte); border-radius: 999px; padding: 4px 12px; font-size: .82rem; font-weight: 600; margin: -4px 0 10px; }
.en-attente::before { content: "⏳ "; }
.appel-prioritaire { display: inline-block; margin-top: 10px; background: color-mix(in srgb, var(--orange) 18%, var(--surface)); color: var(--texte); border: 1px solid var(--orange); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: .85rem; }
.fiche-details { color: var(--doux); font-size: .92rem; display: grid; gap: 4px; margin-bottom: 14px; }
.fiche-details div:first-child { color: var(--texte); }
.fiche-enregistrement { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche-actions svg { width: 18px; height: 18px; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.onglet { flex: 1; display: flex; flex-direction: column; padding-bottom: 12px; }

/* ---------- onglets du bas ---------- */
.onglets-bas {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--fond);
  border-top: 1px solid var(--bord);
  margin: 0 -16px;
  padding: 6px 4px max(6px, env(safe-area-inset-bottom));
}
.onglets-bas button {
  position: relative;
  background: none; border: 0; color: var(--doux);
  font: inherit; font-size: .72rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; cursor: pointer; border-radius: 10px;
}
.onglets-bas button[aria-selected=true] { color: var(--accent); }
.badge {
  position: absolute; top: 2px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--rouge); color: #fff;
  font-size: .7rem; line-height: 18px; text-align: center;
}
.pastille { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--rouge); color: #fff; font-size: .7rem; line-height: 18px; }

/* ---------- clavier ---------- */
.saisie { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.saisie input { font-size: 1.6rem; text-align: center; letter-spacing: .04em; background: transparent; border: 0; border-bottom: 1px solid var(--bord); border-radius: 0; }
.saisie input:focus-visible { outline: none; border-bottom-color: var(--accent); }
.suggestion { text-align: center; color: var(--accent); font-weight: 600; font-size: .9rem; min-height: 1.3em; }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px auto; width: 100%; max-width: 300px; }
.touche {
  aspect-ratio: 1.45;
  border: 0; border-radius: 16px;
  background: var(--touche); color: var(--texte);
  font: inherit; font-size: 1.6rem; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
}
.touche small { font-size: .62rem; color: var(--doux); letter-spacing: .12em; height: .9em; }
.touche:active { filter: brightness(.9); }
.actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: auto; padding-top: 12px; }
.actions .btn { font-size: .8rem; padding: 10px 6px; }

.rond { width: 68px; height: 68px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; cursor: pointer; }
.rond svg { width: 30px; height: 30px; }
.rond.vert { background: var(--vert); }
.rond.rouge { background: var(--rouge); }
.raccroche { transform: rotate(135deg); }

/* ---------- listes (appels, messages, contacts) ---------- */
.segments { display: flex; background: var(--touche); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.segments button { flex: 1; border: 0; background: none; color: var(--doux); font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 4px; border-radius: 9px; cursor: pointer; }
.segments button[aria-selected=true] { background: var(--surface); color: var(--texte); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.recherche { display: flex; gap: 8px; margin-bottom: 10px; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste .groupe-date { font-size: .78rem; font-weight: 700; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; padding: 14px 4px 4px; border: 0; cursor: default; }
.liste li.element { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--bord); }
.liste .rond-icone { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--touche); color: var(--doux); flex: none; font-weight: 700; }
.liste .rond-icone svg { width: 18px; height: 18px; }
.liste .rouge { color: var(--rouge); }
.liste .vert { color: var(--vert); }
.liste .bleu { color: var(--bleu); }
.liste .infos { flex: 1; min-width: 0; }
.liste .qui { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .detail { font-size: .8rem; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .detail.rouge { color: var(--rouge); }
.liste .detail.bleu { color: var(--bleu); }
.liste .detail.vert { color: var(--vert); }
.liste .boutons { display: flex; gap: 6px; flex: none; }
.liste .boutons .icone-btn { background: var(--touche); color: var(--texte); width: 38px; height: 38px; border-radius: 50%; }
.liste .boutons .icone-btn.vert { background: var(--vert); color: #fff; }
.liste .boutons svg { width: 18px; height: 18px; }
.liste li.nouveau .qui::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bleu); margin-right: 6px; vertical-align: middle; }
.liste li.cliquable { cursor: pointer; }
.progression { height: 3px; background: var(--touche); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progression div { height: 100%; width: 0; background: var(--accent); }
.vide { color: var(--doux); text-align: center; margin-top: 40px; padding: 0 20px; }

/* ---------- écran d'appel ---------- */
.appel { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, var(--fond)), var(--fond) 60%); max-width: none; }
.appel > * { width: 100%; max-width: 460px; margin-left: auto; margin-right: auto; }
.appel-haut { text-align: center; padding-top: 7vh; }
.appel-etat { color: var(--doux); font-size: .95rem; }
.appel-nom { font-size: 1.8rem; font-weight: 700; margin-top: 8px; word-break: break-word; }
.appel-numero { color: var(--doux); margin-top: 4px; font-size: 1.05rem; }
.appel-fiche { margin: 10px auto 0; max-width: 340px; color: var(--doux); font-size: .9rem; white-space: pre-line; }
.appel-code { display: inline-block; margin-top: 14px; background: var(--surface); border: 1px solid var(--accent); color: var(--texte); border-radius: 12px; padding: 8px 14px; font-weight: 600; letter-spacing: .05em; }
.appel-duree { margin-top: 10px; font-variant-numeric: tabular-nums; color: var(--doux); }
.consultation { margin-top: 20px; background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 14px 16px; }
.consultation .ligne-btn { margin-top: 10px; }
.controles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: auto; padding: 20px 0; }
.ctrl { background: var(--surface); border: 1px solid var(--bord); color: var(--texte); border-radius: 16px; padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; font: inherit; font-size: .78rem; cursor: pointer; }
.ctrl[aria-pressed=true] { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.ctrl:disabled { opacity: .4; }
.pave-appel { margin-top: auto; }
.appel-bas { display: flex; justify-content: space-around; padding: 12px 0 8px; }
#ecran-appel:not(.en-cours) .appel-bas { margin-top: auto; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.sonne #btn-decrocher { animation: pulse 1.2s ease-in-out infinite; }

/* ---------- dialogues ---------- */
dialog { max-width: min(440px, calc(100vw - 32px)); width: 100%; max-height: calc(100dvh - 32px); overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.collegues { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.collegues button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--bord); background: var(--fond); color: var(--texte); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.collegues button:disabled { opacity: .45; cursor: default; }


/* ======================================================================
   Identité visuelle : profondeur, dégradés doux et typographie soignée.
   Ces règles affinent les composants définis plus haut sans changer
   leur structure (mêmes classes, mêmes variables).
   ====================================================================== */
body {
  background:
    radial-gradient(1100px 520px at 8% -12%, var(--halo), transparent 62%),
    radial-gradient(900px 480px at 102% -4%, color-mix(in srgb, var(--bleu) 9%, transparent), transparent 58%),
    radial-gradient(700px 420px at 50% 115%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
    var(--fond);
  background-attachment: fixed;
  font-feature-settings: "ss01" 1, "cv01" 1;
  -webkit-font-smoothing: antialiased;
}
h1 { font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
h2 { font-weight: 700; letter-spacing: -.012em; }
h3 { font-weight: 650; letter-spacing: -.005em; }

.carte {
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--bord) 76%, transparent);
  box-shadow: var(--ombre);
}
#ecran-connexion .carte, #form-admin {
  border-radius: 26px;
  box-shadow: var(--ombre-forte);
}

.btn {
  border-radius: 13px;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background-color .2s ease;
}
.btn.principal {
  background-image: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn.principal:hover { filter: brightness(1.07) saturate(1.05); box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn.secondaire { background: color-mix(in srgb, var(--accent) 7%, var(--touche)); }
.btn.secondaire:hover { background: color-mix(in srgb, var(--accent) 14%, var(--touche)); }
.btn:active { transform: translateY(1px) scale(.995); }

input:not([type=checkbox]):not([type=radio]), select, textarea {
  background: var(--surface);
  border-radius: 13px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--texte) 5%, transparent);
  transition: border-color .15s ease, box-shadow .18s ease, background-color .15s ease;
}
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--bord)); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
label { font-weight: 500; }

.logo {
  border-radius: 18px;
  background-image: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.statut { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bord) 60%, transparent); }

.onglets-bas {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid color-mix(in srgb, var(--bord) 70%, transparent);
}
.onglets-bas button { transition: color .15s ease, transform .15s ease; }
.onglets-bas button[aria-selected=true]::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.onglets-bas button:active { transform: scale(.96); }

.touche {
  background: linear-gradient(180deg, var(--surface), var(--touche));
  border: 1px solid color-mix(in srgb, var(--bord) 70%, transparent);
  box-shadow: 0 1px 1px color-mix(in srgb, var(--texte) 4%, transparent), 0 6px 14px -10px color-mix(in srgb, var(--texte) 45%, transparent);
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}
.touche:active { transform: translateY(1px); box-shadow: none; }
.rond { box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--texte) 70%, transparent); }

.segments, .onglets-admin { background: color-mix(in srgb, var(--touche) 80%, transparent); }
.segments button[aria-selected=true] { background-image: linear-gradient(180deg, var(--surface), var(--surface-2)); }

.liste li.element { transition: background-color .15s ease; }
.liste li.cliquable:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.liste .rond-icone { background: color-mix(in srgb, var(--touche) 85%, transparent); }

dialog {
  border: 0;
  border-radius: 22px;
  box-shadow: var(--ombre-forte);
  background: var(--surface);
  color: var(--texte);
  padding: 22px;
}
dialog::backdrop { background: rgba(6, 14, 20, .5); backdrop-filter: blur(3px); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--doux) 35%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--doux) 55%, transparent); background-clip: content-box; }

/* Données sensibles d'une fiche : bloc distinct, jamais mélangé aux notes */
.bloc-sensible {
  border: 1px solid color-mix(in srgb, var(--rouge) 35%, var(--bord));
  border-radius: 12px; padding: 10px 12px; margin: 4px 0 12px;
  background: color-mix(in srgb, var(--rouge) 6%, var(--surface));
  font-size: .9rem; line-height: 1.45;
}
.bloc-sensible h3 { margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rouge); }
.bloc-sensible > div > div + div { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
