/* === DESIGN SYSTEM TOKENS === */
:root {
  /* Categorical */
  --c-biberon: #FFE05C;
  --c-eau: #7CB9D8;
  --c-change: #9BCFB2;
  --c-sieste: #3D5A6C;
  --c-repas: #D85C8E;
  --c-medic: #D58FA8;
  --c-temp: #F29B88;
  --c-humeur: #B6A8DC;
  --c-activite: #EEA05C;
  --c-photo: #6FBEB8;
  --c-vomi: #C97D6D;
  --c-anomalie: #D58FA8;

  /* Mood adaptive (default = Calme) */
  --bg: #F4EBD9;
  --bg-tint: #FBF3E4;
  --accent: #6B9E8F;
  --caveat: #6B9E8F;

  /* Neutrals */
  --paper: #FBF3E4;
  --card: #FFFFFF;
  --text: #3D5A6C;
  --text-2: rgba(61,90,108,.7);
  --muted: rgba(61,90,108,.5);
  --divider: rgba(61,90,108,.08);
  --stroke: rgba(61,90,108,.18);

  /* Alerts */
  --critical: #B85450;
  --success: #6B9E8F;
  --warning: #D9A85C;
}

/* Mood variations */
body[data-mood="joyeux"] { --bg: #FBF3DC; --bg-tint: #FFF6D9; --accent: #FFD166; --caveat: #FF8C5A; }
body[data-mood="difficile"] { --bg: #F2E4E1; --bg-tint: #F9EBE6; --accent: #E88DA6; --caveat: #B85450; }
body[data-mood="nuit"] {
  --bg: #1A2433; --bg-tint: #222D3F; --accent: #D9A85C; --caveat: #D9A85C;
  --paper: #1A2433; --card: #27334A;
  --text: #F4EBD9; --text-2: rgba(244,235,217,.65); --muted: rgba(244,235,217,.45);
  --divider: rgba(244,235,217,.10); --stroke: rgba(244,235,217,.18);
}

/* === RESET === */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
/* iOS : les inputs time/date gardent une largeur intrinsèque native qui ignore
   width:100% et débordent à droite. On neutralise l'apparence native + min-width.
   On leur donne aussi un VRAI look de champ (bordure/fond/texte lisible) : sinon,
   après appearance:none, ils paraissent vides et la valeur hérite d'une couleur
   estompée → on ne sait pas où cliquer (signalé sur iPhone). */
input[type="time"],input[type="date"] {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%;
  background: var(--bg-tint);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px; /* >=16px : évite le zoom auto au focus sur iOS */
}
/* iOS Safari : les inputs texte/number/textarea ont une largeur intrinsèque native
   qui dépasse leur conteneur (débordement à droite signalé sur plusieurs formulaires).
   On neutralise l'apparence native + on borne la largeur. (Look : bordure/fond/padding
   viennent des classes existantes type .ob-field — on ne les redéfinit pas ici.) */
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], input[type="url"], input:not([type]), textarea {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%;
}
html,body { height: 100%; overflow-x: hidden; overscroll-behavior: none; max-width: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--text);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease;
}
input,button,textarea,select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

.serif { font-family: 'Fraunces', serif; font-weight: 700; }
.caveat { font-family: 'Caveat', cursive; font-size-adjust: 0.52; font-weight: 700; color: var(--caveat); }

/* Preview banner */
#preview-banner {
  background: linear-gradient(90deg, var(--c-repas), var(--c-medic));
  color: #FBF3E4;
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}
#preview-banner a { text-decoration: underline; opacity: .9; }

/* App container */
#app { min-height: calc(100vh - 36px); }

