:root {
  --bg: #EEF2EF;
  --card: #FFFFFF;
  --elev: #F3F6F4;
  --soft: #E4EAE7;
  --border: #C9D5D1;
  --border-soft: #DCE4E1;
  --nuit: #0E2A2F;
  --nuit-2: #1D4A50;
  --accent: #8C6D35;
  --accent-strong: #6E5428;
  --accent-soft: #F3ECDF;
  --fg: #0E2A2F;
  --fg-dim: #5B6E6D;
  --fg-muted: #4A5F5E;
  --success: #2F6B4F;
  --warn: #8A5A12;
  --warn-soft: #F6EBD8;
  --danger: #8A3B12;
  --etoile: #E0A526;
  --titre: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --texte: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rayon: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.5 var(--texte);
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-strong); }

.entete {
  background: var(--nuit);
  color: #B9CBC7;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.entete b { color: #fff; font-family: var(--titre); font-size: 20px; letter-spacing: .08em; font-weight: 600; }

main { max-width: 560px; margin: 0 auto; padding: 22px 16px 32px; }

.surtitre { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-dim); margin: 0 0 6px; }
h1 { font-family: var(--titre); font-weight: 500; font-size: 38px; line-height: 1.05; margin: 0 0 20px; }
h1 em { font-style: normal; color: var(--accent); }
h2 { font-family: var(--titre); font-weight: 600; font-size: 24px; margin: 28px 0 12px; }
h3 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-dim); margin: 18px 0 8px; font-weight: 600; }

.carte {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--rayon);
  padding: 18px;
  margin-bottom: 12px;
}
.carte.douce { background: var(--elev); }
.vide { text-align: center; color: var(--fg-dim); padding: 28px 18px; }

.bouton {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 10px;
}
.bouton.plein { background: var(--nuit); border-color: var(--nuit); color: #fff; }
.bouton.danger { color: var(--danger); border-color: #E2C9BC; }
.bouton.petit { display: inline-block; width: auto; padding: 8px 14px; font-size: 15px; margin: 0 6px 6px 0; }
.rangee { display: flex; gap: 10px; }
.rangee > * { flex: 1; }

.etats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.etat {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--rayon);
  padding: 14px 10px;
  text-align: center;
}
.etat span { display: block; font-size: 30px; line-height: 1.2; }
.etat.actif { border: 2px solid var(--accent); background: var(--accent-soft); }

.phrase { font-family: var(--titre); font-size: 26px; line-height: 1.2; color: var(--accent-strong); margin: 0 0 6px; }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 6px 0 6px 28px; position: relative; }
.liste li::before { position: absolute; left: 0; top: 6px; }
.liste.fais li::before { content: '✓'; color: var(--success); font-weight: 700; }
.liste.laisse li::before { content: '–'; color: var(--fg-dim); font-weight: 700; }
.liste.soir li::before { content: '☾'; color: var(--accent); }

.historique { display: flex; gap: 6px; flex-wrap: wrap; }
.historique div { width: 30px; text-align: center; font-size: 11px; color: var(--fg-dim); }
.historique div span { display: block; font-size: 20px; }

.bandeau { background: var(--warn-soft); border: 1px solid #E8D3AE; color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.bandeau button { background: none; border: 0; color: var(--accent-strong); text-decoration: underline; padding: 0; font-weight: 600; }

.puces { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.puce { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.puce.actif { background: var(--nuit); color: #fff; border-color: var(--nuit); }

.mois { font-family: var(--titre); font-size: 22px; margin: 22px 0 8px; text-transform: capitalize; }
.fait { display: block; width: 100%; text-align: left; }
.fait .quand { font-size: 13px; color: var(--fg-dim); display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.fait .texte { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.fait .details { font-size: 14px; color: var(--fg-muted); margin-top: 6px; }
/* v2.0 (correction 1) : quand le fait a été noté, et modifié */
.marques { font-size: 12px; color: var(--fg-dim); margin-top: 6px; }
.badge { font-size: 12px; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }

label.champ { display: block; margin-bottom: 14px; }
label.champ > span { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 6px; }
input[type=text], input[type=date], input[type=time], input[type=number], input[type=tel], input[type=password], textarea {
  width: 100%;
  background: var(--elev);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; }
.aide { font-size: 14px; color: var(--fg-muted); }
.case { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.case input { width: 22px; height: 22px; }
details.carte summary { cursor: pointer; font-weight: 600; }

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.nav a {
  flex: 1;
  max-width: 140px;
  text-align: center;
  padding: 10px 4px 12px;
  font-size: 12px;
  color: var(--fg-dim);
  text-decoration: none;
}
.nav a span { display: block; font-size: 22px; line-height: 1.3; }
.nav a.actif { color: var(--nuit); font-weight: 600; }

.pied { text-align: center; color: var(--fg-dim); font-size: 13px; margin-top: 30px; }
.pied p { margin: 4px 0; }
.signature { font-family: var(--titre); font-size: 16px; color: var(--fg-muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--nuit); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px;
  opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 20;
}
.toast.visible { opacity: 1; }

@media (min-width: 600px) { h1 { font-size: 44px; } }

/* v2.0 (correction 4) : le code du journal : l'avertissement, et la phrase demandée pour une sauvegarde chiffrée */
.carte.avertissement { background: var(--warn-soft); border-color: #E8D3AE; color: var(--warn); }
.voile { position: fixed; inset: 0; background: rgba(14, 42, 47, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30; }
.voile .carte { width: 100%; max-width: 420px; }

/* v2.0 (correction 2) : la feuille d'impression du journal (« Imprimer ou enregistrer en PDF »). À l'écran, elle ne se
   voit pas ; à l'impression, elle est seule. */
.impression { display: none; }
@media print {
  @page { size: A4; margin: 16mm 15mm; }
  body { background: #fff; color: #000; padding: 0; min-height: 0; font: 11pt/1.45 var(--texte); }
  body > *:not(.impression) { display: none !important; }
  .impression { display: block; }
  .impression h1 { font-family: var(--titre); font-size: 20pt; font-weight: 600; margin: 0 0 4pt; color: #000; }
  .impression .entete-impression, .impression .legende { font-size: 9.5pt; color: #333; margin: 0 0 4pt; }
  .impression .legende { margin-bottom: 10pt; }
  .impression .fait-imprime { border-top: .5pt solid #888; padding: 8pt 0 6pt; break-inside: avoid; }
  .impression h2 { font-family: var(--texte); font-size: 11pt; font-weight: 700; margin: 0 0 4pt; }
  .impression p { margin: 0 0 3pt; }
  .impression .texte { white-space: pre-wrap; }
  .impression .marques { font-size: 9pt; color: #444; margin-top: 4pt; }
  .impression .pied-impression { border-top: .5pt solid #888; padding-top: 6pt; font-size: 9pt; color: #444; }
}
