/* ══════════════════════════════════════════════════════════════
   Maison — charte « Ciel doux »
   Ciel qui suit l'heure, nuages de pâte douce, cartes blanches
   très arrondies, grande phrase du jour. Mobile d'abord.
   Couche 1 = primitives (seul endroit où vivent les hex).
   ══════════════════════════════════════════════════════════════ */
:root {
  /* — 1. Primitives — */
  --bleu-900:#1d2b4f; --bleu-700:#2f4f86; --bleu-500:#4f86d4; --bleu-300:#9cc3ef; --bleu-100:#e3effc;
  --peche-500:#f0936a; --peche-300:#f8c2a3; --peche-100:#fde9dd;
  --lilas-500:#9a7fe0; --lilas-300:#c8b7f4; --lilas-100:#efe9fd;
  --menthe-500:#46b98b; --menthe-100:#dcf4ea;
  --sable-300:#e6d3b3;
  --blanc:#ffffff; --encre:#1f2433; --encre-2:#5b6274; --encre-3:#8d93a3; --filet:#e9ecf3;
  --rouge:#d94a5c;

  /* — 2. Sémantiques — */
  --carte: rgba(255,255,255,.92);
  --carte-plein: var(--blanc);
  --texte: var(--encre); --texte-2: var(--encre-2); --texte-3: var(--encre-3);
  --hero: var(--blanc); --hero-2: rgba(255,255,255,.62);
  --garde: var(--bleu-500); --garde-fond: var(--bleu-100);
  --vacances: var(--peche-500); --vacances-fond: var(--peche-100);
  --conges: var(--lilas-500); --conges-fond: var(--lilas-100);
  --off: var(--menthe-500); --off-fond: var(--menthe-100);
  --action: var(--bleu-900);
  --danger: var(--rouge);
  --ombre: 0 1px 2px rgba(29,43,79,.06), 0 18px 40px -18px rgba(29,43,79,.35);
  --ombre-chip: 0 1px 1px rgba(29,43,79,.08), 0 6px 14px -6px rgba(29,43,79,.35);

  /* — 3. Échelles — */
  --r-s: 10px; --r-m: 16px; --r-l: 26px; --r-pill: 999px;
  --ease: cubic-bezier(.16,1,.3,1);
  --t1: 140ms; --t2: 240ms; --t3: 420ms;
  --police: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Ciel selon l'heure (classe posée par app.js) */
.ciel-matin { --ciel-a:#6fa6e3; --ciel-b:#a9c9ee; --ciel-c:#f3cfb0; }
.ciel-jour  { --ciel-a:#4d8fdc; --ciel-b:#8fbcee; --ciel-c:#d9e9f8; }
.ciel-soir  { --ciel-a:#7b74c9; --ciel-b:#b79bd8; --ciel-c:#f1c3c0; }
.ciel-nuit  { --ciel-a:#1f2550; --ciel-b:#3d3f7c; --ciel-c:#6f5e96; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--ciel-a, #4d8fdc); }
body {
  margin: 0; min-height: 100dvh; font-family: var(--police); color: var(--texte);
  background: linear-gradient(180deg, var(--ciel-a) 0%, var(--ciel-b) 55%, var(--ciel-c) 100%) fixed;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 104px);
  overflow-x: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--texte); }
svg { width: 1em; height: 1em; flex: none; }

/* — Décor : nuages et galets de pâte douce — */
.ciel { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.nuage, .galet { position: absolute; display: block; }
.nuage {
  width: 220px; height: 70px; border-radius: 999px; background: rgba(255,255,255,.55); filter: blur(18px);
}
.n1 { top: 18%; left: -60px; } .n2 { top: 62%; right: -80px; width: 280px; } .n3 { bottom: 4%; left: 20%; width: 320px; opacity: .7; }
.galet {
  width: 74px; height: 96px; border-radius: 46% 54% 50% 50% / 58% 58% 42% 42%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.85) 0 8%, transparent 32%),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,.10), transparent 55%),
    var(--galet, var(--peche-300));
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.08), 0 20px 30px -18px rgba(29,43,79,.45);
  animation: flotte 9s var(--ease) infinite alternate;
}
.g1 { --galet: var(--peche-300); top: 9%; right: 6%; transform: rotate(18deg); }
.g2 { --galet: var(--lilas-300); top: 46%; left: -26px; width: 60px; height: 78px; animation-delay: -3s; }
.g3 { --galet: var(--sable-300); bottom: 16%; right: -18px; width: 66px; height: 84px; animation-delay: -6s; }
@keyframes flotte { from { translate: 0 0; rotate: -6deg; } to { translate: 0 -14px; rotate: 6deg; } }

