/* =========================================================================
   Physioslate · Télésoin — feuille de style unique.
   Sobre, contrasté, utilisable au cabinet comme sur un téléphone.
   ========================================================================= */

:root {
  --fond: #f6f7f9;
  --fond-carte: #ffffff;
  --fond-creux: #eef1f4;
  --trait: #d9dee4;
  --texte: #16202b;
  --texte-doux: #5b6b7c;
  --accent: #0f766e;
  --accent-clair: #e6f4f1;
  --accent-fort: #0b5a54;
  --danger: #b42318;
  --danger-clair: #fdecea;
  --avertissement: #92400e;
  --avertissement-clair: #fef3c7;
  --succes: #15803d;
  --ombre: 0 1px 2px rgba(16, 32, 43, .06), 0 8px 24px rgba(16, 32, 43, .06);
  --rayon: 14px;
  --rayon-petit: 9px;
  --largeur: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0d1218;
    --fond-carte: #151d26;
    --fond-creux: #1d2733;
    --trait: #2b3743;
    --texte: #e8edf2;
    --texte-doux: #9aabbc;
    --accent: #2dd4bf;
    --accent-clair: #10312f;
    --accent-fort: #5eead4;
    --danger: #f87171;
    --danger-clair: #3b1513;
    --avertissement: #fcd34d;
    --avertissement-clair: #38290a;
    --succes: #4ade80;
    --ombre: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  color: var(--texte);
  font: 400 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overflow-wrap: break-word;
}

.sprite { display: none; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .35em; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .5em; }
h3 { font-size: .95rem; margin: 0 0 .4em; }
p { margin: 0 0 .9em; }
a { color: var(--accent); }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- barre -- */

.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem clamp(.9rem, 3vw, 1.6rem);
  background: var(--fond-carte);
  border-bottom: 1px solid var(--trait);
  position: sticky; top: 0; z-index: 20;
  padding-top: max(.7rem, env(safe-area-inset-top));
}

body[data-vue="seance"] .barre { display: none; }

.marque {
  display: flex; align-items: center; gap: .6rem;
  color: inherit; text-decoration: none; font-size: .95rem;
}
.marque b { display: block; letter-spacing: -.01em; }
.marque-suite { display: block; font-size: .78rem; color: var(--texte-doux); }
.marque-logo {
  width: 30px; height: 30px; flex: none;
  fill: none; stroke: var(--accent); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}

.barre-etat { display: flex; align-items: center; gap: .5rem; }

.pastille {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--texte-doux);
  background: var(--fond-creux); border-radius: 999px; padding: .25rem .65rem;
}
.pastille svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.pastille[data-niveau="ok"] { color: var(--succes); }
.pastille[data-niveau="alerte"] { color: var(--avertissement); background: var(--avertissement-clair); }

/* ----------------------------------------------------------------- vues -- */

#principal { flex: 1; display: flex; flex-direction: column; }

.vue { display: none; }
.vue.active { display: block; padding: clamp(1rem, 3vw, 2.2rem) clamp(.9rem, 3vw, 1.6rem) 3rem; }
.vue.active.pleine { display: flex; flex-direction: column; padding: 0; flex: 1; min-height: 0; }

.centre { display: grid; place-items: center; min-height: 50vh; }

