/* Liquid glass: translucent layers over an ambient wash, hairline highlights
   on every raised edge, and spring-ish motion. Mobile-first throughout. */
:root {
  --ink: #0d1220;
  --ink-soft: #5c6785;
  --tint: 59, 108, 246;          /* accent as raw channels, for rgba() mixes */
  --accent: rgb(var(--tint));
  --done: #10a37f;
  --danger: #e0455e;

  --glass: rgba(255, 255, 255, 0.58);
  /* Used where blurring would be too costly: slightly more opaque so it still
     reads as frosted without a backdrop filter behind it. */
  --glass-solid: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.76);
  --dock: rgba(238, 241, 249, 0);
  --page-fade: rgba(238, 241, 249, 0.92);
  --glass-line: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(13, 18, 32, 0.08);
  --glass-shadow: 0 18px 40px -22px rgba(13, 18, 32, 0.5);
  --blur: blur(26px) saturate(180%);

  --text: var(--ink);
  --muted: var(--ink-soft);
  --radius: 22px;
  --tap: 48px;
  --spring: cubic-bezier(0.22, 1.15, 0.36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef2fb;
    --ink-soft: #9aa5be;
    --glass: rgba(26, 33, 50, 0.56);
    --glass-solid: rgba(26, 33, 50, 0.72);
    --glass-strong: rgba(30, 38, 58, 0.78);
    --dock: rgba(7, 11, 20, 0);
    --page-fade: rgba(7, 11, 20, 0.92);
    --glass-line: rgba(255, 255, 255, 0.14);
    --glass-edge: rgba(0, 0, 0, 0.4);
    --glass-shadow: 0 20px 44px -20px rgba(0, 0, 0, 0.75);
    --done: #33c99b;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* App-shell layout: the document itself never scrolls, so there is no
   rubber-banding, no pull-to-refresh and no page-level zoom. Only <main>
   scrolls, the way a native screen does. */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;          /* kills double-tap zoom */
}

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.011em;
  background: #eef1f9;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;   /* long-press selection feels wrong in an app */
}

input, textarea, .bubble, .chore-title, .chore-meta { -webkit-user-select: text; user-select: text; }
@media (prefers-color-scheme: dark) { body { background: #070b14; } }

/* The wash the glass refracts. Fixed, so panels drift over it as you scroll. */
body::before {
  content: '';
  position: fixed; inset: -20vh -20vw;
  z-index: -1;
  background:
    radial-gradient(42vmax 42vmax at 12% 8%, rgba(var(--tint), 0.34), transparent 62%),
    radial-gradient(38vmax 38vmax at 88% 6%, rgba(125, 91, 237, 0.30), transparent 60%),
    radial-gradient(44vmax 44vmax at 74% 92%, rgba(16, 163, 127, 0.24), transparent 62%),
    radial-gradient(36vmax 36vmax at 18% 86%, rgba(246, 185, 59, 0.22), transparent 60%);
  /* No filter: blurring a full-screen layer re-rasterised it every frame of
     the drift. The gradients are soft enough on their own. */
  will-change: transform;
  animation: drift 34s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.08); }
}

button, input, select, textarea { font: inherit; color: inherit; }

/* The one material everything raised is made of.
   Backdrop blur is deliberately NOT here: these classes cover dozens of
   elements at once — 42 cells in a month grid — and each blurred layer is
   composited separately, which is what made switching to the calendar drop
   frames. Only the handful of large chrome surfaces below actually blur. */
.glass, .chore, .day, .bubble.bot, .proposal, .person, .chip, .seg, .field input,
.field select, .field textarea, .icon-btn, .ghost, .chat-input input, .card {
  background: var(--glass-solid);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
@media (prefers-color-scheme: dark) {
  .glass, .chore, .day, .bubble.bot, .proposal, .person, .chip, .seg, .field input,
  .field select, .field textarea, .icon-btn, .ghost, .chat-input input {
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  flex: 0 0 auto; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.12));
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-line);
}
@media (prefers-color-scheme: dark) {
  .topbar { background: linear-gradient(to bottom, rgba(18, 24, 38, 0.62), rgba(18, 24, 38, 0.18)); }
}
.topbar-inner { flex: 1; min-width: 0; }
.topbar h1 { font-size: 26px; margin: 0; letter-spacing: -0.03em; font-weight: 700; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.icon-btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto;
  border-radius: 50%; cursor: pointer; font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  transition: transform .2s var(--spring);
}
.icon-btn:active { transform: scale(0.92); }