/* — En-tête — */
.haut { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto; height: 52px; }
.marque {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r-pill);
  background: rgba(20,24,40,.82); color: var(--blanc); font-weight: 700; font-size: 13px; letter-spacing: .2px;
}
.marque svg { font-size: 14px; }
.qui {
  min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); background: rgba(255,255,255,.28);
  color: var(--blanc); font-weight: 700; font-size: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

main { max-width: 720px; margin: 0 auto; }

/* — Grande phrase du jour — */
.hero { padding: clamp(28px, 9vh, 80px) 2px clamp(22px, 5vh, 44px); text-align: center; }
.hero h1 {
  margin: 0; color: var(--hero); font-weight: 700; letter-spacing: -.02em; line-height: 1.38;
  font-size: clamp(25px, 7.2vw, 42px); text-shadow: 0 1px 18px rgba(29,43,79,.18);
}
.hero h1 .doux { color: var(--hero-2); }
.hero p { margin: 14px 0 0; color: var(--hero-2); font-weight: 600; font-size: clamp(15px, 4.2vw, 18px); }
.chip {
  display: inline-flex; align-items: center; gap: .28em; vertical-align: .06em;
  padding: .06em .38em .08em; border-radius: .42em; background: var(--blanc); color: var(--texte);
  box-shadow: var(--ombre-chip); text-shadow: none; line-height: 1.15; font-weight: 750;
  transition: transform var(--t1) var(--ease);
}
.chip svg { font-size: .78em; color: var(--garde); }
.chip.peche svg { color: var(--vacances); } .chip.lilas svg { color: var(--conges); }
button.chip:active { transform: scale(.94); }

