/* ===========================================================================
   ORDO / les deux postes
   Le site est sombre ; l'outil de travail est clair. Un poste de soin s'utilise
   en pleine lumiere, debout, souvent vite. Tout est donc dimensionne pour la
   lecture rapide : cibles larges, hierarchie courte, une seule action par ecran.
   =========================================================================== */

body.app {
  background: var(--papier);
  color: var(--encre);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ─────────────── Barre de poste ─────────────── */
.barre {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 0 clamp(16px, 3vw, 32px); height: 64px;
  background: var(--nuit); color: var(--craie);
}
.barre__logo { display: flex; align-items: center; gap: 10px; color: var(--vert-vif); text-decoration: none; }
.barre__logo svg { width: 26px; height: 26px; }
.barre__logo span {
  font-family: var(--titre); font-weight: 800; font-size: 21px;
  letter-spacing: -.035em; color: var(--craie);
}
.barre__compte { margin-left: auto; text-align: right; line-height: 1.25; }
.barre__qui { display: block; font-size: 14px; font-weight: 600; }
.barre__ou { display: block; font-size: 12px; color: var(--craie-3); }

.bascule {
  position: relative; display: flex; gap: 2px; padding: 3px;
  border-radius: 999px; background: rgba(255, 255, 255, .06);
}
.bascule__item {
  position: relative; z-index: 1; border: none; background: none; cursor: pointer;
  padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--craie-2); transition: color .2s ease;
}
.bascule__item[aria-selected="true"] { color: #04120E; }
.bascule__curseur {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 0;
  border-radius: 999px; background: var(--vert-vif);
  transition: transform .32s cubic-bezier(.2,.7,.3,1), width .32s cubic-bezier(.2,.7,.3,1);
}

.bandeau-demo {
  margin: 0; padding: 9px clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--laiton) 15%, var(--papier));
  border-bottom: 1px solid color-mix(in srgb, var(--laiton) 32%, transparent);
  font-size: 13px; color: #7A5320;
}
.bandeau-demo button {
  background: none; border: none; padding: 0; margin-left: 8px; cursor: pointer;
  color: #7A5320; text-decoration: underline; text-underline-offset: 2px; font-size: 13px;
}

