/* Focused dossier workspace. All original information/actions remain in Informations. */
.patient-detail.patient-detail--focused { display: block; max-width: none; }
.patient-detail--focused .patient-main { width: 100%; min-width: 0; gap: 10px; }
.patient-detail--focused .patient-information-grid[hidden] { display: none !important; }
.patient-detail--focused .patient-information-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  align-items: start; gap: 16px; width: 100%; position: static; max-height: none;
}
.patient-information-grid > * { min-width: 0; }
.patient-context { padding: 14px 18px; margin-bottom: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--bg-elevated); border-left: 4px solid var(--primary); }
.patient-context-top { display: flex; align-items: center; gap: 12px; }
.patient-context-identity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; flex: 1; min-width: 0; }
.patient-context-identity strong { font-size: 21px; overflow-wrap: anywhere; }
.patient-context-identity span { color: var(--text-mute); font-size: 13px; }
.patient-context .patient-close-btn { position: static; flex-shrink: 0; }

/* ── L'IDENTITÉ DANS LA BANNIÈRE COLLANTE (22/09/2026) ───────────────────────
   Dr Nanni : « je veux ces informations d'identité dans la bannière générale,
   y compris la photo et s'ils ont été validés eID pour l'espace patient. »
   Elles n'étaient que dans la carte latérale, donc visibles seulement sur
   l'onglet « Informations » : au moment de prescrire, le praticien n'avait plus
   sous les yeux ni le visage ni le numéro national.

   🪤 Le conteneur aligne sur la LIGNE DE BASE du texte : sans `align-self`,
   la photo remonte au-dessus du nom. */
