/* ==================================== */
/* SUIVI GROSSESSE - STYLES SPECIFIQUES */
/* ==================================== */

/* Styles partages : <link> de suivi-grossesse.html, avant cette feuille (PERF-05) */

/* Zéro persistance : un « tirer pour rafraîchir » effacerait la saisie en cours */
html {
  overscroll-behavior-y: contain;
}

/* ==================================== */
/* VARIABLES SPECIFIQUES GROSSESSE      */
/* ==================================== */
:root {
  /* Couleurs trimestres */
  --trimester-0: #9CA3AF; /* Pré-conception */
  --trimester-1: #F59E0B; /* T1 */
  --trimester-2: #10B981; /* T2 */
  --trimester-3: #3B82F6; /* T3 */
  --trimester-4: #8B5CF6; /* Post-partum */

  /* Couleurs statuts */
  --status-pending: #F59E0B;
  --status-completed: #10B981;
  --status-alert: #EF4444;

  /* Accent grossesse (rose doux) */
  --accent-grossesse: #EC4899;
  --accent-grossesse-light: rgba(236, 72, 153, 0.1);
  --accent-grossesse-text: #BE185D; /* texte : 5,22 à 6,04:1 sur blanc et sur le rose clair (AA) ; #EC4899 reste pour fonds, bordures, cases */
}

/* ==================================== */
/* TOP NAVIGATION BAR                   */
/* ==================================== */
.top-nav {
  display: flex;
  align-items: stretch;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ==================================== */
/* CONSULTATION SLIDER                  */
/* ==================================== */
.consultation-slider {
  display: flex;
  flex: 1;
  gap: 4px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: opacity 0.2s ease;
  /* Hauteur des boutons, générés en JS, réservée dès le premier rendu (PERF-11) */
  min-height: 58px;
}

.consultation-slider.dimmed {
  opacity: 0.5;
}

.consultation-slider::-webkit-scrollbar {
  display: none;
}

/* ==================================== */
/* NAV TAB BUTTON (Documents)           */
/* ==================================== */
.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-left: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.nav-tab-btn.active {
  background: var(--accent-primary);
  color: white;
}

.nav-tab-btn svg {
  flex-shrink: 0;
}

/* ==================================== */
/* PANELS CONTAINER                     */
/* ==================================== */
.panels-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ==================================== */
/* MAIN PANELS                          */
/* ==================================== */
.main-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.main-panel.active {
  display: block;
}

.consultation-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  min-width: 48px;
  border: none;
  border-radius: var(--border-radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.consultation-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.consultation-btn.active {
  background: white;
  color: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.consultation-btn.completed {
  position: relative;
}

.consultation-btn.completed::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--status-completed);
  border-radius: 50%;
}

.consultation-btn-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Couleur du bouton, sans opacité : à 0,7, 3,31:1 sur blanc */
.consultation-btn-period {
  font-size: 9px;
  white-space: nowrap;
}

/* Indicateur trimestre */
.consultation-btn[data-trimester="0"] { border-left: 3px solid var(--trimester-0); }
.consultation-btn[data-trimester="1"] { border-left: 3px solid var(--trimester-1); }
.consultation-btn[data-trimester="2"] { border-left: 3px solid var(--trimester-2); }
.consultation-btn[data-trimester="3"] { border-left: 3px solid var(--trimester-3); }
.consultation-btn[data-trimester="4"] { border-left: 3px solid var(--trimester-4); }

/* ==================================== */
/* PATIENT INFO CARD                    */
/* ==================================== */
.patient-info-card {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.patient-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.patient-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.patient-info-item[hidden] {
  display: none;
}

/* --text-secondary : --text-muted donne 3,36:1 sur blanc */
.patient-info-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.patient-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Groupe sanguin et rhésus côte à côte (SEC-10 : plus de style en ligne) */
.patient-groupe-rh {
  display: flex;
  gap: 4px;
}

.patient-groupe-rh #patient-groupe-sanguin {
  flex: 1;
  padding: 4px;
}

.patient-groupe-rh #patient-rhesus {
  width: 50px;
  padding: 4px;
}

.sa-display {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-grossesse-text);
}

