/* Baby Log: a calm nursery palette. Soft lavender-grey ground, deep navy ink and buttons,
   one pastel per activity (feed blue, diaper apricot, sleep indigo, pump teal), rounded Fredoka for
   names and numbers, Figtree for everything else. Layout: one phone-width column, cards only where
   something is tappable or grouped, a floating tab bar. */
:root {
  --bg: #f5f3fa;
  --surface: #ffffff;
  --surface-2: #efecf7;
  --ink: #22203a;
  --muted: #6c6886;
  --line: #e4e0ef;
  --on-ink: #ffffff;
  --on-accent: #ffffff;

  --feed: #3f6fe0;    --feed-tint: #e5ecff;
  --diaper: #d9701f;  --diaper-tint: #ffeadb;
  --sleep: #6450e0;   --sleep-tint: #eae6ff;
  --pump: #0f8f84;    --pump-tint: #d9f2ef;
  --travel: #2a8a5a;  --travel-tint: #ddf2e6;
  --danger: #d1393a;  --danger-tint: #fce6e5;
  --gift: #8a5a00;

  /* chart series (validated for colour-blind separation) */
  --breast: #d4569a; --formula: #3f7ae0; --night: #5a4fcf; --nap: #c98a1e;

  --night-sky-1: #2b2470; --night-sky-2: #4a3bb8;
  --scrim: rgba(20, 18, 40, .38);
  --shadow: 0 1px 2px rgba(34, 32, 58, .05), 0 8px 24px rgba(34, 32, 58, .07);
  --shadow-lift: 0 10px 30px rgba(34, 32, 58, .16);

  --display: "Fredoka", "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11111f; --surface: #1b1b2e; --surface-2: #25253b; --ink: #edebf8; --muted: #a19ebb; --line: #2f2e48; --on-ink: #11111f; --on-accent: #14132a;
    --feed: #82a3ff;   --feed-tint: #1f2a4d;
    --diaper: #f5a05c; --diaper-tint: #3a2716;
    --sleep: #a597ff;  --sleep-tint: #28224d;
    --pump: #45c7ba;   --pump-tint: #123532;
    --travel: #4cc08a; --travel-tint: #15301f;
    --danger: #ff7b73; --danger-tint: #45201e;
    --gift: #f2c46b;
    --formula: #4a85eb; --night: #7468e0; --nap: #b97c12;
    --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--body); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--feed) 55%, transparent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: .005em; }
h1 { font-size: 28px; line-height: 1.1; }
h2 { font-size: 20px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.err { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 999px; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--line); transition: transform .12s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.btn.ghost { background: var(--surface); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.wide { display: flex; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .45; }
.sleep-btn { background: var(--sleep); color: var(--on-accent); border-color: transparent; }
.pump-btn { background: var(--pump); color: var(--on-accent); border-color: transparent; }
.diaper-save { background: var(--diaper); color: var(--on-accent); }
.link { color: var(--feed); padding: 12px; display: block; margin: 6px auto 0; font-size: 15px; font-weight: 600; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--surface-2); color: var(--ink); }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
}
.icon-btn .ico { width: 22px; height: 22px; }