.primary {
  background: linear-gradient(180deg, rgba(var(--tint), 1), rgba(var(--tint), 0.86));
  border: 1px solid rgba(var(--tint), 0.9);
  color: #fff; border-radius: 14px; padding: 0 18px; min-height: var(--tap);
  font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(var(--tint), 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: transform .2s var(--spring);
}
.primary:active { transform: scale(0.97); }
.ghost { border-radius: 14px; padding: 0 16px; min-height: var(--tap); cursor: pointer; }
.ghost.danger { color: var(--danger); }

main {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;        /* scroll chaining stops here */
  padding: 16px 14px calc(120px + var(--safe-bottom));
  width: 100%; max-width: 720px; margin: 0 auto;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 0 0; }

/* --------------------------------------------------------- pull to refresh */
.ptr {
  /* Above the toolbar (z-index 20), or it pulls down behind the header. */
  position: fixed; left: 50%; top: 0; z-index: 21;
  width: 38px; height: 38px; margin-left: -19px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
  opacity: 0; transform: translateY(0) scale(0.7);
  pointer-events: none;
}
.ptr svg {
  width: 19px; height: 19px; fill: none; stroke: var(--accent);
  stroke-width: 2.4; stroke-linecap: round;
  /* An arc that closes as you pull, like a dial filling up. */
  stroke-dasharray: 54; stroke-dashoffset: 54;
}
.ptr.settling { transition: opacity .24s ease, transform .34s var(--spring); }
.ptr.spinning svg { stroke-dashoffset: 14; animation: spin .8s linear infinite; }
main.ptr-settling { transition: transform .34s var(--spring); }

/* ------------------------------------------------------------------- chores */
.group-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin: 20px 4px 2px; font-weight: 600;
}
.chore {
  display: flex; align-items: center; gap: 14px;
  border-radius: var(--radius); padding: 14px; min-height: 70px;
  transition: transform .22s var(--spring), opacity .22s ease;
}
.chore:active { transform: scale(0.988); }
.chore.done { opacity: 0.5; }
.chore.done .chore-title { text-decoration: line-through; }

