/* Our Care. Tokens and rules: DESIGN.md. No inline styles anywhere (strict CSP). */
:root {
  color-scheme: light;
  --fs: 1rem;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --shell: #12324a; --shell-ink: #f2f7f8; --shell-ink-2: #b5c9d2; --shell-rule: rgba(242, 247, 248, .16);
  --ground: #eef4f5; --surface: #ffffff; --rule: #cfdde2; --ink: #10202b; --ink-2: #4a5f6b;
  --band: rgba(127, 183, 196, .30);
  --now: #c2187a; --now-on-shell: #ff74b8;
  --taken: #1f7a5a; --taken-on-shell: #8fd3b4; --taken-soft: #e3f1ea;
  --late: #8a5a00; --late-mark: #c98a1a; --late-on-shell: #f0b54a; --late-bg: #f6ead1;
  --missed: #b8322a; --missed-on-shell: #ff9283; --missed-bg: #f8e3e0;
  --upcoming: #4a5f6b; --upcoming-on-shell: #b5c9d2;
  --primary: #12324a; --on-primary: #ffffff;
  --bar: #f7fafb; --tab-on: #12324a; --seg: #e1eaed; --av: #d3e6eb; --av-ink: #12324a;
  --tick-ring: #6f8893; --toast: #10202b; --toast-ink: #f2f7f8; --toast-act: #9fd3df; --focus: #2b7f96;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --shell: #0c2131; --shell-ink: #efe6d6; --shell-ink-2: #a8a08f; --shell-rule: rgba(239, 230, 214, .14);
    --ground: #07141d; --surface: #0e2030; --rule: #1d3344; --ink: #efe6d6; --ink-2: #aaa190;
    --band: rgba(80, 150, 170, .26);
    --now: #ec6aaa; --now-on-shell: #ec6aaa;
    --taken: #6cc39c; --taken-on-shell: #6cc39c; --taken-soft: rgba(108, 195, 156, .12);
    --late: #e6ad50; --late-mark: #e6ad50; --late-on-shell: #e6ad50; --late-bg: rgba(230, 173, 80, .13);
    --missed: #ef7d70; --missed-on-shell: #ef7d70; --missed-bg: rgba(239, 125, 112, .13);
    --upcoming: #aaa190; --upcoming-on-shell: #a8a08f;
    --primary: #8cc6d3; --on-primary: #07141d;
    --bar: #0a1923; --tab-on: #8cc6d3; --seg: #152a3a; --av: #17324a; --av-ink: #cfe6ec;
    --tick-ring: #66808b; --toast: #e9e1d2; --toast-ink: #10202b; --toast-act: #12324a; --focus: #8cc6d3;
  }
}

