/* BabyOps "nightlight": a dim, warm screen for 3 AM. No pure white anywhere. */
:root {
  --bg: #15100c;
  --surface: #1f1812;
  --surface-2: #2a2017;
  --line: #3a2c1f;
  --text: #e6d9c2;
  --muted: #a89880;
  --dim: #75684f;
  --ember: #e0a158;
  --ember-ink: #1c1209;
  --ember-glow: rgba(224, 161, 88, .22);
  --sage: #9fb68a;
  --sage-ink: #14190f;
  --madder: #c4717f;
  --madder-ink: #1d0d11;
  --radius: 22px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 400 17px/1.45 var(--sans); touch-action: manipulation;
  padding: var(--safe-t) 0 var(--safe-b);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--ember); outline-offset: 3px; border-radius: 12px;
}
a { color: var(--ember); }
.num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; font-optical-sizing: auto; }
.ampm { font: 500 .38em var(--sans); color: var(--muted); margin-left: .25em; letter-spacing: .02em; }
.wrap { width: 100%; max-width: 460px; margin: 0 auto; padding: 0 18px 40px; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 6px; }
.who {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px;
  background: var(--surface); border-radius: 999px; font-weight: 600; color: var(--text);
}
.who i { width: 10px; height: 10px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 10px var(--ember-glow); }
.who.ben i { background: var(--sage); }
.bar-r { display: flex; align-items: center; gap: 8px; }
.pings {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px 0 14px;
  border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 15px; color: var(--muted);
}
.pings .sw { width: 46px; height: 28px; border-radius: 999px; background: var(--surface-2); position: relative; transition: background .2s; border: 1px solid var(--line); }
.pings .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: transform .2s, background .2s; }
.pings[aria-checked="true"] { color: var(--text); }
.pings[aria-checked="true"] .sw { background: #3b2c19; border-color: var(--ember); }
.pings[aria-checked="true"] .sw::after { transform: translateX(18px); background: var(--ember); }
.gear { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--muted); text-decoration: none; }
.gear svg { width: 22px; height: 22px; }

