/* Clarity Home: a white board in a dark frame. Each person writes in their own marker color. */
:root {
  --frame: #1C1510; --frame-2: #2D241C; --frame-ink: #F7F0E6; --frame-ink-2: #D2C5B5;
  --board: #FFFFFF; --board-2: #F4F2EF; --line: #E3DED7; --line-strong: #857B72;
  --ink: #1F1B17; --ink-2: #5A524A;
  --accent: #1E56A0; --accent-ink: #FFFFFF; --accent-soft: #E9F0F9;
  --ok: #1F7A3A; --danger: #B3261E; --danger-bg: #FCEBE9; --warn-ink: #774B00; --warn-bg: #FFF3D6;
  --focus-ink: #1C1510; --focus-halo: #FFFFFF;
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --frame: #0F0B08; --frame-2: #231C16; --frame-ink: #F7F0E6; --frame-ink-2: #CDBFAE;
    --board: #1A1613; --board-2: #241F1A; --line: #3A322B; --line-strong: #93887C;
    --ink: #F3EDE5; --ink-2: #C2B7AA;
    --accent: #93B8EE; --accent-ink: #0F0B08; --accent-soft: #1E2A3A;
    --ok: #7CCB93; --danger: #F4A097; --danger-bg: #3A1D1A; --warn-ink: #F3C66B; --warn-bg: #33270F;
    --focus-ink: #FFFFFF; --focus-halo: #0F0B08;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; box-shadow: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.45; color: var(--ink);
  background: var(--frame); min-height: 100vh; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 28px; margin: 4px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 26px 0 8px; }