html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
* { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select { font: inherit; color: inherit; background: none; border: 0; }
button, select, a { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
fieldset { border: 0; min-width: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--font); font-size: var(--fs); line-height: 1.3; -webkit-font-smoothing: antialiased; }
::selection { background: var(--band); }
input, select { caret-color: var(--primary); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.shell :focus-visible { outline-color: var(--shell-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.app { min-height: 100dvh; padding-bottom: calc(83px + env(safe-area-inset-bottom)); }
.page { padding-bottom: 28px; }
.page.surface { background: var(--surface); min-height: calc(100dvh - 120px); }

/* shell */
.shell { position: sticky; top: 0; z-index: 3; background: var(--shell); color: var(--shell-ink); padding-top: env(safe-area-inset-top); }
.shell-body { padding: 10px 20px 16px; }
.status-line { font-size: calc(32 / 17 * var(--fs)); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.status-sub { margin-top: 4px; font-size: calc(15 / 17 * var(--fs)); color: var(--shell-ink-2); font-variant-numeric: tabular-nums; }
.shell-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px 20px 14px; }
.shell-title h1 { font-size: calc(32 / 17 * var(--fs)); font-weight: 700; letter-spacing: -0.025em; }
.shell-btn { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--shell-rule); color: var(--shell-ink); font-size: calc(15 / 17 * var(--fs)); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.shell-btn svg { width: 16px; height: 16px; }
.navbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 6px 12px 12px; }
.navbar strong { font-weight: 600; text-align: center; }
.navbar .l, .navbar .r { min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; }
.navbar .l { justify-self: start; color: var(--shell-ink-2); }
.navbar .r { justify-self: end; font-weight: 700; }

/* day line (signature) */
.dayline { display: block; margin-top: 10px; overflow: visible; }
.dl-name { margin-top: 12px; font-size: calc(13 / 17 * var(--fs)); font-weight: 600; color: var(--shell-ink-2); }
.dl-band { fill: var(--band); }
.dl-track { fill: var(--shell-rule); }
.dl-tick { stroke: var(--shell-ink-2); stroke-opacity: .7; stroke-width: 1; }
.dl-tick.minor { stroke-opacity: .4; }
.dl-label { fill: var(--shell-ink-2); font-size: min(calc(11 / 17 * var(--fs)), 15px); font-weight: 500; font-variant-numeric: tabular-nums; }
.dl-now { stroke: var(--now-on-shell); stroke-width: 2; stroke-linecap: round; }
.dl-now-label { fill: var(--now-on-shell); font-size: min(calc(12 / 17 * var(--fs)), 16px); font-weight: 700; font-variant-numeric: tabular-nums; }

/* marks: shape and colour both carry state */
.on-shell { --hole: var(--shell); }
.on-ground { --hole: var(--ground); }
.on-surface { --hole: var(--surface); }
.mk-taken { --c: var(--taken); }
.mk-takenLate, .mk-late { --c: var(--late-mark); }
.mk-due { --c: var(--ink); }
.mk-upcoming, .mk-skipped { --c: var(--upcoming); }
.mk-missed { --c: var(--missed); }
.on-shell .mk-taken { --c: var(--taken-on-shell); }
.on-shell .mk-takenLate, .on-shell .mk-late { --c: var(--late-on-shell); }
.on-shell .mk-due { --c: var(--shell-ink); }
.on-shell .mk-upcoming, .on-shell .mk-skipped { --c: var(--upcoming-on-shell); }
.on-shell .mk-missed { --c: var(--missed-on-shell); }
.mk .mk-fill { fill: var(--c); }
.mk .mk-ring { fill: var(--hole); stroke: var(--c); }
.mk .mk-check { fill: none; stroke: var(--hole); }
.mk .mk-line { fill: none; stroke: var(--c); }
.mk-ico { flex: none; }

/* banners */
.banner { padding: 12px 20px; font-size: calc(15 / 17 * var(--fs)); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--rule); }
.banner-delayed, .banner-nobody, .banner-push { background: var(--late-bg); color: var(--ink); }
.banner-failing { background: var(--missed-bg); color: var(--ink); }

/* groups and rows */
.band-surface { background: var(--surface); }
.group { padding: 0 20px; }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 24px 0 10px; }
.group-head h2 { font-size: calc(20 / 17 * var(--fs)); font-weight: 700; letter-spacing: -0.015em; }
.group-head .count { font-size: calc(15 / 17 * var(--fs)); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.subhead { font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); padding: 12px 0 6px; }
.group-end { height: 8px; }
.row { display: grid; grid-template-columns: 1fr 48px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.row-main { display: grid; grid-template-columns: calc(70 / 17 * var(--fs)) 1fr; gap: 12px; text-align: left; align-items: start; min-height: 48px; padding: 2px 0; border-radius: 10px; }
.t { font-size: calc(20 / 17 * var(--fs)); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 1px; }
.t small { font-size: calc(13 / 17 * var(--fs)); font-weight: 500; color: var(--ink-2); margin-left: 2px; letter-spacing: 0; }
.name { display: block; font-size: var(--fs); font-weight: 600; }
.detail { display: block; font-size: calc(15 / 17 * var(--fs)); color: var(--ink-2); margin-top: 2px; }
.state { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: calc(14 / 17 * var(--fs)); font-weight: 600; font-variant-numeric: tabular-nums; }
.c-due { color: var(--ink); font-weight: 700; }
.c-late { color: var(--late); }
.c-missed { color: var(--missed); }
.c-taken { color: var(--taken); }
.c-muted { color: var(--ink-2); font-weight: 500; }
.tick { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--tick-ring); display: grid; place-items: center; transition: background-color .25s cubic-bezier(.16, 1, .3, 1), border-color .25s cubic-bezier(.16, 1, .3, 1), transform .2s cubic-bezier(.16, 1, .3, 1); }
.tick.need { border-color: var(--primary); border-width: 2.5px; }
.tick:active { transform: scale(.92); }
.tick svg { width: 24px; height: 24px; }
.tick svg path { stroke: var(--taken); stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .4s cubic-bezier(.16, 1, .3, 1) .05s; }
.tick.on { background: var(--taken-soft); border-color: var(--taken); border-width: 1.5px; }
.tick.on svg path { stroke-dashoffset: 0; }
.empty { padding: 48px 28px; text-align: center; color: var(--ink-2); font-size: var(--fs); line-height: 1.5; }
.empty a { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.note { font-size: calc(14 / 17 * var(--fs)); color: var(--ink-2); line-height: 1.45; padding: 10px 0 0; }

/* buttons */
.btn-sm { min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: calc(15 / 17 * var(--fs)); font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-fill { background: var(--primary); color: var(--on-primary); }
.btn-line { border: 1.5px solid var(--tick-ring); color: var(--ink); }
.btn-primary { width: 100%; min-height: 54px; border-radius: 15px; background: var(--primary); color: var(--on-primary); font-size: var(--fs); font-weight: 650; margin-top: 16px; font-variant-numeric: tabular-nums; }
.btn-quiet { width: 100%; min-height: 50px; border-radius: 15px; border: 1.5px solid var(--rule); font-size: var(--fs); font-weight: 600; margin-top: 10px; }
.textbtn { font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--missed); min-height: 44px; padding: 0 8px; display: inline-flex; align-items: center; }
.textbtn.ink { color: var(--primary); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: var(--bar); border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px 0 calc(8px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; font-size: calc(10.5 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); }
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--tab-on); }

/* toast */
.toast { position: fixed; left: 14px; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 8; background: var(--toast); color: var(--toast-ink); border-radius: 16px; padding: 10px 8px 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: calc(15 / 17 * var(--fs)); font-weight: 500; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .3s cubic-bezier(.16, 1, .3, 1), transform .3s cubic-bezier(.16, 1, .3, 1); }
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast .tacts { display: flex; flex: none; }
.toast button { min-height: 44px; font-weight: 700; color: var(--toast-act); padding: 6px 10px; border-radius: 8px; }

/* sheet */
.sheet-back { position: fixed; inset: 0; z-index: 6; background: rgba(4, 16, 24, .45); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; padding: 8px 20px calc(28px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px -16px rgba(0, 0, 0, .35); }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--rule); margin: 0 auto 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet h3 { font-size: calc(24 / 17 * var(--fs)); font-weight: 700; letter-spacing: -0.02em; }
.sheet .state { font-size: calc(15 / 17 * var(--fs)); margin-top: 12px; }
.icon-btn { width: 44px; height: 44px; margin: -5px -5px 0 0; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn span { width: 34px; height: 34px; border-radius: 50%; background: var(--seg); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.field-label { font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); margin: 22px 0 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--seg); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button, .seg label span { min-height: 44px; border-radius: 8px; font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; display: grid; place-items: center; }
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 2px 6px -2px rgba(0, 0, 0, .12); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg.filter { margin: 16px 20px 0; }
.list { margin-top: 18px; }
.list-row { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--rule); font-size: var(--fs); text-align: left; position: relative; }
.list-row:last-child { border-bottom: 1px solid var(--rule); }
.list-row select { position: absolute; inset: 0; opacity: 0; width: 100%; }
.chev { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.skip-form { display: flex; gap: 10px; padding: 10px 0; }
.skip-form input { flex: 1; min-height: 44px; border-bottom: 1px solid var(--rule); }
.sheet h4 { font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); margin: 20px 0 6px; }
.activity li { list-style: none; display: grid; grid-template-columns: calc(70 / 17 * var(--fs)) 1fr; gap: 12px; font-size: calc(15 / 17 * var(--fs)); padding: 5px 0; }
.activity .tnum { color: var(--ink-2); }

/* lists, forms, people */
.mrow { width: 100%; display: grid; grid-template-columns: 1fr auto 18px; gap: 10px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rule); text-align: left; }
.mrow .times { display: block; font-size: calc(15 / 17 * var(--fs)); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mrow .sup { font-size: calc(14 / 17 * var(--fs)); color: var(--ink-2); text-align: right; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; border-top: 1px solid var(--rule); }
.field.rule-end, .rule-end { border-bottom: 1px solid var(--rule); }
.field label, .field > span:first-child { flex: none; }
.field input, .field select { text-align: right; color: var(--ink-2); width: 100%; min-width: 0; padding: 14px 0; outline: none; }
.field input:focus, .field select:focus { color: var(--ink); }
.field .val { color: var(--ink-2); }
.field .pair { display: flex; gap: 8px; align-items: center; }
.field .pair input { width: 5em; }
.field .pair select { width: auto; }
.note-inline { font-size: calc(14 / 17 * var(--fs)); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.chip { min-height: 44px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; position: relative; }
.chip .x { width: 44px; height: 44px; margin-right: -6px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.chip .x svg { width: 14px; height: 14px; }
.chip.add { border-style: dashed; border-color: var(--tick-ring); padding: 0 16px 0 12px; background: none; }
.chip.add svg { width: 16px; height: 16px; }
.chip.add select { position: absolute; inset: 0; opacity: 0; width: 100%; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--tick-ring); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: left .25s cubic-bezier(.16, 1, .3, 1); }
.switch[aria-checked="true"] { background: var(--taken); }
.switch[aria-checked="true"]::after { left: 22px; }
.danger-row { display: flex; gap: 10px; padding: 26px 0 30px; }
.danger-row button { flex: 1; min-height: 48px; border-radius: 15px; border: 1.5px solid var(--rule); font-weight: 600; }
.danger-row .stop { color: var(--missed); }
.prow, .prow-form { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); }
.prow-form { grid-template-columns: minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; }
.prow-form input, .prow-form select { min-height: 44px; }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--av); color: var(--av-ink); font-weight: 700; display: grid; place-items: center; font-size: calc(16 / 17 * var(--fs)); }
.av.pending { background: none; border: 1.5px dashed var(--tick-ring); color: var(--ink-2); }
.who { display: block; font-size: var(--fs); font-weight: 600; }
.sub { display: block; font-size: calc(14 / 17 * var(--fs)); color: var(--ink-2); margin-top: 2px; }
.acts { display: flex; gap: 4px; }
.inline-form { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--rule); }
.inline-form label { font-size: calc(15 / 17 * var(--fs)); font-weight: 600; color: var(--ink-2); }
.inline-form input, .inline-form select { min-height: 44px; border-bottom: 1px solid var(--rule); }
.row-form { grid-template-columns: 1fr auto; align-items: center; }

/* join */
.join { padding: 0 20px; }
.install-hint { margin: 20px 0 8px; padding: 16px; border-radius: 15px; background: var(--surface); border: 1px solid var(--rule); line-height: 1.45; }
.install-hint ol { margin: 8px 0 8px 20px; }
.join-form { display: grid; gap: 10px; margin-top: 20px; }
.join-form label { font-weight: 600; }
.join-form input { min-height: 54px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); padding: 0 14px; font-size: calc(22 / 17 * var(--fs)); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.join-form input[name="name"], .join-form input[name="setup"] { font-size: var(--fs); letter-spacing: 0; }
.form-error { color: var(--missed); font-weight: 600; font-size: calc(15 / 17 * var(--fs)); }

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