.note { margin: 6px 0; padding: 10px 14px; border-radius: 14px; background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1.35; }
.note b { color: var(--text); font-weight: 600; }
.note.slim { padding: 8px 14px; font-size: 14px; margin: 4px 0; }
.note.okbar { display: block; margin-top: 26px; padding: 14px 16px; text-decoration: none; color: var(--ember); font-weight: 600; min-height: 48px; }
.note.warn { background: #2e1d14; color: #e3b98f; }
.note a { font-weight: 600; }

/* ---------- Gwen: the lamp ---------- */
.lamp { position: relative; margin: 10px auto 2px; width: min(66vw, 36svh, 300px); aspect-ratio: 1; display: grid; place-items: center; text-align: center; }
.lamp::before {
  content: ""; position: absolute; inset: -12%; border-radius: 50%;
  background: radial-gradient(closest-side, var(--ember-glow), transparent 72%);
}
.lamp.nursing::before { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
.lamp svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.lamp .track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.lamp .arc { fill: none; stroke: var(--ember); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.lamp.nursing .arc { stroke: var(--sage); }
.lamp-in { position: relative; padding: 0 12%; }
.lamp .time { font-size: clamp(48px, 15vw, 76px); line-height: 1; font-weight: 300; letter-spacing: -.02em; color: var(--text); font-variation-settings: "SOFT" 100, "WONK" 0; }
.lamp .sub { margin-top: 8px; color: var(--muted); font-size: 18px; font-weight: 500; }
.lamp .sub.late { color: var(--ember); }
.lamp .lbl { color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.hint { text-align: center; color: var(--dim); font-size: 14px; margin: 2px 0 0; min-height: 20px; }

.benline { margin: 6px 0 14px; padding: 10px 16px; border-radius: 16px; background: var(--surface); display: flex; gap: 12px; align-items: center; }
.benline .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.benline.seen .dot { background: var(--sage); }
.benline.toldben .dot { background: var(--ember); }
.benline p { margin: 0; font-size: 16px; line-height: 1.3; }
.benline small { display: block; color: var(--muted); font-size: 14px; }

/* ---------- Gwen: the buttons ---------- */
.big { display: block; width: 100%; border-radius: 30px; font-weight: 700; letter-spacing: -.005em; transition: transform .12s, filter .12s; position: relative; }
.big:active { transform: scale(.975); filter: brightness(.92); }
.nurse { min-height: 172px; background: var(--ember); color: var(--ember-ink); font-size: 34px; font-family: var(--serif); font-weight: 600; box-shadow: 0 0 60px var(--ember-glow); }
.nurse small { display: block; font: 500 17px var(--sans); opacity: .75; margin-top: 6px; }
.nurse.done { background: var(--sage); color: var(--sage-ink); box-shadow: 0 0 60px rgba(159,182,138,.16); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.pair .big { min-height: 120px; font-size: 24px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.pair .need { background: #3a1f26; color: #f0c6cd; border-color: #5a2d38; }
.pair .need small, .pair .big small { display: block; font: 500 14px var(--sans); color: inherit; opacity: .7; margin-top: 4px; }
.pair .need.sent { background: var(--surface); color: var(--muted); border-color: var(--line); }
.pair .need.acked { background: #1e2a19; color: var(--sage); border-color: #34462b; }
.quiet { display: block; margin: 12px auto 0; min-height: 48px; padding: 0 22px; border-radius: 999px; color: var(--muted); font-weight: 600; background: var(--surface); }

/* ---------- log ---------- */
.sec { margin-top: 30px; }
.sec h2 { font: 400 22px/1.2 var(--serif); margin: 0 0 12px; letter-spacing: -.01em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.stat { padding: 8px 0; }
.stat b { display: block; font: 300 36px/1 var(--serif); font-variant-numeric: lining-nums; }
.stat span { color: var(--muted); font-size: 14px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { border-top: 1px solid var(--line); }
.log button { width: 100%; display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: baseline; text-align: left; min-height: 52px; padding: 10px 2px; }
.log .t { font: 400 19px var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--text); }
.log .d { color: var(--text); }
.log .d small { color: var(--muted); font-size: 15px; margin-left: 6px; }
.log .open { color: var(--sage); }
.empty { color: var(--dim); padding: 14px 0; }
details.week { margin-top: 18px; }
details.week summary { min-height: 48px; display: flex; align-items: center; color: var(--muted); font-weight: 600; cursor: pointer; }
table.t7 { width: 100%; border-collapse: collapse; font-size: 16px; }
table.t7 th, table.t7 td { padding: 9px 4px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.t7 th:first-child, table.t7 td:first-child { text-align: left; }
table.t7 th { color: var(--muted); font-weight: 500; font-size: 14px; border-top: 0; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 5, 3, .7); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 460px; background: var(--surface); border-radius: 28px 28px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font: 400 24px var(--serif); margin: 0 0 16px; text-align: center; }
.sheet .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sheet .row3 button { min-height: 120px; border-radius: 24px; background: var(--surface-2); border: 1px solid var(--line); font: 600 24px var(--sans); }
.sheet .row3 button:active { background: #3b2c19; }
.sheet .cancel { margin-top: 14px; width: 100%; min-height: 56px; border-radius: 18px; color: var(--muted); font-weight: 600; }
.sheet label { display: block; color: var(--muted); font-size: 15px; margin: 12px 0 6px; }
input[type=time], input[type=date], input[type=text], input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 500 17px var(--sans);
}
input[type=time], input[type=date] { font-family: var(--serif); }
.btnrow { display: flex; gap: 12px; margin-top: 18px; }
.btn { flex: 1; min-height: 56px; border-radius: 18px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); padding: 0 16px; }
.btn.go { background: var(--ember); color: var(--ember-ink); border-color: var(--ember); }
.btn.danger { color: #e6a0a8; }
.idbtns { display: grid; gap: 14px; margin: 8px 0 6px; }
.idbtns button { min-height: 96px; border-radius: 26px; font: 600 30px var(--serif); background: var(--surface-2); border: 1px solid var(--line); }
.idbtns button.g { background: var(--ember); color: var(--ember-ink); border-color: var(--ember); }
.idbtns button.b { background: var(--sage); color: var(--sage-ink); border-color: var(--sage); }

.toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); max-width: min(92vw, 420px); z-index: 30; padding: 14px 20px; border-radius: 18px; background: #3b2c19; color: var(--text); font-weight: 600; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.err { background: #4a2229; color: #f3cdd2; }

/* ---------- Ben ---------- */
.ben-grid { display: block; }
.gwenstate { display: flex; gap: 12px; align-items: center; margin: 12px 0 8px; padding: 14px 16px; border-radius: 18px; background: var(--surface); }
.gwenstate .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sage); flex: none; }
.gwenstate.nursing .dot { background: var(--ember); box-shadow: 0 0 14px var(--ember-glow); }
.gwenstate p { margin: 0; line-height: 1.3; }
.gwenstate small { color: var(--muted); font-size: 15px; display: block; }
.alert { margin: 12px 0; padding: 18px; border-radius: 22px; background: #3a1f26; color: #f0c6cd; }
.alert.acked { background: #1e2a19; color: var(--sage); }
.alert h2 { margin: 0 0 4px; font: 500 28px var(--serif); }
.alert .btn { margin-top: 12px; background: #f0c6cd; color: #3a1f26; border: 0; width: 100%; }
.now { margin: 14px 0 6px; padding: 24px 22px 22px; border-radius: 30px; background: var(--surface); position: relative; box-shadow: inset 0 0 0 1px var(--line), 0 0 70px var(--ember-glow); }
.now .lbl { color: var(--ember); font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.now h1 { margin: 0; font: 400 clamp(30px, 8vw, 40px)/1.12 var(--serif); letter-spacing: -.015em; }
.now .when { margin-top: 12px; color: var(--muted); font-size: 18px; }
.now .told { margin-top: 12px; font-size: 15px; color: var(--muted); }
.now .told.seen { color: var(--sage); }
.now.idle { box-shadow: inset 0 0 0 1px var(--line); }
.now.idle .lbl { color: var(--muted); }
.rail { list-style: none; margin: 8px 0 0; padding: 0; }
.rail li { display: grid; grid-template-columns: 86px 1fr; gap: 6px; padding: 16px 2px; border-top: 1px solid var(--line); align-items: baseline; }
.rail .t { font: 300 28px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.rail .t .ampm { font-size: 14px; }
.rail .l { font-size: 19px; line-height: 1.3; }
.rail .l small { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }
.tag { font-style: italic; color: var(--dim); font-size: 14px; }
.now .tag { display: block; margin-top: 4px; }
.rail-h { font: 400 15px var(--sans); color: var(--muted); margin: 22px 0 0; }

@media (min-width: 900px) {
  body.ben .wrap { max-width: 1040px; }
  body.ben .ben-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; align-items: start; }
  body.ben .sec:first-child { margin-top: 0; }
}
@media (min-width: 700px) { .lamp { width: 280px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- gate ---------- */
.gate { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px 18px; text-align: center; }
.gate h1 { font: 300 38px var(--serif); margin: 0 0 6px; letter-spacing: -.01em; }
.gate p { color: var(--muted); margin: 0 0 26px; }
.dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 22px; height: 18px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--dim); transition: background .15s, border-color .15s; }
.dots i.on { background: var(--ember); border-color: var(--ember); box-shadow: 0 0 12px var(--ember-glow); }
.dots.bad { animation: shake .35s; }
.dots.bad i { border-color: var(--madder); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; justify-content: center; }
.pad button { height: 84px; border-radius: 50%; background: var(--surface-2); font: 300 34px var(--serif); border: 1px solid var(--line); }
.pad button:active { background: #3b2c19; }
.pad .ghost { background: none; border: 0; font: 600 16px var(--sans); color: var(--muted); }
.err { color: #e3a1aa; min-height: 24px; margin-top: 16px; font-weight: 600; }

/* ---------- settings ---------- */
.set h1 { font: 300 34px var(--serif); margin: 8px 0 4px; }
.set .back { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 600; }
.card { background: var(--surface); border-radius: 22px; padding: 16px; margin: 14px 0; }
.card h2 { font: 400 22px var(--serif); margin: 0 0 4px; }
.card p.m { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.item { border-top: 1px solid var(--line); padding: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.item .full { grid-column: 1 / -1; }
.item label { color: var(--muted); font-size: 13px; display: block; margin: 0 0 3px; }
.item .chk { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-size: 15px; }
.item .chk input { width: 22px; height: 22px; accent-color: var(--ember); }
.item .del { color: #e6a0a8; min-height: 44px; font-weight: 600; text-align: right; }
.unc { color: var(--ember); font-size: 13px; font-weight: 600; }
.stickysave { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); }
textarea.raw { min-height: 260px; font: 13px/1.4 ui-monospace, Menlo, monospace; }