.patient-context-photo {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  align-self: center; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--bg-soft, #eef2f7);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: var(--text-mute);
}
.patient-context-coords {
  /* Une ligne, coupée proprement : l'adresse complète reste dans l'infobulle et
     dans la carte « Identité & coordonnées ». La bannière renseigne, elle ne
     remplace pas la fiche. */
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.patient-context-badge {
  align-self: center; flex-shrink: 0;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft, #f1f5f9); color: var(--text-mute);
  white-space: nowrap;
}
.patient-context-badge.est-lu { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.patient-context-badge.est-absent { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.patient-context-badge.est-danger { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

@media (max-width: 720px) {
  /* Sur téléphone la bannière doit rester une bannière : la photo rétrécit et
     les coordonnées passent à la ligne au lieu de pousser le nom hors champ. */
  .patient-context-photo { width: 34px; height: 34px; font-size: 13px; }
  .patient-context-coords { flex-basis: 100%; }
}
.patient-consultation-context { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-top: 9px; align-items: baseline; }
.patient-context-label { color: var(--text-mute); font-size: 12px; }
.patient-context-reason { font-size: 15px; overflow-wrap: anywhere; }
.patient-context .patient-allergy-banner { margin: 10px 0 0; padding: 8px 12px; }
.patient-dossier-navigation { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.patient-detail--focused .patient-primary-tabs { display: flex; flex: 1; gap: 4px; flex-wrap: nowrap; overflow-x: auto; margin: 0; padding: 4px; min-width: 0; }
.patient-detail--focused .patient-primary-tab { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; }
.patient-section-choice { flex: 0 1 220px; min-width: 150px; }
.patient-section-select { width: 100%; min-height: 40px; }
.patient-detail--focused .patient-dossier-search { margin-bottom: 0; }
.patient-detail--focused .results-workspace { grid-template-columns: minmax(260px, 310px) minmax(0, 1fr); }
.patient-detail--focused .results-detail { min-width: 0; }
.patient-detail--focused .results-detail :is(pre, table) { max-width: 100%; }
.patient-detail--focused :is(button, select):focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media(max-width: 760px) {
  .patient-context { padding: 12px; }
  .patient-context-top { flex-wrap: wrap; gap: 8px; }
  .patient-context-identity { flex-basis: calc(100% - 48px); }
  .patient-context-identity strong { font-size: 19px; }
  .patient-context-top > .patient-close-btn { order: -1; margin-left: auto; }
  .patient-dossier-navigation { flex-wrap: wrap; gap: 6px; }
  .patient-detail--focused .patient-primary-tabs { flex-basis: 100%; }
  .patient-section-choice { flex: 1; }
  .patient-detail--focused .results-workspace { grid-template-columns: minmax(0, 1fr); }
  .patient-detail--focused .results-list { max-height: 220px; overflow-y: auto; }
}

@media(min-width: 1000px) {
 .patient-detail--focused .results-toolbar { flex-direction: row; align-items: center; gap: 12px; padding: 8px; }
 .patient-detail--focused .results-tools { flex: 1; min-width: 240px; }
 .patient-detail--focused .results-tabs { flex: 0 1 auto; }
}

/* Report emphasis is editorial, never a green reassurance signal. */
.patient-detail--focused .rpt-conclusion-callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  box-shadow: none;
}
.patient-detail--focused .rpt-conclusion-callout-title {
  color: var(--primary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 10px;
}
.patient-detail--focused .rpt-conclusion-callout-title::before { content: none; }
.patient-detail--focused .rpt-conclusion-callout-body {
  color: var(--text);
  font-weight: 400;
}
.patient-detail--focused .rpt-conclusion-callout-body > .rpt-key-label {
  display: block;
  color: var(--text);
  font-weight: 650;
  margin-bottom: 5px;
}
.patient-detail--focused .rpt-section-conclusion {
  --section-color: var(--primary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.patient-detail--focused .patient-dossier-search[hidden] { display: none !important; }

/* Synthèse : trois piles indépendantes, plutôt que sept tuiles étroites
   avec une deuxième rangée bloquée par la carte la plus haute. */
.patient-context { padding: 10px 16px; }
.patient-context .patient-allergy-banner { margin-top: 7px; padding: 5px 10px; gap: 8px; }
.patient-context .patient-allergy-banner .pab-body { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; flex: 1; }
.patient-context .patient-allergy-banner .pab-value { overflow-wrap: anywhere; }
.patient-context .patient-allergy-banner .pab-label { font-size: 12px; text-transform: none; letter-spacing: normal; }
.patient-context .patient-allergy-banner > button { flex-shrink: 0; }
.patient-context .patient-allergy-banner--none { background: transparent; border-color: var(--border); }
.patient-context .patient-allergy-banner--none .pab-label { color: var(--text-soft); }
.patient-consultation-context[hidden] { display: none; }
.synth-clinical-summary { margin: 0 0 10px; color: var(--text-soft); font-size: 14px; line-height: 1.5; }
.synthese-grid.synthese-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.synth-column { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.synth-column-title { margin: 0 2px 2px; font-size: 13px; font-weight: 650; color: var(--text-mute); }
.synth-column > .synthese-card { margin: 0; padding: 12px 14px; border-radius: 12px; min-width: 0; box-shadow: none; }
.synth-column > .synthese-card[hidden] { display: none; }
.synth-column .card-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 6px; }
.synth-column .card-h h2 { font-size: 14px; margin: 0; }
.synth-column .card-h > button { margin-left: auto; white-space: normal; text-align: right; }
.synth-column .synth-empty { padding: 2px 0; }
.synth-column .synth-line { padding-top: 6px; padding-bottom: 6px; }
.synth-column .synth-line-main { overflow-wrap: anywhere; }
.synth-column .synth-since-empty { font-size: 13px; padding: 0; }
.synth-column .synth-vitals-row { flex-wrap: wrap; }
@media (max-width: 1150px) {
  .synthese-grid.synthese-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .synth-column:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .synth-column:last-child > .synth-column-title { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .synthese-grid.synthese-overview, .synth-column:last-child { grid-template-columns: minmax(0, 1fr); }
  .synth-column { gap: 8px; }
  .synth-column-title { margin-top: 6px; }
  .synth-column .card-h > button, .patient-context .patient-allergy-banner > button { min-height: 36px; }
}

/* SANS DOUBLON D'AFFICHAGE (23/09/2026). Sur l'onglet « Informations », la carte
   « Identité & coordonnées » détaille déjà NISS, adresse, téléphone et e-mail :
   la bannière ne les répète pas sur cet écran-là. Sur tous les autres onglets,
   elle les garde (identitovigilance au moment de prescrire). */
.patient-main:has(> .patient-side:not([hidden])) .patient-context-coords { display: none; }

/* Lecture des comptes rendus : fond papier blanc, texte noir (23/10/2026). */
.rpt-prose-card,
.lab-results-card,
.res-conclusion,
.lab-conclusion,
.rpt-section-body,
.patient-detail--focused .rpt-conclusion-callout,
.patient-detail--focused .rpt-section-conclusion {
  background: #fff;
  color: #000;
  --text: #000;
  --text-soft: #000;
}
.res-conclusion-body,
.lab-conclusion-body,
.patient-detail--focused .rpt-conclusion-callout-body,
.rpt-section-body .rpt-p {
  color: #000;
}

/* Les fiches administratives et les lecteurs occupent l'espace de travail. */
.patient-administrative-page { width: 100%; min-width: 0; }
.patient-administrative-page .patient-header-card { padding: 20px; background: #fff; }
.patient-administrative-page .patient-admin-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.patient-admin-group { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.patient-admin-group h3 { margin: 0 0 12px; font-size: 14px; color: var(--primary); }
.patient-administrative-page .patient-meta-list .row { display: grid; grid-template-columns: minmax(130px, 30%) minmax(0, 1fr); gap: 16px; padding: 6px 0; align-items: baseline; }
.patient-administrative-page .patient-meta-list .key { width: auto; min-width: 0; white-space: normal; }
.patient-administrative-page .patient-meta-list .row > :last-child { text-align: left; color: #111; overflow-wrap: anywhere; }
.patient-main .patient-header-card[hidden] { display: none !important; }
.patient-administrative-page .patient-card-actions { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 16px; flex-wrap: wrap; }
.medication-status-action { border: 0; background: transparent; cursor: pointer; width: 28px; height: 28px; padding: 0; border-radius: 50%; }
.medication-status-action:hover { background: var(--primary-soft); outline: 1px solid var(--primary); }
.medication-action-menu { position: fixed; margin: 0; padding: 6px; width: 260px; border: 1px solid var(--border); border-radius: 10px; background: white; color: #111; box-shadow: 0 8px 32px #152a5033; z-index: 1000; }
.medication-action-menu button { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; background: white; color: inherit; padding: 10px 12px; cursor: pointer; }
.medication-action-menu button:hover, .medication-action-menu button:focus-visible { background: var(--primary-soft); }
.patient-rsw-workspace { display: flex; flex-direction: column; gap: 14px; width: 100%; min-width: 0; }
.patient-rsw-workspace .rsw-2col { grid-template-columns: minmax(260px, 30%) minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 10px; overflow: hidden; background: white; }
.patient-rsw-workspace .rsw-list { border: 0; border-right: 1px solid var(--border); border-radius: 0; min-height: 55vh; max-height: 72vh; }
.patient-rsw-workspace .rsw-detail { position: static; border: 0; border-radius: 0; min-width: 0; height: 72vh; max-height: none; color: #111; background: white; }
.patient-rsw-workspace .rsw-detail-body { background: white; color: #111; padding: 20px; }
.home-patient-results { max-height: 48vh; overflow-y: auto; overscroll-behavior: contain; }

.v2-plan-header { display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:12px; background:#fff; }
.v2-plan-header input { flex:1 1 220px; min-width:160px; }
.v2-plan-header select { width:auto; }
.v2-plan-count { color:#536174; font-size:12px; }
.v2-plan-delete { color:#b42318; margin-left:auto; }

/* Échéance : champs alignés et pleine largeur, choix de partage explicite. */
.rappel-editor { display:flex; flex-direction:column; gap:14px; padding:18px 22px; max-height:68vh; overflow:auto; background:#fff; color:#111; }
.rappel-editor > label { display:flex; flex-direction:column; gap:6px; font-weight:500; }
.rappel-editor .input { width:100%; box-sizing:border-box; background:#fff; color:#111; }
.rappel-editor textarea { resize:vertical; min-height:76px; }
.rappel-editor > .rappel-editor-share { flex-direction:row; align-items:center; gap:10px; font-weight:400; }
.rappel-editor-share input { width:18px; height:18px; flex:none; }