/* — Cartes — */
.carte {
  background: var(--carte); border-radius: var(--r-l); box-shadow: var(--ombre); padding: 18px;
  margin-bottom: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.carte h2 { margin: 0 0 4px; font-size: clamp(17px, 4.6vw, 20px); font-weight: 800; letter-spacing: -.01em; }
.carte .sous { margin: 0 0 12px; color: var(--texte-3); font-size: 14px; font-weight: 600; }
.ligne-titre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Semaine */
.semaine { list-style: none; margin: 0; padding: 0; }
.semaine li + li { border-top: 1px solid var(--filet); }
.semaine button {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 2px; text-align: left;
}
.semaine .j { width: 48px; flex: none; }
.semaine .j b { display: block; font-size: 13px; color: var(--texte-3); font-weight: 700; text-transform: capitalize; }
.semaine .j span { font-size: 20px; font-weight: 800; }
.semaine li.auj .j span { color: var(--garde); }
.semaine .quoi { flex: 1; min-width: 0; }
.semaine .note { display: block; color: var(--texte-3); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.semaine .chev { color: var(--texte-3); font-size: 18px; }

.etiquette {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill);
  font-weight: 750; font-size: 15px; background: var(--garde-fond); color: var(--bleu-700);
}
.etiquette.vacances { background: var(--vacances-fond); color: var(--vacances); }
.etiquette.conges { background: var(--conges-fond); color: var(--conges); }
.etiquette.off { background: var(--off-fond); color: var(--off); }
.etiquette.weekend, .etiquette.ferie, .etiquette.avant { background: transparent; color: var(--texte-3); padding-left: 0; }
.etiquette .modif { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.totaux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.total { background: var(--bleu-100); border-radius: var(--r-m); padding: 12px 14px; }
.total b { display: block; font-size: clamp(20px, 6vw, 26px); font-weight: 800; color: var(--bleu-900); }
.total span { font-size: 13px; font-weight: 700; color: var(--texte-2); }

/* — Dock (navigation) — */
.dock {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 14px); translate: -50% 0; z-index: 20;
  display: flex; gap: 2px; padding: 5px; border-radius: var(--r-pill);
  background: rgba(20,24,40,.86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 34px -12px rgba(20,24,40,.6);
}
.dock button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 15px; border-radius: var(--r-pill);
  color: rgba(255,255,255,.72); font-weight: 700; font-size: 14px; transition: background var(--t2) var(--ease), color var(--t2);
}
.dock button svg { font-size: 17px; }
.dock button[aria-current="page"] { background: var(--blanc); color: var(--encre); }

/* — Année — */
.annee-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 16px; color: var(--blanc); }
.annee-nav b { font-size: clamp(26px, 8vw, 36px); font-weight: 800; letter-spacing: -.02em; min-width: 3.2em; text-align: center; }
.rond {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: rgba(255,255,255,.3); color: var(--blanc); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px; padding: 0 4px; color: var(--blanc); font-size: 13px; font-weight: 700; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.mois-grille { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .mois-grille { grid-template-columns: 1fr 1fr; } }
.mois { margin: 0; }
.mois .ligne-titre h2 { text-transform: capitalize; }
.mois .ligne-titre span { color: var(--texte-3); font-size: 13px; font-weight: 700; }
.jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.jours .dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--texte-3); padding-bottom: 2px; }
.jours button {
  aspect-ratio: 1; min-height: 38px; border-radius: var(--r-s); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 750; position: relative; transition: transform var(--t1) var(--ease);
}
.jours button:active { transform: scale(.9); }
.jours button small { font-size: 9px; font-weight: 700; opacity: .8; line-height: 1; margin-top: 1px; }
.jours .garde { background: var(--garde-fond); color: var(--bleu-700); }
.jours .vacances { background: var(--vacances); color: var(--blanc); }
.jours .conges { background: var(--conges); color: var(--blanc); }
.jours .off { background: var(--off-fond); color: var(--off); }
.jours .weekend, .jours .avant { color: var(--texte-3); }
.jours .ferie { color: var(--texte-3); text-decoration: underline dotted; }
.jours .auj { box-shadow: inset 0 0 0 2px var(--bleu-900); }
.jours .modif::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* — Boutons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px;
  border-radius: var(--r-pill); background: var(--action); color: var(--blanc); font-weight: 800; font-size: 16px;
  transition: transform var(--t1) var(--ease), opacity var(--t1);
}
.btn:active { transform: scale(.97); }
.btn.large { width: 100%; }
.btn.clair { background: var(--bleu-100); color: var(--bleu-900); }
.btn.lien { background: transparent; color: var(--texte-2); min-height: 44px; }
.btn.danger { background: transparent; color: var(--danger); }
.btn[disabled] { opacity: .5; }
.btn-flottant { width: 100%; margin-bottom: 14px; min-height: 58px; font-size: 17px; background: var(--blanc); color: var(--bleu-900); box-shadow: var(--ombre); }

