@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Accessibilité : focus clavier / Switch Control ─── */
:focus-visible {
  outline: 3px solid var(--primaire);
  outline-offset: 3px;
  border-radius: 8px;
}

:root {
  /* Palette Apple Health — senior-friendly */
  --fond:            #F4F6F5;
  --carte:           #E8F3EC;
  --blanc:           #FFFFFF;
  --accent:          #4F8A6D;
  --accent-sombre:   #3A6B55;
  --accent-clair:    #E8F3EC;
  --sos:             #D64545;
  --sos-clair:       #FDF2F2;
  --texte:           #1E1E1E;
  --texte-doux:      #6B7280;

  /* Compat ← ancien système */
  --primaire:        #4F8A6D;
  --primaire-clair:  #E8F3EC;
  --rouge:           #D64545;
  --vert:            #3A7D5C;
  --gris-clair:      #F4F6F5;

  /* Sections écrans secondaires */
  --repas-couleur:   #D97706;
  --repas-clair:     #FEF3C7;
  --meds-couleur:    #2563EB;
  --meds-clair:      #EFF6FF;
  --glyc-couleur:    #7C3AED;
  --glyc-clair:      #F5F3FF;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  background: var(--fond);
  color: var(--texte);
  overflow: hidden;
}

/* ── ÉCRANS ─────────────────────────────────────────── */
.ecran {
  display: none;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  position: absolute;
  top: 0; left: 0;
  overflow-y: auto;
}
.ecran.actif { display: flex; }

/* ── HEADER ACCUEIL ──────────────────────────────────── */
.entete {
  background: linear-gradient(160deg, #4F8A6D 0%, #3A6B55 100%);
  transition: background 0.8s ease;
  color: white;
  padding: 48px 24px 36px;
  text-align: center;
  position: relative;
}
.entete-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Goutte-bouton admin */
.logo-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.15s, opacity 0.15s;
  display: block;
}
.logo-btn:active { transform: scale(0.92); opacity: 0.8; }
.logo { width: 46px; height: 46px; }
.entete h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.bonjour { font-size: 22px; opacity: 0.95; font-weight: 600; margin-top: 2px; line-height: 1.3; }

/* ── BOUTONS PRINCIPAUX ACCUEIL ─────────────────────── */
.boutons-principaux {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 20px 16px;
}

.btn-principal {
  display: flex;
  align-items: center;
  gap: 20px;
  border: none;
  border-radius: 24px;
  padding: 24px 24px;
  min-height: 76px;
  font-size: 22px;
  font-weight: 700;
  color: var(--texte);
  background: var(--blanc);
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  width: 100%;
  text-align: left;
}
.btn-principal:active {
  transform: scale(0.97);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.btn-principal.btn-repas { background: var(--blanc); }
.btn-principal.btn-meds  { background: var(--blanc); }

.btn-urgence-home {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--sos-clair);
  border: none;
  border-radius: 24px;
  border-left: 6px solid var(--sos);
  padding: 24px 24px;
  min-height: 76px;
  font-size: 22px;
  font-weight: 700;
  color: var(--sos);
  box-shadow: 0 2px 16px rgba(214,69,69,0.10);
  cursor: pointer;
  transition: transform 0.12s;
  width: 100%;
  text-align: left;
}
.btn-urgence-home:active { transform: scale(0.97); }

.btn-icone { font-size: 36px; flex-shrink: 0; }
.btn-texte { line-height: 1.25; }

/* ── GRILLE APPELS URGENCE (4 boutons) ───────────────── */
.grille-appels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 28px;
}
.btn-appel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  border-radius: 20px;
  padding: 18px 10px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s;
  min-height: 100px;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  text-align: center;
  background: white;
  border-radius: 20px;
  padding: 18px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.btn-appel:active { transform: scale(0.96); }
