/* =====================================================================
   CORVÉE — design system
   1. Tokens (couleurs, rayons, ombres, espacements)   2. Base
   3. Composants : Button, Card, Avatar, ProgressBar, Badge/Chip, Field, Sheet
   4. Mise en page : en-tête, navigation flottante, grilles
   5. Écrans : accueil enfant, parent, assistant, stats    6. Animations
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #FFF9F0;
  --surface: #FFFFFF;
  --surface-2: #FFF1DE;
  --ink: #2B2540;
  --muted: #6B6580;          /* ≥ 4.5:1 sur --bg */
  --primary: #7C5CFC; --primary-d: #5A3FD6; --on-primary: #FFFFFF;
  --coral: #FF6B6B;   --coral-d: #D84A4A;
  --sun: #FFD23F;     --sun-d: #D9A800;
  --ok: #4CD964;      --ok-d: #2FA845;
  --teal: #2EC4B6;
  --on-bright: #2B2540;      /* texte sur coral / sun / ok (contraste AA) */
  --pos: #1E8A36; --neg: #C73A3A;
  --r-card: 24px; --r-sm: 16px; --r-pill: 999px;
  --shadow-soft: 0 4px 14px -6px rgba(43, 37, 64, .18);
  --gap: 16px;
  --font: 'Nunito', 'Baloo 2', ui-rounded, system-ui, -apple-system, sans-serif;
  --fs: 100%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1C1830; --surface: #2A2545; --surface-2: #352F58; --ink: #F6F1FF; --muted: #B8B0D0;
    --primary: #9C84FF; --primary-d: #6F55E0; --on-primary: #1C1830; --pos: #6FE58A; --neg: #FF9A9A; --shadow-soft: 0 4px 14px -6px rgba(0,0,0,.5); }
}
:root[data-theme="dark"] { --bg: #1C1830; --surface: #2A2545; --surface-2: #352F58; --ink: #F6F1FF; --muted: #B8B0D0;
  --primary: #9C84FF; --primary-d: #6F55E0; --on-primary: #1C1830; --pos: #6FE58A; --neg: #FF9A9A; --shadow-soft: 0 4px 14px -6px rgba(0,0,0,.5); }

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--fs); }
body { margin: 0; font: 1rem/1.45 var(--font); background: var(--bg); color: var(--ink); padding-bottom: 110px; }
h1, h2, h3 { margin: 0; font-weight: 900; line-height: 1.15; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; margin: 22px 0 10px; } h3 { font-size: 1.1rem; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: .95rem; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 170px; }

/* ---------- 3a. Button (effet 3D) ---------- */
.btn { --c: var(--primary); --cd: var(--primary-d); --t: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 26px; border: 0; border-radius: var(--r-pill);
  background: var(--c); color: var(--t); font: 800 1.1rem var(--font); cursor: pointer;
  box-shadow: 0 5px 0 var(--cd); transition: transform .12s, box-shadow .12s, filter .2s; text-align: center; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:disabled { --c: var(--surface-2); --cd: rgba(0,0,0,.12); --t: var(--muted); cursor: not-allowed; }
.btn.ok { --c: var(--ok); --cd: var(--ok-d); --t: var(--on-bright); }
.btn.coral { --c: var(--coral); --cd: var(--coral-d); --t: var(--on-bright); }
.btn.sun { --c: var(--sun); --cd: var(--sun-d); --t: var(--on-bright); }
.btn.ghost { --c: var(--surface); --cd: rgba(43,37,64,.16); --t: var(--ink); }
.btn.block { width: 100%; }
.btn.xl { min-height: 64px; font-size: 1.25rem; }
.btn.sm { min-height: 48px; padding: 0 18px; font-size: 1rem; }
.btn.icon { min-width: 48px; padding: 0 12px; }

/* ---------- 3b. Card ---------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: 16px; box-shadow: var(--shadow-soft); }
.card.tint { box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--mc, var(--primary)) 55%, transparent), var(--shadow-soft); }
.stack { display: grid; gap: var(--gap); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }

/* ---------- 3c. Avatar ---------- */
.avatar { --mc: var(--primary); width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.7rem; background: color-mix(in srgb, var(--mc) 22%, var(--surface)); border: 3px solid var(--mc); }
.avatar.lg { width: 84px; height: 84px; font-size: 2.8rem; } .avatar.sm { width: 38px; height: 38px; font-size: 1.2rem; border-width: 2px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.who { display: grid; justify-items: center; gap: 8px; padding: 16px 8px; border: 0; border-radius: var(--r-card); background: var(--surface);
  box-shadow: var(--shadow-soft); font: 800 1.05rem var(--font); color: var(--ink); cursor: pointer; transition: transform .15s; }
.who:hover { transform: translateY(-3px); } .who:active { transform: scale(.97); }

/* ---------- 3d. ProgressBar ---------- */
.progress { height: 18px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--ok)); transition: width .5s cubic-bezier(.3,1.4,.5,1); }
.progress.sun > i { background: linear-gradient(90deg, var(--sun), var(--coral)); }
.progress.sm { height: 10px; }
.pl { display: flex; justify-content: space-between; font-weight: 800; font-size: .9rem; margin-bottom: 4px; }

