@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f4f2fb;
  --card: #ffffff;
  --ink: #201d33;
  --muted: #726f88;
  --line: #e8e5f2;
  --brand: #6a5acd;
  --brand-ink: #ffffff;
  --ok: #1f9d55;
  --ok-bg: #e6f6ec;
  --soon: #b26b00;
  --soon-bg: #fdf1dc;
  --exp: #c0392b;
  --exp-bg: #fbe6e3;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(40, 30, 80, 0.07);
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { padding-bottom: env(safe-area-inset-bottom); }

.wrap { max-width: 460px; margin: 0 auto; padding: 16px 16px 44px; }

/* header nav row (back + profile gear) */
.navbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.navbar .back { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 15px; }
.gear { background: var(--card); border: none; box-shadow: var(--shadow); width: 38px; height: 38px;
  border-radius: 50%; font-size: 17px; cursor: pointer; line-height: 1; }
.gear:active { transform: scale(0.94); }

/* homepage section headers + bottle list */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.sec-head:first-of-type { margin-top: 8px; }
.sec-head .section-title { margin: 0; }
.sec-link { color: var(--brand); font-weight: 600; font-size: 13px; text-decoration: none; }
.blist a { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.blist a:first-child { border-top: none; }
.blist .bn { font-weight: 600; font-size: 16px; }
.blist .bt { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* big stat row (pumping summary on home) */
.bigrow { display: flex; align-items: center; justify-content: space-between; }
.bigrow .n { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.bigrow .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.container-name { font-size: 22px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.container-name .edit { font-size: 13px; color: var(--brand); background: none; border: none; cursor: pointer; }
.slug-tag { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace;
  background: var(--bg); padding: 2px 8px; border-radius: 8px; }

/* status card */
.status { text-align: center; padding: 24px 18px; border-radius: var(--radius); margin-bottom: 14px; }
.status.ok   { background: var(--ok-bg); }
.status.soon { background: var(--soon-bg); }
.status.expired { background: var(--exp-bg); }
.status .headline { font-size: 13px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; }
.status.ok .headline { color: var(--ok); }
.status.soon .headline { color: var(--soon); }
.status.expired .headline { color: var(--exp); }
.status .count { font-size: 34px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.02em; }
.status .sub { font-size: 14px; color: var(--muted); }

.meta { display: flex; gap: 10px; margin-bottom: 14px; }
.meta .chip { flex: 1; background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 12px; }
.meta .chip .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.meta .chip .v { font-size: 15px; font-weight: 600; margin-top: 2px; }

.actions { display: grid; gap: 10px; margin-bottom: 8px; }
button.btn { font-size: 16px; font-weight: 600; border: none; border-radius: 12px;
  padding: 14px; cursor: pointer; }
button.btn.primary { background: var(--brand); color: var(--brand-ink); }
button.btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
button.btn.danger { background: var(--exp-bg); color: var(--exp); }
button.btn.small { padding: 10px; font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* log / history disclosure */
.disclosure summary { cursor: pointer; font-weight: 600; padding: 6px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .caret { color: var(--muted); }
.logline { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.logline .when { color: var(--ink); }
.logline .amt { color: var(--muted); }
.logline.oldest .when::after { content: " · sets expiry"; color: var(--brand); font-size: 12px; }
.mvbox { width: 18px; height: 18px; accent-color: var(--brand); vertical-align: -3px; margin-right: 6px; }

/* voice quick-log floating button */
.micfab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 24px; line-height: 1;
  box-shadow: 0 4px 16px rgba(40, 30, 80, 0.3); z-index: 15; }
.micfab:active { transform: scale(0.93); }

/* home Ask bar (Claude assistant) */
.askbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
  max-width: 460px; margin: 0 auto; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
.askpanel { background: var(--card); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 20px rgba(40,30,80,.12);
  padding: 8px 12px 12px; display: none; }
.askpanel.show { display: block; }
.askhead { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px;
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.askclose { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; }
#askmsgs { max-height: 42vh; overflow-y: auto; }
.askrow { display: flex; gap: 8px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); }
.askrow input { border: none; box-shadow: none; padding: 8px 0; font-size: 15px; flex: 1; background: transparent; }
.askrow input:focus { outline: none; }
.askmic, .asksend { border: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
  flex: 0 0 auto; font-size: 17px; }
.askmic { background: var(--bg); }
.askmic.live { background: var(--exp-bg); }
.asksend { background: var(--brand); color: #fff; }
.asksend:disabled { opacity: .5; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; margin: 6px 0; font-size: 14px; line-height: 1.4; }
.bubble.me { background: var(--brand); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.ai { background: var(--bg); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble.ai.logged { border: 1px solid var(--ok); }
.bubble.typing { color: var(--muted); }

.hist-batch { border-top: 1px solid var(--line); padding: 12px 0; }
.hist-batch .h { display: flex; justify-content: space-between; font-weight: 600; }
.hist-batch .d { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* forms */
label.field { display: block; margin-bottom: 14px; }
label.field .lbl { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: block; }
input, select { width: 100%; min-width: 0; font-size: 16px; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); }
.row2 > * { min-width: 0; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 12px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.amt-row { display: flex; gap: 8px; align-items: stretch; }
.amt-row input { flex: 1; }
.seg.unit { flex: 0 0 auto; width: 120px; }
.seg.unit button { padding: 12px 0; }

.title { font-size: 18px; font-weight: 700; margin: 0 0 14px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin: 22px 4px 10px; }
.section-title:first-of-type { margin-top: 8px; }
.linkdel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px;
  padding: 0 0 0 8px; }
.linkdel:active { color: var(--exp); }
.linkedit { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px;
  font-weight: 600; padding: 0 2px 0 10px; }
.soon-card { opacity: .55; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.disclaimer { font-size: 11px; color: var(--muted); text-align: center; margin-top: 18px; line-height: 1.5; }
.err { color: var(--exp); font-size: 13px; font-weight: 600; margin: 0 0 6px; min-height: 16px; }
.checkrow { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 15px; cursor: pointer; }
.checkrow input { width: 20px; height: 20px; accent-color: var(--brand); flex: 0 0 auto; }

/* diaper kind picker — big one-handed tap targets */
.kindgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kindgrid button { padding: 16px 8px; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kindgrid button .ke { font-size: 26px; line-height: 1; }
.kindgrid button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.invite-box { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex;
  align-items: center; justify-content: space-between; gap: 10px; }
.invite-box code { font-family: ui-monospace, monospace; font-weight: 700; font-size: 16px; letter-spacing: .08em; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,16,40,.4); display: flex;
  align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: var(--card); width: 100%; max-width: 460px; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 0 auto 14px; }
.back { background: none; border: none; color: var(--brand); font-size: 15px; cursor: pointer;
  padding: 0; margin-bottom: 10px; }

/* home quick-actions + last-event footer */
.zone-card { cursor: pointer; transition: transform .08s ease, box-shadow .15s ease; }
.zone-card:active { transform: scale(0.992); }
.zone-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.zone-last { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.qacts { display: flex; gap: 8px; flex-wrap: wrap; }
.qbtn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px;
  padding: 9px 15px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.qbtn:active { transform: scale(0.94); }
.qbtn.brand { background: var(--brand); color: #fff; border-color: var(--brand); }

/* transient confirmation toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(6px);
  bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 13px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; }
.toast.show { opacity: .97; transform: translateX(-50%) translateY(0); }

/* type polish */
.container-name { letter-spacing: -.02em; }
h1, h2, .title, .bigrow .n, .status .count { font-family: var(--font); }
button, input, select { font-family: var(--font); }
