:root {
  --bg: #f7f3ee; --card: #ffffff; --text: #26303b; --muted: #77808b; --line: #ebe5dd;
  --primary: #4f7cac; --primary-ink: #ffffff; --primary-soft: #e3ecf6;
  --feed: #e8a06b; --feed2: #f3c9a5; --sleep: #7d8fd8; --diaper: #5fb69a; --diaper2: #a7d9c6;
  --health: #e07a7a; --pump: #a891d6; --act: #e7b84a; --note: #8d9aa6; --mom: #d58bb0;
  --danger: #d0535b; --ok: #4f9e7c;
  --radius: 20px; --shadow: 0 1px 2px rgba(38, 48, 59, .05), 0 6px 18px rgba(38, 48, 59, .06);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
html.night {
  --bg: #0f1114; --card: #191c21; --text: #c9ced6; --muted: #7d8590; --line: #262a31;
  --primary: #7fa3cc; --primary-ink: #0f1114; --primary-soft: #1f2833;
  --feed: #b9825a; --feed2: #7a5a42; --sleep: #6c79b6; --diaper: #4e9680; --diaper2: #355f53;
  --health: #b46767; --pump: #8a78b1; --act: #b8954a; --note: #6f7a85; --mom: #a8728f;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.4; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
a { color: var(--primary); }
b { font-weight: 700; }
small { display: block; color: var(--muted); font-size: .84rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.ic { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

#app { max-width: 600px; margin: 0 auto; min-height: 100vh; }
#hd { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hd-main { display: flex; align-items: center; gap: 12px; }
.hd-logo { width: 42px; height: 42px; border-radius: 14px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.hd-logo svg { width: 30px; height: 30px; }
.hd-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.hd-sub { font-size: .86rem; color: var(--muted); }
.hd-title { font-weight: 800; font-size: 1.1rem; }
.icbtn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--text); }
.icbtn:active { background: var(--line); }
.icbtn.big { width: 52px; height: 52px; font-size: 1.6rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
main { padding: 6px 14px calc(96px + env(safe-area-inset-bottom)); }
#nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; display: flex; justify-content: space-around; max-width: 600px; margin: 0 auto;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
#nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .72rem; color: var(--muted); border-radius: 12px; }
#nav button.on { color: var(--primary); font-weight: 700; }
.offline-bar { display: none; margin: 0 14px 8px; padding: 8px 12px; border-radius: 12px; background: #fff3cd; color: #6b5300; font-size: .85rem; }
body.offline .offline-bar { display: block; }
html.night .offline-bar { background: #3a3220; color: #e6d39a; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card.list { padding: 6px 8px; }
.card-h { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 8px; }
.card.list .card-h { padding: 8px 8px 2px; }
.link { color: var(--primary); font-weight: 700; font-size: .9rem; }
.day { margin: 18px 4px 6px; font-weight: 800; color: var(--muted); font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.banner { display: flex; align-items: center; gap: 10px; background: var(--primary-soft); border-radius: var(--radius); padding: 12px 8px 12px 16px; margin: 8px 0; }
.banner > div { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.status { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-height: 112px; border-top: 4px solid var(--c, var(--line)); }
.status b { display: block; font-size: 1.02rem; margin-top: 4px; }
.st-h { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.st-h .ic { width: 16px; height: 16px; }
.st-feed { --c: var(--feed); } .st-sleep { --c: var(--sleep); } .st-diaper { --c: var(--diaper); } .st-health { --c: var(--health); }
.pill { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--text); font-size: .78rem; font-weight: 600; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.actions.three { grid-template-columns: repeat(3, 1fr); }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 82px; border-radius: 20px;
  background: color-mix(in srgb, var(--c) 16%, var(--card)); color: color-mix(in srgb, var(--c) 70%, var(--text)); font-weight: 700; font-size: .85rem; }
.act .ic { width: 28px; height: 28px; }
.act:active { transform: scale(.96); }
.c-feed { --c: var(--feed); } .c-feed2 { --c: var(--feed2); } .c-sleep { --c: var(--sleep); } .c-diaper { --c: var(--diaper); } .c-diaper2 { --c: var(--diaper2); }
.c-health { --c: var(--health); } .c-pump { --c: var(--pump); } .c-act { --c: var(--act); } .c-note { --c: var(--note); } .c-mom { --c: var(--mom); }

.run { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 8px 0; border-radius: var(--radius); background: var(--c); color: #fff; box-shadow: var(--shadow); }
.run > div { flex: 1; }
.run small { color: rgba(255, 255, 255, .85); }
.run .big { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
html.night .run { color: #0f1114; } html.night .run small { color: rgba(15, 17, 20, .75); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpis b { font-size: 1.25rem; display: block; }
.card.kpis { padding: 14px; }

.li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; width: 100%; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.li:last-child { border-bottom: 0; }
.li > .ic { color: var(--primary); }
.li .grow, .grow { flex: 1; min-width: 0; }
.li.check .box { width: 26px; height: 26px; flex: none; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.li.check.done .box { background: var(--ok); border-color: var(--ok); }
.li.check.done b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.li .txt { text-align: left; }
.li.expired b { color: var(--danger); }
.row-ev { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border-radius: 14px; }
.row-ev:active { background: var(--bg); }
.row-ev b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, var(--card)); color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.dot .ic { width: 20px; height: 20px; }
.by { font-size: .72rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-of-type { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); min-height: 108px; }
.tile .ic { color: var(--primary); width: 26px; height: 26px; margin-bottom: 4px; }

.hero { margin: 8px 0 12px; padding: 26px 20px; border-radius: 26px; color: #fff; text-align: center;
  background: linear-gradient(150deg, #6f9ccb, #4f7cac 60%, #43699a); box-shadow: var(--shadow); }
html.night .hero { background: linear-gradient(150deg, #2c3b52, #22304a); color: var(--text); }
.hero-big { font-size: 3.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.hero-big.sm { font-size: 2rem; }
.hero-sub { margin-top: 6px; opacity: .92; }
.hero-note { margin-top: 12px; display: inline-block; background: rgba(255, 255, 255, .16); padding: 6px 12px; border-radius: 99px; font-size: .9rem; }
.hero .btn { margin-top: 14px; }
.hero-logo { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 24px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.hero-logo svg { width: 54px; height: 54px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 16px; font-weight: 700; text-decoration: none; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .88rem; }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn.xl { min-height: 60px; font-size: 1.08rem; border-radius: 20px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.light { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn:disabled { opacity: .6; }
.btn:active { transform: scale(.98); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.row.end { justify-content: flex-end; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.center { justify-content: center; }
.chip { padding: 8px 14px; border-radius: 99px; background: var(--card); border: 1.5px solid var(--line); font-size: .88rem; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.chart { width: 100%; height: auto; display: block; }
.chart .lbl { font-size: 10px; fill: var(--muted); }
.chart .val { font-size: 10px; fill: var(--text); font-weight: 700; }
.chart rect.c-feed { fill: var(--feed); } .chart rect.c-feed2 { fill: var(--feed2); } .chart rect.c-act { fill: var(--act); }
.chart rect.c-sleep { fill: var(--sleep); } .chart rect.c-diaper { fill: var(--diaper); } .chart rect.c-diaper2 { fill: var(--diaper2); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.growth .band1 { fill: color-mix(in srgb, var(--primary) 12%, transparent); }
.growth .band2 { fill: color-mix(in srgb, var(--primary) 22%, transparent); }
.growth .median { fill: none; stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 4 3; }
.growth .baby { fill: none; stroke: var(--feed); stroke-width: 2.5; }
.growth .pt { fill: var(--feed); stroke: var(--card); stroke-width: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c); }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 20, 28, .38); opacity: 0; transition: opacity .25s; }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-width: 600px; margin: 0 auto; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 26px 26px 0 0; padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.sheet.open .sheet-bg { opacity: 1; }
.sheet.open .sheet-card { transform: none; }
.sheet-h { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 0 6px; background: var(--bg); z-index: 2; font-size: 1.15rem; }
.field { display: block; margin: 12px 0; }
.flabel { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 6px; }
.field small { margin-top: 6px; }
input:not([type=radio]):not([type=checkbox]), select, textarea { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); outline: none; font-size: 1rem; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: .92rem; cursor: pointer; }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.checkline { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; }
.checkline input { width: 22px; height: 22px; accent-color: var(--primary); }
.formend { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.formend .btn.primary { flex: 1; max-width: 240px; margin-left: auto; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0; }
.stepper input { width: 120px !important; text-align: center; font-size: 2rem !important; font-weight: 800; min-height: 64px !important; }
.stepper span { font-weight: 700; color: var(--muted); }
details { margin: 12px 0; background: var(--card); border-radius: 16px; padding: 4px 14px; }
summary { padding: 10px 0; font-weight: 700; color: var(--primary); cursor: pointer; }
.timeinput .chips { margin-top: 8px; }
.diapers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0; }
.dbtn { min-height: 92px; border-radius: 20px; background: color-mix(in srgb, var(--diaper) 18%, var(--card)); color: color-mix(in srgb, var(--diaper) 70%, var(--text)); font-weight: 800; font-size: 1.05rem; text-align: center; border: 2px solid transparent; }
.dbtn.on { border-color: var(--diaper); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 8px; border-radius: 24px; background: var(--card); border: 2px solid var(--line); text-align: center; }
.side span { font-weight: 800; font-size: 1.1rem; }
.side b { font-size: 2rem; font-variant-numeric: tabular-nums; }
.side.sug { border-color: var(--feed); border-style: dashed; }
.side.on { background: var(--feed); border-color: var(--feed); color: #fff; animation: pulse 2s infinite; }
.side.on small { color: rgba(255, 255, 255, .9); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--feed) 45%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
.total { margin: 6px 0; }
.big-time { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 10px 0 0; }
.alert { background: color-mix(in srgb, var(--health) 16%, var(--card)); color: color-mix(in srgb, var(--health) 55%, var(--text)); border-radius: 16px; padding: 12px 14px; margin: 10px 0; font-weight: 600; }
.photo-pick { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; border: 1.5px dashed var(--line); background: var(--card); cursor: pointer; margin: 12px 0; color: var(--primary); font-weight: 700; }
.photo-pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }
.err-text { color: var(--danger); min-height: 1.2em; font-weight: 600; }

/* contractions */
.ctr { display: grid; place-items: center; margin: 14px 0; }
.ctr-btn { width: 210px; height: 210px; border-radius: 50%; background: var(--mom); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 10px 30px color-mix(in srgb, var(--mom) 40%, transparent); }
.ctr-btn span { font-size: 1rem; opacity: .9; }
.ctr-btn b { font-size: 1.5rem; }
.ctr-btn.on { background: var(--danger); animation: pulse2 1.6s infinite; }
.ctr-btn.on b { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
@keyframes pulse2 { 50% { transform: scale(1.03); } }

/* souvenirs */
.miles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 6px; border-radius: 16px; background: var(--bg); min-height: 112px; justify-content: center; }
.mile .ic { color: var(--muted); }
.mile.done .ic { color: var(--act); }
.mile b { font-size: .8rem; line-height: 1.2; }
.mile small { font-size: .72rem; }
.mile img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; }
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.album img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
img.full { width: 100%; border-radius: 14px; }

.progress { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
.water { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.water b { font-size: 1.6rem; }
.vote.on { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.prenom { font-size: 1.1rem; }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(15, 20, 28, .45); display: grid; place-items: center; padding: 20px; }
.modal-card { width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; background: var(--card); border-radius: 26px; padding: 22px; }
.welcome p { margin: 0 0 12px; line-height: 1.5; }
.welcome p:first-of-type { font-size: 1.3rem; font-weight: 800; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 80;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 16px; background: #26303b; color: #fff; font-weight: 600; transition: all .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { background: var(--danger); }
.toast button { color: #ffd59e; font-weight: 800; }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { margin: 6px 0 2px; font-size: 2rem; }
.login-card form { text-align: left; margin-top: 18px; }

/* rapport */
.report { background: #fff; color: #222; border-radius: var(--radius); padding: 18px; }
.report h2 { margin: 0; } .report h3 { margin: 18px 0 6px; font-size: 1rem; }
.report table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.report th, .report td { border-bottom: 1px solid #e5e5e5; padding: 6px 4px; text-align: left; }
@media print {
  #hd, #nav, .noprint, .offline-bar, .toast { display: none !important; }
  body, html { background: #fff; }
  main { padding: 0; }
  .report { box-shadow: none; padding: 0; }
}
@media (min-width: 640px) { main { padding-left: 20px; padding-right: 20px; } }