/* ---------- 3e. Badge / Chip ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: var(--r-pill); font-weight: 800; font-size: .85rem; background: var(--surface-2); color: var(--ink); }
.chip.gain { background: color-mix(in srgb, var(--ok) 30%, var(--surface)); }
.chip.loss { background: color-mix(in srgb, var(--coral) 28%, var(--surface)); }
.chip.info { background: color-mix(in srgb, var(--sun) 40%, var(--surface)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.bdg { text-align: center; padding: 12px 6px; border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-soft); font-weight: 800; font-size: .85rem; }
.bdg .em { font-size: 2.2rem; display: block; }
.bdg.locked { opacity: .6; } .bdg.locked .em { filter: grayscale(1); }
.bdg small { display: block; font-weight: 600; color: var(--muted); }

/* ---------- 3f. Champs ---------- */
label.f { display: grid; gap: 6px; font-weight: 800; font-size: .95rem; }
input, select, textarea { font: 600 1rem var(--font); min-height: 52px; padding: 10px 16px; border-radius: var(--r-sm); border: 3px solid transparent;
  background: var(--surface); color: var(--ink); width: 100%; box-shadow: var(--shadow-soft); }
input:focus, select:focus { outline: none; border-color: var(--primary); }
input[type=checkbox] { width: 24px; min-height: 24px; box-shadow: none; }
.field-row { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.pick button, .opt { min-height: 56px; border-radius: var(--r-sm); border: 3px solid transparent; background: var(--surface); box-shadow: var(--shadow-soft);
  font: 800 1rem var(--font); color: var(--ink); cursor: pointer; padding: 6px 10px; }
.pick button { font-size: 1.7rem; }
.pick button[aria-pressed="true"], .opt[aria-pressed="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; }
.stepper input { width: 120px; text-align: center; font-size: 1.4rem; font-weight: 900; }
details.more { background: var(--surface); border-radius: var(--r-sm); padding: 10px 14px; box-shadow: var(--shadow-soft); }
details.more summary { font-weight: 800; cursor: pointer; min-height: 40px; display: flex; align-items: center; }
details.more[open] summary { margin-bottom: 10px; }

/* ---------- 4. En-tête, navigation flottante ---------- */
header.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
header.top .in { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.hello { font-weight: 900; font-size: 1.15rem; line-height: 1.1; }
.wallet { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--sun); color: var(--on-bright); font-weight: 900; box-shadow: 0 3px 0 var(--sun-d); }
nav.dock { position: fixed; bottom: calc(var(--badge) + env(safe-area-inset-bottom)); left: 12px; right: 12px; /* au-dessus du bandeau « Powered by Netlify » */ max-width: 520px; z-index: 8;
  display: flex; gap: 4px; padding: 6px; background: var(--surface); border-radius: 28px; box-shadow: 0 10px 30px -8px rgba(43,37,64,.35); }
nav.dock button { flex: 1; min-height: 56px; border: 0; background: none; border-radius: 22px; color: var(--muted); font: 800 .75rem var(--font); cursor: pointer; display: grid; place-items: center; padding: 4px 2px; }
nav.dock button .ic { font-size: 1.45rem; line-height: 1; position: relative; }
nav.dock button[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.dot::after { content: attr(data-n); position: absolute; top: -6px; right: -12px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--coral); color: var(--on-bright); font: 900 .75rem var(--font); display: grid; place-items: center; }
.seg { display: flex; gap: 6px; padding: 5px; background: var(--surface-2); border-radius: var(--r-pill); }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: var(--r-pill); background: none; font: 800 .95rem var(--font); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); }
.back { margin: 8px 0; }

