/* ═════════════════════════════════════════════════════════════
   MPConnect – style-additions.css
   Version corrigée, valide et harmonisée
   - supprime les doublons
   - harmonise bureau / grand écran
   - corrige le bottom nav décalé sur PC
   - améliore cartes, sections, en-têtes, profils, listes
   ═════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────
   VARIABLES COMPLÉMENTAIRES
   ────────────────────────────────────────────────────────── */
:root {
  --container-wide: 1280px;
  --card-radius: 18px;
  --card-radius-lg: 22px;
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-medium: 0 12px 30px rgba(15, 23, 42, 0.10);
  --shadow-strong: 0 18px 45px rgba(15, 23, 42, 0.14);
  --surface-glass: rgba(255, 255, 255, 0.88);
  --desktop-nav-width: 900px;
}

/* ──────────────────────────────────────────────────────────
   MISE EN PAGE GLOBALE
   ────────────────────────────────────────────────────────── */
.app-container {
  max-width: var(--container-wide);
}

.main-content {
  width: 100%;
}

@media (min-width: 1280px) {
  .main-content {
    max-width: 1180px;
    margin: 0 auto;
  }
}

/* ──────────────────────────────────────────────────────────
   EN-TÊTE DE PAGE
   ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.95rem;
  background: transparent;
  border-bottom: none;
}

.btn-back {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(8, 145, 178, 0.14);
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .22s ease;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.btn-back:hover {
  transform: translateY(-1px);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(8,145,178,.22);
}

.page-header h1 {
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ──────────────────────────────────────────────────────────
   APPLICATION HEADER
   ────────────────────────────────────────────────────────── */
.app-header {
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
}

.header-content {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0.95rem 1.35rem;
  gap: 1rem;
}

.logo-small {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-title {
  display: flex;
  flex-direction: column;
  margin-left: 0.75rem;
  min-width: 0;
}

.header-title span {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.15;
}

.header-title small {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.15;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* ──────────────────────────────────────────────────────────
   CARTES GLOBALES
   ────────────────────────────────────────────────────────── */
.section-card,
.profile-card,
.patient-card-large,
.result-card,
.legend-card,
.calendar-card,
.day-detail-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--card-radius-lg);
  box-shadow: var(--shadow-soft);
}

.section-card {
  padding: 1.25rem;
}

.section-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

@media (min-width: 992px) {
  .section-card {
    padding: 1.45rem 1.5rem;
  }
}

/* ──────────────────────────────────────────────────────────
   BOUTONS
   ────────────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-copy,
.btn-inline,
.btn-icon {
  transition: all .22s ease;
}

.btn-primary {
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: .1px;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  border-radius: 14px;
  font-weight: 800;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.btn-inline {
  border: 1px solid rgba(8,145,178,.12);
  box-shadow: 0 4px 12px rgba(8,145,178,.08);
}

.btn-inline:hover {
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────
   FORMULAIRES
   ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.48rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea,
textarea,
select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1.5px solid #d5e1ea;
  border-radius: 14px;
  font-size: 0.96rem;
  background: #fff;
  color: var(--text-primary);
  box-sizing: border-box;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8,145,178,.10);
}

.form-help {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.45rem;
}

/* ──────────────────────────────────────────────────────────
   PROFIL
   ────────────────────────────────────────────────────────── */
.profile-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1rem 7rem;
}

.profile-card {
  padding: 1.45rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 88px;
  background: linear-gradient(135deg, rgba(8,145,178,.12), rgba(14,165,233,.06));
  pointer-events: none;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0891B2 0%, #0EA5E9 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  margin: 0 auto 1rem;
  position: relative;
  z-index: 1;
  box-shadow: 0 14px 28px rgba(8,145,178,.22);
}

.profile-name {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.profile-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.95rem;
  background: #e0f2fe;
  color: #075985;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.info-list {
  text-align: left;
  margin-top: 0.75rem;
  position: relative;
  z-index: 1;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(226,232,240,.9);
  flex-wrap: wrap;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 800;
  min-width: 130px;
}

.info-value {
  font-size: 0.96rem;
  color: var(--text-primary);
  flex: 1;
  word-break: break-word;
}

.code-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.84rem;
  border: 1px solid #e2e8f0;
}

/* ──────────────────────────────────────────────────────────
   LISTES PATIENTS / CARTES
   ────────────────────────────────────────────────────────── */