/* === LOGIN VIEW === */
.login-screen {
  min-height: calc(100vh - 36px);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: 28px;
  padding: 40px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 30px rgba(0,0,0,.06);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo .logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  overflow: hidden;
  display: block;
  box-shadow: 0 2px 7px rgba(61,90,108,.14);
  border: 1px solid rgba(61,90,108,.06);
}
.login-logo .logo svg { width: 100%; height: 100%; display: block; }
/* --- Login redesign : email d'abord, social, biométrie --- */
.login-sep {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12.5px; font-weight: 700; margin: 16px 0;
}
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--divider); }
.login-social { display: flex; flex-direction: column; gap: 10px; }
.btn-social {
  border-radius: 999px; padding: 14px 18px; font-size: 15px; font-weight: 700;
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid transparent; cursor: pointer;
}
.btn-social svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-social.apple { background: #111820; color: #fff; }
.btn-social.google { background: #fff; color: #3c4043; border-color: var(--stroke); }
.btn-biometric {
  margin-top: 10px; background: var(--bg-tint); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 999px; padding: 14px 18px;
  font-size: 15px; font-weight: 700; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer;
}
.btn-biometric svg { width: 19px; height: 19px; flex: 0 0 auto; }
.login-emailchip {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-tint); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 11px 15px; margin-bottom: 16px;
}
.login-emailchip .em { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.login-emailchip .em .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #FBF3E4; display: grid; place-items: center; font-size: 12px; flex: 0 0 auto; }
.login-emailchip .edit { font-size: 12.5px; font-weight: 800; color: var(--accent); flex: 0 0 auto; }
.login-micro { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; margin-top: 16px; }
.login-logo .name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 26px;
}
.login-eyebrow {
  font-family: 'Caveat', cursive; font-size-adjust: 0.52;
  font-weight: 700;
  font-size: 22px;
  color: var(--caveat);
  margin-bottom: 6px;
}
.login-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.2;
  margin-bottom: 22px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--bg-tint);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #FBF3E4;
  padding: 16px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
  transition: transform .1s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(107,158,143,.3); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  color: var(--text);
  padding: 14px 24px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  font-weight: 600;
  font-size: 15px;
  width: 100%;
}
.login-error {
  color: var(--critical);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
}
.login-foot a { color: var(--caveat); font-weight: 600; }
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--divider);
}

/* === SHELL APP (post-login) === */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.shell-header {
  /* + safe-area : sinon la barre Simple/Pro passe sous l'encoche/Dynamic Island iPhone */
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
}
.role-switch {
  display: flex;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 4px;
}
.role-switch button {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  color: var(--text-2);
  transition: background .2s;
}
.role-switch button.active {
  background: var(--accent);
  color: #FBF3E4;
}
.shell-header .spacer { flex: 1; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--c-repas);
  color: #FBF3E4;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: transform .15s;
}
.avatar:hover { transform: scale(1.05); }
.moment-toggle {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  margin-inline-end: 4px;
}

.header-chat {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--stroke);
  font-size: 18px;
  cursor: pointer;
  margin-inline-end: 4px;
}
.header-chat:hover { transform: scale(1.05); }
.header-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--critical, #c0584f);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.shell-main { flex: 1; padding: 16px 20px 100px; overflow-y: auto; }

