/* Jurnal bebe v4.1.7 — "night nursery"
   Light theme by default, night-sky dark theme on request (☀️/🌙).
   Palette: indigo ink, moonlight cream, honey-apricot moon, sage.
   Typeface: Outfit (bundled, SIL OFL) — works fully offline. */

@font-face {
  font-family: "Outfit";
  src: url("fonts/Outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --night-1: #1a2140;      /* sky gradient top */
  --night-2: #2a3560;      /* sky gradient bottom */
  --moon: #f2b96b;
  --moon-soft: #f8d9a8;
  --bg: #f3f2ee;           /* warm paper under the night-sky header */
  --card: #ffffff;
  --ink: #1e2440;
  --muted: #5f6782;         /* 4.6:1 on white */
  --accent: #4a5aa8;       /* indigo action color */
  --line: #e2e4ef;
  --danger: #c0504a;
  --ok-ink: #2c6a4f;
  --ok-bg: #e2f1e8;
  --shadow: 0 1px 2px rgba(35, 42, 69, 0.05), 0 8px 24px rgba(35, 42, 69, 0.07);
  --shadow-lift: 0 2px 4px rgba(35, 42, 69, 0.07), 0 14px 34px rgba(35, 42, 69, 0.12);
  --ring: 0 0 0 4px rgba(74, 90, 168, 0.18);
  --radius: 18px;         /* cards, panels, tiles */
  --radius-sm: 12px;      /* buttons, inputs, thumbnails */
  --radius-xs: 8px;       /* code, bars, tiny chips */
  --fs-xs: 0.72rem; --fs-sm: 0.82rem; --fs-md: 0.9rem; --fs-lg: 1.15rem; --fs-xl: 1.4rem; --fs-2xl: 1.7rem;
  --tap: 2.75rem;          /* 44px: the smallest comfortable thumb target */
  /* spacing: every padding/gap sits on a 0.25rem grid (0.25 · 0.5 · 0.75 · 1 · 1.5 · 2) */
  /* per-event tints */
  --t-feed: #fdeeda; --t-feed-ink: #9a6420;
  --t-diaper: #e6f1ea; --t-diaper-ink: #35704f;
  --t-sleep: #e7e9f8; --t-sleep-ink: #4a5aa8;
  --t-measure: #f7e8ee; --t-measure-ink: #9a4a6b;
  --t-other: #fdf3d8; --t-other-ink: #8f7020;
  font-size: 1rem;
}

/* Light is the default; dark is a choice (☀️/🌙 in the header, remembered per device). */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #10152a;
    --card: #1a2140;
    --ink: #eceef8;
    --muted: #a3abcc;
    --accent: #93a2e8;
    --line: #2c3455;
    --ok-bg: #1e3a30;
    --ok-ink: #9ed8ba;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.5);
    --ring: 0 0 0 4px rgba(147, 162, 232, 0.25);
    --t-feed: #3a2f1c; --t-feed-ink: #f2c98a;
    --t-diaper: #1e332a; --t-diaper-ink: #9ed8ba;
    --t-sleep: #252c52; --t-sleep-ink: #b3bef2;
    --t-measure: #3a2431; --t-measure-ink: #eeaac8;
    --t-other: #38301a; --t-other-ink: #f0d992;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
}

h1 { font-size: var(--fs-2xl); font-weight: 750; margin: 1.1rem 0 0.35rem; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 1rem; font-weight: 680; margin: 1.2rem 0 0.5rem; letter-spacing: -0.012em; }
code {
  font-size: 0.82em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere; /* long paths/URLs must never widen the page */
}
h3 { font-size: var(--fs-md); margin: 1rem 0 0.3rem; color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
img { max-width: 100%; }
form { margin: 0; }          /* layout comes from .form / the parent, never from the browser */

.wrap { max-width: 720px; margin: 0 auto; padding: 0.5rem 1rem 3rem; }
.narrow { max-width: 460px; padding-top: 2rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; left: -9999px; }

/* ---- Sky header: the identity of the app ---- */
.sky {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--night-1), var(--night-2));
  color: #f3f0e8;
  padding: 0.75rem 1rem 0.75rem;
  border-radius: 0 0 26px 26px;
}
.sky-inner { max-width: 720px; margin: 0 auto; position: relative; }
.sky-top { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
  flex: none; width: 2.75rem; height: 2.75rem; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--moon); color: #2c3157; font-weight: 750; font-size: var(--fs-lg); letter-spacing: -0.02em;
}
.brand { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.brand-name { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-age { font-size: var(--fs-sm); color: rgba(255, 255, 255, 0.72); }

/* stars twinkle in headers and the hero */
.star {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #fdf3d8;
  opacity: 0.7;
  animation: twinkle 3.4s ease-in-out infinite;
}
.s1 { top: 18%; left: 8%; }
.s2 { top: 34%; left: 88%; animation-delay: 0.9s; }
.s3 { top: 68%; left: 74%; width: 3px; height: 3px; animation-delay: 1.7s; }
.s4 { top: 12%; left: 55%; width: 3px; height: 3px; animation-delay: 2.3s; }
.s5 { top: 60%; left: 30%; animation-delay: 1.2s; }
.s6 { top: 80%; left: 12%; width: 3px; height: 3px; animation-delay: 0.4s; }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.9; } }