.patients-list,
.antecedents-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.patient-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: rgba(255,255,255,.95);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: all .22s ease;
  border: 1px solid rgba(8,145,178,.08);
}

.patient-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(8,145,178,.16);
}

.patient-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary);
  font-size: 1.05rem;
  flex-shrink: 0;
}

.patient-info {
  flex: 1;
  min-width: 0;
}

.patient-name {
  font-weight: 700;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-code {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-card button {
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .patient-card {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .patient-card button {
    width: 100%;
    margin-top: 0.45rem;
  }
}

@media (min-width: 900px) {
  .patients-list,
  .antecedents-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ──────────────────────────────────────────────────────────
   GRANDE CARTE PATIENT / RÉSULTATS
   ────────────────────────────────────────────────────────── */
.patient-card-large,
.result-card {
  padding: 1.7rem;
}

.patient-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 auto 1.25rem;
  box-shadow: 0 14px 28px rgba(8,145,178,.22);
}

.patient-info-large h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.patient-info-large p {
  margin-bottom: 0.7rem;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.result-card {
  text-align: center;
}

.result-card h3 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

/* ──────────────────────────────────────────────────────────
   ANTÉCÉDENTS
   ────────────────────────────────────────────────────────── */
.antecedent-card {
  background: rgba(255,255,255,.95);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-soft);
}

.antecedent-card.medical { border-left-color: #0891B2; }
.antecedent-card.chirurgical { border-left-color: #F59E0B; }
.antecedent-card.familial { border-left-color: #8B5CF6; }

.antecedent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.antecedent-type {
  display: inline-flex;
  align-items: center;
  padding: 0.26rem 0.75rem;
  background: var(--secondary);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
}

.antecedent-date {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.antecedent-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.antecedent-traitement {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ──────────────────────────────────────────────────────────
   QR / SCANNER / RÉSULTATS
   ────────────────────────────────────────────────────────── */
.qr-scanner-container {
  padding: 2rem 1.5rem;
}

.scanner-info {
  text-align: center;
  margin-bottom: 2rem;
}

.scanner-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.scanner-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.video-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 2rem;
  border-radius: 18px;
  overflow: hidden;
  display: none;
  box-shadow: var(--shadow-medium);
}

#qr-video {
  width: 100%;
  height: auto;
  display: block;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-area {
  width: 200px;
  height: 200px;
  border: 3px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { border-color: var(--primary); }
  50% { border-color: var(--primary-light); }
}

.scanner-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 420px;
  margin: 0 auto;
}

.analysis-result {
  padding: 0 1.5rem;
}

.patient-details {
  text-align: left;
  padding: 1.2rem;
  background: var(--background);
  border-radius: 14px;
  margin-bottom: 1.2rem;
}

.patient-details p {
  margin-bottom: 0.7rem;
  color: var(--text-primary);
}

.patient-details strong {
  color: var(--text-secondary);
  font-weight: 700;
}

/* ──────────────────────────────────────────────────────────
   BADGES DE STATUT
   ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  margin-top: 0.45rem;
}

.status-pending {
  background: #FEF3C7;
  color: #92400E;
}

.status-confirmed {
  background: #D1FAE5;
  color: #065F46;
}

.status-cancelled {
  background: #FEE2E2;
  color: #991B1B;
}

.status-completed {
  background: #DBEAFE;
  color: #1E40AF;
}

/* ──────────────────────────────────────────────────────────
   MODALES
   ────────────────────────────────────────────────────────── */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-primary);
}

.close-modal {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--secondary);
  color: var(--primary);
  font-size: 1.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all .22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  background: var(--primary);
  color: #fff;
}

/* Modale IA */
.ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.ai-modal.active {
  display: flex;
}

.ai-modal-card {
  width: 100%;
  max-width: 760px;
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow-strong);
  border: 1px solid var(--border);
  padding: 1rem;
}

.ai-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ai-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.ai-modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.ai-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.ai-modal-output {
  margin-top: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: var(--background);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--text-primary);
  max-height: 40vh;
  overflow: auto;
}

@media (min-width: 760px) {
  .ai-modal {
    align-items: center;
  }

  .ai-modal-card {
    padding: 1.25rem;
  }
}

/* ──────────────────────────────────────────────────────────
   ÉTATS
   ────────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-style: italic;
}

.error {
  text-align: center;
  padding: 1rem 1.1rem;
  color: var(--error);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 14px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

/* ──────────────────────────────────────────────────────────
   BOTTOM NAV – VERSION CORRIGÉE BUREAU
   ────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(calc(100% - 20px), var(--desktop-nav-width));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(226,232,240,.95);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: stretch;
  padding: .5rem .65rem calc(.45rem + env(safe-area-inset-bottom));
  z-index: 300;
  box-shadow: 0 -10px 30px rgba(15,23,42,.12);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.6rem 0.35rem;
  border-radius: 14px;
  transition: .2s ease;
  min-width: 0;
  text-align: center;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-item span {
  display: block;
  line-height: 1.05;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary);
  background: linear-gradient(135deg, rgba(8,145,178,.10), rgba(14,165,233,.10));
}

@media (min-width: 1200px) {
  .bottom-nav {
    width: min(980px, calc(100% - 48px));
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .nav-item {
    font-size: 0.76rem;
    padding: 0.68rem 0.45rem;
  }

  .nav-item svg {
    width: 23px;
    height: 23px;
  }
}

@media (max-width: 767px) {
  .bottom-nav {
    width: 100%;
    left: 0;
    right: 0;
    transform: none;
    border-left: none;
    border-right: none;
    border-radius: 18px 18px 0 0;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    gap: 0.2rem;
  }

  .nav-item {
    font-size: 0.64rem;
    padding: 0.5rem 0.18rem;
  }

  .nav-item svg {
    width: 21px;
    height: 21px;
  }

  .nav-item span {
    white-space: normal;
    line-height: 1.02;
  }
}

@media (max-width: 420px) {
  .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    font-size: 0.6rem;
  }
}

/* ──────────────────────────────────────────────────────────
   CORRECTION MESSAGERIE + ZONE SÉCURISÉE
   ────────────────────────────────────────────────────────── */
.messages-layout {
  height: calc(100dvh - 132px - var(--bottom-nav-height) - env(safe-area-inset-bottom));
  /* Fallback pour anciens navigateurs */
  height: calc(var(--vh, 1vh) * 100 - 132px - var(--bottom-nav-height) - env(safe-area-inset-bottom));
}

.chat-input-bar {
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  z-index: 50;
  background: var(--surface);
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE GLOBAL
   ────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .page-header {
    padding: 1rem;
  }

  .page-header h1 {
    font-size: 1.1rem;
  }

  .result-card,
  .patient-card-large,
  .profile-card,
  .section-card {
    padding: 1rem;
    margin: 0.75rem 0;
  }

  .code-badge {
    margin-top: 0.45rem;
    font-size: 1rem;
    letter-spacing: 1.4px;
  }

  .info-label {
    min-width: 105px;
  }
}

@media (min-width: 992px) {
  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-content,
  .profile-shell {
    max-width: 1180px;
    margin: 0 auto;
  }
}

/* MARQUEURS PREMIUM */
#mpconnect-v5-marker,
#mpconnect-v5-patient,
#profil-v5-banner,
#messages-v5-banner,
#patient-v5-banner {
  position: relative;
  overflow: hidden;
}