/* ─────────────── Ossature ─────────────── */
.vue { padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 32px) 72px; }
.colonnes {
  display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 24px); max-width: 1320px; margin-inline: auto;
  align-items: start;
}
.carte {
  background: var(--papier-2); border: 1px solid var(--ligne-clair);
  border-radius: var(--r-lg); box-shadow: var(--ombre-douce); overflow: hidden;
}
.carte__tete { padding: clamp(20px, 2.4vw, 28px) clamp(20px, 2.4vw, 28px) 0; }
.carte__titre {
  font-family: var(--titre); font-weight: 800; font-size: 26px;
  letter-spacing: -.03em; margin: 0 0 6px; font-variation-settings: "opsz" 24;
}
.carte__titre--petit { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.carte__sous { margin: 0; color: var(--encre-2); font-size: 14.5px; max-width: 62ch; }

/* ─────────────── Champs ─────────────── */
.formulaire { padding: clamp(20px, 2.4vw, 28px); }
.grille-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grille-champs--fin { margin-top: 22px; }
.bloc { display: flex; flex-direction: column; gap: 6px; }
.bloc--plein { grid-column: span 2; }
.bloc__nom { font-size: 13px; font-weight: 600; color: #33504C; }
.bloc__nom em { font-style: normal; font-weight: 400; color: #91A7A3; }
.bloc__aide { font-size: 12px; color: #829996; }
.bloc input, .bloc select, .ligne-med input, .ligne-med select {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid #D4DEDB; background: var(--papier-2); color: var(--encre);
  font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease;
}
.bloc input::placeholder, .ligne-med input::placeholder { color: #A6B7B4; }
.bloc input:focus, .bloc select:focus, .ligne-med input:focus, .ligne-med select:focus {
  outline: none; border-color: var(--vert);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--vert) 18%, transparent);
}
.bloc input[aria-invalid="true"], .ligne-med input[aria-invalid="true"] {
  border-color: var(--alerte); box-shadow: 0 0 0 3px color-mix(in srgb, var(--alerte) 15%, transparent);
}

/* ─────────────── Lignes de prescription ─────────────── */
.section-lignes { margin-top: 26px; }
.section-lignes__tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sous-titre { font-family: var(--titre); font-weight: 600; font-size: 16px; letter-spacing: -.015em; margin: 0; }

.ligne-med {
  display: grid; grid-template-columns: minmax(0, 2.1fr) 92px minmax(0, 2fr) 38px;
  gap: 10px; align-items: end;
  padding: 14px; margin-bottom: 10px;
  border: 1px solid var(--ligne-clair); border-radius: var(--r-md); background: var(--papier);
}
.ligne-med__rang {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  font-family: var(--donnee); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: #91A7A3; margin-bottom: -4px;
}
.ligne-med .bloc__nom { font-size: 12px; }
.ligne-med__retirer {
  width: 38px; height: 42px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid #D4DEDB; background: var(--papier-2); color: #7F9490;
  display: grid; place-items: center; transition: color .15s ease, border-color .15s ease;
}
.ligne-med__retirer:hover { color: var(--alerte); border-color: var(--alerte); }
.ligne-med__retirer svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.raccourcis { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.raccourci {
  border: 1px solid #DDE6E3; background: var(--papier-2); color: #4A625F; cursor: pointer;
  border-radius: 999px; padding: 4px 11px; font-size: 12px;
  font-family: var(--donnee); transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.raccourci:hover { border-color: var(--vert); color: #0A6E4E; background: color-mix(in srgb, var(--vert) 8%, var(--papier-2)); }

/* ─────────────── Boutons ─────────────── */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.bouton--plein { background: var(--vert-vif); color: #04120E; }
.bouton--plein:hover { background: var(--vert); }
.bouton--plein:active { transform: scale(.985); }
.bouton--discret { background: var(--papier-2); color: #33504C; border-color: #D4DEDB; }
.bouton--discret:hover { border-color: var(--encre-2); color: var(--encre); }
.bouton--grand { padding: 13px 26px; font-size: 15.5px; }
.bouton--sombre { background: var(--encre); color: var(--papier-2); }
.bouton--sombre:hover { background: #12292E; }

.formulaire__pied {
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--ligne-clair);
}
.formulaire__erreur { margin: 0 auto 0 0; color: var(--alerte); font-size: 14px; font-weight: 500; }

/* ─────────────── Le sceau ─────────────── */
.scelle { padding: clamp(28px, 4vw, 48px); text-align: center; }
.scelle__cachet {
  display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 20px;
  border-radius: 50%; background: color-mix(in srgb, var(--vert) 12%, transparent);
  animation: cachet .5s cubic-bezier(.2,.8,.3,1.1);
}
.scelle__cachet svg { width: 34px; height: 34px; fill: none; stroke: var(--vert); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cachet { from { transform: scale(.5); opacity: 0; } }
.scelle__titre { font-family: var(--titre); font-weight: 800; font-size: 27px; letter-spacing: -.03em; margin: 0 0 8px; }
.scelle__txt { margin: 0 0 20px; color: var(--encre-2); }
.scelle__code {
  display: inline-block; padding: 11px 20px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--laiton) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--laiton) 34%, transparent);
  color: #7A5320; font-size: 19px; letter-spacing: .08em; margin: 0 0 20px;
}
.scelle__note { margin: 0 auto 26px; max-width: 44ch; color: var(--encre-2); font-size: 14.5px; }
.scelle__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ─────────────── Recherche au comptoir ─────────────── */
.chercher { display: flex; gap: 10px; padding: 22px clamp(20px, 2.4vw, 28px); }
.chercher__champ { position: relative; flex: 1; display: block; }
.chercher__icone {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: none; stroke: #829996;
  stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.chercher input {
  width: 100%; padding: 14px 16px 14px 42px; border-radius: var(--r-sm);
  border: 1px solid #D4DEDB; background: var(--papier-2); color: var(--encre);
  font-family: var(--donnee); font-size: 16px;
}
.chercher input:focus {
  outline: none; border-color: var(--vert);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--vert) 18%, transparent);
}
.chercher .bouton { padding-inline: 24px; }

.resultat { padding: 0 clamp(20px, 2.4vw, 28px) clamp(20px, 2.4vw, 28px); }
.etat-vide {
  border: 1px dashed #D4DEDB; border-radius: var(--r-md); padding: 34px 26px;
  text-align: center; color: var(--encre-2); font-size: 14.5px;
}
.etat-vide__titre { margin: 0 0 6px; font-weight: 600; color: var(--encre); font-size: 15.5px; }
.etat-vide p { margin: 0 auto; max-width: 46ch; }

/* ─────────────── Fiche d'ordonnance ─────────────── */
.fiche { border: 1px solid var(--ligne-clair); border-radius: var(--r-md); overflow: hidden; animation: monte .3s cubic-bezier(.2,.7,.3,1); }
@keyframes monte { from { opacity: 0; transform: translateY(8px); } }
.fiche__tete {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px; background: var(--papier); border-bottom: 1px solid var(--ligne-clair);
}
.fiche__etats { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.fiche__qui { font-family: var(--titre); font-weight: 800; font-size: 21px; letter-spacing: -.025em; margin: 0 0 3px; }
.fiche__meta { margin: 0; font-size: 13px; color: var(--encre-2); }
.fiche__corps { padding: 18px 20px; }
.fiche__pied {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; border-top: 1px solid var(--ligne-clair); background: var(--papier);
}
.fiche__compte { font-size: 13.5px; color: var(--encre-2); }
.fiche__actions { display: flex; gap: 10px; margin-left: auto; }
.fiche__note {
  margin: 14px 0 0; padding: 11px 13px; border-radius: var(--r-sm); font-size: 14px;
  background: color-mix(in srgb, var(--laiton) 12%, transparent); color: #7A5320;
}

.med { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid #EDF2F0; }
.med:last-child { border-bottom: none; }
.med__case {
  width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--vert);
  cursor: pointer;
}
.med__txt { flex: 1; min-width: 0; }
.med__nom { display: block; font-weight: 600; font-size: 15.5px; }
.med__dose { display: block; font-family: var(--donnee); font-size: 12.5px; color: var(--encre-2); }
.med__boites {
  font-family: var(--donnee); font-size: 13px; padding: 4px 10px; border-radius: 999px;
  background: var(--papier); border: 1px solid var(--ligne-clair); white-space: nowrap;
}
.med[data-servi="oui"] .med__nom { color: #7F9490; text-decoration: line-through; }

/* ─────────────── Jetons d'etat ─────────────── */
.jeton {
  display: inline-block; font-family: var(--donnee); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .04em;
}
.jeton--attente { background: color-mix(in srgb, var(--vert) 14%, transparent); color: #0A6E4E; }
.jeton--partielle { background: color-mix(in srgb, var(--laiton) 18%, transparent); color: #7A5320; }
.jeton--soldee { background: #E9EFED; color: #6E8783; }
.jeton--expiree { background: color-mix(in srgb, var(--alerte) 13%, transparent); color: #A63A28; }
.jeton--code { background: color-mix(in srgb, var(--laiton) 14%, transparent); color: #7A5320; }

/* ─────────────── Journaux ─────────────── */
.journal { padding: 16px clamp(20px, 2.4vw, 28px) clamp(20px, 2.4vw, 28px); }
.journal:empty::after {
  content: "Rien pour le moment.";
  display: block; padding: 18px 0; color: #91A7A3; font-size: 14px;
}
.entree {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 13px 0; border: none; border-bottom: 1px solid #EDF2F0; background: none;
  transition: opacity .15s ease;
}
.entree:last-child { border-bottom: none; }
.entree:hover { opacity: .68; }
.entree__haut { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.entree__qui { font-weight: 600; font-size: 15px; }
.entree__bas { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 3px; }
.entree__meta { font-family: var(--donnee); font-size: 11.5px; color: var(--encre-2); }

/* ─────────────── Messages ─────────────── */
.messages {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.message {
  background: var(--encre); color: var(--papier-2); padding: 12px 20px;
  border-radius: 999px; font-size: 14.5px; font-weight: 500;
  box-shadow: 0 16px 40px -16px rgba(8, 23, 27, .55);
  animation: message-entre .28s cubic-bezier(.2,.8,.3,1);
}
.message[data-ton="alerte"] { background: var(--alerte); }
@keyframes message-entre { from { opacity: 0; transform: translateY(12px); } }

/* ─────────────── Adaptations ─────────────── */
@media (max-width: 1080px) {
  .colonnes { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .barre { flex-wrap: wrap; height: auto; padding-block: 10px; gap: 12px; }
  .barre__compte { order: 2; }
  .bascule { order: 3; width: 100%; }
  .bascule__item { flex: 1; }
  .grille-champs { grid-template-columns: 1fr; }
  .bloc--plein { grid-column: span 1; }
  .ligne-med { grid-template-columns: 1fr 1fr; }
  .ligne-med > .bloc:first-of-type { grid-column: span 2; }
  .ligne-med__retirer { grid-column: 2; justify-self: end; }
  .section-lignes__tete { flex-direction: column; align-items: stretch; gap: 10px; }
  .section-lignes__tete .bouton { width: 100%; }
  .chercher { flex-direction: column; }
  .formulaire__pied { flex-direction: column; align-items: stretch; }
  .formulaire__pied .bouton { width: 100%; }
  .formulaire__erreur { margin: 0 0 4px; }
}