h3 { font-size: 17px; margin: 16px 0 6px; }
p { margin: 8px 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
img, svg { display: block; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -120px; z-index: 100; background: var(--board); color: var(--ink); padding: 12px 16px; border-radius: 10px; font-weight: 700; }
.skip:focus { top: calc(var(--safe-t) + 10px); }

:focus-visible { outline: 3px solid var(--focus-ink); outline-offset: 2px; box-shadow: 0 0 0 8px var(--focus-halo); }
.topbar :focus-visible, .tabbar :focus-visible, .toast :focus-visible, .demo-bar :focus-visible { outline-color: var(--frame-ink); box-shadow: 0 0 0 8px var(--frame); }
main:focus { outline: none; }
main:focus-visible { outline: none; box-shadow: none; }

.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.inline { display: inline-block; width: 16px; height: 16px; vertical-align: -2px; margin: 0 4px; }

/* ---------- frame ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--frame); color: var(--frame-ink); padding: calc(var(--safe-t) + 8px) 12px 8px 16px; }
.topbar-inner { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; min-height: 48px; }
.brand { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 17px; }
.household { font-size: 14px; color: var(--frame-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.household:empty { display: none; }
.sync { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--frame-ink-2); white-space: nowrap; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: #7CCB93; }
.sync.is-saving .dot { background: #F3C66B; }
.sync.is-offline .dot { background: transparent; box-shadow: inset 0 0 0 2px #B9B2AA; }
.sync.is-error .dot { background: #F4A097; }
.sync.is-demo .dot { background: #93B8EE; }
.icon-btn { width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; flex: none; text-decoration: none; }
.icon-btn.on-frame { color: var(--frame-ink); }
.icon-btn.on-frame[aria-current="page"] { background: var(--frame-2); }
.demo-bar { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 6px auto 0; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--frame-2); color: var(--frame-ink); font-size: 15px; }
.demo-bar[hidden] { display: none; }
.demo-bar p { flex: 1; margin: 0; }

main {
  display: block; background: var(--board); border-radius: 22px 22px 0 0; max-width: 760px; margin: 0 auto;
  min-height: calc(100vh - 64px); padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 104px);
}
body.is-onboarding main { padding-bottom: 48px; }
.view { max-width: 640px; margin: 0 auto; }
.loading { color: var(--ink-2); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--frame);
  display: grid; grid-template-columns: repeat(5, minmax(0, 150px)); justify-content: center; gap: 2px;
  padding: 6px 4px calc(6px + var(--safe-b));
}
.tabbar[hidden] { display: none; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px;
  padding: 4px 2px; color: var(--frame-ink-2); text-decoration: none; font-size: 13px; font-weight: 700; border-radius: 12px; position: relative;
}
.tabbar a[aria-current="page"] { color: var(--frame-ink); background: var(--frame-2); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 4px; width: 22px; height: 3px; border-radius: 3px; background: #93B8EE; }

.fab {
  position: fixed; z-index: 15; right: max(16px, calc(50% - 364px)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(15, 11, 8, 0.35);
}
.fab[hidden] { display: none; }
.fab .i { width: 30px; height: 30px; stroke-width: 2.4; }

/* ---------- headings and helpers ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-head h1 { margin: 0; }
.today-head h1 { font-size: 30px; }
.lede { font-size: 18px; color: var(--ink-2); margin: 6px 0 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head h2 { margin: 26px 0 6px; }
.more { font-weight: 700; font-size: 15px; white-space: nowrap; padding: 10px 0; }
.count { display: inline-block; min-width: 1.7em; padding: 0 7px; border-radius: 999px; background: var(--board-2); color: var(--ink-2); font-size: 14px; text-align: center; font-weight: 700; vertical-align: 2px; }
.empty { color: var(--ink-2); margin: 8px 0; }
.empty-state { border: 2px dashed var(--line-strong); border-radius: 18px; padding: 6px 16px 14px; margin: 12px 0; }
.hint { color: var(--ink-2); font-size: 15px; margin: 0; }
.note { white-space: pre-wrap; background: var(--board-2); border-radius: 12px; padding: 10px 12px; }
.sub { font-size: 16px; color: var(--ink-2); margin-top: 18px; }
.aside-line { margin: 10px 0; }
.aside-line a { font-weight: 700; }
.center { text-align: center; }
.filter-row { margin: 14px 0 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 700; text-decoration: none; min-height: 44px; }
.back .i { width: 20px; height: 20px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 999px; border: 2px solid transparent; font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn .i { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--danger); color: var(--board); }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.on-frame { background: transparent; color: var(--frame-ink); border-color: var(--frame-ink-2); }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.65; cursor: progress; }
.link-btn { background: none; border: 0; padding: 8px 0; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.actions.stack { flex-direction: column; align-items: stretch; }
.actions.center { justify-content: center; }

/* ---------- rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 58px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .lead { flex: none; display: grid; place-items: center; width: 44px; color: var(--ink-2); }
.row-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0;
  padding: 10px 0; cursor: pointer; border-radius: 8px;
}
.row-main.static { cursor: default; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-title .i.inline { stroke: var(--ink-2); }
.row-meta { font-size: 15px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.check {
  flex: none; position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: var(--board); display: grid; place-items: center; color: transparent; cursor: pointer;
}
.check .i { width: 22px; height: 22px; stroke-width: 2.6; }
.check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--board); }
@media (hover: hover) { .check:hover { color: var(--line-strong); } .check[aria-pressed="true"]:hover { color: var(--board); } }
.is-done .row-title, .is-checked .row-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.due { font-weight: 700; color: var(--ink-2); }
.due.overdue { color: var(--danger); }
.due.today { color: var(--warn-ink); }
h2.is-overdue { color: var(--danger); }
.qty { font-weight: 400; color: var(--ink-2); }
.time-col { flex: none; width: 84px; font-size: 14px; color: var(--ink-2); font-weight: 700; line-height: 1.25; }
.date-small { display: block; color: var(--ink); }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 0 7px; border-radius: 6px; border: 1.5px solid currentColor; }
.tag-appointment { color: var(--accent); }
.tag-reservation { color: var(--ok); }

/* marker check, drawn in the doer's color */
.flourish { position: absolute; inset: -9px; pointer-events: none; }
.flourish svg { width: 100%; height: 100%; fill: none; stroke: var(--pc); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 42; stroke-dashoffset: 42; animation: draw 0.5s cubic-bezier(.3, .7, .3, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- people magnets ---------- */
.magnet {
  --size: 36px; flex: none; width: var(--size); height: var(--size); border-radius: 50%; background: var(--pc, var(--ink-2));
  color: #FFFFFF; font-weight: 700; font-size: calc(var(--size) * 0.4); display: inline-grid; place-items: center; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}
.magnet.sm { --size: 30px; }
.magnet.xs { --size: 22px; font-size: 10px; box-shadow: none; }
.magnet.anyone { background: var(--board-2); color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.magnet.anyone .i { width: 58%; height: 58%; }

/* ---------- feed and tally ---------- */
.feed, .tally { list-style: none; padding: 0; margin: 0; }
.feed li, .tally li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.feed li span { flex: 1; min-width: 0; }
.feed time { color: var(--ink-2); font-size: 15px; white-space: nowrap; }
.tally .count { margin-left: auto; min-width: auto; background: none; font-size: 15px; color: var(--ink); }
.tally li span:nth-child(2) { font-weight: 700; }

/* ---------- today ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
.qa {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 4px; min-height: 80px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--board-2); font-weight: 700; font-size: 15px; cursor: pointer; text-align: center;
}
.qa .i { width: 26px; height: 26px; color: var(--accent); }
.link-rows { list-style: none; padding: 0; margin: 0; }
.link-rows a { display: flex; align-items: center; gap: 10px; min-height: 54px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-weight: 700; }
.link-rows li:last-child a { border-bottom: 0; }
.link-rows a > span:first-child { flex: 1; }
.link-rows .i { width: 20px; height: 20px; color: var(--ink-2); }
.count-text { color: var(--ink-2); font-weight: 400; font-size: 15px; }

/* ---------- segmented controls and sub navigation ---------- */
.seg { display: flex; gap: 4px; padding: 4px; margin: 0; border: 0; background: var(--board-2); border-radius: 999px; min-width: 0; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg label { position: relative; flex: 1 0 auto; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.seg input:checked + span { background: var(--board); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus-ink); outline-offset: 2px; box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 8px var(--focus-halo); }
.subnav { display: flex; gap: 4px; padding: 4px; margin: 10px 0 6px; background: var(--board-2); border-radius: 999px; }
.subnav a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 6px 8px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--ink-2); text-decoration: none; text-align: center; }
.subnav a[aria-current="page"] { background: var(--board); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- calendar ---------- */
.month-head { display: flex; align-items: center; gap: 4px; margin: 12px 0 6px; }
.month-head h2 { flex: 1; text-align: center; margin: 0; font-size: 20px; }
.month-head .icon-btn { color: var(--ink); }
table.month { width: 100%; border-collapse: collapse; table-layout: fixed; }
.month th { font-size: 13px; color: var(--ink-2); padding: 4px 0; font-weight: 700; }
.month td { padding: 1px; }
.day {
  width: 100%; min-height: 50px; border: 0; background: none; border-radius: 12px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 0 4px; cursor: pointer;
}
.day.other .num { color: var(--ink-2); font-weight: 400; }
.num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 15px; }
.day.today .num { background: var(--frame); color: var(--frame-ink); }
.day[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 34px; min-height: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--accent)); }
.dot.kind-appointment { border-radius: 2px; }
.dot.kind-reservation { background: transparent; box-shadow: inset 0 0 0 2px var(--pc, var(--ok)); }
.dot.chore-dot { width: 6px; height: 6px; border-radius: 0; transform: rotate(45deg); background: var(--ink-2); }
.day-nav { display: flex; align-items: center; gap: 6px; margin: 12px 0; }
.day-nav input { flex: 1; }
.day-nav .icon-btn { color: var(--ink); }
.resource { border: 2px solid var(--line); border-radius: 16px; padding: 2px 14px 8px; margin: 12px 0; }
.resource-head { display: flex; align-items: center; gap: 10px; }
.resource-head .i { color: var(--ink-2); }
.resource-head h3 { flex: 1; margin: 12px 0; font-size: 19px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.appt { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.appt:last-child { border-bottom: 0; }
.date-block { flex: none; width: 58px; text-align: center; border: 2px solid var(--ink); border-radius: 14px; padding: 5px 0 6px; line-height: 1.1; align-self: flex-start; }
.date-block span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.date-block strong { font-size: 25px; }
.appt-body { min-width: 0; flex: 1; }
.appt-body h3 { margin: 2px 0; }
.appt-body h3 .link-btn { color: var(--ink); text-align: left; padding: 0; min-height: 32px; font-size: 18px; }
.appt-body p { margin: 3px 0; }
.appt-body a { font-weight: 700; display: inline-flex; align-items: center; min-height: 36px; }
.appt-body .note { margin-top: 6px; font-size: 15px; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin: 0; }
.conflict:empty { display: none; }

/* ---------- lists ---------- */
.list-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 8px; margin: 8px -16px 0; scrollbar-width: none; }
.list-tabs a, .tab-add {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 16px; border-radius: 999px;
  border: 2px solid var(--line-strong); color: var(--ink); background: var(--board); text-decoration: none; font-weight: 700; cursor: pointer;
}
.tab-add { border-style: dashed; }
.tab-add .i { width: 18px; height: 18px; }
.list-tabs a[aria-current="page"] { background: var(--frame); color: var(--frame-ink); border-color: var(--frame); }
.list-tabs .count { background: var(--accent); color: var(--accent-ink); vertical-align: 0; }
.list-tabs a[aria-current="page"] .count { background: var(--frame-ink); color: var(--frame); }
.add-item { display: flex; gap: 8px; margin: 6px 0 10px; position: sticky; top: calc(var(--safe-t) + 64px); z-index: 5; background: var(--board); padding: 8px 0; }
.add-item input { flex: 1; min-width: 0; }
.add-item.compact { position: static; padding: 4px 0; }
.aisle h2 { font-size: 16px; color: var(--ink-2); margin: 16px 0 0; }
.cart { margin-top: 18px; border-top: 2px solid var(--line); }
.list-foot { margin-top: 22px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 2px dashed var(--line-strong); background: var(--board); font-size: 15px; font-weight: 700; cursor: pointer;
}
.chip-btn .i { width: 16px; height: 16px; }

/* ---------- projects ---------- */
.project-card { border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.pc-top { display: flex; align-items: center; gap: 10px; }
.card-title { margin: 0; font-size: 18px; min-width: 0; }
.card-title a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-decoration-thickness: 2px; text-underline-offset: 4px; overflow-wrap: anywhere; }
.bar { height: 10px; background: var(--board-2); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; box-shadow: inset 0 0 0 1px var(--line); }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 14px 0 6px; }
.facts dt { font-size: 14px; color: var(--ink-2); }
.facts dd { margin: 2px 0 0; font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend, .field > div > label { font-weight: 700; }
.field > legend { padding: 0; margin-bottom: 6px; }
.field.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field.two > div { display: grid; gap: 6px; min-width: 0; }
.field[hidden], .field.two > div[hidden], .times[hidden], .rotation[hidden], .until[hidden] { display: none; }
.opt { font-weight: 400; color: var(--ink-2); font-size: 15px; }
input, select, textarea {
  font: inherit; font-size: 17px; color: var(--ink); background: var(--board); border: 2px solid var(--line-strong);
  border-radius: 12px; padding: 10px 12px; min-height: 48px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.error { color: var(--danger); font-size: 15px; font-weight: 700; margin: 0; }
.error[hidden] { display: none; }
.check-field { display: flex; align-items: center; gap: 12px; }
.check-field input { width: 26px; height: 26px; min-height: 0; margin: 0; accent-color: var(--accent); }
.check-field label { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; min-height: 0; }
.chip-face { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 14px 5px 8px; border: 2px solid var(--line-strong); border-radius: 999px; background: var(--board); font-weight: 700; }
.chip-face:only-child { padding-left: 14px; }
.chip input:checked + .chip-face { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.chip input:checked + .chip-face::after { content: ""; width: 12px; height: 7px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent); transform: rotate(-45deg) translate(1px, -2px); margin-left: 2px; }
.chip input:focus-visible + .chip-face { outline: 3px solid var(--focus-ink); outline-offset: 2px; box-shadow: 0 0 0 8px var(--focus-halo); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.swatch { position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 10px; border: 2px solid var(--line-strong); border-radius: 12px; font-weight: 700; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; min-height: 0; }
.swatch .sw { width: 24px; height: 24px; border-radius: 50%; background: var(--pc); flex: none; }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.swatch:has(input:checked)::after { content: ""; margin-left: auto; width: 12px; height: 7px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(-45deg) translateY(-2px); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--focus-ink); outline-offset: 2px; box-shadow: 0 0 0 8px var(--focus-halo); }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.inline-form .btn { flex: none; }

/* ---------- sheets ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; padding: 0; border: 0; width: 100%; max-width: 640px;
  max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; background: var(--board); color: var(--ink); overflow: hidden;
}
dialog.sheet::backdrop { background: rgba(15, 11, 8, 0.55); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 8px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 20px; }
.sheet-head h2:focus { outline: none; }
.sheet-head h2:focus-visible { outline: 3px solid var(--focus-ink); outline-offset: 2px; }
.sheet-head .icon-btn { color: var(--ink); }
.sheet-body { padding: 16px 18px calc(22px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 700px) {
  dialog.sheet { inset: 0; margin: auto; border-radius: 22px; max-height: 86vh; height: fit-content; }
}
.pick-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pick {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border: 2px solid var(--line-strong);
  border-radius: 16px; background: var(--board); font-weight: 700; font-size: 18px; cursor: pointer; text-align: left;
}
.pick > .i { width: 26px; height: 26px; color: var(--accent); }
.pick.is-current { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pick-note { margin-left: auto; font-size: 14px; color: var(--ink-2); font-weight: 400; }

/* ---------- toasts ---------- */
.toasts-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 88px); z-index: 30; pointer-events: none; display: flex; justify-content: center; padding: 0 12px; }
body.is-onboarding .toasts-wrap { bottom: calc(16px + var(--safe-b)); }
#toasts { width: 100%; max-width: 560px; display: grid; gap: 8px; }
.toast {
  pointer-events: auto; background: var(--frame); color: var(--frame-ink); border-radius: 16px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; box-shadow: 0 10px 28px rgba(15, 11, 8, 0.3); border: 1px solid var(--frame-2);
}
.toast p { margin: 0; flex: 1 1 170px; }
.toast-btn { background: none; border: 2px solid var(--frame-ink-2); color: var(--frame-ink); border-radius: 999px; padding: 6px 14px; font-weight: 700; min-height: 40px; cursor: pointer; }
.toast.is-leaving { opacity: 0; transition: opacity 0.2s; }

/* ---------- settings ---------- */
.invite { background: var(--board-2); border: 2px solid var(--line); border-radius: 18px; padding: 2px 16px 14px; margin-top: 12px; }
.invite h2 { margin-top: 16px; }
.code-line { margin: 12px 0 4px; }
.code { font-size: 26px; letter-spacing: 0.06em; font-weight: 700; margin-left: 6px; }
.link-line a { overflow-wrap: anywhere; font-weight: 700; }
.row-actions { margin: 10px 0; }
.me-line { display: flex; align-items: center; gap: 12px; }
.me-line p { flex: 1; margin: 0; }
.steps { padding-left: 24px; margin: 8px 0; }
.steps li { margin: 6px 0; }
.plan { color: var(--ink-2); }
.finished { margin-top: 26px; }
.finished summary { font-weight: 700; min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }

/* ---------- photos and the muted background ---------- */
body.has-bg::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(28, 21, 16, 0.8), rgba(28, 21, 16, 0.88)), var(--bg-photo);
  background-size: cover; background-position: center;
}
body.has-bg .topbar { background: rgba(28, 21, 16, 0.92); transition: background-color 0.2s; }
body.has-bg:not(.scrolled) .topbar { background: transparent; }
.today-head { border-radius: 20px; }
.today-head.has-photo {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 168px;
  padding: 20px 16px 14px; margin: 0 0 6px; color: #F7F0E6;
  background-image: linear-gradient(180deg, rgba(28, 21, 16, 0.72), rgba(28, 21, 16, 0.86)), var(--photo, none);
  background-color: #1C1510; background-size: cover; background-position: center;
}
.today-head.has-photo h1, .today-head.has-photo .lede { color: #F7F0E6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
.today-head.has-photo .lede { margin-bottom: 0; }
.photo-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo-tile {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: var(--board-2); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; left: 6px; bottom: 6px; background: rgba(28, 21, 16, 0.88); color: #F7F0E6; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; list-style: none; padding: 2px 16px 6px; margin: 4px -16px 0; scrollbar-width: none; }
.photo-strip li { flex: none; width: 104px; }
.photo-add-tile {
  width: 100%; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--board); font-weight: 700; font-size: 14px; color: var(--accent); cursor: pointer;
}
.bg-now { display: flex; gap: 12px; align-items: flex-start; }
.bg-now .photo-tile { width: 96px; flex: none; }
.bg-now p { margin: 0; color: var(--ink-2); }
.photo-full { width: 100%; height: auto; max-height: 58vh; object-fit: contain; border-radius: 14px; background: var(--board-2); }
.photo-sheet .sheet-body { display: grid; gap: 8px; }

/* ---------- install banner ---------- */
.install-banner { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--accent); background: var(--accent-soft); border-radius: 18px; padding: 12px 14px; margin: 12px 0 4px; }
.install-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--frame); color: var(--frame-ink); display: grid; place-items: center; }
.install-text h2 { margin: 0 0 2px; font-size: 18px; }
.install-text p { margin: 0 0 4px; }
.install-text .actions { margin-top: 4px; }