/* ---- Tabs: top row on desktop, fixed bottom bar on phones ---- */
.tabs { display: flex; gap: 0.25rem; margin-top: 0.7rem; }
.tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #d9dcf0;
  font-size: var(--fs-sm);
}
.tabs a.on { background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 700; }
.tab-icon { font-size: var(--fs-lg); line-height: 1; }

@media (max-width: 640px) {
  .sky { padding-bottom: 1.1rem; }
  .tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    margin: 0;
    padding: 0.4rem 0.6rem calc(0.4rem + env(safe-area-inset-bottom));
    background: var(--card); /* fallback for browsers without color-mix() */
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabs a { color: var(--muted); }
  .tabs a.on { background: var(--t-sleep); color: var(--t-sleep-ink); }
}

/* ---- Cards & forms ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.85rem 0;
  box-shadow: var(--shadow);
}
.form label { display: block; margin: 0.55rem 0; font-size: var(--fs-md); font-weight: 600; }
.pair { display: grid; grid-template-columns: 1fr; gap: 0 0.75rem; }
@media (min-width: 641px) { .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form input:not([type="checkbox"]),
.day-nav input[type="date"] {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.75rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: inherit;
  box-shadow: inset 0 1px 2px rgba(35, 42, 69, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form input:hover:not(:focus) { border-color: var(--muted); }
.form input:focus, .day-nav input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
  outline: none;
}
.form input[type="date"], .form input[type="datetime-local"], .day-nav input[type="date"] {
  font-variant-numeric: tabular-nums;
}
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); }
.form .btn:not(.tiny) { width: 100%; text-align: center; }
.day-nav .btn { width: auto; margin-top: 0; }
.field-label { display: block; margin: 0.75rem 0 0.35rem; font-size: var(--fs-md); font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  min-height: var(--tap);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  margin-top: 0.55rem;
  box-shadow: 0 1px 2px rgba(35, 42, 69, 0.06);
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: 0 1px 2px rgba(35, 42, 69, 0.06); }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn.primary {
  background: var(--accent); /* fallback for browsers without color-mix() */
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(35, 42, 69, 0.15), 0 6px 16px rgba(74, 90, 168, 0.35);
}
.btn.primary:hover { box-shadow: 0 2px 4px rgba(35, 42, 69, 0.15), 0 10px 24px rgba(74, 90, 168, 0.45); }
.btn.primary:focus-visible { box-shadow: var(--ring), 0 6px 16px rgba(74, 90, 168, 0.35); }
.btn.ghost:hover { background: var(--line); }
.btn.tiny { min-height: 2rem; padding: 0.25rem 0.5rem; margin: 0; font-size: var(--fs-sm); line-height: 1; color: var(--muted); border-radius: var(--radius-xs); }
.btn.tiny:hover { color: var(--danger); border-color: var(--danger); }

.alert { background: #f7e5e3; color: var(--danger); padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-weight: 500; }
.ok { background: var(--ok-bg); color: var(--ok-ink); padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-weight: 500; animation: pop 0.25s ease-out; }
.warn { color: var(--danger); font-size: var(--fs-sm); }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }

/* ---- Hero: the moon that counts down to the next feed ---- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: linear-gradient(160deg, var(--night-1), var(--night-2));
  color: #f3f0e8;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.hero .today { flex: 1; min-width: 0; }
.hero .today h2 { margin: 0 0 0.5rem; color: #cfd4ee; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; }
.pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.today-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr)); gap: 0.5rem; }
.tstat {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}
.tstat strong { font-size: var(--fs-2xl); font-weight: 300; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tstat strong small { font-size: var(--fs-sm); font-weight: 600; color: #cfd4ee; }
.tstat span { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #cfd4ee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tstat em { font-style: normal; font-size: var(--fs-xs); color: var(--moon-soft); }
.pill {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: var(--fs-md);
  white-space: nowrap;
}

.ring { position: relative; width: 158px; height: 158px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: rgba(255, 255, 255, 0.07); stroke: rgba(255, 255, 255, 0.16); stroke-width: 8; }
.ring-fg {
  fill: none;
  stroke: var(--moon);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}
.ring.due .ring-fg { stroke: var(--moon-soft); animation: due-pulse 2s ease-in-out infinite; }
.ring.due .ring-text strong { color: var(--moon-soft); }
@keyframes due-pulse {
  0%, 100% { stroke-opacity: 0.55; stroke-width: 8; }
  50% { stroke-opacity: 1; stroke-width: 9; }
}
.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-text strong { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.ring-text span { font-size: var(--fs-xs); color: #cfd4ee; max-width: 100px; }

@media (max-width: 560px) {
  .hero { gap: 0.75rem; padding: 1rem 0.75rem; }
  .ring { width: 108px; height: 108px; }
  .ring-text strong { font-size: var(--fs-lg); }
  .ring-text span { font-size: var(--fs-xs); max-width: 76px; }
  .hero .today h2 { margin-bottom: 0.35rem; font-size: var(--fs-xs); }
  .today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .tstat { padding: 0.5rem 0.25rem; }
  .tstat strong { font-size: var(--fs-lg); }
}

/* ---- Segmented controls, toggles, swatches ---- */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 0.65rem 0; }
/* Visually-hidden inputs (toggles, swatches, dropzone, replaced pickers):
   these MUST win against .form input width/padding rules or they become
   invisible full-width ghosts that push the page sideways. */