/* — Feuille (bas d'écran) — */
.voile { position: fixed; inset: 0; background: rgba(20,24,40,.36); z-index: 40; opacity: 0; transition: opacity var(--t2); }
.voile.ouvert { opacity: 1; }
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--carte-plein); border-radius: 28px 28px 0 0; padding: 10px 18px calc(var(--safe-b) + 18px);
  box-shadow: 0 -20px 50px -20px rgba(20,24,40,.5); translate: 0 100%; transition: translate var(--t3) var(--ease);
}
@media (min-width: 700px) {
  .feuille { left: 50%; right: auto; width: 520px; bottom: 50%; translate: -50% 150%; border-radius: 28px; }
  .feuille.ouvert { translate: -50% 50% !important; }
}
.feuille.ouvert { translate: 0 0; }
.poignee { width: 40px; height: 5px; border-radius: 3px; background: var(--filet); margin: 0 auto 12px; }
.feuille h3 { margin: 0 0 2px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.feuille .sous { margin: 0 0 16px; color: var(--texte-3); font-weight: 600; font-size: 14px; }
.feuille .actions { display: grid; gap: 6px; margin-top: 18px; }
.lbl { display: block; font-size: 13px; font-weight: 800; color: var(--texte-3); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; }

.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segments button {
  min-height: 52px; border-radius: var(--r-m); background: var(--bleu-100); font-weight: 750; font-size: 15px; color: var(--texte-2);
  display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid transparent;
}
.segments button[aria-pressed="true"] { border-color: var(--bleu-900); color: var(--bleu-900); background: var(--blanc); }
.segments i { width: 10px; height: 10px; border-radius: 3px; }

.horaires { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pas { background: var(--bleu-100); border-radius: var(--r-m); padding: 10px; text-align: center; }
.pas small { display: block; font-size: 12px; font-weight: 800; color: var(--texte-3); text-transform: uppercase; letter-spacing: .04em; }
.pas output { display: block; font-size: 30px; font-weight: 800; color: var(--bleu-900); margin: 2px 0 6px; }
.pas div { display: flex; justify-content: center; gap: 10px; }
.pas button { width: 44px; height: 44px; border-radius: 50%; background: var(--blanc); display: grid; place-items: center; font-size: 18px; box-shadow: var(--ombre-chip); }
.pas button:active { transform: scale(.9); }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puces button {
  min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); background: var(--bleu-100); font-weight: 750; font-size: 15px; color: var(--bleu-900);
}
.puces button[aria-pressed="true"] { background: var(--bleu-900); color: var(--blanc); }
.puces.grosses button { min-height: 58px; min-width: 78px; font-size: 19px; }

.champ {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: var(--r-m); border: 2px solid var(--filet); background: var(--blanc);
  font-size: 16px; font-weight: 600;
}
.champ:focus { outline: none; border-color: var(--bleu-500); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Biberons */
.bibs { list-style: none; margin: 0; padding: 0; }
.bibs li { display: flex; align-items: center; gap: 12px; min-height: 54px; border-top: 1px solid var(--filet); }
.bibs li:first-child { border-top: 0; }
.bibs .h { width: 54px; font-weight: 800; font-size: 16px; }
.bibs .ml { flex: 1; font-weight: 800; font-size: 18px; color: var(--bleu-900); }
.bibs .ou { font-size: 13px; font-weight: 750; padding: 4px 10px; border-radius: var(--r-pill); background: var(--bleu-100); color: var(--bleu-700); }
.bibs .ou.maison { background: var(--peche-100); color: var(--vacances); }
.bibs .suppr { width: 44px; height: 44px; display: grid; place-items: center; color: var(--texte-3); font-size: 16px; }
.jour-bib + .jour-bib { margin-top: 14px; }
.vide { color: var(--texte-3); font-weight: 600; margin: 6px 0; }

/* Accès */
.porte { text-align: center; padding-top: 18vh; color: var(--blanc); }
.porte h1 { font-size: clamp(28px, 8vw, 40px); margin: 0 0 12px; }
.porte p { color: var(--hero-2); font-weight: 600; font-size: 17px; max-width: 26em; margin: 0 auto 26px; }
.porte .puces { justify-content: center; }
.porte .puces button { background: var(--blanc); min-height: 56px; padding: 0 24px; font-size: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 84px); translate: -50% 0; z-index: 60;
  background: var(--encre); color: var(--blanc); padding: 12px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: 15px;
  box-shadow: var(--ombre); max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