#mpconnect-v5-marker::after,
#mpconnect-v5-patient::after,
#profil-v5-banner::after,
#messages-v5-banner::after,
#patient-v5-banner::after {
  content: '';
  position: absolute;
  inset: auto -60px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  filter: blur(2px);
}

/* MISE À JOUR UI */
body {
  background: linear-gradient(180deg,#f8fbff 0%,#f4f7fb 55%,#eef6f7 100%);
}

.app-header {
  background: linear-gradient(135deg,#0f172a 0%, #0891B2 45%, #22c55e 100%);
  box-shadow: 0 14px 32px rgba(2,132,199,.18);
}

.app-header .header-title span,
.app-header .header-title small,
.app-header .btn-icon {
  color: #fff;
}

.card,
.stat-card,
.toolbar-card,
.patient-card,
.score-card,
.profile-card,
.message-card {
  border-radius: 24px !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.08) !important;
  border: 1px solid rgba(148,163,184,.18) !important;
}

.btn-primary {
  background: linear-gradient(135deg,#0891B2,#22c55e) !important;
  border: none !important;
  box-shadow: 0 10px 20px rgba(8,145,178,.22);
}

.btn-link {
  background: #f8fafc;
  border-radius: 14px;
  padding: .7rem 1rem;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: #0f172a;
}

input,
select,
textarea {
  border-radius: 16px !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: none !important;
}

.main-content {
  padding-bottom: 7rem !important;
}

/* ===== NAVBAR FIXE MPConnect ===== */

/* Barre du haut */
header,
.app-header,
.top-header,
.main-header,
.navbar,
.nav-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9998;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* Barre du bas */
.bottom-nav,
.bottom-navbar,
.mobile-bottom-nav,
nav.bottom-nav {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -8px 24px rgba(0,0,0,.12);
}

/* Empêche le contenu de passer sous la barre du haut et du bas */
/* NOTE: padding-top retiré – le header est en flux normal (non fixed), pas besoin */
.app-container {
    padding-bottom: calc(var(--bottom-nav-height, 72px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
}

/* Si ton header est plus petit */
@media (max-width: 768px) {
    .app-container {
        padding-bottom: calc(var(--bottom-nav-height, 72px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
    }
}

/* Optionnel : garde le fond premium même en fixe */
header,
.app-header,
.top-header,
.main-header,
.navbar,
.nav-top,
.bottom-nav,
.bottom-navbar,
.mobile-bottom-nav,
nav.bottom-nav {
    background: rgba(4, 12, 28, 0.88) !important;
    border-color: rgba(255,255,255,.08) !important;
}


/* ═══════════════════════════════════════════════════════════
   MPConnect — UI Kit: Accordéons, Steps, Formulaires simplifiés
   Ajouté dans css/style-additions.css
═══════════════════════════════════════════════════════════ */

/* ── Accordéon ─────────────────────────────────────────────── */
.mp-accordion { display: flex; flex-direction: column; gap: 6px; }

.mp-acc-item {
  background: var(--mp-glass, rgba(255,255,255,.04));
  border: 1px solid var(--mp-border, rgba(255,255,255,.09));
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .2s;
}
.mp-acc-item.open { border-color: rgba(27,111,238,.35); }

.mp-acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
  background: none;
  border: none;
  width: 100%;
  color: var(--mp-text, #E2E8F0);
  text-align: left;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.mp-acc-header:hover { background: rgba(255,255,255,.03); }
.mp-acc-header:active { background: rgba(255,255,255,.06); }

.mp-acc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.mp-acc-title-wrap { flex: 1; min-width: 0; }
.mp-acc-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--mp-text, #E2E8F0);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-acc-subtitle {
  font-size: 11px;
  color: var(--mp-muted, rgba(255,255,255,.45));
  font-weight: 500;
}
.mp-acc-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(27,111,238,.15);
  color: #60a5fa;
  flex-shrink: 0;
}
.mp-acc-badge.green { background: rgba(34,197,94,.15); color: #4ade80; }
.mp-acc-badge.yellow { background: rgba(251,191,36,.15); color: #fbbf24; }
.mp-acc-badge.red { background: rgba(248,113,113,.15); color: #f87171; }

.mp-acc-arrow {
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  color: var(--mp-muted, rgba(255,255,255,.45));
}
.mp-acc-item.open .mp-acc-arrow { transform: rotate(180deg); }

.mp-acc-body {
  display: none;
  padding: 0 16px 16px;
  animation: accFadeIn .2s ease;
}
.mp-acc-item.open .mp-acc-body { display: block; }

@keyframes accFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Formulaire progressif par étapes ─────────────────────── */
.mp-steps-nav {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mp-steps-nav::-webkit-scrollbar { display: none; }

.mp-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 60px;
  position: relative;
}
.mp-step-dot::before {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(-50% + 14px);
  right: calc(50% + 14px);
  height: 2px;
  background: var(--mp-border, rgba(255,255,255,.09));
}
.mp-step-dot:first-child::before { display: none; }
.mp-step-dot.done::before { background: #1B6FEE; }

.mp-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--mp-border, rgba(255,255,255,.09));
  background: var(--mp-glass, rgba(255,255,255,.04));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--mp-muted, rgba(255,255,255,.45));
  transition: .25s;
  position: relative;
  z-index: 1;
}
.mp-step-dot.active .mp-step-circle {
  background: #1B6FEE;
  border-color: #1B6FEE;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(27,111,238,.2);
}
.mp-step-dot.done .mp-step-circle {
  background: #22C55E;
  border-color: #22C55E;
  color: #fff;
}
.mp-step-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--mp-muted, rgba(255,255,255,.45));
  text-align: center;
  white-space: nowrap;
}
.mp-step-dot.active .mp-step-label { color: #60a5fa; }
.mp-step-dot.done .mp-step-label { color: #4ade80; }

.mp-step-panel { display: none; }
.mp-step-panel.active { display: block; animation: accFadeIn .2s ease; }

.mp-step-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ── Groupes de champs compacts ───────────────────────────── */
.mp-field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.mp-field { display: flex; flex-direction: column; gap: 4px; }
.mp-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--mp-muted, rgba(255,255,255,.45));
  text-transform: uppercase;
  letter-spacing: .4px;
}
.mp-label .mp-required { color: #f87171; margin-left: 2px; }

.mp-input, .mp-select, .mp-textarea {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--mp-border, rgba(255,255,255,.09));
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--mp-text, #E2E8F0);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.mp-input:focus, .mp-select:focus, .mp-textarea:focus {
  outline: none;
  border-color: #1B6FEE;
  box-shadow: 0 0 0 3px rgba(27,111,238,.15);
}
.mp-input::placeholder { color: rgba(255,255,255,.25); }
.mp-textarea { resize: vertical; min-height: 80px; }
.mp-select { cursor: pointer; }

.mp-field-row { display: grid; gap: 10px; }
.mp-field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.mp-field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 480px) {
  .mp-field-row.cols-2, .mp-field-row.cols-3 { grid-template-columns: 1fr; }
}

/* ── Section collapsable légère ───────────────────────────── */
.mp-section {
  border-bottom: 1px solid var(--mp-border, rgba(255,255,255,.09));
  margin-bottom: 0;
}
.mp-section:last-child { border-bottom: none; }
.mp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mp-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--mp-text, #E2E8F0);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mp-section-body {
  display: none;
  padding-bottom: 14px;
}
.mp-section.open .mp-section-body { display: block; }
.mp-section-arrow { transition: transform .2s; color: var(--mp-muted); }
.mp-section.open .mp-section-arrow { transform: rotate(180deg); }

/* ── Boutons compacts ─────────────────────────────────────── */
.mp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 11px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mp-btn:active { transform: scale(.97); }
.mp-btn-primary { background: linear-gradient(135deg,#1B6FEE,#0EA5E9); color: #fff; }
.mp-btn-primary:hover { opacity: .88; }
.mp-btn-ghost { background: rgba(255,255,255,.07); color: var(--mp-text); border: 1px solid var(--mp-border); }
.mp-btn-ghost:hover { background: rgba(255,255,255,.12); }
.mp-btn-danger { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.2); }
.mp-btn-success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.mp-btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 8px; }
.mp-btn-full { width: 100%; }
.mp-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Cards d'info ─────────────────────────────────────────── */
.mp-info-card {
  background: rgba(27,111,238,.07);
  border: 1px solid rgba(27,111,238,.18);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: rgba(255,255,255,.65);
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.mp-info-card.warning {
  background: rgba(251,191,36,.07);
  border-color: rgba(251,191,36,.2);
}
.mp-info-card.success {
  background: rgba(34,197,94,.07);
  border-color: rgba(34,197,94,.2);
}
.mp-info-card.danger {
  background: rgba(248,113,113,.07);
  border-color: rgba(248,113,113,.2);
}

/* ── Toast moderne ────────────────────────────────────────── */
.mp-toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.mp-toast {
  background: rgba(15,23,42,.96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: toastIn .25s ease;
  pointer-events: all;
  backdrop-filter: blur(12px);
}
.mp-toast.success { border-color: rgba(34,197,94,.3); }
.mp-toast.error   { border-color: rgba(248,113,113,.3); }
.mp-toast.fade-out { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(8px); } }

/* Light theme overrides */
body:not(.dark-theme) .mp-acc-item    { background: #fff; border-color: #E2E8F0; }
body:not(.dark-theme) .mp-acc-title   { color: #1E293B; }
body:not(.dark-theme) .mp-acc-subtitle{ color: #64748B; }
body:not(.dark-theme) .mp-input,
body:not(.dark-theme) .mp-select,
body:not(.dark-theme) .mp-textarea    { background: #F8FAFC; border-color: #E2E8F0; color: #1E293B; }
body:not(.dark-theme) .mp-label       { color: #64748B; }
body:not(.dark-theme) .mp-btn-ghost   { background: #F1F5F9; color: #1E293B; border-color: #E2E8F0; }
body:not(.dark-theme) .mp-section     { border-color: #E2E8F0; }
body:not(.dark-theme) .mp-section-title { color: #1E293B; }


/* ═════════════════════════════════════════════════════════════
   PATCH LIVRAISON PRO — UX globale, mobile et lisibilité
   ═════════════════════════════════════════════════════════════ */
:root{
  --mp-pro-radius:22px;
  --mp-pro-radius-sm:16px;
  --mp-pro-border:rgba(255,255,255,.10);
  --mp-pro-card:rgba(255,255,255,.055);
  --mp-pro-card-strong:rgba(255,255,255,.075);
  --mp-pro-shadow:0 16px 46px rgba(0,0,0,.26);
}
html{scroll-behavior:smooth;}
body.dark-theme{background:#040C1C;}
.app-container{width:100%;max-width:1280px;margin:0 auto;min-height:100dvh;}
button,a,input,select,textarea{font-family:inherit;}
button,a{touch-action:manipulation;}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(14,165,233,.45);outline-offset:2px;}
.mp-page-tools,.mp-pro-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin:0 0 14px;}
.mp-pro-card{background:var(--mp-pro-card);border:1px solid var(--mp-pro-border);border-radius:var(--mp-pro-radius);box-shadow:var(--mp-pro-shadow);}
.mp-pro-empty{padding:22px 16px;border-radius:18px;background:rgba(255,255,255,.045);border:1px dashed rgba(255,255,255,.12);text-align:center;color:rgba(226,232,240,.72);font-size:13px;font-weight:700;line-height:1.5;}
.mp-pro-empty strong{display:block;color:#fff;font-size:14px;margin-bottom:4px;}
.mp-pro-list-btn{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left;padding:10px 12px;border:0;border-bottom:1px solid rgba(255,255,255,.06);background:transparent;color:#E2E8F0;cursor:pointer;}
.mp-pro-list-btn:hover{background:rgba(27,111,238,.12);}
.mp-pro-pill{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:4px 10px;background:rgba(27,111,238,.14);border:1px solid rgba(27,111,238,.25);color:#BFDBFE;font-size:11px;font-weight:900;}
.mp-loading-inline{display:inline-flex;align-items:center;gap:8px;color:rgba(226,232,240,.68);font-size:12px;font-weight:800;}
.mp-loading-inline:before{content:'';width:14px;height:14px;border-radius:999px;border:2px solid rgba(255,255,255,.14);border-top-color:#38BDF8;animation:mpSpin .7s linear infinite;}
@keyframes mpSpin{to{transform:rotate(360deg)}}
@media (min-width:900px){.mp-bottom-nav-wrap{left:50%!important;right:auto!important;transform:translateX(-50%);width:min(920px,calc(100vw - 48px));}.mp-bottom-nav{margin:0;border-radius:26px 26px 0 0;}}
@media (max-width:760px){
  .app-container{max-width:none;}
  .mp-header-card{box-shadow:0 8px 24px rgba(0,0,0,.25)!important;}
  .mp-header-right{gap:6px!important;}
  .mp-header-btn{width:40px!important;height:40px!important;border-radius:14px!important;}
  .mp-lang-switch{display:none!important;}
  .dm-grid,.exa-grid{grid-template-columns:1fr!important;}
  .dos-tabs{overflow-x:auto;scrollbar-width:none;}
  .dos-tabs::-webkit-scrollbar{display:none;}
  .dos-tab{min-width:118px;flex:0 0 auto;}
  .dos-modal-card,.dm-drawer{max-height:88dvh!important;}
}
@media (max-width:430px){
  .mp-header-logo{width:40px!important;height:40px!important;border-radius:14px!important;}
  .mp-header-logo img{width:36px!important;height:36px!important;}
  .mp-header-title{font-size:14px!important;}
  .mp-header-subtitle{display:none!important;}
  .mp-profile-chip{display:none!important;}
}
body:not(.dark-theme) .mp-pro-card{background:#fff;border-color:#E2E8F0;box-shadow:0 12px 32px rgba(15,23,42,.08);}
body:not(.dark-theme) .mp-pro-empty{background:#F8FAFC;border-color:#CBD5E1;color:#475569;}
body:not(.dark-theme) .mp-pro-empty strong{color:#0F172A;}

/* ═════════════════════════════════════════════════════════════
   PATCH RESPONSIVE PRO V2 — rendu multi-écrans livraison
   Objectif : mobile 2 colonnes, tablette 2/3, bureau large.
   ═════════════════════════════════════════════════════════════ */
:root{
  --mp-layout-max: 1320px;
  --mp-layout-pad: clamp(14px, 2.2vw, 30px);
  --mp-card-gap: clamp(12px, 1.6vw, 22px);
  --mp-sidebar-width: 104px;
}

html, body{max-width:100%;overflow-x:hidden;}
body{min-width:320px;}
.app-container,
body.dark-theme .app-container{
  width:100% !important;
  max-width:none !important;
  min-height:100dvh;
  margin:0 auto !important;
  overflow-x:clip;
  box-sizing:border-box;
}

/* Unifie les pages internes : plus de rendu téléphone centré sur ordinateur. */
.main-content,
.dm-shell,
.dos-shell,
.exa-shell,
.patients-shell,
.planlist-shell,
.pf-shell,
.st-shell,
.mpr-shell,
.access-shell,
.create-shell,
.profile-shell,
.terms-shell,
.qr-scanner-container{
  width:min(100%, var(--mp-layout-max));
  max-width:var(--mp-layout-max) !important;
  margin-inline:auto !important;
  padding-inline:var(--mp-layout-pad) !important;
  box-sizing:border-box;
}

/* Dashboard patient : vraie grille responsive au lieu d'une colonne mobile centrée. */
.mp-patient-dashboard{
  width:min(100%, var(--mp-layout-max));
  max-width:var(--mp-layout-max);
  margin:0 auto;
  padding:clamp(12px, 2vw, 26px) var(--mp-layout-pad) 0 !important;
  box-sizing:border-box;
  display:block;
}
.mp-patient-dashboard > style{display:none!important;}

.mp-exams-callout{
  margin:0 0 16px;
  padding:16px;
  border-radius:22px;
  background:linear-gradient(135deg,rgba(27,111,238,.16),rgba(34,197,94,.12));
  border:1px solid rgba(78,150,255,.20);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  box-shadow:0 14px 36px rgba(0,0,0,.18);
}

.mp-plan-banner,
.mp-hero,
.mp-chart-card,
.mp-rdv,
.mp-rdv-empty,
.mp-ai,
.mp-exams-callout{
  margin-left:0 !important;
  margin-right:0 !important;
}

/* Les mesures ne doivent plus défiler horizontalement : grille claire partout. */
.mp-mrow{
  display:grid !important;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px !important;
  overflow:visible !important;
  padding-bottom:0 !important;
  margin-bottom:18px !important;
}
.mp-mc{
  min-width:0 !important;
  width:100%;
  min-height:132px;
  flex-shrink:1 !important;
}
.mp-agrid{
  grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  gap:12px !important;
}
.mp-atile{min-height:82px;}
.mp-sec-hdr{margin-top:2px !important;}

@media (min-width:768px){
  .mp-mrow{grid-template-columns:repeat(3, minmax(0, 1fr));}
  .mp-agrid{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}
  .patients-list,
  .antecedents-list,
  .patients-list-premium,
  .stats-grid,
  .sa-stats-grid,
  .sa-actions-grid,
  .plans-grid,
  .planlist-grid,
  .quick-actions,
  .dm-actions,
  .exa-form-grid,
  .pf-grid,
  .mpr-meta-grid,
  .hint-grid,
  .form-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width:992px){
  .mp-patient-dashboard{
    display:grid;
    grid-template-columns:minmax(0, 1.75fr) minmax(340px, .95fr);
    column-gap:var(--mp-card-gap);
    row-gap:16px;
    align-items:start;
  }
  #dp-video-call-notif{grid-column:1 / -1;order:0;margin:0!important;}
  .mp-patient-dashboard > .mp-plan-banner{grid-column:2;order:10;}
  .mp-patient-dashboard > .mp-exams-callout{grid-column:2;order:11;}
  .mp-patient-dashboard > .mp-hero{grid-column:1;order:10;margin-bottom:0;}
  .mp-patient-dashboard > .mp-sec-hdr--metrics{grid-column:1;order:20;margin-bottom:-4px!important;}
  .mp-patient-dashboard > .mp-mrow{grid-column:1;order:21;margin-bottom:0!important;}
  .mp-patient-dashboard > .mp-sec-hdr--quick{grid-column:2;order:20;margin-bottom:-4px!important;}
  .mp-patient-dashboard > .mp-agrid{grid-column:2;order:21;margin-bottom:0!important;}
  .mp-patient-dashboard > .mp-chart-card{grid-column:1;order:30;margin-bottom:0;}
  .mp-patient-dashboard > .mp-rdv,
  .mp-patient-dashboard > .mp-rdv-empty{grid-column:2;order:30;margin-bottom:0;}
  .mp-patient-dashboard > .mp-ai{grid-column:1 / -1;order:40;margin-bottom:10px;}
  .mp-hero{min-height:250px;display:flex;flex-direction:column;justify-content:space-between;}
  .mp-mrow{grid-template-columns:repeat(3, minmax(0, 1fr));}
  .mp-agrid{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}

  .dm-grid,
  .exa-grid,
  .access-grid,
  .create-grid,
  .mpr-grid,
  .pf-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    gap:var(--mp-card-gap) !important;
  }
  .dm-card.full,
  .exa-card.full,
  .pf-card.full{grid-column:1 / -1 !important;}
}

@media (min-width:1200px){
  .mp-mrow{grid-template-columns:repeat(4, minmax(0, 1fr));}
  .mp-agrid{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}
  .patients-list,
  .antecedents-list,
  .patients-list-premium,
  .stats-grid,
  .sa-stats-grid,
  .sa-actions-grid,
  .plans-grid,
  .planlist-grid,
  .quick-actions,
  .dm-actions,
  .hint-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width:1440px){
  .mp-patient-dashboard{grid-template-columns:minmax(0, 1.9fr) minmax(380px, .95fr);}
  .mp-agrid{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}
  .patients-list-premium,
  .sa-actions-grid,
  .quick-actions{grid-template-columns:repeat(4, minmax(0, 1fr)) !important;}
}

@media (max-width:520px){
  .mp-patient-dashboard{padding-inline:12px!important;}
  .mp-exams-callout{padding:14px 14px;border-radius:20px;}
  .mp-exams-callout > div:first-child{min-width:0;}
  .mp-exams-callout a{flex-shrink:0;}
  .mp-hero{padding:18px 16px;border-radius:22px;}
  .hero-num{font-size:clamp(42px, 14vw, 56px)!important;}
  .mp-mc{padding:13px 12px;min-height:122px;}
  .mc-v{font-size:clamp(18px, 6vw, 23px);}
  .mp-atile{padding:13px 12px;gap:9px;}
  .at-body strong{font-size:11.5px;}
}

/* Les très petits téléphones gardent 2 colonnes, mais avec cartes plus compactes. */
@media (max-width:380px){
  .mp-agrid{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}
  .mp-mrow{grid-template-columns:repeat(2, minmax(0, 1fr)) !important;}
  .mp-mc{min-height:116px;}
  .mc-badge{position:static;display:inline-flex;margin-top:8px;}
  .at-ico{width:32px;height:32px;}
}

/* Tables : évite les débordements visuels. */
.table-wrap,
.table-responsive,
.sa-table-wrap,
.ac-table-wrap,
.exa-table-wrap,
.patients-table-wrap{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:18px;
}
table{max-width:100%;}

/* Modales : meilleures limites sur mobile et bureau. */
.modal-content,
.dos-modal-card,
.patients-modal-card,
.dm-drawer,
.ai-modal-card{
  width:min(100%, 920px);
  max-height:min(88dvh, 860px);
  overflow:auto;
}
@media (max-width:640px){
  .modal-content,
  .dos-modal-card,
  .patients-modal-card,
  .dm-drawer,
  .ai-modal-card{
    width:calc(100vw - 20px) !important;
    border-radius:22px !important;
  }
}

@media (min-width:1180px){
  .mp-patient-dashboard,
  .main-content,
  .dm-shell,
  .dos-shell,
  .exa-shell,
  .patients-shell,
  .planlist-shell,
  .pf-shell,
  .st-shell,
  .mpr-shell,
  .access-shell,
  .create-shell,
  .profile-shell,
  .terms-shell,
  .qr-scanner-container{
    width:min(var(--mp-layout-max), calc(100% - 150px)) !important;
    margin-left:max(118px, calc((100vw - var(--mp-layout-max)) / 2 + 118px)) !important;
    margin-right:auto !important;
  }
  body.dark-theme .app-container,
  .app-container{
    padding-bottom:28px !important;
  }
}