/* ---------- 5. Écrans ---------- */
.auth { max-width: 460px; margin: 0 auto; padding: 24px 16px; }
.auth h1 { text-align: center; }
.hero { display: flex; align-items: center; gap: 14px; margin: 8px 0 6px; }
.bubble { position: relative; background: var(--surface); border-radius: 20px; padding: 12px 16px; font-weight: 800; box-shadow: var(--shadow-soft); }
.bubble::before { content: ''; position: absolute; left: -9px; top: 26px; border: 9px solid transparent; border-right-color: var(--surface); border-left: 0; }
.mascot { width: 88px; height: 88px; flex: none; animation: bob 3s ease-in-out infinite; }
.chore { display: grid; grid-template-columns: 64px 1fr; gap: 8px 14px; align-items: center; --mc: var(--primary); }
.chore .em { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 2.3rem; background: color-mix(in srgb, var(--mc) 20%, var(--surface)); }
.chore .act { grid-column: 1 / -1; }
.chore.done { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); }
.chore.pending { background: color-mix(in srgb, var(--sun) 30%, var(--surface)); }
.chore.refused { background: color-mix(in srgb, var(--coral) 14%, var(--surface)); }
.state { font-weight: 900; display: flex; gap: 8px; align-items: center; min-height: 48px; }
.empty { text-align: center; padding: 28px 12px; }
.empty .mascot { margin: 0 auto 8px; display: block; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi b { display: block; font-size: 1.5rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-soft); font-size: .95rem; }
th, td { padding: 8px 10px; text-align: right; } th { font-size: .8rem; color: var(--muted); }
th:first-child, td:first-child { text-align: left; font-weight: 700; }
tr + tr td { border-top: 1px solid var(--surface-2); }
.big-num { font-size: 2.2rem; font-weight: 900; }
.celebrate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(43,37,64,.75); padding: 20px; animation: fade .25s; }
.celebrate .card { text-align: center; max-width: 380px; animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.sheet-bg { position: fixed; inset: 0; z-index: 25; background: rgba(43,37,64,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { max-height: 92vh; overflow-y: auto; width: 100%; max-width: 520px; background: var(--bg); border-radius: 28px 28px 0 0; padding: 20px 16px calc(var(--badge) + 16px + env(safe-area-inset-bottom)); animation: up .25s ease-out; }

/* ---------- Toasts (annuler pendant 5 s) ---------- */
#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--badge) + 84px + env(safe-area-inset-bottom)); z-index: 40; display: grid; gap: 8px; max-width: 520px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-radius: 20px; background: var(--ink); color: var(--bg); font-weight: 800; box-shadow: var(--shadow-soft); animation: up .25s; position: relative; overflow: hidden; }
.toast.err { background: #C73A3A; color: #fff; }
.toast button { min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--sun); color: var(--on-bright); font: 900 .95rem var(--font); cursor: pointer; }
.toast .timer { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--sun); animation: shrink 5s linear forwards; }

/* ---------- 6. Animations ---------- */
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes shrink { to { width: 0; } }
@keyframes check { 0% { transform: scale(.4) rotate(-20deg); } 60% { transform: scale(1.3) rotate(6deg); } 100% { transform: scale(1); } }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }
.chore.just { animation: pop .35s cubic-bezier(.3,1.6,.5,1); } .chore.just .em { animation: check .5s; }
.confetti { position: fixed; top: -14px; width: 10px; height: 14px; z-index: 50; pointer-events: none; border-radius: 3px; animation: fall 1.6s ease-in forwards; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } .confetti { display: none; } }
@media (min-width: 560px) { nav.dock { left: 50%; transform: translateX(-50%); right: auto; width: 520px; } #toasts { left: 50%; right: auto; transform: translateX(-50%); width: 520px; } }
@media (min-width: 900px) { nav.dock { left: 50%; transform: translateX(-50%); right: auto; width: 520px; } #toasts { left: 50%; right: auto; transform: translateX(-50%); width: 520px; } }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } nav.dock button { font-size: .68rem; } }

/* ---------- 3d. Avatars dessinés, éditeur, code PIN, notifications ---------- */
.avatar { overflow: hidden; }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.drawn { background: var(--surface); }
.avatar.xl { width: 112px; height: 112px; border-width: 4px; }
.avbtn { border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; transition: transform .15s; }
.avbtn:active { transform: scale(.92); }
.bell { position: relative; overflow: visible; }
.bell.dot::after { top: -4px; right: -4px; }
body.noscroll { overflow: hidden; }
.sheet.av { max-height: 94vh; overflow-y: auto; padding-bottom: 0; }
.av-top { position: sticky; top: -20px; z-index: 2; background: var(--bg); padding-top: 20px; margin-top: 8px; }
.av-stage { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 8px 0 10px; }
.av-tools { display: grid; gap: 8px; }
.av-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.av-tabs button { flex: none; display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 8px 6px; border: 3px solid transparent; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--shadow-soft); font: 800 .75rem var(--font); color: var(--ink); cursor: pointer; }
.av-tabs button span { font-size: 1.4rem; }
.av-tabs button[aria-selected="true"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; padding: 4px 0 12px; }
.av-opt { aspect-ratio: 1; border-radius: 18px; border: 3px solid transparent; background: var(--surface); box-shadow: var(--shadow-soft); padding: 3px; cursor: pointer; overflow: hidden; }
.av-opt svg { width: 100%; height: 100%; display: block; border-radius: 14px; }
.av-opt[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.av-opt.sw { background: var(--c); border-radius: 50%; border-color: color-mix(in srgb, var(--ink) 18%, transparent); }
.av-opt.sw[aria-pressed="true"] { border-color: var(--ink); }
.av-opt.st { font-size: 1.9rem; display: grid; place-items: center; }
.av-save { position: sticky; bottom: 0; padding: 12px 0 20px; background: linear-gradient(transparent, var(--bg) 30%); }
.who .avatar, .nudge .avatar { flex: none; }
.nudge { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; font: 700 1rem var(--font); color: var(--ink); cursor: pointer; margin-bottom: 12px; }
.nudge > span:first-child { font-size: 2rem; }
.notif { display: block; width: 100%; text-align: left; border: 0; font: 600 1rem var(--font); color: var(--ink); cursor: pointer; padding: 12px 14px; }
.notif.new { box-shadow: inset 5px 0 0 var(--coral), var(--shadow-soft); }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 20px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pk { min-height: 68px; border: 0; border-radius: 22px; background: var(--surface); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 14%, transparent); font: 900 1.7rem var(--font); color: var(--ink); cursor: pointer; }
.pk:active { transform: translateY(4px); box-shadow: none; }
.pk[data-k="ok"] { background: var(--ok); color: var(--on-bright); }
.auth .mascot { display: block; margin: 0 auto 6px; width: 104px; height: 104px; }

/* ---------- 3e. Pièces dorées, micro-interactions, classement ---------- */
.coin { display: inline-block; filter: sepia(1) saturate(4.5) hue-rotate(9deg) brightness(1.3) drop-shadow(0 1px 0 rgba(150,90,0,.35)); }
.btn:not(.bell), .opt, .pk, .who, .av-opt, .seg button, .pick button, .nudge, .notif { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.btn:not(.bell)::after, .opt::after, .pk::after, .who::after, .av-opt::after, .seg button::after, .pick button::after, .nudge::after, .notif::after {
  content: ""; position: absolute; left: var(--rx, 50%); top: var(--ry, 50%); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: rgba(255,255,255,.65); opacity: 0; transform: scale(0); pointer-events: none; }
.tap::after { animation: ripple .5s ease-out; }
.tap { animation: squish .38s cubic-bezier(.3,1.6,.5,1); }
@keyframes ripple { 0% { opacity: .8; transform: scale(0); } 100% { opacity: 0; transform: scale(34); } }
@keyframes squish { 0% { scale: 1; } 30% { scale: .93; } 65% { scale: 1.04; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .tap, .tap::after { animation: none; } }
.rank { display: flex; align-items: center; gap: 12px; }
.rank .pos { font-size: 1.7rem; min-width: 38px; text-align: center; font-weight: 900; }
.rank.first { padding-block: 18px; }
.rank.you { outline: 3px solid var(--primary); }

/* ---------- 3f. Photo preuve ---------- */
.proof-big { width: 100%; max-height: 52vh; object-fit: contain; border-radius: var(--r-card); background: var(--surface-2); }
.proof { position: relative; display: block; width: 100%; margin-top: 10px; padding: 0; border: 0; border-radius: var(--r-sm); overflow: hidden; cursor: pointer; background: var(--surface-2); }
.proof img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.proof span { position: absolute; right: 8px; bottom: 8px; padding: 6px 12px; border-radius: var(--r-pill); background: rgba(43,37,64,.75); color: #fff; font: 800 .85rem var(--font); }
.lightbox { align-items: center; padding: 12px; z-index: 50; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 16px; }

/* ---------- 3g. Messagerie ---------- */
.chat { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; height: 100dvh; background: var(--bg); max-width: 760px; margin: 0 auto; }
.chat header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.chat header h2 { margin: 0; font-size: 1.2rem; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bub { position: relative; padding: 8px 14px 6px; border-radius: 20px 20px 20px 6px; background: var(--surface); box-shadow: var(--shadow-soft); min-width: 64px; }
.msg.mine .bub { border-radius: 20px 20px 6px 20px; background: var(--primary); color: var(--on-primary); }
.bub b { display: block; font-size: .8rem; color: var(--primary-d); }
.bub .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 700; }
.bub time { display: block; text-align: right; font-size: .68rem; opacity: .65; margin-top: 2px; }
.msg-del { position: absolute; top: -10px; right: -6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface-2); box-shadow: var(--shadow-soft); font-size: .8rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.bub:hover .msg-del, .bub:focus-within .msg-del { opacity: 1; }
@media (hover: none) { .msg-del { opacity: .85; } }
.msg-day { align-self: center; margin: 8px 0 2px; padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font: 800 .75rem var(--font); text-transform: capitalize; }
.chat-quick { display: flex; gap: 8px; padding: 6px 16px; overflow-x: auto; }
.chat-quick button { flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 1.4rem; cursor: pointer; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 16px calc(var(--badge) + 4px + env(safe-area-inset-bottom)); /* au-dessus du badge Netlify */ }
.chat-form textarea { flex: 1; resize: none; min-height: 52px; max-height: 120px; padding: 14px 16px; border: 3px solid transparent; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-soft); font: 700 1rem var(--font); color: var(--ink); }
.chat-form textarea:focus { outline: none; border-color: var(--primary); }

/* ---------- 3h. Badge Netlify, discussions, jours, enfants dépliables ---------- */
:root { --badge: 76px; }   /* hauteur réservée en bas : le bandeau « Powered by Netlify » ne doit rien cacher */
.sheet.av .av-save { padding-bottom: calc(var(--badge) + 8px); }
.chat header .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat header h2 small { font-size: .8rem; font-weight: 700; }
.conv { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-soft); text-align: left; font: inherit; color: var(--ink); cursor: pointer; margin-bottom: 8px; min-height: 64px; }
.conv .grow { min-width: 0; display: block; }
.conv .prev { display: block; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .prev.unread { color: var(--ink); font-weight: 900; }
.conv time { font-size: .75rem; align-self: flex-start; }
.pill { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--coral); color: var(--on-bright); font: 900 .8rem var(--font); display: grid; place-items: center; }
.sec { margin: 16px 0 8px; font-size: 1rem; }
.chat-note { margin: 0 16px 4px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .82rem; }
.daypick { display: flex; gap: 6px; margin-top: 10px; }
.daypick button { flex: 1; min-width: 0; height: 46px; border: 3px solid transparent; border-radius: 50%; background: var(--surface-2); color: var(--ink); font: 900 1rem var(--font); cursor: pointer; }
.daypick button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.opt.sm { padding: 8px 14px; min-height: 40px; }
.kid-block { padding: 0; overflow: hidden; border-left: 6px solid var(--mc); }
.kid-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 64px; }
.kid-head .grow { min-width: 0; display: block; }
.kid-head .chips { margin-top: 4px; }
.chev { font-size: 1.3rem; transition: transform .2s; color: var(--muted); }
.kid-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.kid-body { padding: 0 12px 12px; }
.kid-body .card { box-shadow: none; background: var(--bg); }
header.top .grow { min-width: 0; }
.hello, header.top .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