.carte {
  background: var(--fond-carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: clamp(1.1rem, 3vw, 1.9rem);
  max-width: var(--largeur);
  margin: 0 auto 1.1rem;
}
.carte.etroite { max-width: 30rem; }
.carte.discrete { box-shadow: none; background: transparent; }

.chapeau { color: var(--texte-doux); }
.discret { color: var(--texte-doux); }
.mini { font-size: .82rem; }
.centre-texte { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; }
.selectionnable { user-select: all; word-break: break-all; }

.encart {
  background: var(--fond-creux);
  border-radius: var(--rayon-petit);
  padding: 1rem 1.1rem;
  margin: 0 0 1.1rem;
}
.encart h2 { margin-top: 0; }

.avis {
  background: var(--avertissement-clair);
  color: var(--avertissement);
  border-radius: var(--rayon-petit);
  padding: .7rem .9rem;
  font-size: .87rem;
  margin: .8rem 0;
}
.avis.fort { font-weight: 500; }
.avis.mini { font-size: .78rem; padding: .55rem .7rem; }

.erreur {
  background: var(--danger-clair); color: var(--danger);
  border-radius: var(--rayon-petit); padding: .6rem .8rem;
  font-size: .88rem; margin: .7rem 0;
}

.puces { margin: 0 0 .8em; padding-left: 1.15em; }
.puces li { margin-bottom: .4em; }

.bloc { border-top: 1px solid var(--trait); padding-top: 1.2rem; margin-top: 1.4rem; }
.bloc:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* -------------------------------------------------------------- champs -- */

label { display: block; font-size: .87rem; font-weight: 500; margin: .9rem 0 .3rem; }
label .discret { font-weight: 400; }

input[type="text"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%; font: inherit; color: inherit;
  background: var(--fond); border: 1px solid var(--trait);
  border-radius: var(--rayon-petit); padding: .6rem .75rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input.grand, select.grand { padding: .75rem .85rem; font-size: 1.02rem; }
input.geant { font-size: 2rem; letter-spacing: .12em; padding: .7rem; }
input[readonly] { background: var(--fond-creux); }

.ligne-champs { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.ligne-champs.serree { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.ligne-champs.serree label { margin-top: 0; font-size: .8rem; }
@media (max-width: 560px) { .ligne-champs { grid-template-columns: 1fr; } }

.case-large {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--fond-creux); border-radius: var(--rayon-petit);
  padding: .9rem 1rem; margin: 1rem 0; font-weight: 400; cursor: pointer;
}
.case-large input { margin-top: .2rem; width: 1.15rem; height: 1.15rem; flex: none; }

.liste-controle { list-style: none; margin: 0; padding: 0; }
.liste-controle li { margin-bottom: .55rem; }
.liste-controle label {
  display: flex; gap: .6rem; align-items: flex-start;
  font-weight: 400; font-size: .9rem; margin: 0; cursor: pointer;
}
.liste-controle input { margin-top: .18rem; width: 1.05rem; height: 1.05rem; flex: none; }
.aide-inline { color: var(--texte-doux); font-size: .82rem; display: block; }

.repli { margin: .8rem 0; }
.repli summary { cursor: pointer; font-size: .88rem; color: var(--accent); }

/* ------------------------------------------------------------- boutons -- */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 500; cursor: pointer;
  background: var(--fond-carte); color: var(--texte);
  border: 1px solid var(--trait); border-radius: var(--rayon-petit);
  padding: .6rem 1rem; min-height: 44px;
}
.bouton:hover:not(:disabled) { border-color: var(--accent); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .bouton.principal { color: #06201d; } }
.bouton.principal:hover:not(:disabled) { background: var(--accent-fort); border-color: var(--accent-fort); }
.bouton.large { width: 100%; margin-top: 1rem; padding: .8rem 1rem; }
.bouton.discret { background: transparent; }
.bouton.danger { color: var(--danger); border-color: var(--danger); background: transparent; }

.bouton-icone {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  background: transparent; border: 1px solid transparent; border-radius: var(--rayon-petit);
  color: var(--texte-doux); cursor: pointer; font-size: 1.3rem; line-height: 1;
}
.bouton-icone:hover { background: var(--fond-creux); color: var(--texte); }
.bouton-icone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lien {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.lien.retour { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: 1rem; text-decoration: none; font-size: .9rem; }
.lien.retour svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.rangee-boutons { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.rangee-boutons.centre { justify-content: center; }

/* -------------------------------------------------------------- étapes -- */

.etapes { list-style: none; display: flex; gap: .4rem; margin: 0 0 1.5rem; padding: 0; }
.etape {
  flex: 1; font-size: .76rem; color: var(--texte-doux);
  display: flex; flex-direction: column; gap: .35rem;
  border-top: 3px solid var(--trait); padding-top: .5rem;
}
.etape span {
  display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--fond-creux); font-size: .7rem; font-weight: 600;
}
.etape.active { color: var(--accent); border-top-color: var(--accent); }
.etape.active span { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .etape.active span { color: #06201d; } }

.qr-cadre {
  display: grid; place-items: center; background: #fff;
  border-radius: var(--rayon-petit); padding: 1rem; margin: 1rem 0;
}
.qr-cadre img { width: min(240px, 70vw); height: auto; image-rendering: pixelated; }

/* ---------------------------------------------------------- invitation -- */

.bloc-partage { display: grid; gap: 1rem; grid-template-columns: 1.4fr 1fr; margin: 1.2rem 0; }
@media (max-width: 680px) { .bloc-partage { grid-template-columns: 1fr; } }

.canal {
  background: var(--fond-creux); border-radius: var(--rayon-petit);
  padding: 1rem 1.1rem; position: relative;
}
.canal.accent { background: var(--accent-clair); }
.canal h2 { margin: .2rem 0 .3rem; }
.etiquette-canal {
  font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent);
}

.champ-copie { display: flex; gap: .5rem; margin: .6rem 0; }
.champ-copie input { flex: 1; min-width: 0; font-size: .84rem; }

.pin {
  font: 700 2.4rem/1.1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .14em; margin: .5rem 0; user-select: all; color: var(--accent-fort);
}
@media (prefers-color-scheme: dark) { .pin { color: var(--accent-fort); } }

.attente-patient {
  display: flex; align-items: center; gap: .8rem;
  background: var(--fond-creux); border-radius: var(--rayon-petit);
  padding: .9rem 1.1rem; margin: 1.2rem 0 .6rem;
}
.attente-patient p { margin: 0; font-size: .92rem; }
.attente-patient.prete { background: var(--accent-clair); color: var(--accent-fort); }

/* -------------------------------------------------------------- rotor --- */

.rotor {
  width: 30px; height: 30px; flex: none; margin: 0 auto .8rem;
  border: 3px solid var(--trait); border-top-color: var(--accent);
  border-radius: 50%; animation: tourner .9s linear infinite;
}
.rotor.petit { width: 18px; height: 18px; border-width: 2px; margin: 0; }
@keyframes tourner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rotor { animation-duration: 3s; } }

.apercu-attente {
  background: #000; border-radius: var(--rayon-petit); overflow: hidden;
  aspect-ratio: 4/3; margin: 1rem 0; max-width: 22rem; margin-inline: auto;
}
.apercu-attente video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

/* -------------------------------------------------------------- séance -- */

.scene {
  position: relative; flex: 1; min-height: 0;
  background: #05080b; overflow: hidden;
}

.distant-enveloppe { position: absolute; inset: 0; }
#video-distant { width: 100%; height: 100%; object-fit: contain; background: #05080b; }
#video-distant.miroir { transform: scaleX(-1); }

#calque-mesure { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

.voile-attente {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  background: rgba(5, 8, 11, .82); color: #e8edf2; text-align: center; padding: 1rem;
}
.voile-attente p { margin: 0; font-size: .95rem; }

.local-enveloppe {
  position: absolute; right: 1rem; bottom: 1rem;
  width: clamp(96px, 22vw, 220px); aspect-ratio: 4/3;
  border-radius: 10px; overflow: hidden; background: #000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .14);
  cursor: grab; touch-action: none;
}
.local-enveloppe video { width: 100%; height: 100%; object-fit: cover; }
.local-enveloppe video.miroir { transform: scaleX(-1); }
.local-enveloppe.masque { opacity: .35; }

.indicateur-qualite {
  position: absolute; left: 1rem; top: 1rem;
  display: flex; align-items: flex-end; gap: 3px; height: 20px;
  background: rgba(5, 8, 11, .55); border-radius: 6px; padding: 4px 6px;
}
.indicateur-qualite i { width: 4px; background: #64748b; border-radius: 1px; }
.indicateur-qualite i:nth-child(1) { height: 25%; }
.indicateur-qualite i:nth-child(2) { height: 50%; }
.indicateur-qualite i:nth-child(3) { height: 75%; }
.indicateur-qualite i:nth-child(4) { height: 100%; }
.indicateur-qualite[data-niveau="1"] i:nth-child(-n+1),
.indicateur-qualite[data-niveau="2"] i:nth-child(-n+2),
.indicateur-qualite[data-niveau="3"] i:nth-child(-n+3),
.indicateur-qualite[data-niveau="4"] i:nth-child(-n+4) { background: #4ade80; }
.indicateur-qualite[data-niveau="1"] i:nth-child(1) { background: #f87171; }
.indicateur-qualite[data-niveau="2"] i:nth-child(-n+2) { background: #fbbf24; }

.chrono-affiche {
  position: absolute; left: 50%; top: 1rem; transform: translateX(-50%);
  background: rgba(5, 8, 11, .72); color: #fff; border-radius: 10px;
  padding: .5rem 1rem; text-align: center; min-width: 8.5rem;
}
.chrono-affiche b { display: block; font: 700 1.9rem/1.1 ui-monospace, Consolas, monospace; }
.chrono-affiche span { font-size: .74rem; opacity: .8; }
.chrono-affiche.repos { background: rgba(146, 64, 14, .85); }

/* ------------------------------------------------------------ panneaux -- */

.panneau {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(24rem, 92vw);
  background: var(--fond-carte); border-left: 1px solid var(--trait);
  display: flex; flex-direction: column; z-index: 5;
  padding: 0 1rem 1rem; overflow-y: auto;
}
.panneau header {
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--fond-carte);
  padding: .9rem 0 .6rem; border-bottom: 1px solid var(--trait); margin-bottom: .8rem;
}
.panneau header h2 { margin: 0; }
@media (max-width: 560px) { .panneau { width: 100%; border-left: 0; } }

.outil { border-top: 1px solid var(--trait); padding-top: 1rem; margin-top: 1rem; }
.outil:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.mesure {
  font: 700 1.8rem/1.2 ui-monospace, Consolas, monospace;
  color: var(--accent); margin: .5rem 0;
}

.fil { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; min-height: 6rem; }
.message {
  max-width: 85%; padding: .5rem .75rem; border-radius: 12px;
  font-size: .92rem; background: var(--fond-creux);
}
.message.moi { align-self: flex-end; background: var(--accent-clair); }
.message time { display: block; font-size: .68rem; color: var(--texte-doux); margin-top: .2rem; }

#form-chat { display: flex; gap: .5rem; margin: .7rem 0 .4rem; }
#form-chat input { flex: 1; min-width: 0; }

#champ-notes { flex: 1; min-height: 16rem; resize: vertical; font-size: .92rem; line-height: 1.5; }

/* --------------------------------------------------------- barre outils -- */

.barre-outils {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  flex-wrap: wrap; background: var(--fond-carte); border-top: 1px solid var(--trait);
  padding: .5rem .6rem; padding-bottom: max(.5rem, env(safe-area-inset-bottom));
  z-index: 10;
}

.commande {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .18rem;
  min-width: 62px; min-height: 52px; padding: .35rem .5rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--rayon-petit);
  color: var(--texte-doux); font: inherit; font-size: .68rem; cursor: pointer;
}
.commande svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.commande:hover { background: var(--fond-creux); color: var(--texte); }
.commande[aria-pressed="true"] { color: var(--danger); }
.commande.actif { color: var(--accent); background: var(--accent-clair); }
.commande.danger { color: #fff; background: var(--danger); margin-left: .6rem; }
.commande.danger:hover { background: var(--danger); filter: brightness(1.1); }
.commande[hidden] { display: none; }

.badge {
  position: absolute; top: .1rem; right: .55rem;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: .62rem; padding: 0 .32rem; min-width: 1rem; text-align: center;
}

/* --------------------------------------------------------------- divers -- */

.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 1rem; }
.tableau td { border-bottom: 1px solid var(--trait); padding: .6rem .3rem; vertical-align: middle; }
.tableau td:last-child { text-align: right; width: 1%; white-space: nowrap; }
.badge-courant {
  font-size: .7rem; background: var(--accent-clair); color: var(--accent-fort);
  border-radius: 999px; padding: .1rem .5rem; margin-left: .4rem;
}

.recap {
  text-align: left; background: var(--fond-creux); border-radius: var(--rayon-petit);
  padding: .9rem 1.1rem; margin: 1rem 0; font-size: .9rem;
}
.recap dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: 0; }
.recap dt { color: var(--texte-doux); }
.recap dd { margin: 0; }

.bulle {
  position: fixed; left: 50%; bottom: 5.2rem; transform: translateX(-50%);
  background: var(--texte); color: var(--fond);
  padding: .6rem 1.1rem; border-radius: 999px; font-size: .88rem;
  z-index: 100; box-shadow: var(--ombre); max-width: 90vw; text-align: center;
}

.dialogue {
  border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--fond-carte); color: var(--texte);
  padding: 1.4rem; max-width: 26rem; box-shadow: var(--ombre);
}
.dialogue::backdrop { background: rgba(5, 8, 11, .6); }
.dialogue h2 { margin-top: 0; }