.seg-opt input, .tog input, .swatch input, .drop input, .dtp-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.seg-opt, .tog { min-width: 0; }
.seg-opt span, .tog span {
  min-width: 0;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.seg-opt span:active, .tog span:active { transform: scale(0.97); }
.seg-opt input:checked + span {
  background: var(--t-sleep);
  border-color: var(--t-sleep-ink);
  color: var(--t-sleep-ink);
  box-shadow: inset 0 0 0 1px var(--t-sleep-ink);
}
.seg-opt input:focus-visible + span, .tog input:focus-visible + span, .swatch input:focus-visible + .sw-chip { box-shadow: var(--ring); }

.togs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 0.65rem 0; }
.tog span { padding: 1rem 0.5rem; font-size: 1rem; }
.tog-pee input:checked + span { background: var(--t-sleep); border-color: var(--t-sleep-ink); color: var(--t-sleep-ink); box-shadow: inset 0 0 0 1px var(--t-sleep-ink); }
.tog-poop input:checked + span { background: var(--t-feed); border-color: var(--t-feed-ink); color: var(--t-feed-ink); box-shadow: inset 0 0 0 1px var(--t-feed-ink); }
.tog input:checked + span::before { content: "✓ "; font-weight: 800; }
.tog-feed input:checked + span { background: var(--t-feed); border-color: var(--t-feed-ink); color: var(--t-feed-ink); box-shadow: inset 0 0 0 1px var(--t-feed-ink); }
.feed-togs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0.3rem 0 0.5rem; }
.swatch { min-width: 0; margin: 0; cursor: pointer; } /* a <label>: undo .form label's vertical margin */
.sw-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.sw-chip:active { transform: scale(0.96); }
.sw-dot {
  flex: 0 0 auto;
  width: 1.05rem; height: 1.05rem;
  border-radius: 50%;
  /* the outline keeps black visible on the night theme and white on the day theme */
  box-shadow: inset 0 0 0 1.5px rgba(128, 128, 128, 0.45);
  transition: transform 0.12s;
}
.swatch input:checked + .sw-chip {
  border-color: var(--accent);
  background: var(--t-sleep);
  color: var(--t-sleep-ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.swatch input:checked + .sw-chip .sw-dot { transform: scale(1.2); }
.swatch input:focus-visible + .sw-chip { box-shadow: var(--ring); }
@media (max-width: 380px) { .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Custom date/time picker (desktop) ---- */
.dtp {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.75rem;
  font: inherit;
  font-weight: 500;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(35, 42, 69, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-variant-numeric: tabular-nums;
}
.dtp:hover { border-color: var(--muted); }
.dtp:focus-visible { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.dtp.empty .dtp-val { color: var(--muted); font-weight: 400; }
.dtp-ico { font-size: 1rem; }
.day-nav .dtp { margin-top: 0; flex: 1; width: auto; }

.dtp-pop {
  position: absolute;
  z-index: 40;
  width: 322px;
  max-width: calc(100vw - 16px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 0.75rem;
  animation: pop 0.14s ease-out;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cal-head strong { font-size: var(--fs-md); text-transform: capitalize; letter-spacing: -0.01em; }
.cal-nav {
  font: inherit;
  font-size: var(--fs-lg);
  line-height: 1;
  width: 2rem; height: 2rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-nav:hover { background: var(--t-sleep); color: var(--t-sleep-ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); padding: 0.25rem 0; }
.cal-day {
  font: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
}
.cal-day:hover:not(:disabled) { background: var(--t-sleep); color: var(--t-sleep-ink); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--line); }
.cal-day.sel { background: var(--accent); color: #fff; font-weight: 700; box-shadow: none; }
.cal-day:disabled { color: var(--line); cursor: default; }

.tp { display: flex; align-items: stretch; justify-content: center; gap: 0.25rem; margin-top: 0.7rem; }
.tp-sep { align-self: center; font-weight: 800; color: var(--muted); }
.tp-col {
  height: 168px;
  width: 4.2rem;
  overflow-y: auto;
  scrollbar-width: thin;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.25rem;
  scroll-snap-type: y proximity;
}
.tp-it {
  display: block;
  width: 100%;
  font: inherit;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-md);
  padding: 0.5rem 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--ink);
  cursor: pointer;
  scroll-snap-align: center;
  transition: background 0.12s;
}
.tp-it:hover { background: var(--t-sleep); color: var(--t-sleep-ink); }
.tp-it.sel { background: var(--accent); color: #fff; font-weight: 700; }
.dtp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.dtp-foot .btn { margin-top: 0; padding: 0.5rem 1rem; width: auto; }

/* ---- Time chips ---- */
.time-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.time-chip {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.time-chip:hover { background: var(--t-sleep); color: var(--t-sleep-ink); }

/* ---- Drag & drop photo zone ---- */
.drop { display: block; margin: 0.65rem 0; cursor: pointer; }
.drop-face {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  font-size: var(--fs-md);
  transition: border-color 0.15s, background 0.15s;
}
.drop-ico { font-size: var(--fs-xl); }
.drop:hover .drop-face, .drop.over .drop-face { border-color: var(--accent); background: var(--t-sleep); color: var(--t-sleep-ink); }
.drop.has-file .drop-face { border-style: solid; border-color: var(--ok-ink); background: var(--ok-bg); color: var(--ok-ink); }
.drop-prev { display: block; max-width: 130px; border-radius: var(--radius-xs); margin-top: 0.45rem; }
.drop-head { display: flex; align-items: center; gap: 0.5rem; }
.drop-actions { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.drop-btn {
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 650;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.drop-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 641px) {
  .drop-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drop-btn { padding: 0.75rem 1rem; font-size: var(--fs-md); }
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 13, 26, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.15s ease-out;
}
.lightbox figure { margin: 0; max-width: min(92vw, 900px); max-height: 88vh; text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: var(--radius-sm); box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.lightbox figcaption { color: #d9dcf0; font-size: var(--fs-md); padding-top: 0.6rem; }
.lbx {
  position: absolute;
  font: inherit;
  font-size: var(--fs-xl);
  line-height: 1;
  width: 2.8rem; height: 2.8rem;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.lbx:hover { background: rgba(255,255,255,0.25); }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 0.7rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.7rem; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; }
@media (max-width: 560px) { .lb-prev, .lb-next { top: auto; bottom: 1rem; transform: none; } }

/* ---- "time since" action hub ---- */
.last-row { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 0.75rem 0; }
.last { min-width: 0; margin: 0; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.last-ico { flex: none; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: var(--radius-sm); font-size: var(--fs-lg); }
.last-ico.t-feed { background: var(--t-feed); } .last-ico.t-diaper { background: var(--t-diaper); }
.last-ico.t-sleep { background: var(--t-sleep); } .last-ico.t-other { background: var(--t-other); }
.last-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.last .qform, .last .qrow { flex: none; }
.last-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.last strong { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last.sleeping { background: var(--t-sleep); border-color: transparent; }
.last.sleeping .last-label, .last.sleeping strong { color: var(--t-sleep-ink); }
.last.sleeping .last-ico { background: rgba(255, 255, 255, 0.5); }
.qform { display: inline-flex; margin: 0; }
.panel .qform { display: flex; width: 100%; margin: 0.5rem 0 0.2rem; }
.panel .qform .btn { width: 100%; margin-top: 0; }
.or-sep { margin: 0.9rem 0 0.2rem; font-size: var(--fs-sm); }
.qrow { display: flex; gap: 0.25rem; }
.qbtn {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 2.25rem;
  border-radius: 999px;
}
.qbtn:hover { background: var(--t-sleep); color: var(--t-sleep-ink); }
.qbtn:active { transform: scale(0.95); }


.ok-undo { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.ok-undo .btn.tiny { background: var(--card); }
/* ---- Quick add: tile buttons open one panel below the grid ---- */
.quick { container-type: inline-size; }
.tile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; } /* 3 + 2 */
@container (min-width: 30rem) { .tile-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  font: inherit;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink);
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
  overflow-wrap: anywhere;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tile:active { transform: scale(0.96); box-shadow: var(--shadow); }
.tile:focus-visible { box-shadow: var(--ring); outline: none; }
.tile-icon {
  display: grid;
  place-items: center;
  width: 2.9rem; height: 2.9rem;
  border-radius: var(--radius);
  font-size: var(--fs-xl);
}
.t-feed .tile-icon    { background: var(--t-feed); }
.t-diaper .tile-icon  { background: var(--t-diaper); }
.t-sleep .tile-icon   { background: var(--t-sleep); }
.t-measure .tile-icon { background: var(--t-measure); }
.t-other .tile-icon   { background: var(--t-other); }
.t-feed.on    { background: var(--t-feed);    border-color: var(--t-feed-ink);    color: var(--t-feed-ink); }
.t-diaper.on  { background: var(--t-diaper);  border-color: var(--t-diaper-ink);  color: var(--t-diaper-ink); }
.t-sleep.on   { background: var(--t-sleep);   border-color: var(--t-sleep-ink);   color: var(--t-sleep-ink); }
.t-measure.on { background: var(--t-measure); border-color: var(--t-measure-ink); color: var(--t-measure-ink); }
.t-other.on   { background: var(--t-other);   border-color: var(--t-other-ink);   color: var(--t-other-ink); }
.panel {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.5rem 1rem 1rem;
  margin-top: 0.7rem;
  animation: pop 0.18s ease-out;
}
@media (max-width: 720px) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { font-size: var(--fs-sm); padding: 0.75rem 0.25rem; }
}

/* ---- Events: a timeline with colored dots ---- */
.events { list-style: none; padding: 0; margin: 0.6rem 0 0.6rem 0.55rem; border-left: 2px solid var(--line); }
.event {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem 1rem;
  margin: 0.55rem 0 0.55rem 1.1rem;
}
.event::before {
  content: "";
  position: absolute;
  left: -1.53rem;
  top: 1.15rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--bg);
}
.ev-feed::before   { background: var(--t-feed-ink); }
.ev-diaper::before { background: var(--t-diaper-ink); }
.ev-sleep::before  { background: var(--t-sleep-ink); }
.ev-weight::before, .ev-height::before, .ev-head::before, .ev-temp::before { background: var(--t-measure-ink); }
.ev-note::before, .ev-bath::before, .ev-medicine::before, .ev-photo::before { background: var(--t-other-ink); }
.ev-emoji { font-size: var(--fs-xl); }
.ev-body { flex: 1; min-width: 0; }
.ev-body strong { display: block; font-size: var(--fs-md); }
.ev-detail { color: var(--muted); font-size: var(--fs-md); overflow-wrap: anywhere; }
.parts { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.part {
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--t-feed);
  color: var(--t-feed-ink);
  white-space: nowrap;
}
.ev-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.ev-actions { display: flex; gap: 0.25rem; }
.event time { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-sep {
  margin: 1.3rem 0 0.2rem -0.65rem;
  font-weight: 800;
  font-size: var(--fs-md);
  background: var(--bg);
  padding: 0.25rem 0;
}
.thumb { max-width: 140px; border-radius: var(--radius-xs); margin-top: 0.45rem; display: block; }

/* ---- Filters & pager ---- */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.85rem 0; }
.chip {
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(35, 42, 69, 0.05);
  transition: transform 0.12s, box-shadow 0.15s;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 1.2rem 0; }

/* ---- Stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin: 0.85rem 0; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; background: var(--t-measure); border-color: transparent; }
.stat strong { font-size: var(--fs-xl); color: var(--t-measure-ink); letter-spacing: -0.01em; }
.stat-label { font-size: var(--fs-sm); font-weight: 600; }
.bars { margin: 0.3rem 0 0.9rem; }
.bar-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: var(--fs-sm); }
.bar-label { flex: 0 0 3.6rem; color: var(--muted); }
.bar-track { flex: 1; height: 1rem; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--moon));
  border-radius: 999px;
  min-width: 3px;
}
.bar-val { flex: 0 0 4rem; text-align: right; font-variant-numeric: tabular-nums; }
/* ---- Expenses ---- */
.form input.big-amount { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.month-title { margin: 0; flex: 1; text-align: center; text-transform: capitalize; }
.month-total { margin: 0.5rem 0 0.9rem; text-align: center; font-size: var(--fs-2xl); font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.nav-ph { visibility: hidden; }
.catbars { display: grid; gap: 0.5rem; }
.catbar { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; font-size: var(--fs-md); }
.catbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catbar-track { height: 0.65rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.catbar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.catbar-sum { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) {
  .catbar { grid-template-columns: 7.2rem minmax(0, 1fr); }
  .catbar-sum { grid-column: 2; margin-top: -0.2rem; }
}
.exp { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; margin: 0.5rem 0; }
.exp-thumb { flex: 0 0 auto; width: 52px; height: 52px; border-radius: var(--radius-xs); overflow: hidden; display: grid; place-items: center; }
.exp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.exp-noimg { background: var(--bg); font-size: var(--fs-xl); }
.exp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.exp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.exp-sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-actions { display: flex; gap: 0.25rem; }
.exp-actions form { display: inline-flex; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }

/* ---- Expense trend ---- */
.etrend { width: 100%; height: auto; display: block; }
.et-bar { fill: var(--accent); }
.et-val { fill: var(--muted); font-size: var(--fs-md); text-anchor: middle; font-variant-numeric: tabular-nums; }
.et-mon { fill: var(--muted); font-size: var(--fs-md); text-anchor: middle; }
.et-base { stroke: var(--line); stroke-width: 1; }
.alltime { margin: 0.6rem 0 0; text-align: center; color: var(--muted); }
.alltime strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.money-card .month-total { margin: 0.4rem 0 0.2rem; }

/* ---- Baby switcher ---- */
.kids { display: inline-flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; margin-top: 0.75rem; }
.kids form { display: inline-flex; }
.kid {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}
.kid:hover { background: rgba(255, 255, 255, 0.12); }
.kid-on { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: transparent; cursor: default; }

/* ---- Offline toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 5.4rem;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: var(--fs-md);
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  max-width: calc(100vw - 2rem);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 641px) { .toast { bottom: 1.4rem; } }

/* ---- Breastfeeding timer ---- */
.nurse { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.8rem; }
.nurse-clock { font-size: var(--fs-2xl); font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.nurse-row, .btn-row { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.btn-row .btn, .btn-row .qform { width: 100%; margin: 0; display: flex; justify-content: center; }
@media (min-width: 641px) { .nurse-row, .btn-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nurse .qform { display: flex; width: 100%; }
.nurse .qform > .btn { width: 100%; margin-top: 0; }
.nurse small { font-size: var(--fs-xs); font-weight: 500; opacity: 0.85; margin-left: 0.3rem; }

/* ---- Theme toggle (in the sky bar) ---- */
.theme-btn {
  flex: none; width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center;
  border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 1rem; cursor: pointer;
}
.theme-btn:hover { background: rgba(255, 255, 255, 0.22); }

/* ---- Settings sub-tabs ---- */
.subtabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.subtabs a {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 600;
}
.subtabs a.on { background: var(--accent); border-color: transparent; color: #fff; }
.google-btn { display: block; text-align: center; margin-top: 0.6rem; }

/* ---- Backup channels ---- */
.row-form { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.4rem 0; }
.row-form .btn { margin-top: 0; width: auto; }
.ok-dot { color: var(--ok-ink); font-weight: 700; font-size: var(--fs-md); }
.kid-row {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.kid-row:last-child { border-bottom: 0; }
.rl { list-style: none; padding: 0; margin: 0.3rem 0; }
.members { list-style: none; padding: 0; margin: 0.3rem 0; }
.member { padding: 0.75rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.5rem; }
.member:last-child { border-bottom: 0; }
.member-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.badge { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.25rem 0.5rem; border-radius: 999px; background: var(--t-sleep); color: var(--t-sleep-ink); }
.member-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.member-actions .vax-mark[open] { flex-basis: 100%; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.danger:hover { background: rgba(192, 80, 74, 0.1); }

/* ---- Pediatrician report ---- */
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.report h1 { margin: 0 0 0.2rem; font-size: var(--fs-xl); }
.report h2 { margin: 1.1rem 0 0.45rem; font-size: 1rem; }
.rt { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.rt th { text-align: left; font-weight: 600; padding: 0.5rem 0.5rem 0.5rem 0; white-space: nowrap; }
.rt td { padding: 0.5rem 0.75rem 0.5rem 0; }
.rt tr + tr { border-top: 1px solid var(--line); }
.report .rl { list-style: disc; padding-left: 1.1rem; }
.rl li { margin: 0.25rem 0; }
.rq { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem; }
.small { font-size: var(--fs-sm); }
.form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.75rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}
.form textarea:focus-visible { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.form select.native { display: block; width: 100%; margin-top: 0.3rem; padding: 0.75rem; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); }
@media print {
  .sky, .tabs, .foot, .no-print, .ok { display: none !important; }
  body { background: #fff; padding-left: 0 !important; }
  .wrap { max-width: none; padding: 0; }
  .report { box-shadow: none; border: 0; }
}

/* ---- Rhythm insights ---- */
.insights h2 { margin-bottom: 0.4rem; }
.ins {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.45rem 0;
  font-size: var(--fs-md);
  line-height: 1.45;
}
.ins-ico { flex: 0 0 auto; font-size: 1rem; }
.ins-due {
  background: var(--t-feed);
  color: var(--t-feed-ink);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

/* ---- Sleep heatmap ---- */
.heatmap { width: 100%; height: auto; display: block; }
.hm-grid { stroke: var(--line); stroke-width: 1; }
.hm-hour { font-size: var(--fs-xs); fill: var(--muted); text-anchor: middle; }
.hm-day { font-size: var(--fs-xs); fill: var(--muted); text-anchor: end; font-variant-numeric: tabular-nums; }
.hm-sleep { fill: var(--accent); opacity: 0.85; }

.wchart { width: 100%; height: auto; }
.wline { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.wdot { fill: var(--moon); stroke: var(--card); stroke-width: 2; }
.ax { font-size: var(--fs-xs); fill: var(--muted); }

/* ---- Stats: day picker ---- */
.day-nav { display: flex; align-items: center; gap: 0.5rem; }
.day-nav input[type="date"] { flex: 1; min-width: 0; margin-top: 0; }
.day-view .pill { background: var(--bg); border-color: var(--line); color: var(--ink); }
.day-view .events { margin-top: 0.8rem; }

/* ---- Carnet: vaccines + milestones ---- */
.vax, .miles { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.vax-item, .mile {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px solid var(--line);
}
.vax-item:last-child, .mile:last-child { border-bottom: 0; }
.vax-main strong, .mile-main strong { display: block; font-size: var(--fs-md); }
.vax-main .muted, .mile-main .muted { font-size: var(--fs-sm); }
.vax-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.vax-item:has(.vax-mark[open]), .mile:has(.vax-mark[open]) { flex-wrap: wrap; }
.vax-item:has(.vax-mark[open]) .vax-side, .mile:has(.vax-mark[open]) .vax-side { flex-basis: 100%; align-items: stretch; }
.vax-badge { font-size: var(--fs-sm); font-weight: 700; padding: 0.25rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.vax-badge.done { background: var(--ok-bg); color: var(--ok-ink); }
.vax-badge.upcoming { background: var(--t-sleep); color: var(--t-sleep-ink); }
.vax-badge.overdue { background: #f7e5e3; color: var(--danger); }
.vax-mark summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}
.vax-mark summary::-webkit-details-marker { display: none; }
.vax-mark summary::marker { content: ""; }
.vax-mark[open] { flex-basis: 100%; }
.vax-mark[open] summary { background: var(--accent); color: #fff; border-color: transparent; }
.vax-mark[open] > .form {
  margin-top: 0.6rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}
.vax-mark[open] > .form .btn { width: 100%; }
.mile.hit .mile-main strong { color: var(--ok-ink); }
.mile.hit .mile-main strong::before { content: "✓ "; }
.mile-bar { height: 0.6rem; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 0.4rem 0 0.2rem; }
.mile-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--moon)); border-radius: 999px; }
.mile-add { margin-top: 0.9rem; }

.vax-banner {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
  text-decoration: none;
  color: var(--t-feed-ink);
  background: var(--t-feed);
  border-color: transparent;
}
.vax-banner span { color: inherit; opacity: 0.85; font-size: var(--fs-md); }

/* WHO percentile band */
.wband { fill: var(--t-sleep); opacity: 0.65; }
.wmid { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.wgrid { stroke: var(--line); stroke-width: 1; }
.wpct { font-weight: 700; }

/* ---- Gallery: polaroids pinned to the wall ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-top: 1rem; }
.gitem {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow);
  padding: 0.5rem 0.5rem 0.75rem;
  transform: rotate(-1.3deg);
  transition: transform 0.18s;
}
.gitem:nth-child(2n) { transform: rotate(1.2deg); }
.gitem:nth-child(3n) { transform: rotate(-0.6deg); }
.gitem:hover { transform: rotate(0) scale(1.03); }
.gitem img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.gitem figcaption { font-size: var(--fs-sm); color: var(--muted); padding: 0.5rem 0.25rem 0; text-align: center; }

/* ---- Login ---- */
.login-box { max-width: 380px; margin: 6vh auto 0; padding: 0 1rem; text-align: center; }
.login-box .card { text-align: left; }
.moon-art { position: relative; display: inline-block; padding: 0.5rem 2.5rem; }
.moon-art .star { animation-duration: 2.8s; background: var(--moon); }
.moon-body { fill: var(--moon); }
.moon-crater { fill: rgba(0, 0, 0, 0.09); }
.moon-smile { fill: none; stroke: #7a5320; stroke-width: 3; stroke-linecap: round; }
.moon-eye { fill: #7a5320; }

.foot { text-align: center; color: var(--muted); font-size: var(--fs-sm); padding: 1.25rem 1rem 3rem; }

@media (min-width: 641px) {
  .wrap { padding-bottom: 3rem; }
  .foot { padding-bottom: 1.2rem; }
}

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


/* ============================================================
   Desktop (≥1100px): a different app, not a stretched phone.
   Left navigation rail + two-column flowing content.
   Mobile and tablet above are untouched.
   ============================================================ */
@media (min-width: 1100px) {
  body { padding-left: 232px; }

  /* --- the sky becomes a full-height left rail --- */
  .sky {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 232px;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
    border-radius: 0; /* the phone header's rounded bottom has no place on a rail */
  }
  .sky-inner {
    max-width: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .brand-name { font-size: var(--fs-xl); }
  .kids { margin-top: 1rem; }
  .tabs { flex-direction: column; margin-top: 1.6rem; }
  .tabs a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: var(--fs-md);
  }
  .tabs a span { font-size: var(--fs-lg); }

  /* --- content: wide, breathing --- */
  .wrap {
    max-width: none; /* the phone cap (720px) has no place next to a rail */
    padding: 2rem 2.5rem 3rem;
  }
  /* Home is a fixed two-column grid: live things left, status right, hero across the top.
     Column width is whatever is left after the rail; the hub adapts inside it (3+2 or 5 tiles). */
  .page-acasa {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "ok ok"
      "hero hero"
      "quick last"
      "quick insights"
      "quick vax"
      "recent recent";
    gap: 0 1.5rem;
    align-items: start;
  }
  .page-acasa > * { margin-top: 0; margin-bottom: 1.5rem; }
  .page-acasa > .ok { grid-area: ok; }
  .page-acasa > .hero { grid-area: hero; }
  .page-acasa > .quick { grid-area: quick; }
  .page-acasa > .last-row { grid-area: last; }
  .page-acasa > .insights { grid-area: insights; }
  .page-acasa > .vax-banner { grid-area: vax; }
  .page-acasa > .recent { grid-area: recent; }
  .page-acasa > .recent .events { max-width: 60rem; } /* a wide screen is no reason for 1600px event rows */
  .page-acasa > .hero .today { max-width: 40rem; }    /* four stats, not four billboards */
  /* list pages flow into two columns */
  .page-statistici, .page-cheltuieli, .page-carnet {
    columns: 2;
    column-gap: 1.5rem;
  }
  .page-statistici > *, .page-cheltuieli > *, .page-carnet > * {
    break-inside: avoid;
    margin-top: 0;
    margin-bottom: 1.5rem;
  }
  .page-statistici > .ok, .page-cheltuieli > .ok, .page-carnet > .ok,
  .page-cheltuieli > h1, .page-carnet > h1, .page-statistici > h1 {
    column-span: all;
  }
  /* journal & gallery stay single-column, just roomier */
  .page-jurnal, .page-galerie { max-width: 780px; margin-left: auto; margin-right: auto; }
  .page-setari { max-width: 860px; margin-left: auto; margin-right: auto; }
  .subtabs { position: sticky; top: 0; z-index: 5; padding: 0.5rem 0; background: var(--bg); }

  /* touches that read better with a mouse */
  .hero { margin-top: 0; }
  .toast { bottom: 2rem; left: calc(50% + 116px); }
}