.btn-appel-left { display: none; }
.btn-appel-right { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.btn-appel-numero { font-size: 28px; font-weight: 900; letter-spacing: -0.5px; line-height: 1; }
.btn-appel-label  { font-size: 13px; font-weight: 600; opacity: 0.8; }
.btn-appel.rouge  { background: #FDF1F1; }
.btn-appel.rouge  .btn-appel-numero, .btn-appel.rouge  .btn-appel-label { color: #C0392B; }
.btn-appel.vert   { background: #EFF8F3; }
.btn-appel.vert   .btn-appel-numero, .btn-appel.vert   .btn-appel-label { color: #1E6E45; }
.btn-appel.bleu   { background: #EEF4FD; }
.btn-appel.bleu   .btn-appel-numero, .btn-appel.bleu   .btn-appel-label { color: #2A5BAD; }
.btn-appel.non-configure { opacity: 0.4; pointer-events: none; background: #F0F0F0; }

/* ── HEADERS INTÉRIEURS ──────────────────────────────── */
.entete-ecran {
  background: var(--primaire);
  color: white;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.entete-ecran h2 { font-size: 22px; font-weight: 800; }

#ecran-repas      .entete-ecran,
#ecran-historique .entete-ecran { background: var(--repas-couleur); }

#ecran-medicaments .entete-ecran,
#ecran-ajouter-med .entete-ecran { background: var(--meds-couleur); }

#ecran-glycemie .entete-ecran { background: var(--glyc-couleur); }

#ecran-urgence .entete-ecran { background: var(--rouge); }

.btn-retour {
  background: rgba(255,255,255,0.22);
  border: none;
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── CONTENU ─────────────────────────────────────────── */
.contenu-ecran {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
  flex: 1;
}

.instruction {
  font-size: 21px;
  font-weight: 700;
  color: var(--texte);
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.35;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border: 2.5px solid var(--primaire);
  border-radius: 18px;
  padding: 20px 22px;
  font-size: 19px;
  font-weight: 700;
  color: var(--primaire);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.btn-action:active { background: var(--primaire-clair); }

/* ── GLYCÉMIE ────────────────────────────────────────── */
.glycemie-input-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 3px solid var(--glyc-couleur);
  border-radius: 20px;
  padding: 16px 20px;
}
.champ-glycemie {
  font-size: 36px;
  font-weight: 800;
  color: var(--glyc-couleur);
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}
.glycemie-unite {
  font-size: 18px;
  font-weight: 700;
  color: var(--texte-doux);
  white-space: nowrap;
  flex-shrink: 0;
}
.glycemie-indicateur {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 14px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.glyc-ind-ok         { background: #D4EDDA; color: #147A35; }
.glyc-ind-attention  { background: #FFF3CD; color: #856404; }
.glyc-ind-elevee     { background: #FFE4C4; color: #D96500; }
.glyc-ind-tres-elevee{ background: #FDECEA; color: #CC1F1F; }
.glyc-ind-bas        { background: #FFE4C4; color: #D96500; }
.glycemie-reference {
  background: #F8F9FA;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--texte-doux);
  line-height: 1.8;
  text-align: center;
}
.glycemie-carte { border-left: 7px solid var(--glyc-couleur) !important; }
.glycemie-valeur { font-size: 24px; font-weight: 800; margin-top: 6px; color: var(--texte); }
.glyc-ok        { background: #EAF6EC !important; }
.glyc-haut      { background: #FFF8E1 !important; }
.glyc-tres-haut { background: #FDECEA !important; }
.glyc-bas       { background: #FFF3E0 !important; }

/* ── ZONES DYNAMIQUES ───────────────────────────────── */
.zone-cachee { display: none; }
.zone-cachee.visible { display: block; }

.ecoute-texte { font-size: 19px; text-align: center; color: var(--primaire); font-weight: 700; }
.texte-reconnu {
  font-size: 21px;
  text-align: center;
  color: var(--texte);
  background: white;
  border-radius: 16px;
  padding: 18px;
  margin: 10px 0;
  min-height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.chargement { font-size: 19px; text-align: center; color: var(--texte-doux); padding: 24px; }

.conseil-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 3px 16px rgba(11,102,80,0.12);
}
.conseil-texte { font-size: 20px; line-height: 1.55; color: var(--texte); margin-bottom: 20px; }

/* ── Saisie glycémie mesurée (sur écran repas) ─────── */
.glyc-saisie-carte {
  background: white;
  border-radius: 24px;
  padding: 20px 20px 16px;
  box-shadow: 0 2px 14px rgba(124,58,237,0.10);
  border-left: 6px solid var(--glyc-couleur);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.glyc-saisie-titre {
  font-size: 17px;
  font-weight: 800;
  color: var(--glyc-couleur);
}
.glyc-saisie-ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glyc-clair);
  border-radius: 16px;
  padding: 10px 18px;
  border: 2px solid var(--glyc-couleur);
}
.glyc-saisie-input {
  font-size: 36px;
  font-weight: 800;
  color: var(--glyc-couleur);
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}
.glyc-saisie-unite {
  font-size: 17px;
  font-weight: 700;
  color: var(--texte-doux);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Carte Index Glycémique dans le résultat repas ── */
.repas-ig-carte {
  background: var(--fond);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1.5px solid #E2EAE6;
}
.repas-ig-titre {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--texte-doux);
  margin-bottom: 10px;
}
.repas-ig-ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.repas-ig-desc {
  font-size: 16px;
  color: var(--texte-doux);
}
.repas-ig-diabete {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--texte);
}
.repas-ig-remarque {
  margin-top: 8px;
  font-size: 15px;
  color: var(--texte-doux);
  line-height: 1.45;
}

/* ── BOUTONS CONFIRMER / BRAVO ───────────────────────── */
.btn-confirmer, .btn-bravo {
  display: block;
  width: 100%;
  background: var(--vert);
  border: none;
  border-radius: 16px;
  padding: 20px;
  font-size: 20px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s;
}
.btn-confirmer:active, .btn-bravo:active { transform: scale(0.97); }

/* ── ÉCRAN BRAVO ────────────────────────────────────── */
.bravo-ecran {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  padding: 40px 24px;
  text-align: center;
  background: #EDFAF3;
  gap: 20px;
}
.bravo-icone { font-size: 80px; }
.bravo-titre { font-size: 40px; font-weight: 900; color: var(--vert); }
.bravo-texte { font-size: 22px; color: var(--texte-doux); }
.bravo-sous  { font-size: 17px; color: var(--texte-doux); }

/* ── URGENCE ────────────────────────────────────────── */
.urgence-contenu { align-items: center; justify-content: center; text-align: center; }
.urgence-message { color: var(--texte-doux); margin-bottom: 16px; }

.urgence-rassurant {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
  border-radius: 20px;
  padding: 24px 20px 20px;
  margin-bottom: 20px;
  text-align: center;
}
.urgence-coeur {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 10px;
  animation: battre 1.4s ease-in-out infinite;
}
.urgence-rassurant-texte {
  font-size: 20px;
  font-weight: 600;
  color: #2c5f8a;
  line-height: 1.5;
  margin: 0;
}
@keyframes battre {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.18); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.12); }
  56%       { transform: scale(1); }
}

.proche-info {
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 18px;
  color: var(--texte-doux);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin-bottom: 4px;
}
.proche-info strong { color: var(--texte); font-size: 20px; }

.btn-urgence-gros {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--rouge);
  border: none;
  border-radius: 24px;
  padding: 32px 40px;
  font-size: 22px;
  font-weight: 800;
  color: white;
  box-shadow: 0 6px 24px rgba(204,31,31,0.35);
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s;
}
.btn-urgence-gros .btn-icone { font-size: 48px; }
.btn-urgence-gros:active { transform: scale(0.97); }
.btn-urgence-gros:disabled { background: #ccc; box-shadow: none; }

.btn-urgence-med {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 2px solid #1E6E45;
  border-radius: 20px;
  padding: 20px 24px;
  font-size: 20px;
  font-weight: 700;
  color: #1E6E45;
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s, background 0.15s;
}
.btn-urgence-med .btn-icone { font-size: 36px; }
.btn-urgence-med:active { transform: scale(0.97); background: #E8F8EE; }

.btn-secondaire {
  background: none;
  border: 2px solid #C8DEDA;
  border-radius: 14px;
  color: var(--texte-doux);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  padding: 16px 20px;
  width: 100%;
  text-align: center;
  touch-action: manipulation;
}

/* ── INSCRIPTION ────────────────────────────────────── */
.champ-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.champ-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--texte);
}
.champ-input {
  font-size: 21px;
  padding: 18px 20px;
  border: 2.5px solid #C8DEDA;
  border-radius: 16px;
  outline: none;
  width: 100%;
  min-width: 0;
  background: white;
  color: var(--texte);
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.champ-input:focus { border-color: var(--primaire); }
.champ-aide {
  font-size: 15px;
  color: var(--texte-doux);
  margin-top: 4px;
  padding: 0 4px;
  line-height: 1.4;
}
input[type="time"].champ-input {
  font-size: 20px;
  padding: 16px 14px;
  cursor: pointer;
}

.code-group { display: flex; justify-content: center; margin: 8px 0; }
.champ-code {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 16px;
  text-align: center;
  padding: 20px 24px;
  border: 3px solid var(--primaire);
  border-radius: 20px;
  width: 200px;
  outline: none;
  color: var(--texte);
  background: white;
}

.erreur-msg {
  background: #FDECEA;
  border: 1.5px solid #F5B8B8;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  color: var(--rouge);
  text-align: center;
}

.dev-code-affiche {
  background: #FFF8E1;
  border: 2px dashed #F2C94C;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 18px;
  color: #6B4F00;
  line-height: 1.4;
}
.dev-code-affiche strong {
  display: block;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #B8860B;
  margin-top: 6px;
}

/* ── MÉDICAMENTS ────────────────────────────────────── */
#liste-medicaments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

.med-section-titre {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--texte-doux);
  padding: 6px 4px 2px;
  margin-top: 4px;
}

.med-carte {
  border-radius: 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 2px 12px rgba(0,0,0,0.09);
  transition: opacity 0.3s, transform 0.1s;
  overflow: hidden;
}
.med-carte.pris .med-posologie,
.med-carte.pris .med-freq-tag { opacity: 0.45; }
.med-carte.pris .med-carte-corps { background: #F5F5F5; }

/* ── En-tête colorée horizontale ─────────────────────── */
.med-carte-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
}
.med-carte.matin .med-carte-header { background: #E08C00; }
.med-carte.midi  .med-carte-header { background: #1450C4; }
.med-carte.soir  .med-carte-header { background: #7B10BB; }
.med-carte.nuit  .med-carte-header { background: #3949AB; }

.med-carte-periode-label {
  font-size: 14px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.med-carte-heure-tag {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
  padding: 2px 9px;
  margin-left: auto;
}
.med-retard {
  font-size: 13px;
  font-weight: 800;
  color: white;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 2px 9px;
}

/* Corps de la carte */
.med-carte-corps {
  flex: 1;
  padding: 14px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: white;
}

/* Couleurs de fond léger pour les corps */
.med-carte.matin .med-carte-corps { background: #FFFDF5; }
.med-carte.midi  .med-carte-corps { background: #F4F8FF; }
.med-carte.soir  .med-carte-corps { background: #FAF5FF; }
.med-carte.nuit  .med-carte-corps { background: #F4F5FB; }

.med-freq-tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--texte-doux);
}
.med-desactive-tag {
  font-size: 13px;
  font-weight: 700;
  background: #F0F0F0;
  color: #888;
  border-radius: 6px;
  padding: 2px 8px;
  vertical-align: middle;
  margin-left: 4px;
}

.med-carte-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

/* Couleurs par période (fond global) */
/* La couleur de période est portée uniquement par .med-carte-header */

.med-nom  { font-size: 20px; font-weight: 800; color: var(--texte); }
.med-posologie { font-size: 14px; color: var(--texte-doux); margin-top: 3px; font-style: italic; }
.med-badge-insuline { font-size: 13px; font-weight: 700; background: #E0F0FF; color: #1A6FB0; border-radius: 6px; padding: 2px 8px; vertical-align: middle; margin-left: 4px; }
.med-heure {
  font-size: 15px;
  color: var(--texte-doux);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
/* Bouton pris — grand, full-width */
.btn-med-pris {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
  transition: transform 0.1s;
}
.btn-med-pris:active { transform: scale(0.98); }
.btn-med-pris.deja-pris { background: #B8C8C4 !important; cursor: default; }
.btn-med-pris:disabled  { background: #B8C8C4 !important; cursor: default; }

.med-carte.matin .btn-med-pris:not(.deja-pris):not(:disabled) { background: #E08C00; }
.med-carte.midi  .btn-med-pris:not(.deja-pris):not(:disabled) { background: #1450C4; }
.med-carte.soir  .btn-med-pris:not(.deja-pris):not(:disabled) { background: #8B00CC; }
.med-carte.nuit  .btn-med-pris:not(.deja-pris):not(:disabled) { background: #3949AB; }

.med-carte.en-retard .med-carte-header { background: var(--rouge) !important; }
.med-carte.en-retard .med-nom { color: var(--rouge); }
.med-carte.pas-aujourd .med-carte-corps { opacity: 0.28; }
.med-carte.pas-aujourd .med-carte-header { opacity: 0.5; }
.med-carte.desactive .med-carte-corps   { opacity: 0.35; filter: grayscale(0.6); }
.med-carte.desactive .med-carte-header  { opacity: 0.5; filter: grayscale(0.5); }

/* Carte cliquable */
.med-carte { cursor: pointer; }
.med-carte:active { transform: scale(0.985); }

/* ── Fiche médicament ─────────────────────────────────── */
.fiche-med-carte {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--blanc);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  margin-bottom: 24px;
  position: relative;
}
.fiche-med-icone { font-size: 40px; line-height: 1; }
.fiche-med-info  { flex: 1; }
.fiche-med-nom   { font-size: 22px; font-weight: 800; color: var(--texte); }
.fiche-med-detail{ font-size: 15px; color: var(--texte-doux); margin-top: 4px; }
.fiche-med-posologie { font-size: 14px; color: var(--texte-doux); margin-top: 6px; font-style: italic; }

/* ── Historique injections insuline dans la fiche ──── */
.fiche-insuline-titre {
  font-size: 17px;
  font-weight: 800;
  color: #1A6FB0;
  margin: 20px 0 10px;
}
.insuline-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #EEF5FF;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.insuline-dt {}
.insuline-date  { font-size: 15px; font-weight: 700; color: var(--texte); text-transform: capitalize; }
.insuline-heure { font-size: 15px; color: var(--texte-doux); margin-top: 2px; }
.insuline-unites    { font-size: 22px; font-weight: 900; color: #1A6FB0; }
.insuline-unites-nc { font-size: 18px; color: var(--texte-doux); }
.insuline-periode   { font-size: 12px; font-weight: 600; color: var(--texte-doux); margin-left: 6px; text-transform: capitalize; }
.fiche-insuline-vide { font-size: 15px; color: var(--texte-doux); text-align: center; padding: 16px 0; }
.fiche-med-statut-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #E0F0E8;
  color: var(--accent);
}
.fiche-med-statut-badge.desactive {
  background: #F0E0E0;
  color: var(--rouge);
}

.btn-fiche-desactiver {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.2s;
}
.btn-fiche-desactiver.reactiver {
  border-color: #4F8A6D;
  color: #4F8A6D;
  background: #E6F5ED;
}
.btn-fiche-desactiver:active { opacity: 0.8; }

.fiche-med-hint {
  font-size: 14px;
  color: var(--texte-doux);
  text-align: center;
  margin: 0 0 24px;
  padding: 0 8px;
  line-height: 1.4;
}
.fiche-med-hint.rouge { color: var(--rouge); font-weight: 600; }

.btn-fiche-supprimer {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 2px solid var(--rouge);
  background: transparent;
  color: var(--rouge);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-fiche-supprimer:active { background: #FDE8E8; }

.fiche-suppr-btns {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.btn-fiche-annuler {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid #ccc;
  background: transparent;
  color: var(--texte-doux);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-fiche-confirmer-suppr {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--rouge);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-fiche-confirmer-suppr:active { opacity: 0.85; }

.badge-meds {
  margin-left: auto;
  background: var(--rouge);
  color: white;
  font-size: 15px;
  font-weight: 800;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chargement-meds { font-size: 18px; color: var(--texte-doux); text-align: center; padding: 20px; }

/* ── AJOUTER MÉDICAMENT ─────────────────────────────── */
.frequence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.btn-frequence {
  padding: 14px 8px;
  border: 3px solid #C8DEDA;
  border-radius: 14px;
  background: white;
  font-size: 15px;
  font-weight: 700;
  color: var(--texte-doux);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1.3;
}
.btn-frequence.selectionne {
  border-color: var(--meds-couleur);
  color: var(--meds-couleur);
  background: var(--meds-clair);
}

.jours-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.btn-jour {
  padding: 12px 4px;
  border: 2px solid #C8DEDA;
  border-radius: 12px;
  background: white;
  font-size: 13px;
  font-weight: 700;
  color: var(--texte-doux);
  cursor: pointer;
  text-align: center;
}
.btn-jour.selectionne {
  border-color: var(--meds-couleur);
  color: var(--meds-couleur);
  background: var(--meds-clair);
}

/* ── Scanner compact ──────────────────────────────────── */
.btn-scan-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: white;
  border: 2.5px solid var(--accent);
  border-radius: 14px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.btn-scan-compact:active { background: var(--accent-clair); }

/* ── Carte insuline ───────────────────────────────────── */
.carte-insuline-label {
  display: block;
  cursor: pointer;
  margin-bottom: 4px;
}
.carte-insuline-label input[type="checkbox"] { display: none; }
.carte-insuline-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 2.5px solid #D0E8E0;
  border-radius: 16px;
  padding: 16px 18px;
  transition: border-color 0.2s, background 0.2s;
}
.carte-insuline-label.active .carte-insuline-inner {
  border-color: #1A6FB0;
  background: #E8F3FF;
}
.carte-insuline-icone { font-size: 32px; flex-shrink: 0; }
.carte-insuline-titre { font-size: 18px; font-weight: 700; color: var(--texte); }
.carte-insuline-sous  { font-size: 14px; color: var(--texte-doux); margin-top: 2px; }
.carte-insuline-check { font-size: 22px; margin-left: auto; }

/* ── Options avancées ─────────────────────────────────── */
.btn-options-avancees {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  color: var(--texte-doux);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 4px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 4px;
}
.chevron-options {
  font-size: 22px;
  transition: transform 0.2s;
  display: inline-block;
}

/* ── Liste médicaments enregistrés (écran ajout) ─────── */
.btn-liste-meds-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--blanc);
  border: 2px solid #E0E0E0;
  border-radius: 14px;
  color: var(--texte);
  font-size: 16px;
  font-weight: 700;
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
}
.liste-med-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blanc);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.liste-med-item.desactive { opacity: 0.55; }
.liste-med-item:active { transform: scale(0.98); }
.liste-med-periode {
  font-size: 12px;
  font-weight: 800;
  color: white;
  border-radius: 8px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.liste-med-nom {
  font-size: 16px;
  font-weight: 700;
  color: var(--texte);
  flex: 1;
}
.liste-med-statut {
  font-size: 12px;
  color: #999;
  font-weight: 600;
  white-space: nowrap;
}
#zone-options-avancees {
  background: #F8FAF9;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 8px;
}
.champ-hint-inline { font-size: 15px; font-weight: 400; color: var(--texte-doux); margin-left: 6px; }

.periode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn-periode {
  padding: 18px 12px;
  border: 3px solid transparent;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  text-align: center;
}
.btn-periode { font-size: 22px; line-height: 1.4; }
.btn-periode span { display: block; font-size: 16px; font-weight: 700; margin-top: 4px; }
.btn-periode:active { transform: scale(0.96); }
.btn-periode.matin { background: #FFF8E1; color: #8B5E00; }
.btn-periode.midi  { background: #E3F2FD; color: #0D47A1; }
.btn-periode.soir  { background: #F3E5F5; color: #6A1B9A; }
.btn-periode.nuit  { background: #E8EAF6; color: #283593; }
.btn-periode.selectionne.matin { border-color: #E08C00; }
.btn-periode.selectionne.midi  { border-color: #1450C4; }
.btn-periode.selectionne.soir  { border-color: #8B00CC; }
.btn-periode.selectionne.nuit  { border-color: #3949AB; }

.scan-resultat {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid #C8DEDA;
  line-height: 1.4;
}
.scan-ok       { color: var(--vert); }
.scan-ok-nom   { font-size: 18px; font-weight: 800; color: var(--vert); margin-bottom: 8px; }
.scan-indication {
  font-size: 15px;
  font-weight: 500;
  color: var(--texte);
  background: #EEF7F4;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  margin-top: 6px;
  line-height: 1.5;
}
.scan-posologie {
  font-size: 16px;
  color: var(--texte-doux);
  margin-top: 6px;
  font-style: italic;
}
.scan-err { color: var(--rouge); }

/* ── CALENDRIER HISTORIQUE ──────────────────────────── */
.btn-historique {
  background: none;
  border: 2.5px solid #B0CFCA;
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  color: var(--texte-doux);
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-top: 4px;
}
.calendrier {
  background: white;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.08);
}
.calendrier-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.calendrier-titre {
  font-size: 18px;
  font-weight: 800;
  color: var(--texte);
  text-transform: capitalize;
}
.btn-cal-nav {
  background: var(--primaire-clair);
  border: none;
  border-radius: 10px;
  width: 48px;
  height: 48px;
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  color: var(--primaire);
  cursor: pointer;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.calendrier-grille {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-entete {
  font-size: 11px;
  font-weight: 800;
  color: var(--texte-doux);
  text-align: center;
  padding: 4px 0 6px;
  text-transform: uppercase;
}
.cal-jour {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  gap: 2px;
  padding: 2px;
}
.cal-jour.vide { cursor: default; }
.cal-numero { font-size: 14px; font-weight: 700; color: var(--texte); line-height: 1; }
.cal-jour.cal-futur .cal-numero { color: #C0C0C0; }
.cal-jour.cal-futur { cursor: default; }
.cal-jour.cal-aujourdhui { background: var(--primaire-clair); }
.cal-jour.cal-aujourdhui .cal-numero { color: var(--primaire); font-weight: 900; }
.cal-jour.cal-selectionne { background: var(--primaire) !important; }
.cal-jour.cal-selectionne .cal-numero { color: white !important; }
.cal-dots { display: flex; gap: 3px; justify-content: center; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-repas { background: var(--repas-couleur); }
.dot-glyc  { background: var(--glyc-couleur); }

.cal-legende {
  display: flex;
  gap: 18px;
  justify-content: center;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}
.cal-legende-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--texte-doux);
  font-weight: 600;
}
.cal-legende-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
}

.cal-detail {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 2px solid #EEF0F2;
}
.cal-detail-titre {
  font-size: 16px;
  font-weight: 800;
  color: var(--texte);
}
.cal-vide { font-size: 16px; color: var(--texte-doux); text-align: center; padding: 12px 0; }

/* ── HISTORIQUE CARTES ──────────────────────────────── */
.historique-carte {
  background: white;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(11,102,80,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.historique-entete {
  display: flex;
  align-items: center;
  gap: 12px;
}
.historique-icone { font-size: 24px; flex-shrink: 0; }
.historique-date { display: flex; flex-direction: column; }
.historique-jour { font-size: 15px; font-weight: 700; color: var(--texte); text-transform: capitalize; }
.historique-heure { font-size: 13px; color: var(--texte-doux); font-weight: 600; }
.historique-description {
  font-size: 16px;
  color: var(--texte-doux);
  font-style: italic;
  padding: 8px 12px;
  background: var(--primaire-clair);
  border-radius: 10px;
}
.historique-conseil { font-size: 16px; color: var(--texte); line-height: 1.5; }
.historique-photo {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 12px;
}

/* ── PARAMÈTRES ─────────────────────────────────────── */
.config-section {
  background: white;
  border-radius: 20px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.config-section-titre {
  font-size: 19px;
  font-weight: 800;
  color: var(--texte);
}
.config-section-sous {
  font-size: 16px;
  color: var(--texte-doux);
  margin-top: -6px;
}
.config-confirmation {
  text-align: center;
  color: var(--vert);
  font-size: 17px;
  font-weight: 700;
  padding: 10px;
}

.notif-statut {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
.notif-on   { background: #D4EDDA; color: #147A35; }
.notif-warn { background: #FFF8E1; color: #8B5E00; }
.notif-off  { background: #FDECEA; color: var(--rouge); }

/* ── MODE DÉVELOPPEUR ─────────────────────────────────── */
.config-dev {
  background: #FAFAFA;
  border: 1.5px dashed #C0C0C0;
}
.toggle-dev {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
}
.toggle-dev input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-dev-slider {
  display: inline-block;
  width: 52px;
  height: 30px;
  background: #CCC;
  border-radius: 15px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-dev-slider::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-dev input:checked + .toggle-dev-slider { background: var(--repas-couleur); }
.toggle-dev input:checked + .toggle-dev-slider::after { transform: translateX(22px); }
.toggle-dev-label { font-size: 16px; color: var(--texte); }

/* ── Senior Only ─────────────────────────────────────── */
.senior-only-bloc {
  margin-top: 16px;
  padding: 16px;
  background: #FFF8E8;
  border: 1.5px solid #F0C060;
  border-radius: 16px;
  margin-bottom: 16px;
}
.senior-only-titre {
  font-size: 15px;
  font-weight: 800;
  color: #8A6000;
  margin-bottom: 6px;
}
.senior-only-desc {
  font-size: 13px;
  color: #7A6020;
  margin: 0 0 12px;
  line-height: 1.4;
}
.toggle-senior {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.toggle-senior input { opacity: 0; width: 0; height: 0; position: absolute; pointer-events: none; }
.toggle-senior-slider {
  display: inline-block;
  width: 52px; height: 30px;
  background: #CCC;
  border-radius: 30px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-senior-slider::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 22px; height: 22px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-senior input:checked + .toggle-senior-slider { background: #E07820; }
.toggle-senior input:checked + .toggle-senior-slider::after { transform: translateX(22px); }
.toggle-senior-label { font-size: 15px; font-weight: 700; color: #8A6000; }

.btn-renew-session {
  display: block;
  width: 100%;
  background: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  margin-bottom: 12px;
}
.btn-renew-session:active { background: #E6F5ED; }

.btn-reinit-compte {
  display: block;
  width: 100%;
  background: #FFF4E5;
  border: 2px solid #E07800;
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  color: #E07800;
  cursor: pointer;
  text-align: center;
  margin-bottom: 12px;
}
.btn-reinit-compte:active { background: #FFE5C0; }

.btn-deconnexion {
  display: block;
  width: 100%;
  background: none;
  border: 2px solid var(--rouge);
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  color: var(--rouge);
  cursor: pointer;
  text-align: center;
}
.btn-deconnexion:active { background: #FDECEA; }

/* ── Tableau nutritionnel (Mode DEV) ─────────────────── */
.analyse-dev {
  margin-top: 14px;
  padding: 14px 16px;
  background: #FFF8E1;
  border: 1px dashed #D9A800;
  border-radius: 14px;
  font-size: 15px;
  color: var(--texte);
}
.analyse-dev-titre {
  font-size: 13px;
  font-weight: 800;
  color: #7A5A00;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.analyse-dev-plat { font-size: 16px; margin-bottom: 10px; }
.analyse-dev-portion { color: var(--texte-doux); font-weight: normal; font-size: 14px; }
.analyse-dev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.analyse-dev-table td { padding: 7px 4px; border-bottom: 1px solid #EFE0B0; }
.analyse-dev-table td:first-child { color: var(--texte-doux); }
.analyse-dev-table td:last-child { text-align: right; font-weight: 700; }
.analyse-dev-table tr.souligne-sucres td:first-child { padding-left: 16px; font-style: italic; }
.analyse-dev-table tr:last-child td { border-bottom: none; }
.analyse-dev-remarque {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  font-size: 14px;
  color: #6B4F00;
  line-height: 1.4;
}
.ig-badge, .ind-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.ig-bas        { background: #DCFCE7; color: #14532D; }
.ig-modere     { background: #FEF3C7; color: #78350F; }
.ig-eleve      { background: #FEE2E2; color: #7F1D1D; }
.ind-ok        { background: #DCFCE7; color: #14532D; }
.ind-attention { background: #FEF3C7; color: #78350F; }
.ind-eviter    { background: #FEE2E2; color: #7F1D1D; }

/* ── BLOCAGE ORIENTATION PAYSAGE ── */
@media (orientation: landscape) and (max-height: 600px) {
  body::before {
    content: "↩ Veuillez tourner votre téléphone en mode portrait.";
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F4F6F5;
    color: #1E1E1E;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    padding: 32px;
    line-height: 1.5;
  }
  #app, .ecran { visibility: hidden; }
}

/* (couleurs heure déplacées en fin de fichier pour priorité maximale) */

/* ── CARTE BIEN-ÊTRE ─────────────────────────────────── */
.carte-bienetre {
  margin: -12px 16px 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 24px;
  padding: 20px 20px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  text-align: center;
  opacity: 0;
  transform: translateY(-12px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.carte-bienetre.bienetre-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.bienetre-emoji {
  display: block;
  font-size: 36px;
  margin-bottom: 8px;
  line-height: 1;
}
.bienetre-question {
  font-size: 17px;
  font-weight: 700;
  color: var(--texte);
  line-height: 1.4;
  margin-bottom: 16px;
}
.bienetre-btns {
  display: flex;
  gap: 28px;
  justify-content: center;
}
.bienetre-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  font-size: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
}
.bienetre-btn:active { transform: scale(0.88); }
.bienetre-oui { background: #E8F8EE; }
.bienetre-non { background: #FEF0F0; }
.bienetre-merci {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 0 4px;
  line-height: 1.4;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── MODE NUIT SYSTÈME (prefers-color-scheme: dark) ── */
@media (prefers-color-scheme: dark) {
  :root {
    --fond:          #191E1C;
    --carte:         #222C28;
    --blanc:         #253028;
    --texte:         #EDF2EF;
    --texte-doux:    #8FA89F;
    --accent-clair:  #222C28;
    --primaire-clair:#222C28;
    --sos-clair:     #3A1E1E;
    --gris-clair:    #191E1C;
    --repas-clair:   #2D2412;
    --meds-clair:    #1A2138;
    --glyc-clair:    #281C3C;
  }
  html, body { background: var(--fond); }
  .ecran { background: var(--fond); }
  .entete {
    background: linear-gradient(160deg, #3A6B55 0%, #2C5042 100%);
  }
  .btn-principal {
    background: var(--blanc);
    box-shadow: 0 2px 16px rgba(0,0,0,0.32);
    color: var(--texte);
  }
  .btn-urgence-home { background: var(--sos-clair); }
  .config-section, .conseil-card, .historique-carte,
  .calendrier, .proche-info, .texte-reconnu,
  .glycemie-input-zone, .scan-resultat {
    background: var(--blanc);
    border-color: #354540;
    color: var(--texte);
  }
  .champ-input, .champ-code {
    background: var(--blanc);
    color: var(--texte);
    border-color: #354540;
  }
  .btn-appel { background: #1E2A25; }
  .btn-appel.non-configure { opacity: 0.3; }
  .btn-frequence, .btn-jour, .btn-periode { background: var(--blanc); border-color: #354540; }
  .btn-frequence, .btn-jour { color: var(--texte-doux); }
  .med-carte.matin .med-carte-corps { background: #2D2412; }
  .med-carte.midi  .med-carte-corps { background: #1A2138; }
  .med-carte.soir  .med-carte-corps { background: #281C3C; }
  .med-carte.nuit  .med-carte-corps { background: #1E2340; }
  .med-carte-header { opacity: 0.9; }
  .glycemie-reference { background: #222C28; }
  .calendrier { background: var(--blanc); }
  .cal-numero { color: var(--texte); }
  .analyse-dev { background: #2D2412; border-color: #8B6800; }
  .dev-code-affiche { background: #2D2412; border-color: #8B6800; color: #E8C84A; }
}

/* ── MODE NUIT INTELLIGENT (heure : 21h–6h) ──────── */
body.mode-nuit-heure .entete {
  background: linear-gradient(160deg, #2D5040 0%, #1E3A2C 100%);
}
body.mode-nuit-heure {
  filter: brightness(0.96);
}

/* ── RAPPORT ADMIN ───────────────────────────────────── */
.rapport-tabs {
  display: flex;
  gap: 0;
  background: var(--fond);
  border-bottom: 2px solid #E0E8E4;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.rapport-tab {
  flex: 1;
  padding: 14px 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--texte-doux);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.rapport-tab.actif {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.rapport-corps-wrap {
  overflow-x: auto;
  padding: 16px 12px 32px;
}
.rapport-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 420px;
}
.rapport-table thead tr {
  background: var(--accent);
  color: white;
}
.rapport-table th {
  padding: 10px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}
.rapport-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #EEF2F0;
  vertical-align: top;
  white-space: nowrap;
}
.rapport-table .rapport-td-long {
  white-space: normal;
  max-width: 180px;
  word-break: break-word;
}
.rapport-table tbody tr:nth-child(even) { background: #F8FBF9; }
.rapport-table tbody tr:hover { background: #EEF7F2; }
.rapport-vide {
  text-align: center;
  color: var(--texte-doux);
  font-size: 16px;
  padding: 40px 20px;
}

/* ── Toggle label (insuline) ──────────────────────────── */
.champ-toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--texte);
  cursor: pointer;
  padding: 4px 0;
}
.champ-toggle-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ── Modal unités insuline ─────────────────────────────── */
.modal-insuline-fond {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-insuline-boite {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.modal-insuline-icone { font-size: 48px; margin-bottom: 8px; }
.modal-insuline-titre { font-size: 22px; font-weight: 800; color: var(--texte); margin-bottom: 6px; }
.modal-insuline-sous  { font-size: 16px; color: var(--texte-doux); margin-bottom: 20px; }
.modal-insuline-boite .champ-input { text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 16px; }
.modal-insuline-boite .btn-confirmer { margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════════
   COULEURS DU HEADER SELON L'HEURE
   Placé en dernier pour toujours gagner sur dark mode etc.
   ═══════════════════════════════════════════════════════ */

/* 🌑 Nuit       21h – 5h  : forêt nocturne */
body.heure-nuit       .entete { background: linear-gradient(160deg, #2D5040 0%, #1E3A2C 100%) !important; }

/* 🌅 Aube        5h – 8h  : pêche-abricot */
body.heure-aube       .entete { background: linear-gradient(160deg, #F2A070 0%, #E07858 100%) !important; }

/* ☀️ Matin       8h – 12h : bleu ciel doux */
body.heure-matin      .entete { background: linear-gradient(160deg, #5A9EC8 0%, #3D7EB0 100%) !important; }

/* 🌿 Midi       12h – 14h : vert émeraude */
body.heure-midi       .entete { background: linear-gradient(160deg, #4F8A6D 0%, #3A6B55 100%) !important; }

/* 🌤 Après-midi 14h – 18h : bleu-indigo pastel */
body.heure-aprem      .entete { background: linear-gradient(160deg, #5870C8 0%, #4058B0 100%) !important; }

/* 🍂 Soir       18h – 20h : ambre chaud */
body.heure-soir       .entete { background: linear-gradient(160deg, #C87848 0%, #A85E30 100%) !important; }

/* 🌆 Crépuscule 20h – 21h : lavande douce */
body.heure-crepuscule .entete { background: linear-gradient(160deg, #8A74C4 0%, #6A58A8 100%) !important; }

/* ── Splash vocal ────────────────────────────────────── */
#splash-vocal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #4F8A6D 0%, #2D5A42 100%);
  transition: opacity 0.4s ease;
}
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.splash-logo {
  width: 90px;
  height: 90px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.2));
}
.splash-titre {
  font-size: 36px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
}
.splash-sous {
  font-size: 20px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}
.splash-tap {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  animation: splash-pulse 2s ease-in-out infinite;
}
.splash-tap-point {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  animation: splash-pulse 2s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.15); }
}

/* ── MODALE CONFIRMATION 112 ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-112-boite {
  background: white;
  border-radius: 28px;
  padding: 32px 24px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modal-entree 0.25s ease;
}
@keyframes modal-entree {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-112-icone {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
}
.modal-112-titre {
  font-size: 26px;
  font-weight: 900;
  color: #CC1F1F;
  margin: 0 0 10px;
}
.modal-112-texte {
  font-size: 17px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 28px;
}
.modal-112-boutons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-btn-oui {
  background: #CC1F1F;
  color: white;
  border: none;
  border-radius: 18px;
  padding: 20px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(204,31,31,0.4);
  transition: transform 0.1s;
}
.modal-btn-oui:active { transform: scale(0.97); }
.modal-btn-non {
  background: #f0f0f0;
  color: #555;
  border: none;
  border-radius: 18px;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-btn-non:active { background: #e0e0e0; }

/* ── PIN AIDANT ──────────────────────────────────────── */
.pin-boite {
  background: white;
  border-radius: 28px;
  padding: 32px 24px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modal-entree 0.22s ease;
}
.pin-titre {
  font-size: 22px;
  font-weight: 900;
  color: var(--texte);
  margin-bottom: 6px;
}
.pin-sous {
  font-size: 15px;
  color: var(--texte-doux);
  margin-bottom: 24px;
}
.pin-points {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}
.pin-point {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: transparent;
  transition: background 0.15s, transform 0.1s;
}
.pin-point.rempli {
  background: var(--accent);
  transform: scale(1.1);
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.pin-touche {
  background: #F4F6F5;
  border: none;
  border-radius: 16px;
  font-size: 26px;
  font-weight: 700;
  color: var(--texte);
  padding: 18px 10px;
  min-height: 64px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s, transform 0.08s;
}
.pin-touche:active { background: #DDE4E0; transform: scale(0.94); }
.pin-eff  { font-size: 22px; color: var(--texte-doux); }
.pin-ann  { font-size: 18px; color: var(--rouge); background: #FDF1F1; }
.pin-ann:active { background: #f5d5d5; }

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-8px); }
  80%       { transform: translateX(8px); }
}
.pin-boite.pin-erreur { animation: pin-shake 0.5s ease; }

/* ── BOUTON DEV ACCÈS ────────────────────────────────── */
.btn-dev-acces {
  background: #F0F0F0;
  color: #555;
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.btn-dev-acces:active { background: #E0E0E0; }

/* ── ONBOARDING ──────────────────────────────────────── */
#ecran-onboarding {
  background: linear-gradient(160deg, #4F8A6D 0%, #3A6B55 100%);
  display: none;
  flex-direction: column;
}
#ecran-onboarding.actif { display: flex; }

.ob-header {
  padding: 52px 24px 24px;
  text-align: center;
  color: white;
  flex-shrink: 0;
}
.ob-logo { font-size: 48px; margin-bottom: 10px; }
.ob-titre {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}
.ob-progress-bar {
  background: rgba(255,255,255,0.25);
  border-radius: 99px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ob-progress-fill {
  height: 100%;
  background: white;
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}
.ob-etape-label {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
}

/* ob-contenu : fond blanc arrondi, PAS de overflow propre → c'est le .ecran qui scrolle */
.ob-contenu {
  background: var(--fond);
  border-radius: 28px 28px 0 0;
  padding: 28px 20px 48px;
}

/* Les étapes s'affichent en bloc simple, hauteur naturelle */
.ob-etape { display: none; flex-direction: column; gap: 16px; }
.ob-etape.actif { display: flex; animation: modal-entree 0.25s ease; }

/* Icône, titre, texte directement dans l'étape (sans carte wrapper) */
.ob-card-icone {
  font-size: 52px;
  text-align: center;
  display: block;
}
.ob-card-titre {
  font-size: 24px;
  font-weight: 900;
  color: var(--texte);
  text-align: center;
}
.ob-card-texte {
  font-size: 17px;
  color: var(--texte-doux);
  line-height: 1.65;
  text-align: center;
}
.ob-card-note {
  font-size: 14px;
  color: #D97706;
  font-weight: 600;
  text-align: center;
}

/* Bouton retour dans le header */
.ob-btn-retour {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 12px;
  align-self: flex-start;
}

.ob-btn-suivant {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 18px;
  padding: 20px;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s;
  box-shadow: 0 4px 16px rgba(79,138,109,0.35);
  margin-top: 8px;
}
.ob-btn-suivant:active { transform: scale(0.97); }

.ob-btn-passer {
  background: none;
  border: none;
  color: var(--texte-doux);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px;
  width: 100%;
  text-align: center;
}
.ob-btn-passer:active { opacity: 0.6; }