/* ---------- inputs ---------- */
.when { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.auth-card input, .when input, .add-row input, .add-row select, .order-form input {
  display: block; width: 100%; min-width: 0; margin-top: 5px; padding: 13px 14px; border-radius: var(--r-sm);
  border: 1.5px solid transparent; background: var(--surface-2); color: var(--ink); font-weight: 500;
}
.auth-card input:focus, .when input:focus, .add-row input:focus, .order-form input:focus { border-color: var(--feed); outline: none; }

/* ---------- login ---------- */
#auth { display: grid; place-items: center; min-height: 100dvh; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 28px; padding: 32px 24px 22px; box-shadow: var(--shadow-lift); text-align: center; }
.logo-img { width: 72px; height: 72px; border-radius: 20px; display: block; margin: 0 auto 12px; }
.auth-card h1 { font-size: 30px; }
.auth-card > .muted { margin: 6px 0 0; }
.auth-card form { text-align: left; margin-top: 22px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.contact { text-align: center; font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.contact a { color: var(--feed); font-weight: 600; text-decoration: none; }

/* ---------- app frame ---------- */
#app, #shared {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#app { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top, 0px)) 0 16px; }
.baby { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--sleep-tint) center / cover no-repeat; color: var(--sleep);
  font-family: var(--display); font-weight: 600; font-size: 22px; box-shadow: 0 0 0 3px var(--surface);
}
.avatar.photo span { visibility: hidden; }
.baby-text { display: flex; flex-direction: column; min-width: 0; }
.baby-text h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.greet { font-size: 13px; font-weight: 600; color: var(--muted); }
.age { font-size: 13px; font-weight: 600; color: var(--sleep); }
.section { font-size: 18px; margin: 26px 0 10px; }

/* ---------- next feed ---------- */
.next-card {
  display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: center;
  background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
}
.ring { position: relative; width: 116px; height: 116px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-track { stroke: var(--feed-tint); }
.ring-fill { stroke: var(--feed); stroke-linecap: round; transition: stroke-dashoffset .6s ease; stroke-dasharray: 327; stroke-dashoffset: 327; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.next-time { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-cap { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.next-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--feed); }
.next-due { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 2px 0; }
.next-sub { font-size: 14px; color: var(--muted); }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.next-card.late { background: var(--danger-tint); }
.next-card.late .ring-track { stroke: color-mix(in srgb, var(--danger) 18%, transparent); }
.next-card.late .ring-fill { stroke: var(--danger); }
.next-card.late .next-time, .next-card.late .next-label { color: var(--danger); }
.next-card.late .chip { background: var(--surface); }
.next-card.none .ring-fill { stroke: transparent; }
.next-card.none .next-time { font-size: 20px; color: var(--muted); }

/* ---------- activity tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile {
  position: relative; text-align: left; border-radius: var(--r-lg); padding: 14px 14px 16px; min-height: 138px;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden; transition: transform .12s;
}
.tile:active { transform: scale(.98); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.tile-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--surface); }
.tile-add { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); }
.tile-add .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.tile-name { font-family: var(--display); font-weight: 600; font-size: 19px; }
.tile-last { font-size: 13px; color: var(--muted); line-height: 1.35; font-variant-numeric: tabular-nums; }
.tile.feed { background: var(--feed-tint); }     .tile.feed .tile-add { background: var(--feed); }
.tile.diaper { background: var(--diaper-tint); } .tile.diaper .tile-add { background: var(--diaper); }
.tile.sleep { background: var(--sleep-tint); }   .tile.sleep .tile-add { background: var(--sleep); }
.tile.pump { background: var(--pump-tint); }     .tile.pump .tile-add { background: var(--pump); }
/* sleeping now: the tile turns into a small night sky */
.tile.sleep.running {
  background:
    radial-gradient(1.5px 1.5px at 70% 22%, #fff 60%, transparent 61%),
    radial-gradient(1px 1px at 84% 48%, #fff 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 58% 64%, rgba(255,255,255,.8) 60%, transparent 61%),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,.7) 60%, transparent 61%),
    linear-gradient(160deg, var(--night-sky-1), var(--night-sky-2));
  color: #fff;
}
.tile.sleep.running .tile-last { color: rgba(255,255,255,.88); font-weight: 700; }
.tile.sleep.running .tile-ico { background: rgba(255,255,255,.15); animation: breathe 3.2s ease-in-out infinite; }
.tile.sleep.running .tile-add { display: none; }
@keyframes breathe { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .tile.sleep.running .tile-ico { animation: none; } .btn, .tile { transition: none; } }

.nap-hint { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--sleep-tint); font-size: 14px; }
.nap-hint b { color: var(--sleep); }
.nap-hint.in-sheet { margin: 0 0 14px; }

/* ---------- today numbers ---------- */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.sum { padding: 14px 6px; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sum:nth-child(3n) { border-right: 0; }
.sum:nth-child(n+4) { border-bottom: 0; }
.sum b { display: block; font-family: var(--display); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; }
.sum span { font-size: 12px; font-weight: 600; color: var(--muted); }
.split { text-align: center; font-size: 13px; margin: 10px 0 0; }
.split:empty { display: none; }

/* ---------- history ---------- */
.day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }
#timeline .day:first-child { margin-top: 0; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border-radius: var(--r-md); padding: 10px 14px 10px 10px; margin-bottom: 8px;
}
.row .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; flex: none; }
.row.feed .dot { background: var(--feed-tint); }
.row.diaper .dot { background: var(--diaper-tint); }
.row.sleep .dot { background: var(--sleep-tint); }
.row.pump .dot { background: var(--pump-tint); }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-weight: 700; }
.row .main span { font-size: 13px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 24px 16px; background: var(--surface); border-radius: var(--r-md); border: 1.5px dashed var(--line); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 0;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-around; align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); min-width: 60px; padding: 4px 6px; }
.tab.active { color: var(--ink); }
.tab.active .ico { stroke-width: 2.3; }
.tab.add {
  width: 58px; height: 58px; min-width: 0; border-radius: 50%; padding: 0; margin-top: -30px; justify-content: center;
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-lift);
}
.tab.add .ico { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- sheets ---------- */
#scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; margin: 0 auto; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lift);
  padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.sheet h2 { font-size: 22px; margin-bottom: 14px; }
.sub-h { font-size: 15px; margin: 8px 0 10px; color: var(--muted); font-family: var(--body); font-weight: 700; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; padding: 11px 6px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.multi button.on { background: var(--diaper-tint); }
.amount { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 6px 0 12px; }
.amount div { display: flex; align-items: baseline; gap: 4px; }
.amount input { width: 120px; text-align: center; font-family: var(--display); font-weight: 600; font-size: 48px; border: 0; background: transparent; padding: 0; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.amount input::-webkit-outer-spin-button, .amount input::-webkit-inner-spin-button { -webkit-appearance: none; }
.amount span { color: var(--muted); font-weight: 700; }
.round { width: 52px; height: 52px; border-radius: 50%; background: var(--feed-tint); color: var(--feed); font-size: 26px; font-weight: 700; display: grid; place-items: center; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.chips button { padding: 9px 15px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.chips button.on { background: var(--ink); color: var(--on-ink); }
.big-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.big-choices.three { grid-template-columns: repeat(3, 1fr); }
.choice {
  position: relative; border: 2px solid var(--line); border-radius: 20px; padding: 18px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--surface);
}
.choice b { font-family: var(--display); font-weight: 600; font-size: 19px; }
.choice span { color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.choice .emo { font-size: 32px; color: inherit; }
#preset-choices .choice:active { border-color: var(--feed); background: var(--feed-tint); }
.choice .tick { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); font-size: 13px; display: grid; place-items: center; color: transparent; }
.toggles .choice.on { border-color: var(--diaper); background: var(--diaper-tint); }
.toggles .choice.on .tick { background: var(--diaper); border-color: var(--diaper); color: var(--on-accent); }
#preset-edit-btn { margin: -4px auto 10px; font-size: 14px; }
.preset-editor { background: var(--surface-2); border-radius: var(--r-md); padding: 12px; margin: 0 0 14px; }
.preset-editor .chips { justify-content: flex-start; margin-bottom: 10px; }
.preset-editor .chips button { background: var(--surface); }
.preset-editor input { background: var(--surface) !important; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin: 12px 0 14px; }
.add-row input, .add-row select { margin: 0; }
.add-row select { width: auto; max-width: 130px; }
.add-row .btn { min-height: 0; padding: 10px 16px; }
.add-row.two { grid-template-columns: minmax(0, 1fr) auto; margin: 0; }
.big-timer { font-family: var(--display); font-size: 58px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; color: var(--sleep); margin: 4px 0; }
.pump-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.side { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 6px; text-align: center; }
.side > span { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.amount.small-amt { gap: 4px; margin: 6px 0 4px; }
.amount.small-amt input { width: 52px; font-size: 28px; }
.amount.small-amt span { font-size: 13px; }
.amount.small-amt .round { width: 34px; height: 34px; font-size: 20px; background: var(--pump-tint); color: var(--pump); }
.pump-total { text-align: center; margin: 14px 0; font-size: 15px; color: var(--muted); font-weight: 600; }
.pump-total b { font-family: var(--display); font-size: 24px; color: var(--ink); }
#pump-mins { justify-content: flex-start; }
#pump-mins button.on { background: var(--pump); color: var(--on-accent); }
#sheet-sleep .range-dates { grid-template-columns: 1fr; gap: 0; }

/* ---------- reports ---------- */
.range-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.range-chips::-webkit-scrollbar { display: none; }
.range-chips button { flex: none; padding: 9px 15px; border-radius: 999px; background: var(--surface); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.range-chips button.on { background: var(--ink); color: var(--on-ink); }
.range-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.range-dates .when { margin: 0 0 10px; }
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px 16px; margin-top: 12px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: var(--r-sm); padding: 11px 12px; min-width: 0; }
.stat span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat b { display: block; font-family: var(--display); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 16px; font-size: 13px; font-weight: 600; color: var(--muted); margin: -4px 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw.breast, .bar-seg.breast { background: var(--breast); }
.sw.formula, .bar-seg.formula { background: var(--formula); }
.sw.night, .bar-seg.night { background: var(--night); }
.sw.nap, .bar-seg.nap { background: var(--nap); }
.chart { position: relative; height: 200px; padding: 0 0 22px 44px; }
.chart .grid { position: absolute; inset: 0 0 22px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart .grid span { font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 2px; width: 100%; font-variant-numeric: tabular-nums; }
.bars { position: relative; height: 100%; display: flex; align-items: stretch; gap: 2px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; position: relative; outline: none; cursor: pointer; }
.col:hover .stack, .col:focus .stack { opacity: .8; }
.stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; max-width: 28px; width: 100%; margin: 0 auto; }
.bar-seg { display: block; width: 100%; min-height: 2px; }
.stack .bar-seg:first-child { border-radius: 4px 4px 0 0; }
.col .x { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 10px; width: max-content; max-width: 220px; pointer-events: none; z-index: 2; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.days { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.days th, .days td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.days th:first-child, .days td:first-child { text-align: left; }
.days th { font-size: 12px; color: var(--muted); font-weight: 700; }
.days tfoot td { font-weight: 700; border-bottom: 0; }

/* ---------- travel list ---------- */
.travel-progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
#travel-bar { height: 100%; background: var(--travel); width: 0; transition: width .2s; border-radius: 4px; }
.cat { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 20px 0 8px; }
.item { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: var(--r-sm); padding: 4px 6px 4px 12px; margin-bottom: 6px; }
.item .check { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 9px 0; font-weight: 500; }
.item .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: var(--on-accent); font-size: 14px; font-weight: 700; }
.item.packed .box { background: var(--travel); border-color: var(--travel); }
.item.packed .lbl { text-decoration: line-through; color: var(--muted); }
.mini { width: 36px; height: 36px; border-radius: 10px; color: var(--muted); flex: none; }
#add-item .btn { background: var(--travel); color: var(--on-accent); border-color: transparent; }

/* ---------- items to order ---------- */
.share-card { display: flex; gap: 12px; align-items: center; background: var(--travel-tint); border-radius: var(--r-lg); padding: 16px; }
.share-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-card .btn { background: var(--travel); color: var(--on-accent); border-color: transparent; white-space: nowrap; min-height: 44px; }
.order-form { display: grid; gap: 8px; }
.order-form input { margin: 0; }
.order-form-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.order-form .qty { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.order-form .qty input { padding: 12px 8px; }
.order { display: flex; gap: 10px; align-items: center; background: var(--surface); border-radius: var(--r-md); padding: 12px 10px 12px 14px; margin-bottom: 8px; }
.order-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.order-main b { overflow-wrap: anywhere; }
.order-main a { color: var(--feed); font-size: 14px; text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.order .chip { white-space: nowrap; }
.order.ordered .order-main b, .order.received .order-main b { color: var(--muted); }
.order.received .order-main b { text-decoration: line-through; }
.qty-badge { font-size: 13px; color: var(--muted); font-weight: 600; }
.claim { font-size: 13px; color: var(--gift); font-weight: 700; }
.done { font-size: 13px; color: var(--travel); font-weight: 700; }
#shared { padding-bottom: 40px; }
#shared > .muted { margin: 0 0 16px; }
#shared .order-actions { flex-direction: column; align-items: flex-end; }
#shared .btn.primary { background: var(--travel); color: var(--on-accent); min-height: 42px; padding: 8px 14px; }

/* ---------- settings ---------- */
.photo-pick { cursor: pointer; }

/* ---------- toast + alarm ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--on-ink); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: var(--shadow-lift);
}
#alarm { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.alarm-box { background: var(--surface); border-radius: 28px; padding: 28px 22px 20px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow-lift); }
.alarm-box .logo { font-size: 46px; }

/* ---------- baby photo backdrop ---------- */
/* a fixed layer (iOS ignores background-attachment: fixed) that fades into the page colour */
#backdrop { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center 30%; }
#backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.32) 0, rgba(0,0,0,0) 24%, color-mix(in srgb, var(--bg) 40%, transparent) 46%, color-mix(in srgb, var(--bg) 88%, transparent) 72%);
}
body.has-photo { background: transparent; }
body.has-photo #view-home { padding-top: 26vh; }
body.has-photo .top h1, body.has-photo .greet, body.has-photo .age { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
body.has-photo .next-card, body.has-photo .summary, body.has-photo .nap-hint {
  background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
body.has-photo .next-card.late { background: color-mix(in srgb, var(--danger-tint) 90%, transparent); }
body.has-photo .section, body.has-photo .day, body.has-photo .cat, body.has-photo .split, body.has-photo #view-travel > .muted {
  display: table; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
body.has-photo .split { margin: 10px auto 0; }

/* ---------- print (reports) ---------- */
@media print {
  .tabbar, .top .icon-btn, .range-chips, #r-print, #backdrop, #view-home, #view-travel, #view-orders { display: none !important; }
  body, body.has-photo { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  #app { padding-bottom: 0; }
}
.next-actions .chip { padding: 7px 12px; font-size: 13px; }