/* Aide : référentiels appliqués, liste dépliable (SEO-15) */
.help-referentiels {
  font-size: 12px;
  color: var(--text-secondary);
}

.help-referentiels summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
}

.help-referentiels ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

/* Titre h1 de la page (SEO-07) : hors écran visuellement, mais lu par les aides
   techniques dans tous les états de la barre latérale. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ==================================== */
/* CONSULTATION FORM                    */
/* ==================================== */
.consultation-form-container {
  padding: 16px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Animation de transition */
.consultation-form-container.transitioning {
  pointer-events: none;
}

.consultation-form-container.slide-out-left {
  opacity: 0;
  transform: translateX(-20px);
}

.consultation-form-container.slide-out-right {
  opacity: 0;
  transform: translateX(20px);
}

.consultation-form-container.slide-in-left {
  animation: slideInLeft 0.2s ease forwards;
}

.consultation-form-container.slide-in-right {
  animation: slideInRight 0.2s ease forwards;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.consultation-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.consultation-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.consultation-period {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Sections formulaire */
.form-section {
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.form-section.collapsed .form-section-content {
  display: none;
}

.form-section-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Grilles formulaire */
.form-grid {
  display: grid;
  gap: 12px;
}

/* ==================================== */
/* CHECKBOXES GRID                      */
/* ==================================== */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

/* ==================================== */
/* RESOURCES SECTION                    */
/* ==================================== */
.resources-section {
  padding: 12px;
  margin-top: auto;
}

.resources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.resource-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.resource-btn:hover {
  background: white;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.resource-btn svg {
  width: 20px;
  height: 20px;
}

/* ==================================== */
/* CONSULTATION PANEL - DASHBOARD       */
/* ==================================== */
#panel-consultation {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Header consultation fixe */
.consultation-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-canvas);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.consultation-header .consultation-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.consultation-header .consultation-period {
  font-size: 13px;
  color: var(--accent-grossesse-text);
  font-weight: 500;
  padding: 2px 8px;
  background: var(--accent-grossesse-light);
  border-radius: var(--border-radius-pill);
}

.consultation-header .consultation-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Dashboard container. Pleine largeur dès le premier rendu : vide, il se
   rétrécissait à son contenu, puis s'élargissait au rendu des sections (PERF-11) */
.consultation-dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Zone principale avec grille 2 colonnes */
.consultation-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
  align-items: start; /* Sections adaptées à leur contenu */
}

/* Quick panel sticky */
.consultation-quick-panel {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
}

/* Quick patient summary */
.quick-patient-summary {
  background: var(--accent-grossesse-light);
  border: 1px solid var(--accent-grossesse);
  border-radius: var(--border-radius-md);
  padding: 12px;
  display: flex;
  gap: 16px;
}

.quick-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --text-secondary : --text-muted donne 2,90:1 sur le fond rose */
.quick-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-grossesse-text);
}

/* Sections dans quick panel - collapsibles avec switch */
.consultation-quick-panel .form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.consultation-quick-panel .form-section.collapsed .form-section-content {
  display: none;
}

.consultation-quick-panel .form-section.expanded {
  border-color: var(--accent-grossesse);
}

/* Header de section avec switch */
.quick-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: background-color var(--transition-fast);
}

.quick-section-header:hover {
  background: var(--bg-hover);
}

.quick-section-header .section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0;
}

/* Switch Non/Oui */
.quick-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.quick-switch-toggle {
  position: relative;
  width: 36px;
  height: 18px;
  background: var(--bg-tertiary);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.quick-switch-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.quick-switch-toggle.active {
  background: var(--color-warning);
}

.quick-switch-toggle.active::after {
  transform: translateX(18px);
}

.quick-switch-label {
  font-weight: 500;
  min-width: 24px;
}

.quick-switch-toggle.active + .quick-switch-label {
  color: var(--color-warning);
  font-weight: 600;
}

/* Contenu de section */
.consultation-quick-panel .form-section-content {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}

.consultation-quick-panel .form-section-title {
  display: none; /* Caché car on utilise quick-section-header */
}

.consultation-quick-panel .form-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Bandelette urinaire : alignement horizontal sur toute la largeur, retour à la
   ligne sur écran étroit (sans lui, colonne de 529 px à 393 px de large) */
.form-field-group:has(#bandelette_params) {
  grid-column: 1 / -1;
}

#bandelette_params {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.consultation-quick-panel .form-checkbox-label {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-fast);
}