.check {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid rgba(var(--tint), 0.35); background: rgba(255, 255, 255, 0.35);
  cursor: pointer; display: grid; place-items: center;
  color: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .22s var(--spring);
}
.check[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--done), color-mix(in srgb, var(--done) 78%, black));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 18px -8px var(--done), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.check:active { transform: scale(0.88); }
.check .tick {
  width: 17px; height: 17px; display: block;
  fill: none; stroke: currentColor; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.chevron {
  width: 20px; height: 20px; display: block;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.check.pop { animation: pop .46s var(--spring); }
@keyframes pop {
  0% { transform: scale(1); }
  36% { transform: scale(1.34); }
  100% { transform: scale(1); }
}

.chore-body { flex: 1; min-width: 0; cursor: pointer; }
.chore-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chore-meta { color: var(--muted); font-size: 13px; display: flex; gap: 7px; flex-wrap: wrap; margin-top: 3px; }
.pill {
  font-size: 11.5px; border: 1px solid var(--glass-line); border-radius: 20px;
  padding: 2px 9px; color: var(--muted); background: rgba(255, 255, 255, 0.28);
}
.pill.daily, .pill.once { color: var(--accent); border-color: rgba(var(--tint), 0.4); }

.empty { text-align: center; color: var(--muted); padding: 52px 20px; line-height: 1.7; }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty.compact { padding: 12px; font-size: 14px; }

/* ----------------------------------------------------------------- calendar */
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  border-radius: 16px; overflow: hidden; padding: 4px;
}
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg.mode { margin-bottom: 14px; }
.seg button {
  min-height: 42px; border-radius: 12px; border: 0; background: transparent;
  cursor: pointer; color: var(--muted); font-weight: 500;
  transition: background .2s ease, color .2s ease, transform .2s var(--spring);
}
.seg button.on {
  background: linear-gradient(180deg, rgba(var(--tint), 1), rgba(var(--tint), 0.88));
  color: #fff; box-shadow: 0 8px 18px -10px rgba(var(--tint), 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.seg button:active { transform: scale(0.96); }

.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-label {
  background: transparent; border: 0; font-size: 17px; font-weight: 650; cursor: pointer;
  min-height: var(--tap); padding: 0 12px; border-radius: 14px; letter-spacing: -0.02em;
}
.weekdays, .calendar {
  display: grid;
  /* minmax(0, 1fr), not 1fr: grid items default to min-width auto, so a day
     holding three dots and a "+2" would widen its track and push the grid
     past the container. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.weekdays div { text-align: center; font-size: 11.5px; color: var(--muted); padding-bottom: 6px; }

.day {
  aspect-ratio: 1; border-radius: 15px; cursor: pointer; padding: 7px 3px 4px;
  min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .2s var(--spring);
}
.day:active { transform: scale(0.94); }
.day.outside { opacity: 0.36; }
.day.today {
  border-color: rgba(var(--tint), 0.55);
  background: linear-gradient(180deg, rgba(var(--tint), 0.22), rgba(var(--tint), 0.08));
}
.day.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.day-num { font-size: 14px; font-weight: 650; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dot.done { background: var(--done); }
.day-count { font-size: 10.5px; color: var(--muted); }
.day-heading { display: flex; justify-content: space-between; align-items: baseline; }
.day-heading.is-today { color: var(--accent); }

/* --------------------------------------------------------------------- chat */
.chat-view { display: flex; flex-direction: column; min-height: 60vh; }
.chat-log { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.bubble {
  max-width: 85%; padding: 12px 15px; border-radius: 20px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble.user {
  align-self: flex-end; color: #fff; border-bottom-right-radius: 7px;
  background: linear-gradient(180deg, rgba(var(--tint), 1), rgba(var(--tint), 0.86));
  box-shadow: 0 12px 26px -14px rgba(var(--tint), 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.bubble.bot { align-self: flex-start; border-bottom-left-radius: 7px; }
.bubble.error {
  align-self: stretch; background: rgba(224, 69, 94, 0.1);
  border: 1px solid rgba(224, 69, 94, 0.45); color: var(--danger); font-size: 14px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; padding-top: 4px; }
.chip {
  border-radius: 20px; padding: 9px 15px; font-size: 14px; cursor: pointer; min-height: 42px;
  transition: transform .2s var(--spring);
}
.chip:active { transform: scale(0.95); }
.chip:hover { color: var(--accent); }

.proposals { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; width: 100%; }
.proposal {
  display: flex; align-items: center; gap: 12px; border-radius: 18px; padding: 13px 15px;
  border-color: rgba(var(--tint), 0.45);
}
.proposal-body { flex: 1; min-width: 0; }
.proposal .chore-title { white-space: normal; }
.proposal-verb {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 2px; font-weight: 600;
}
.proposal.remove { border-color: rgba(224, 69, 94, 0.5); }
.proposal.remove .proposal-verb { color: var(--danger); }
.proposal.applied { opacity: 0.5; }

.chat-view { position: relative; }
/* Clearance for the fixed composer below, so the last message can scroll
   clear of it rather than hiding underneath. */
.chat-log { padding-bottom: 74px; }

/* Anchored to the bottom of the viewport, not sticky inside the scroller:
   it covers the whole strip above the tab bar, so messages scrolling past
   disappear behind frosted glass instead of showing in the gaps. */
.chat-input {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 16px 14px calc(90px + var(--safe-bottom) * 0.34);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    var(--glass-strong) 22%,
    var(--glass-strong) 100%
  );
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
}
@media (prefers-color-scheme: dark) {
  .chat-input {
    background: linear-gradient(
      to bottom,
      rgba(22, 29, 46, 0) 0%,
      rgba(22, 29, 46, 0.88) 22%,
      rgba(22, 29, 46, 0.94) 100%
    );
  }
}

/* The controls themselves stop at the content width, like everything else. */
.chat-input-inner {
  display: flex; gap: 8px;
  max-width: 692px; margin: 0 auto;
}
.chat-input input { flex: 1; min-width: 0; min-height: var(--tap); border-radius: 16px; padding: 0 16px; }

.typing {
  color: var(--muted); font-size: 14px; align-self: flex-start;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.spinner {
  width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* ------------------------------------------------------------------ people */
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  border-radius: 20px; padding: 0 15px; min-height: 42px; cursor: pointer; font-size: 14.5px;
  transition: transform .2s var(--spring);
}
.person:active { transform: scale(0.95); }
.person.on {
  background: linear-gradient(180deg, rgba(var(--tint), 1), rgba(var(--tint), 0.88));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 18px -10px rgba(var(--tint), 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* --------------------------------------------------------------------- FAB */
.fab {
  position: fixed; right: 18px; z-index: 35;
  bottom: calc(98px + var(--safe-bottom) * 0.34);
  width: 60px; height: 60px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35); padding: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(var(--tint), 1), rgba(var(--tint), 0.82));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 18px 34px -14px rgba(var(--tint), 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform .22s var(--spring);
}
.fab svg { width: 27px; height: 27px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.fab:active { transform: scale(0.9); }

/* An installed iOS app has ~34px of safe area below the bar; without this the
   tab bar appears to float over a band of empty background. Fading the wash
   out to the page colour makes that strip read as part of the dock. */
body::after {
  content: '';
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(76px + var(--safe-bottom));
  z-index: 24; pointer-events: none;
  background: linear-gradient(to bottom, var(--dock), var(--page-fade) 62%);
}

/* ------------------------------------------------------------------ tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  isolation: isolate;
  /* The safe inset is mostly absorbed, not added: adding it in full left the
     bar floating ~48px up in an installed app, which reads as dead space. */
  bottom: calc(10px + var(--safe-bottom) * 0.34); z-index: 30;
  width: min(420px, calc(100vw - 28px));
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-radius: 26px; padding: 6px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  touch-action: none;            /* the bar owns horizontal drags */
  cursor: grab;
}
.tabbar.dragging { cursor: grabbing; }
.tabbar.dragging .tab { transition: none; }
.tab {
  position: relative; z-index: 0;
  background: none; border: 1px solid transparent; padding: 8px 0; cursor: pointer;
  border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 500; min-height: 52px;
  transition: color .24s ease, transform .28s var(--spring), font-weight .2s ease;
}
.tab .tab-icon {
  /* Drawn, not typed: ☑ ▦ ✳ are substituted with colour emoji on some
     platforms and fall back to boxes on others. */
  width: 22px; height: 22px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .28s var(--spring), stroke-width .24s ease;
}

/* Header icon button shares the drawn-icon style of the tabs. */
.icon-btn .tab-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The selected tab reads as a separate pane of glass pressed into the bar:
   shadow along the top lip and light along the bottom is what the eye reads
   as concave, the inverse of the raised buttons elsewhere. */
.tab.active { color: var(--accent); font-weight: 620; transform: scale(1.03); }
.tab.active .tab-icon { transform: scale(1.04); stroke-width: 2; }

/* One pane of glass that travels between tabs, rather than a highlight
   blinking off one and on to another. */
.tab-indicator {
  position: absolute; z-index: -1;
  top: 6px; bottom: 6px; left: 6px;
  width: calc((100% - 12px) / 4);   /* replaced with a measured width by shell.js */
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(to bottom, rgba(var(--tint), 0.13), rgba(var(--tint), 0.05));
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 2.5px -1px rgba(13, 18, 32, 0.10),
    inset 0 -1px 0 rgba(255, 255, 255, 0.34);
  transform: translateX(0);
}
/* No transition until the first position is set, or it slides in on load. */
.tabbar.ready .tab-indicator {
  transition: transform .42s var(--spring), width .42s var(--spring);
}
.tab:active { transform: scale(0.95); }
.tab.active:active { transform: scale(1.01); }

@media (prefers-color-scheme: dark) {
  .tab-indicator {
    border-color: rgba(255, 255, 255, 0.09);
    background: linear-gradient(to bottom, rgba(var(--tint), 0.20), rgba(var(--tint), 0.07));
    box-shadow:
      inset 0 1px 3px -1px rgba(0, 0, 0, 0.32),
      inset 0 -1px 0 rgba(255, 255, 255, 0.10);
  }
}

/* ------------------------------------------------------------------- sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 12, 22, 0.42);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line); border-bottom: 0;
  border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(26px + var(--safe-bottom));
  box-shadow: 0 -20px 60px -24px rgba(13, 18, 32, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: rise .3s var(--spring);
}
@keyframes rise { from { transform: translateY(26px); opacity: 0.4; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--glass-line); margin: 4px auto 16px; }
.sheet h2 { margin: 0 0 16px; font-size: 20px; letter-spacing: -0.02em; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input:not([type=checkbox]):not([type=color]), .field select, .field textarea {
  width: 100%; min-height: var(--tap); border-radius: 14px; padding: 10px 13px;
}
.field textarea { min-height: 82px; resize: vertical; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .primary, .sheet-actions .ghost { flex: 1; }

/* -------------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + var(--safe-bottom)); z-index: 50;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line);
  color: var(--text);
  padding: 12px 20px; border-radius: 22px; font-size: 14px; max-width: 90vw;
  box-shadow: var(--glass-shadow);
  animation: rise .26s var(--spring);
}

.confetti {
  position: fixed; width: 7px; height: 10px; border-radius: 2px;
  pointer-events: none; z-index: 60; will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .check.pop, .sheet, .toast, .sheet-backdrop { animation: none; }
  .tabbar.ready .tab-indicator { transition: none; }
  .confetti { display: none; }
  * { transition-duration: 0.01ms !important; }
}

@media (min-width: 700px) {
  main { padding-top: 22px; }
  .fab { right: calc(50% - 340px); bottom: 30px; }
  .sheet { border-radius: 28px; border-bottom: 1px solid var(--glass-line); margin-bottom: 6vh; }
  .sheet-backdrop { align-items: center; }
}

.proposal.applied { border-color: color-mix(in srgb, var(--done) 55%, transparent); }
.proposal.applied .proposal-verb { color: var(--done); }
.proposal.applied .chore-title { text-decoration: line-through; opacity: 0.75; }
.proposal button:disabled { opacity: 0.65; cursor: default; }
.proposal-error { color: var(--danger); font-size: 12.5px; margin-top: 4px; }


/* ================================================== families, stats, auth */
:root {
  --on-time: #10a37f;
  --late: #e0a52d;
  --missed: #e0455e;
  --pending: #8a93a8;
}
@media (prefers-color-scheme: dark) {
  :root { --on-time: #10a37f; --late: #c48f2a; --missed: #e0455e; }
}
body[data-screen="signin"] .app-only, body[data-screen="onboarding"] .app-only { display: none !important; }
body[data-screen="signin"] main, body[data-screen="onboarding"] main { padding-bottom: 40px; }
body[data-screen="signin"] .topbar-inner, body[data-screen="onboarding"] .topbar-inner { text-align: center; }

.card { border-radius: var(--radius); padding: 16px; }
.auth-card { max-width: 420px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 6px; }
.auth-card h2 { margin: 0 0 8px; font-size: 20px; }
.auth-card form { display: flex; flex-direction: column; }
.auth-card .field { margin-bottom: 12px; }
.wide { width: 100%; display: block; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 8px 0; font-size: 14px; }
.links { margin-top: 2px; }
.or { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px 0 6px; position: relative; }
.or::before, .or::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--glass-edge); }
.or::before { left: 0; } .or::after { right: 0; }
.google::before { content: 'G'; font-weight: 700; color: #4285f4; margin-right: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bad-text { color: var(--missed); }
.sheet-text { margin: 0 0 14px; line-height: 1.5; }
.sheet-meta { margin: -8px 0 14px; }
.field-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin: -6px 0 15px; font-size: 14px; cursor: pointer; }
.toggle-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.field input[type=color] { width: 56px; height: 40px; border: 0; background: none; padding: 0; }
.primary.danger-bg { background: linear-gradient(180deg, var(--danger), color-mix(in srgb, var(--danger) 80%, black)); border-color: transparent; box-shadow: none; }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg.five { grid-template-columns: repeat(5, 1fr); }
.seg.wrap { display: flex; flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 30%; padding: 0 8px; font-size: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-between .seg { grid-template-columns: repeat(3, auto); padding: 3px; }
.row-between .seg button { min-height: 32px; padding: 0 10px; font-size: 13px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips-row { margin-bottom: 14px; }

/* people */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700;
  flex: 0 0 auto; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.avatar.xs { width: 18px; height: 18px; font-size: 10px; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.md { width: 40px; height: 40px; font-size: 17px; }
.avatars { display: flex; gap: -4px; }
.avatars .avatar { margin-left: -5px; border: 2px solid var(--glass-solid); }
.person { display: inline-flex; align-items: center; gap: 7px; }
.person.on .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,0.7); }
.pill.who { display: inline-flex; align-items: center; gap: 5px; }
.pill.who .avatar { margin-right: -2px; }
.pill.status.on_time { color: var(--on-time); border-color: color-mix(in srgb, var(--on-time) 45%, transparent); }
.pill.status.late { color: color-mix(in srgb, var(--late) 80%, var(--text)); border-color: color-mix(in srgb, var(--late) 55%, transparent); }
.pill.status.missed { color: var(--missed); border-color: color-mix(in srgb, var(--missed) 45%, transparent); }
.pill.time { color: var(--accent); border-color: rgba(var(--tint), 0.4); }
.chore.missed .check { border-color: color-mix(in srgb, var(--missed) 55%, transparent); }
.dot.on_time { background: var(--on-time); }
.dot.late { background: var(--late); }
.dot.missed { background: var(--missed); }
.dot.pending { background: var(--accent); }

/* lists */
.list { padding: 4px 6px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-bottom: 1px solid var(--glass-edge); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row.tappable { cursor: pointer; border-radius: 14px; transition: background .15s ease; }
.list-row.tappable:active { background: rgba(var(--tint), 0.08); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-title.small { font-weight: 500; font-size: 14px; white-space: normal; }

/* overview */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero-number { font-size: 40px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.member-card { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; text-align: center; padding: 14px 10px; transition: transform .2s var(--spring); }
.member-card:active { transform: scale(0.97); }
.member-top { display: flex; align-items: center; gap: 10px; }
.member-name { font-weight: 650; }
.member-facts { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.tallies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.tally { text-align: center; }
.tally-value { font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--pending); }
.swatch.on_time { background: var(--on-time); }
.swatch.late { background: var(--late); }
.swatch.missed { background: var(--missed); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* charts */
.ring { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring-track { fill: none; stroke: var(--glass-edge); }
.ring-arc { fill: none; stroke-linecap: round; stroke: var(--pending); transition: stroke-dashoffset .6s var(--spring); }
.ring-arc.good { stroke: var(--on-time); }
.ring-arc.warn { stroke: var(--late); }
.ring-arc.bad { stroke: var(--missed); }
.ring-text { font-size: 15px; font-weight: 700; fill: var(--text); }
.ring-label { font-size: 11.5px; color: var(--muted); }
.bars { width: 100%; }
.bars-svg { width: 100%; height: 84px; display: block; }
.bar.on_time { fill: var(--on-time); }
.bar.late { fill: var(--late); }
.bar.missed { fill: var(--missed); }
.bar.empty { fill: var(--glass-edge); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.rate { width: 70px; height: 8px; border-radius: 4px; background: var(--glass-edge); overflow: hidden; flex: 0 0 auto; }
.rate-fill { height: 100%; border-radius: 4px; background: var(--pending); }
.rate-fill.good { background: var(--on-time); }
.rate-fill.warn { background: var(--late); }
.rate-fill.bad { background: var(--missed); }

/* invites */
.invite { display: flex; flex-direction: column; gap: 4px; }
.invite-code { font-size: 26px; font-weight: 750; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- desktop layout */
@media (min-width: 900px) {
  body { flex-direction: row; }
  .topbar { position: fixed; top: 0; left: 240px; right: 0; z-index: 20; }
  main { margin-left: 240px; max-width: none; padding: 96px 40px 60px; }
  main > div, main > section { max-width: 920px; margin: 0 auto; }
  .tabbar {
    left: 0; top: 0; bottom: 0; transform: none; width: 240px; height: 100vh;
    border-radius: 0; padding: 92px 14px 20px; grid-template-columns: 1fr; align-content: start; gap: 4px;
    border-right: 1px solid var(--glass-line); border-top: 0; border-bottom: 0; border-left: 0; cursor: default;
  }
  .tabbar::before { content: 'Chores'; position: absolute; top: 26px; left: 24px; font-weight: 750; font-size: 22px; letter-spacing: -0.03em; }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 16px; font-size: 15px; min-height: 48px; }
  .tab-indicator { left: 14px; top: 92px; bottom: auto; width: calc(100% - 28px) !important; height: 48px; }
  .tab.active { transform: none; }
  body::after { display: none; }
  .fab { right: 40px; bottom: 40px; }
  #familyBtn { display: none; }
  .chat-input { left: 240px; padding-bottom: 24px; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .sheet { max-width: 620px; }
  .toast { bottom: 40px; }
}