/* === BOUSSOLE MATIN === */
.mood-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tint);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
/* Chip d'identité du bébé courant (accueil) — savoir QUEL bébé on consulte */
.baby-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-tint, var(--bg-tint));
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  margin: 0 8px 12px 0;
  cursor: default;
  -webkit-appearance: none;
  max-width: 100%;
}
.baby-chip[data-goto-tab], .baby-chip[data-open-babyswitch] { cursor: pointer; }
/* Chip nounou cliquable (changer de bébé) */
.mood-chip--switch { border: none; cursor: pointer; -webkit-appearance: none; font-family: inherit; }
/* Sélecteur d'enfant dans le header (nounou) — à la place de l'ancien Simple/Avancé */
.hdr-baby {
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--stroke);
  font-size: 13px; font-weight: 800; color: var(--text);
  white-space: nowrap; cursor: pointer; -webkit-appearance: none; font-family: inherit;
  max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
}
/* Sélecteur rapide de bébé (sheet) */
.baby-switch-list { display: flex; flex-direction: column; gap: 8px; }
.baby-switch-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1.5px solid var(--stroke); border-radius: 16px;
  padding: 14px 16px; font-size: 16px; font-weight: 700; color: var(--text);
  cursor: pointer; -webkit-appearance: none; text-align: start;
}
.baby-switch-row.is-current { border-color: var(--accent); background: var(--bg-tint); }
.baby-switch-row .emoji { font-size: 22px; }
.baby-switch-row .lbl { flex: 1; }
.baby-switch-row .baby-switch-cur { color: var(--accent); font-weight: 800; }
/* Bandeau masquerade (admin « connecté à la place de ») */
.masq-banner { display: flex; align-items: center; gap: 10px; background: #3D5A6C; color: #FBF3E4; font-size: 13px; font-weight: 700; padding: 8px 16px; }
.masq-banner button { margin-inline-start: auto; background: rgba(255,255,255,.2); color: #fff; border: none; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 13px; cursor: pointer; -webkit-appearance: none; }
/* Admin — lignes utilisateurs */
.admin-user { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.admin-user:last-child { border-bottom: 0; }
.admin-user.is-off { opacity: .55; }
.admin-user-ava { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--c-repas); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 14.5px; font-weight: 700; color: var(--text); }
.admin-off-tag { font-size: 11px; font-weight: 700; color: var(--critical); background: rgba(0,0,0,.05); border-radius: 6px; padding: 1px 6px; }
.admin-user-meta { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.admin-act { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--card); font-size: 16px; cursor: pointer; -webkit-appearance: none; }
.admin-act.off { color: var(--critical); }
.admin-act.on { color: var(--accent); }
/* Récap "nuit enregistrée" sur l'accueil Matin */
.night-recap {
  background: var(--bg-tint);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.baby-chip .baby-chip__name { white-space: nowrap; }
.baby-chip .baby-chip__age { font-weight: 600; opacity: 0.8; }
.baby-chip .baby-chip__switch { font-weight: 600; opacity: 0.7; font-size: 13px; }
/* Bandeau "sieste en cours" (accueil parent + nounou) — tap pour terminer */
.nap-ongoing {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--c-sieste, #3D5A6C); color: #FBF3E4;
  border: none; border-radius: 16px; padding: 12px 16px; margin: 0 0 12px;
  cursor: pointer; text-align: start; -webkit-appearance: none;
  box-shadow: 0 3px 12px rgba(61,90,108,.28);
}
.nap-ongoing__ic { font-size: 24px; line-height: 1; }
.nap-ongoing__txt { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.nap-ongoing__txt strong { font-size: 15px; font-weight: 800; }
.nap-ongoing__since { font-size: 13px; opacity: .85; }
.nap-ongoing__end {
  flex: 0 0 auto; font-weight: 800; font-size: 14px;
  background: rgba(255,255,255,.18); padding: 8px 14px; border-radius: 999px;
}
.greeting {
  font-family: 'Caveat', cursive; font-size-adjust: 0.52;
  font-weight: 700;
  font-size: 22px;
  color: var(--caveat);
  margin-bottom: 4px;
}
.question {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 20px;
}

.btn-big-primary {
  background: var(--accent);
  color: #FBF3E4;
  padding: 18px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
  margin-bottom: 12px;
  transition: transform .1s, box-shadow .15s;
}
.btn-big-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }

/* Bannière "Transmission du soir" en haut de l'accueil nounou (le soir / une fois envoyée) */
.evening-cta {
  display: block;
  width: 100%;
  text-align: center;
  padding: 15px 20px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
}
.evening-cta.go {
  background: var(--accent);
  color: #FBF3E4;
  box-shadow: 0 6px 18px rgba(107,158,143,.28);
  animation: eveningPulse 2.6s ease-in-out infinite;
}
.evening-cta.go:hover { transform: translateY(-1px); }
.evening-cta.sent {
  background: #E9F3EE;
  color: #3E7A63;
  border: 1px solid #C5E2D4;
}
@keyframes eveningPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(107,158,143,.28); }
  50% { box-shadow: 0 6px 24px rgba(107,158,143,.45); }
}
.btn-big-secondary {
  background: var(--card);
  color: var(--text);
  padding: 16px 24px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  margin-bottom: 20px;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.macro {
  text-align: center;
  padding: 14px 6px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: transform .1s;
}
.macro:hover { transform: scale(0.97); }
.macro .emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.macro.bib { background: var(--c-biberon); }
.macro.eau { background: var(--c-eau); }
.macro.change { background: var(--c-change); }
.macro.sieste { background: var(--c-sieste); color: #FBF3E4; }
.macro.repas { background: var(--c-repas); color: #FBF3E4; }
.macro.medic { background: var(--c-medic); color: #FBF3E4; }
.macro.temp { background: var(--c-temp); }
.macro.humeur { background: var(--c-humeur); }
.macro.activite { background: var(--c-activite); }
.macro.photo { background: var(--c-photo); }
.macro.vomi { background: var(--c-vomi); color: #FBF3E4; }

/* Cards */
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.card-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

/* Pro grid */
.pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.pro-stat {
  background: var(--card);
  padding: 16px;
  border-radius: 18px;
}
.pro-stat .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.pro-stat .value {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 22px;
}
.pro-stat .sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

/* === P03 — Boussole matin Pro (Détails) === */
.md-back {
  background: none;
  border: 0;
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  margin: -4px 0 8px -8px;
  line-height: 1;
}
.md-card {
  border-radius: 22px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--card);
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.md-card-bib    { background: #FFF6D6; }
.md-card-change { background: #DCEEE2; }
.md-card-soins  { background: var(--card); }
.md-card-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 10px;
}
.md-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}
.md-row .md-time { font-weight: 700; min-width: 52px; }
.md-row .md-val  { font-weight: 600; }
.md-row .md-sub  { color: var(--text-2); font-size: 12px; margin-inline-start: auto; }
.md-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.md-dot.dot-bib    { background: var(--c-biberon); }
.md-dot.dot-change { background: var(--c-change); }
.md-empty {
  color: var(--text-2);
  font-size: 13px;
  padding: 4px 0 8px;
}
.md-add {
  width: 100%;
  background: var(--card);
  border: 1px dashed rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  margin-top: 8px;
}
.md-card-bib    .md-add { color: #B89500; border-color: rgba(184,149,0,.3); }
.md-card-change .md-add { color: #4D8B66; border-color: rgba(77,139,102,.3); }
.soins-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.soin-pill {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.soin-pill.on {
  background: var(--accent);
  color: #FBF3E4;
  border-color: var(--accent);
}
.soin-pill .soin-check { font-size: 12px; }
.md-note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  padding: 4px 6px 4px 14px;
  margin: 14px 0 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.md-note {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 10px 0;
  outline: none;
  color: var(--text);
}
.md-mic {
  background: none;
  border: 0;
  font-size: 18px;
  padding: 6px 8px;
  cursor: pointer;
}
.md-save {
  background: var(--accent);
  color: #FBF3E4;
  border: 0;
  border-radius: 999px;
  width: 100%;
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 90px;
  cursor: pointer;
}
.md-save:hover { opacity: 0.92; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding: 10px 8px 28px;
  gap: 2px;
}
.nav-tab .icon { font-size: 22px; }
.nav-tab .label { font-size: 10px; font-weight: 700; }
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
}
.nav-tab.active { color: var(--accent); }
.nav-tab .icon { font-size: 22px; display: inline-flex; align-items: center; justify-content: center; height: 24px; }
.nav-tab .icon svg { width: 24px; height: 24px; }
.nav-tab .label { font-size: 11px; font-weight: 700; }
.nav-fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #FBF3E4;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Caveat', cursive; font-size-adjust: 0.52;
  font-weight: 700;
  font-size: 22px;
  color: var(--caveat);
}

/* Mood selector (debug for preview) */
.mood-selector {
  position: fixed;
  bottom: 100px;
  inset-inline-end: 16px;
  background: var(--card);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  display: flex;
  gap: 4px;
  z-index: 50;
  font-size: 10px;
}
.mood-selector button {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
}
.mood-selector button.active { background: var(--accent); color: #FBF3E4; }

/* Coming soon placeholder */
.coming-soon {
  padding: 60px 20px;
  text-align: center;
}
.coming-soon h2 {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin-bottom: 8px;
}
.coming-soon p {
  color: var(--text-2);
  font-size: 15px;
}
/* Journal — vue synthétique (mode Simple) */
.journal-synth { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.synth-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--stroke); border-radius: 16px; padding: 14px 16px; font-size: 15.5px; font-weight: 700; color: var(--text); }
.synth-ic { font-size: 22px; line-height: 1; }
/* Repas — tuiles-icônes (pictos universels) */
.repas-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.repas-tile { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--stroke); cursor: pointer; -webkit-appearance: none; }
.repas-tile-ic { font-size: 26px; line-height: 1; }
.repas-tile-lbl { font-size: 10.5px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.15; }
.repas-tile.active { background: var(--accent); border-color: var(--accent); }
.repas-tile.active .repas-tile-lbl { color: #fff; }
.repas-tile.other { border-style: dashed; background: var(--bg-tint); }
.repas-tile.other .repas-tile-lbl { color: var(--text-2); }
/* Feedback (Donner mon avis) */
.fb-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-cat { flex: 1; min-width: 90px; padding: 10px 8px; border-radius: 12px; border: 1.5px solid var(--stroke); background: var(--card); font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; -webkit-appearance: none; }
.fb-cat.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Stats — vue Simple : grandes cartes visuelles (mode parent Simple) */
.stat-simple-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-simple-card {
  background: var(--card); border: 1.5px solid var(--stroke); border-radius: 20px;
  padding: 18px 16px; text-align: center;
}
.stat-simple-card .ssc-emoji { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.stat-simple-card .ssc-big { font-family: Georgia, 'Times New Roman', serif; font-size: 28px; font-weight: 700; color: var(--text-1); line-height: 1.1; }
.stat-simple-card .ssc-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* Chat — sélecteur de réaction multi-emoji (ouvert au clic sur 🤍) */
.chat-react-pick { display: flex; gap: 4px; margin-top: 4px; background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; padding: 4px 6px; width: fit-content; box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.chat-msg.me .chat-react-pick { margin-inline-start: auto; }
.chat-react-emoji { background: none; border: 0; font-size: 20px; line-height: 1; padding: 4px; border-radius: 50%; cursor: pointer; -webkit-appearance: none; }
.chat-react-emoji:active { transform: scale(1.2); }
/* Chat — bannière « soin détecté → enregistrer dans le rapport » (repris V1) */
.chat-care-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 2px 0 12px; padding: 8px 12px;
  background: var(--bg-tint); border: 1px solid var(--stroke); border-radius: 14px;
}
.chat-care-banner .ccb-txt { font-size: 13px; font-weight: 600; color: var(--text-2); }
.chat-care-save {
  background: var(--accent); color: #FBF3E4; border: none; -webkit-appearance: none;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}
.chat-care-save:disabled { opacity: .6; }
/* Chat — bouton « haut de la conversation » */
.chat-to-top { position: absolute; top: 64px; right: 12px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--stroke); background: var(--card); color: var(--text-2); font-size: 15px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); opacity: .85; -webkit-appearance: none; }

/* Chat — bouton micro en enregistrement (pulse rouge) + icône note vocale dans la bulle */
.chat-mic.recording { background: #E8574A !important; color: #fff; animation: bd-rec-pulse 1s ease-in-out infinite; }
@keyframes bd-rec-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(232,87,74,.5); } 50% { box-shadow: 0 0 0 8px rgba(232,87,74,0); } }
.bubble-voice-ic { font-size: 16px; margin-inline-end: 4px; vertical-align: middle; }

/* ============================================================
   iPad / grand écran — vraie mise en page tablette
   Cible STRICTE tablette (largeur ET hauteur ≥), pour ne pas
   toucher les téléphones en paysage.
   • Canvas profond + surface app claire, cadrée, posée.
   • La barre du bas devient un RAIL de navigation vertical à
     gauche (via grid sur .shell, sans toucher le DOM).
   • Contenu : colonne confortable centrée (pas étirée) ;
     l'accueil passe à 2 colonnes en grand format (cf 2e bloc).
   ============================================================ */
@media (min-width: 744px) and (min-height: 600px) {
  /* Canvas un cran plus profond que la surface (fallback solide
     si color-mix non supporté → var(--bg)). */
  body {
    background: var(--bg);
    background: radial-gradient(125% 75% at 50% -8%,
      color-mix(in srgb, var(--bg) 85%, #fff 15%) 0%,
      var(--bg) 45%,
      color-mix(in srgb, var(--bg) 90%, #000 10%) 100%);
    background-attachment: fixed;
  }

  /* La surface : large, centrée, posée — grille [rail | contenu]. */
  .shell {
    max-width: 1024px;
    /* Borné à la hauteur écran : le rail (grid-row 1/3) reste fixe et c'est
       .shell-main qui scrolle en interne. Sans ce cap, un contenu long
       (messagerie) fait scroller toute la surface → le rail disparaît. */
    height: 100dvh;
    overflow: hidden;
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--divider), 0 24px 70px -30px rgba(31,41,51,.32);
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .masq-banner { grid-column: 1 / -1; }
  .shell-header { grid-column: 2; grid-row: 1; background: var(--paper); }
  /* Contenu : colonne lisible ~640 px CENTRÉE dans la cellule via un
     padding latéral fluide (fiable, contrairement à justify-self en grille).
     L'accueil passe pleine largeur + 2 colonnes au 2e bloc (≥ 900px). */
  .shell-main {
    grid-column: 2; grid-row: 2;
    min-height: 0;               /* sinon le scroll en grille est cassé */
    padding: 22px max(30px, calc((100% - 640px) / 2)) 32px;
  }

  /* Barre du bas → rail vertical à gauche. */
  .bottom-nav {
    grid-column: 1; grid-row: 1 / 3;
    position: static; width: auto; max-width: none; margin: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 6px;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 8px 16px;
    border-top: none; border-inline-end: 1px solid var(--divider);
  }
  .bottom-nav .nav-tab {
    flex-direction: column; gap: 4px;
    padding: 11px 4px; border-radius: 14px;
    transition: background .15s;
  }
  .bottom-nav .nav-tab.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .bottom-nav .nav-fab { order: 0; margin: 6px auto 12px; }

  /* Messagerie : en mobile l'input est fixé au-dessus de la barre du bas.
     Ici la barre est un rail à gauche, donc ce calage (fixed, bottom:70px,
     480px centré) tombe à côté. On en refait un pied COLLANT en bas de la
     colonne, dans .shell-main qui scrolle → il suit sans emporter le rail.
     Sélecteur scopé sous .shell-main pour battre la base `.chat-footer`
     de views.css (chargé après app.css → gagnerait à spécificité égale). */
  .shell-main .chat-footer {
    position: sticky;
    bottom: 0;
    left: auto; right: auto;
    max-width: none;
    margin: 0;
    padding-inline: 0;
  }
  .shell-main .chat-stream { padding-bottom: 12px; }  /* plus besoin de réserver 120px */

  /* Login : carte un peu plus présente sur grand écran. */
  .login-card { box-shadow: 0 26px 64px -30px rgba(31,41,51,.30); }
}

/* ============================================================
   Dashboard iPad PAYSAGE — « console de garde » (accueil matin)
   AGIR (gauche) = l'accueil actuel ; SUIVRE (droite) = journal + tendances.
   Hors paysage iPad : .dash-suivre masqué + .dash-agir en display:contents
   → rendu STRICTEMENT identique à avant (iPhone / iPad portrait).
   ============================================================ */
.dash-suivre { display: none; }
.dash-agir { display: contents; }   /* aucun effet de layout hors grille */

@media (min-width: 1024px) and (min-height: 600px) and (orientation: landscape) {
  .shell { max-width: 1180px; }
  .shell-main[data-view="home"]:has(.dash-suivre) {
    display: grid;
    grid-template-columns: minmax(0, 40fr) minmax(0, 60fr);
    gap: 28px; align-items: start;
    padding: 22px 30px 32px;          /* annule le centrage 640px du bloc iPad */
  }
  .shell-main[data-view="home"]:has(.dash-suivre) .dash-agir { display: block; }
  .shell-main[data-view="home"]:has(.dash-suivre) .dash-suivre { display: flex; flex-direction: column; gap: 16px; }
  /* Bannières (démo / offline / erreur save) = enfants directs de .shell-main →
     les forcer en pleine largeur pour ne pas casser la grille 2 zones. */
  .shell-main[data-view="home"]:has(.dash-suivre) > :not(.dash-agir):not(.dash-suivre) { grid-column: 1 / -1; }

  .dash-card { background: var(--paper); border: 1px solid var(--divider); border-radius: 18px; padding: 16px 18px; }
  .dash-card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .dash-card-h h3 { font-family: 'Fraunces', serif; font-size: 18px; margin: 0; }
  .dash-link { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; }
  .dash-journal-list .journal-event { padding: 7px 0; }
  .dash-empty { color: var(--muted); font-size: 14px; padding: 10px 2px; }
  /* Cartes de totaux du jour (mode Simple) — cartes blanches façon iPhone. */
  .dash-totals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .dash-total { background: var(--card); border: 1px solid var(--divider); border-radius: 16px; padding: 16px; }
  .dash-total-k { font-size: 13px; font-weight: 700; color: var(--text-2); }
  .dash-total-v { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; margin-top: 4px; line-height: 1; }
  .dash-total-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; min-height: 1em; }
}