.consultation-quick-panel .form-checkbox-label:hover {
  background: var(--bg-hover);
}

.consultation-quick-panel .form-checkbox-text {
  font-size: 12px;
}

/* ==================================== */
/* RAPPORT PANEL                        */
/* ==================================== */
#panel-rapport {
  padding: 0;
}

#rapport-container {
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* ==================================== */
/* RESPONSIVE                           */
/* ==================================== */

/* Tablette: quick panel en haut */
@media (max-width: 1024px) {
  .consultation-dashboard {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Sans défilement propre : avec `overflow-y: auto`, sa rangée de grille tombait
     à 0 px dès que le formulaire dépassait le tableau de bord, qu'il recouvrait */
  .consultation-quick-panel {
    position: relative;
    top: 0;
    max-height: none;
    overflow-y: visible;
    flex-direction: row;
    flex-wrap: wrap;
    order: -1;
    gap: 8px;
  }

  .quick-patient-summary {
    flex: 0 0 auto;
  }

  .consultation-quick-panel .form-section {
    flex: 1 1 200px;
    min-width: 180px;
  }

  .consultation-main {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .consultation-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .consultation-header .consultation-date {
    margin-left: 0;
    width: 100%;
    order: -1;
  }

  .consultation-dashboard {
    padding: 12px;
  }

  .consultation-main {
    grid-template-columns: 1fr;
  }

  .consultation-quick-panel {
    flex-direction: column;
  }

  .consultation-quick-panel .form-section {
    flex: 1 1 100%;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .consultation-slider {
    padding: 6px;
    min-height: 36px;
  }

  .consultation-btn {
    padding: 6px 8px;
    min-width: 40px;
  }

  .consultation-btn-label {
    font-size: 10px;
  }

  .consultation-btn-period {
    display: none;
  }

  .patient-info-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================================== */
/* CONSULTATION FORM RENDERER           */
/* ==================================== */

/* Formulaire principal */
.consultation-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section de formulaire */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 16px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* Layouts des champs */
.form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-fields.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-fields.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Groupe de champ */
.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Labels */
.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-label-inline {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.form-label-small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-required {
  color: var(--status-alert);
}

.form-description {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

/* Inputs de base */
.form-input {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-input--number {
  width: 80px;
}

.form-input--date {
  width: auto;
}

.form-input--bp {
  width: 60px;
  text-align: center;
}

.form-input--small {
  padding: 6px 8px;
  font-size: 12px;
}

/* Textarea */
.form-textarea {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Select */
.form-select {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Focus clavier : la seule bordure d'accent (1 px) est un indicateur trop faible ;
   contour de 2 px comme les onglets et curseurs partagés, 6,77:1 sur --bg-main
   (A11Y-08) */
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--accent-primary-hover);
  outline-offset: 2px;
}

.form-select--small {
  padding: 6px 8px;
  font-size: 12px;
}

/* Number avec unité */
.form-number-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-unit {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Checkboxes */
.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-checkbox-label:hover {
  border-color: var(--accent-primary);
}

.form-checkbox-label:has(.form-checkbox:checked) {
  background: var(--accent-grossesse-light);
  border-color: var(--accent-grossesse);
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-grossesse);
  cursor: pointer;
}

.form-checkbox-text {
  font-size: 12px;
  color: var(--text-primary);
}

.form-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Radio buttons */
.form-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-radio-label:hover {
  border-color: var(--accent-primary);
}

.form-radio-label:has(.form-radio:checked) {
  background: var(--accent-grossesse-light);
  border-color: var(--accent-grossesse);
}

.form-radio {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-grossesse);
  cursor: pointer;
}

.form-radio-text {
  font-size: 12px;
  color: var(--text-primary);
}

/* Toggle switch */
.form-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Piste éteinte claire, cernée par --border-medium (3,26:1 sur blanc, A11Y-08) :
   pleine en --border-medium, elle avait la luminance de la piste allumée (rose) */
.form-toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border-light);
  box-shadow: inset 0 0 0 1px var(--border-medium);
  border-radius: 22px;
  transition: background var(--transition-fast);
}

.form-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.form-toggle:checked + .form-toggle-slider {
  background: var(--accent-grossesse);
  box-shadow: none;
}

.form-toggle:checked + .form-toggle-slider::before {
  transform: translateX(18px);
}

.form-toggle-text {
  font-size: 13px;
  color: var(--text-primary);
}

/* Champ calculé */
.form-calculated {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--accent-grossesse-light);
  border-radius: var(--border-radius-md);
}

.form-calculated-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-grossesse-text);
}

.form-calculated-badge {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  color: white;
  border-radius: var(--border-radius-pill);
}

/* Tension artérielle */
.form-bp-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-bp-separator {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-bp-interpretation {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--border-radius-pill);
}

.form-bp-interpretation--normal {
  background: #D1FAE5;
  color: #059669;
}

.form-bp-interpretation--elevated {
  background: #FEF3C7;
  color: #D97706;
}

.form-bp-interpretation--severe {
  background: #FEE2E2;
  color: #DC2626;
}

/* Conduite associée au niveau de TA, sous la pastille */
.form-bp-message {
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-bp-message:empty {
  display: none;
}

/* Hauteur utérine mesurée, située sur la courbe INTERGROWTH-21st */
.form-calculated-badge--normal {
  background: #D1FAE5;
  color: #059669;
}

/* HU hors couloir, grossesse prolongée (≥ 41 SA) */
.form-calculated-badge--low,
.form-calculated-badge--high,
.form-calculated-badge--prolongee {
  background: #FEF3C7;
  color: #D97706;
}

/* Terme dépassé (≥ 42 SA) */
.form-calculated-badge--depasse {
  background: #FEE2E2;
  color: #DC2626;
}

/* Pastille sous la SA de la barre latérale et du panneau rapide (CLIN-SDG-23),
   sur plusieurs lignes dans ces colonnes étroites */
.patient-info-item .form-calculated-badge,
.quick-stat .form-calculated-badge {
  align-self: flex-start;
  border-radius: var(--border-radius-sm);
}

.form-calculated-message {
  margin-top: 4px;
  font-size: 12px;
  color: #D97706;
}

.form-calculated-message:empty {
  display: none;
}

/* Alertes calculées sous un champ (bandelette, HGPO) */
.form-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.form-alerts:empty {
  display: none;
}

.form-alert {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  border-left: 3px solid var(--status-pending);
  border-radius: var(--border-radius-sm);
  background: #FEF3C7;
  color: #92400E;
}

.form-alert--danger {
  border-left-color: var(--status-alert);
  background: #FEE2E2;
  color: #991B1B;
}

/* IMC Calculator */
.form-imc-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.form-imc-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-imc-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--border-radius-md);
}

.form-imc-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.form-imc-category {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  color: white;
  border-radius: var(--border-radius-pill);
}

/* Liste dynamique */
.form-dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-dynamic-list-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-dynamic-list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
}

.form-dynamic-list-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
}

.form-dynamic-list-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-dynamic-list-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-dynamic-list-delete:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.form-dynamic-list-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px dashed var(--border-medium);
  border-radius: var(--border-radius-md);
  background: transparent;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-dynamic-list-add:hover {
  background: var(--accent-grossesse-light);
  border-color: var(--accent-grossesse);
  color: var(--accent-grossesse-text);
}

/* ==================================== */
/* RESPONSIVE - FORMULAIRES             */
/* ==================================== */
@media (max-width: 768px) {
  .form-fields.grid-2,
  .form-fields.grid-3 {
    grid-template-columns: 1fr;
  }

  .form-imc-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .form-imc-input {
    width: 100%;
  }

  .form-dynamic-list-fields {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .form-section {
    padding: 12px;
  }

  .form-bp-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-checkbox-group,
  .form-radio-group {
    flex-direction: column;
  }
}