/* ---------- onboarding ---------- */
.onboard { max-width: 520px; margin: 0 auto; }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--frame); color: var(--frame-ink); display: grid; place-items: center; margin: 10px 0 14px; }
.brand-mark .i { width: 36px; height: 36px; }
.ob-card { border: 2px solid var(--line); border-radius: 18px; padding: 2px 16px 16px; margin: 16px 0; }
.ob-card h2 { margin-top: 16px; }
.code-input { font-size: 22px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.error-box { background: var(--danger-bg); color: var(--danger); border: 2px solid var(--danger); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin: 0; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
[data-region="err"]:empty { display: none; }
[data-region="err"]:focus { outline: none; }
.noscript { color: var(--frame-ink); padding: 24px; }

/* ---------- motion and display modes ---------- */
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-up 0.22s ease-out; }
  @keyframes sheet-up { from { transform: translateY(28px); opacity: 0.6; } }
  .toast { animation: toast-in 0.18s ease-out; }
  @keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .check[aria-pressed="true"], .magnet, .dot, .bar span, .day.today .num { forced-color-adjust: none; }
  .check[aria-pressed="true"] { background: Highlight; color: HighlightText; border-color: Highlight; }
  .magnet { border: 1px solid CanvasText; }
  .dot { background: CanvasText; }
  .bar span { background: Highlight; }
  .seg input:checked + span, .subnav a[aria-current="page"], .tabbar a[aria-current="page"], .list-tabs a[aria-current="page"], .day[aria-pressed="true"] { outline: 2px solid Highlight; }
  :focus-visible { outline: 3px solid Highlight; }
  .tabbar a[aria-current="page"]::before { background: Highlight; }
}
@media (min-width: 760px) {
  main { margin-top: 8px; border-radius: 22px; }
  .tabbar { border-top: 1px solid var(--frame-2); }
}
