/*
  DF Chores v2. Phone-first, warm paper, soft lines, rounded cards.
  Light and dark follow the device. No external fonts.
*/

:root {
  color-scheme: light dark;
  --brand: #3f5bd9;
  --brand-strong: #2f45ab;
  --brand-tint: #eef1fd;
  --on-brand: #fff;
  --positive: #17703f;
  --positive-tint: #e6f4ec;
  --caution: #8a5300;
  --caution-tint: #fdf1de;
  --amber: #b45309;
  --amber-tint: #fdf1de;
  --danger: #a3222b;
  --danger-tint: #fdecec;
  --on-danger: #fff;
  --info: #1f5f77;
  --info-tint: #e7f2f6;
  --accent: #e0a526;
  --ink: #191c22;
  --ink-soft: #55606f;
  --ink-faint: #667181;
  --surface: #fff;
  --page: #f5f3ef;
  --raised: #fff;
  --line: #e4e1db;
  --line-strong: #c9c5bd;
  --past: #efece6;
  --hatch: rgb(40 32 20 / 5%);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgb(40 32 20 / 5%), 0 4px 12px rgb(40 32 20 / 4%);
  --shadow-lift: 0 2px 6px rgb(40 32 20 / 8%), 0 10px 24px rgb(40 32 20 / 8%);
  --tap: 48px;
  --gutter: 16px;
  --bottom-bar: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #93a6ff;
    --brand-strong: #b3c0ff;
    --brand-tint: #1e2440;
    --on-brand: #141820;
    --positive: #6fd39b;
    --positive-tint: #12301f;
    --caution: #f0bd6a;
    --caution-tint: #33260f;
    --amber: #f59e0b;
    --amber-tint: #33260f;
    --danger: #ff9a9f;
    --danger-tint: #3a1a1d;
    --on-danger: #2a0f12;
    --info: #7fc6e0;
    --info-tint: #102b34;
    --accent: #f0bd6a;
    --ink: #eef1f6;
    --ink-soft: #b3bdcb;
    --ink-faint: #8d99a9;
    --surface: #191d24;
    --page: #101318;
    --raised: #1f242c;
    --line: #2e353f;
    --line-strong: #3d4653;
    --past: #161a20;
    --hatch: rgb(255 255 255 / 5%);
    --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 4px 12px rgb(0 0 0 / 25%);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / 40%), 0 10px 24px rgb(0 0 0 / 35%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-bar) + env(safe-area-inset-bottom, 0px));
}
body:not(:has(.bottom-nav)) { padding-bottom: 0; }
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.25; letter-spacing: -0.015em; font-weight: 700; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: 12px 16px;
}
.skip-link:focus { left: 0; }
.shell { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
.page { padding: 16px 0 28px; }
.page-head, .row-between { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; justify-content: space-between; }
.page-head { margin-bottom: 14px; }
.page-head p, .eyebrow, .hint { margin: 0; color: var(--ink-soft); font-size: 0.925rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.money-positive { color: var(--positive); }
.money-negative { color: var(--danger); }
.money-was { margin-left: 6px; font-weight: 500; font-size: 0.8125rem; color: var(--ink-soft); text-decoration: line-through; }

/* Masthead and navigation */
.masthead {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
  backdrop-filter: blur(10px);
}
.masthead-inner { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.wordmark {
  display: flex; align-items: center; gap: 9px; margin-right: auto;
  font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.mark, .wordmark .mark, .signin-brand .mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: var(--on-brand); font-size: 0.8125rem; font-weight: 800;
}
.masthead-actions { display: flex; align-items: center; gap: 4px; }
.icon-button, .kebab {
  position: relative; display: grid; place-items: center;
  min-width: var(--tap); min-height: var(--tap);
  border: 0; background: transparent; border-radius: var(--radius-sm);
  color: var(--ink-soft); cursor: pointer; text-decoration: none; font: inherit; font-size: 1.25rem;
}
.icon-button:hover, .kebab:hover { background: var(--page); color: var(--ink); }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font-size: 0.75rem; font-weight: 750; color: #fff; background: var(--brand); flex: none;
}
.avatar-sm { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-lg { width: 42px; height: 42px; font-size: 0.9375rem; }
.avatar-xl { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar[data-colour="rose"] { background: #b5326b; }
.avatar[data-colour="amber"] { background: #9a6108; }
.avatar[data-colour="teal"] { background: #126b70; }
.avatar[data-colour="indigo"] { background: #3f5bd9; }
.avatar[data-colour="green"] { background: #1f7043; }
.avatar[data-colour="plum"] { background: #6c3fa0; }
.avatar[data-colour="slate"] { background: #4a5666; }
.top-nav { display: none; }
.nav-badge, .badge-count {
  min-width: 1.25rem; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--danger); color: var(--on-danger);
  font-size: 0.75rem; font-weight: 700; line-height: 1.25rem; text-align: center;
}
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--bottom-bar); padding: 8px 2px;
  color: var(--ink-faint); font-size: 0.6875rem; font-weight: 600; text-decoration: none;
}
.bottom-nav .icon { width: 1.5rem; height: 1.5rem; }
@media (max-width: 340px) {
  .bottom-nav .nav-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.bottom-nav a[aria-current="page"] { color: var(--brand); }
.bottom-nav .nav-badge { position: absolute; top: 4px; margin-left: 22px; }
@media (min-width: 860px) {
  .top-nav { display: flex; gap: 2px; margin-right: 8px; }
  .top-nav a {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
    border-radius: var(--radius-pill); color: var(--ink-soft); font-size: 0.9375rem; font-weight: 600; text-decoration: none;
  }
  .top-nav a:hover { background: var(--page); color: var(--ink); }
  .top-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand-strong); }
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

/* Notices, toasts, sheets, drawer */
.notice, .fine-banner {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-left-width: 4px;
  border-radius: var(--radius-sm); background: var(--raised); font-size: 0.9375rem;
}
.notice { transition: opacity 0.2s ease; }
.notice.is-dismissed { opacity: 0; }
.notice-good { border-left-color: var(--positive); background: var(--positive-tint); }
.notice-bad, .fine-banner { border-left-color: var(--danger); background: var(--danger-tint); }
.notice-warn { border-left-color: var(--caution); background: var(--caution-tint); }
.notice-info { border-left-color: var(--info); background: var(--info-tint); }
.error-summary { border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-tint); color: var(--danger); padding: 12px 14px; margin-bottom: 16px; }
.error-summary ul { margin: 0; padding-left: 1.2em; }
.toast-region {
  position: fixed; z-index: 70; left: 16px; right: 16px;
  bottom: calc(var(--bottom-bar) + 12px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--page); box-shadow: var(--shadow-lift); cursor: pointer;
}
.toast-bad { background: var(--danger); color: var(--on-danger); }
.toast-good { background: var(--positive); color: #fff; }
.toast-warn { background: var(--caution); color: #fff; }
dialog.sheet, dialog.drawer {
  padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lift); max-width: 100%;
}
dialog.sheet:not(.drawer):not(.sheet-confirm) {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(640px, 100%);
  border-radius: 20px 20px 0 0; max-height: min(88dvh, 820px);
}
dialog.sheet-confirm {
  position: fixed; inset: 0; margin: auto; width: min(420px, calc(100% - 32px));
  height: fit-content; border-radius: var(--radius); padding: 8px 8px 16px;
}
dialog.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(420px, 100%);
  height: 100%; max-height: 100%; border-radius: 0;
}
dialog.sheet::backdrop, dialog.drawer::backdrop { background: rgb(25 22 16 / 42%); }
.sheet-panel { max-height: min(88dvh, 820px); overflow: auto; }
dialog.drawer .sheet-panel { max-height: 100%; height: 100%; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 16px; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-body { padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.sheet-confirm form { padding: 8px 12px 4px; }
.sheet-confirm h2 { margin: 8px 4px; }
.sheet-confirm p { margin: 0 4px 16px; }
@media (min-width: 860px) {
  .toast-region { left: auto; right: 24px; bottom: 24px; width: min(380px, calc(100% - 48px)); }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet:not(.sheet-confirm):not(.drawer)[open] { animation: sheet-in 0.2s ease; }
  dialog.drawer[open] { animation: drawer-in 0.22s ease; }
}
@keyframes sheet-in { from { transform: translateY(16px); } to { transform: none; } }
@keyframes drawer-in { from { transform: translateX(24px); } to { transform: none; } }

/* Buttons and forms. Touch targets stay at least 44px (the token is 48). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-weight: 650; line-height: 1.2; cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--brand); }
.btn-quiet:hover { background: var(--brand-tint); }
.btn-block { width: 100%; }
.btn-small { min-height: var(--tap); padding: 8px 12px; font-size: 0.875rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.action-bar .btn { flex: 1 1 140px; }
.field { display: block; margin-bottom: 14px; }
.field > label, .field-label { display: block; font-weight: 650; margin-bottom: 6px; }
.field .hint { display: block; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; }
.checkline { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 6px 0; }
.checkline input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); }
.field-error { display: block; color: var(--danger); font-size: 0.875rem; font-weight: 600; margin-top: 4px; }
.field-error:empty { display: none; }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 720px) { .form-grid-2, .grid-2 { grid-template-columns: 1fr 1fr; } }
.card, .tile {
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; color: inherit; text-decoration: none;
}
a.tile:hover { border-color: var(--line-strong); }
.card-tight { padding: 12px 14px; }
.section-title {
  display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 8px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
}
.empty { padding: 28px 16px; text-align: center; color: var(--ink-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.tabs ul, .filters { display: flex; gap: 8px; overflow-x: auto; list-style: none; margin: 0 0 14px; padding: 0; }
.tabs a, .filters a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.tabs a[aria-current="page"], .filters a[aria-current="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--brand); }
.prose { white-space: pre-wrap; }
.photo-proof img, .check-photo svg, .check-photo img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--page); color: var(--ink-soft); font-size: 0.8125rem; font-weight: 650;
}
.chip-todo { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-strong); }
.chip-waiting { background: var(--page); border-color: var(--line-strong); color: var(--ink-soft); }
.chip-good, .chip-paid { background: var(--positive-tint); border-color: var(--positive); color: var(--positive); }
.chip-bad, .chip-overdue { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.chip-neutral, .chip-cancelled { color: var(--ink-faint); }

/* Today */
.balance {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px;
}
.balance p, .balance .balance-figure {
  margin: 0; padding: 12px; background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.balance span, .figure-label { display: block; color: var(--ink-soft); font-size: 0.75rem; font-weight: 650; }
.balance strong, .figure { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
@media (max-width: 420px) {
  .balance { gap: 6px; }
  .balance p, .balance .balance-figure { padding: 8px; }
  .balance strong, .figure { font-size: 1.05rem; }
}
.check-pill {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 14px;
  border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font-weight: 700; text-decoration: none;
}
.chore-card { border-left: 6px solid var(--line-strong); }
.chore-card header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.chore-card h2 { margin: 0; font-size: 1.125rem; }
.state-pill {
  flex: none; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700;
  border: 1px solid transparent;
}
.checker-note { margin: 8px 0; color: var(--ink-soft); }
.chore-card .btn, .grab .btn { margin-top: 8px; }
/* Traffic light (spec 2026-10-13 §2.2): colour, glyph and word together; colour never carries the meaning alone. */
.state-todo { --state: var(--brand); background: var(--brand-tint); border-color: var(--brand); }
.state-waiting { --state: var(--ink-faint); background: var(--page); border-color: var(--line-strong); color: var(--ink-soft); }
.state-sent-back { --state: var(--amber); background: transparent; border: 2px solid var(--amber); color: var(--ink); }
.state-lapsed { --state: var(--amber); background: var(--amber-tint); border-color: var(--amber); color: var(--ink); }
.state-rejected { --state: var(--danger); background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.state-approved { --state: var(--positive); background: var(--positive-tint); border-color: var(--positive); color: var(--positive); }
.chore-card.state-todo { border-left-color: var(--brand); background: var(--raised); color: inherit; }
.chore-card.state-waiting { border-left-color: var(--ink-faint); background: var(--raised); color: inherit; }
.chore-card.state-sent-back { border-left-color: var(--amber); background: var(--raised); color: inherit; }
.chore-card.state-lapsed { border-left-color: var(--amber); background: var(--amber-tint); color: inherit; }
.chore-card.state-rejected { border-left-color: var(--danger); background: var(--raised); color: inherit; }
.chore-card.state-approved { border-left-color: var(--positive); background: var(--raised); color: inherit; }
.state-started { --state: var(--brand); background: var(--brand-tint); border-color: var(--brand); color: var(--brand-strong); }
.chore-card.state-started { border-left-color: var(--brand); background: var(--raised); color: inherit; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card-actions .btn { flex: 1 1 10rem; }
.started-line { color: var(--brand-strong); font-weight: 600; }
.hint-warn { color: var(--amber); display: block; }
.chore-card .state-pill { background: var(--page); color: var(--ink); border-color: var(--line); }
.state-word { font-size: 0.75rem; font-weight: 700; }
.state-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; list-style: none; margin: 4px 0 10px; padding: 0; font-size: 0.8125rem; }
.state-legend li { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid transparent; font-weight: 700; }
.grabs { margin: 8px 0 18px; }
.grab-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.grab {
  flex: 0 0 min(280px, 85%); padding: 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--raised); box-shadow: var(--shadow);
}
.later-list { list-style: none; margin: 0; padding: 0; }
.later-list li {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); min-height: var(--tap); align-items: center;
}

/* Week board */
.week-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.week-switch { display: flex; align-items: center; gap: 8px; }
.week-switch .btn { min-width: var(--tap); padding-inline: 12px; }
.week-shell { display: flex; flex-direction: column; gap: 16px; }
.pool-rail, .people-list, .pool-group {
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.pool-search { margin-bottom: 10px; }
.pool-group + .pool-group { margin-top: 10px; }
.pool-group h2 { margin: 0 0 8px; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); }
.pool-chip, .board-chip {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: var(--tap); padding: 8px 40px 8px 22px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  user-select: none; touch-action: pan-x pan-y;
}
.pool-chip { margin-bottom: 8px; cursor: grab; }
.board-chip { cursor: grab; margin-bottom: 6px; }
.board-chip[data-draggable="false"] { cursor: default; }
.board-chip-title, .pool-chip .board-chip-title { font-weight: 700; font-size: 0.875rem; line-height: 1.25; }
.board-chip-pay { font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.board-chip::before, .state-pill::before { font-weight: 800; }
.board-chip::before {
  position: absolute; left: 8px; top: 12px; font-size: 0.8rem; content: "•"; color: var(--state, var(--ink-faint));
}
.board-chip.state-todo::before { content: "○"; }
.board-chip.state-sent-back::before { content: "!"; }
.board-chip.state-waiting::before { content: "…"; }
.board-chip.state-approved::before { content: "✓"; }
.board-chip.state-lapsed::before { content: "–"; }
.board-chip.state-rejected::before { content: "×"; }
.board-chip.state-started::before { content: "▶"; }
.board-chip.state-todo { border-color: var(--brand); }
.board-chip.state-sent-back { border: 2px solid var(--amber); }
.board-chip.state-lapsed { border-color: var(--amber); background: var(--amber-tint); }
.board-chip.state-rejected { border-color: var(--danger); background: var(--danger-tint); }
.board-chip.state-approved { border-color: var(--positive); background: var(--positive-tint); }
.board-chip.state-started { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-strong); }
.chip-menu { position: static; }
.chip-menu > summary { list-style: none; }
.chip-menu > summary::-webkit-details-marker { display: none; }
.board-chip .kebab, .pool-chip .kebab { position: absolute; top: 0; right: 0; }
.chip-menu-panel {
  position: absolute; z-index: 5; right: 0; top: calc(100% - 8px); min-width: 200px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lift);
}
.chip-menu-panel button, .chip-menu-panel a {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 10px;
  border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; border-radius: 8px;
}
.chip-menu-panel button:hover, .chip-menu-panel a:hover { background: var(--page); }
.chip-carried { font-size: 0.7rem; color: var(--ink-soft); }
.chip-pool { display: inline-flex; align-items: center; }
.board-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.board-table { min-width: 980px; }
.board-row { display: grid; grid-template-columns: 118px repeat(7, minmax(118px, 1fr)); }
.board-cell, .board-colhead, .board-person, .board-corner {
  min-height: 76px; padding: 6px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
}
.board-person, .board-corner {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.board-colhead, .board-corner { position: sticky; top: 0; z-index: 3; background: var(--surface); min-height: 48px; font-size: 0.8125rem; }
.board-corner { z-index: 4; }
.board-colhead span { display: block; font-size: 1rem; }
.board-cell.is-today, .board-colhead.is-today { background: var(--brand-tint); box-shadow: inset 0 -3px 0 var(--brand); }
.board-cell.is-past, .board-colhead.is-past { background: var(--past); color: var(--ink-faint); }
.board-row.is-unassigned .board-cell {
  background: repeating-linear-gradient(-45deg, transparent, transparent 6px, var(--hatch) 6px, var(--hatch) 8px);
}
.board-chip.dragging, .pool-chip.dragging { opacity: 0.45; }
.drag-ghost { position: fixed; z-index: 80; width: 160px; margin: 0; pointer-events: none; box-shadow: var(--shadow-lift); opacity: 0.95; }
.board-cell.drop-target { outline: 3px dashed var(--brand); outline-offset: -3px; background: var(--brand-tint); }
.board-cell.drop-invalid { outline: 3px dashed var(--danger); outline-offset: -3px; background: var(--danger-tint); cursor: not-allowed; }
@media (min-width: 1000px) {
  .week-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .pool-rail { position: sticky; top: 72px; max-height: calc(100dvh - 96px); overflow: auto; }
}
@media (max-width: 999px) {
  .pool-groups { display: flex; gap: 10px; overflow-x: auto; }
  .pool-group { flex: 0 0 200px; }
}

/* Check */
.check-card { display: grid; gap: 12px; padding: 12px; }
.check-photo {
  display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--line); cursor: pointer; min-height: 180px;
}
.check-photo svg { aspect-ratio: 4 / 3; object-fit: cover; }
.check-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.check-actions .btn { flex: 1 1 140px; }
.check-reject summary { list-style: none; cursor: pointer; }
.check-reject summary::-webkit-details-marker { display: none; }
.check-reject[open] { flex-basis: 100%; }
.done-today { margin-top: 18px; }
.done-today summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 700; }
@media (min-width: 800px) {
  .check-card { grid-template-columns: minmax(220px, 38%) 1fr; align-items: start; }
}

/* Money */
.money-grid { display: flex; flex-direction: column; gap: 10px; }
.money-head { display: none; }
.money-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.money-row .who { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.money-row [data-label]::before {
  content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 650; color: var(--ink-faint);
}
.money-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.money-total {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 14px;
  padding-top: 12px; font-size: 1.125rem;
}
.pots { margin-bottom: 18px; }
.pots-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pots-head .section-title { margin: 0; }
.pots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.pot { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.pot h3 { margin: 0 0 6px; }
.pot dl { margin: 0; display: grid; gap: 4px; }
.pot dl > div { display: flex; justify-content: space-between; gap: 12px; }
.pot dt { color: var(--ink-soft); font-size: 0.875rem; }
.pot dd { margin: 0; }
.pot-short { margin-left: 4px; font-size: 0.8125rem; font-weight: 700; }
.ledger { list-style: none; margin: 0 0 16px; padding: 0; }
.ledger li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .money-head { display: grid; }
  .money-head, .money-row {
    grid-template-columns: 1.4fr repeat(4, 0.8fr) auto; align-items: center;
    background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 0;
  }
  .money-head { color: var(--ink-faint); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
  .money-row .who, .money-actions { grid-column: auto; }
  .money-row [data-label]::before { display: none; }
  .money-actions { flex-wrap: nowrap; }
}

/* People and pool lists (pool rail above; people for /People) */
.people-list { list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.person-row {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.person-row .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.role-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 8px;
  border-radius: var(--radius-pill); background: var(--brand-tint); color: var(--brand-strong);
  font-size: 0.75rem; font-weight: 700;
}
.role-chip.is-off { background: var(--page); color: var(--ink-faint); }
.person-card { align-self: start; }
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

/* Shared components: icons, roundels, money jar, small helpers used by several pages. */
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; stroke: currentColor; }
.icon-lg { width: 1.75em; height: 1.75em; }
.icon-sm { width: 1em; height: 1em; }
.roundel {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--brand-tint); color: var(--state, var(--brand));
}
.roundel .icon { width: 24px; height: 24px; vertical-align: 0; }
.roundel-sm { width: 36px; height: 36px; }
.roundel-sm .icon { width: 20px; height: 20px; }
.roundel-raised { background: var(--raised); box-shadow: var(--shadow); }
.roundel-badge {
  position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--raised); border: 1px solid var(--line); color: var(--state, inherit);
}
.roundel-badge .icon { width: 14px; height: 14px; }
.balance-row { display: flex; gap: 12px; align-items: stretch; }
.balance-row .balance { flex: 1; margin-bottom: 0; }
.jar {
  position: relative; flex: none; width: 80px; height: 110px; overflow: hidden;
  border: 3px solid var(--line-strong); border-radius: 14px 14px 26px 26px; background: var(--raised);
}
.jar::before {
  content: ""; position: absolute; top: -3px; left: 14px; right: 14px; height: 10px; z-index: 1;
  border-radius: 0 0 5px 5px; background: var(--line-strong);
}
.jar-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--accent); opacity: 0.9;
  transition: height 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.jar-fill.df-ripple { animation: df-ripple 0.7s ease-out; }
@keyframes df-ripple {
  0% { transform: scaleY(1); }
  30% { transform: scaleY(1.06) translateY(-2px); }
  60% { transform: scaleY(0.97); }
  100% { transform: scaleY(1); }
}
@media (max-width: 420px) { .jar { width: 64px; height: 92px; } }
@media (prefers-reduced-motion: reduce) { .jar-fill { transition: none; } .jar-fill.df-ripple { animation: none; } }
.money-event { position: relative; }
.potential { margin: 8px 0 18px; color: var(--ink-soft); font-weight: 650; }
.potential:empty { display: none; }
.chip-repeat, .chip-taken { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; color: var(--ink-soft); font-size: 0.75rem; }
.chip-repeat .icon, .chip-taken .icon { width: 0.875rem; height: 0.875rem; }
.board-chip:has(.board-chip-roundel)::before { content: none; }
.board-chip:has(.board-chip-roundel), .pool-chip:has(.board-chip-roundel) { padding-left: 38px; }
.board-chip-roundel { position: absolute; left: 8px; top: 8px; display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--state, var(--brand)); }
.board-chip-roundel .chip-icon { width: 20px; height: 20px; }
.board-chip-roundel .chip-state-badge { position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px; }
.pool-chip .board-chip-roundel { color: var(--brand); }
.pool-group > summary { display: flex; align-items: center; gap: 6px; min-height: var(--tap); cursor: pointer; }
.pool-new { margin-top: 12px; }
.pool-new > form { margin-top: 10px; }
[data-recent]:empty { display: none; }
.title-row { display: flex; gap: 12px; align-items: center; min-width: 0; }
.title-row h2, .title-row h3 { margin: 0; }
.who-line { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: var(--ink-soft); }
.empty-art img { display: block; max-width: 220px; width: 60%; margin: 0 auto 10px; }
.fine-banner { align-items: center; }
.fine-banner form { margin: 0; }
.photo-hero { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.photo-hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); display: block; }
.photo-hero-none {
  display: grid; place-items: center; align-content: center; gap: 6px; aspect-ratio: 4 / 3; border-radius: var(--radius);
  background: var(--page); color: var(--ink-faint); border: 1px dashed var(--line-strong);
}
.photo-pair { display: grid; gap: .5rem; }
.photo-slot { margin: 0; }
.photo-slot figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .25rem; }
.photo-gap { margin: 0; text-align: center; font-size: .85rem; color: var(--ink-soft); }
.photo-flag-missing { border: 2px solid var(--danger); color: var(--danger); background: var(--danger-tint); font-weight: 700; }
@media (min-width: 700px) {
  .photo-pair { grid-template-columns: 1fr auto 1fr; align-items: start; }
  .photo-gap { align-self: center; padding: 0 .25rem; }
  .photo-pair > .photo-slot:last-child { grid-column: 3; }
}
.photo-overlay { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; align-items: center; }
.check-actions .btn { min-height: 56px; font-size: 1.05rem; }
.check-actions form { display: contents; }
.money-grid .btn { gap: 6px; }
.money-grid .owed { font-weight: 800; }
.money-grid .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.ledger li > span:first-child { display: flex; gap: 8px; align-items: center; }
.fine-reverse { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fine-reverse input[type="text"] { min-height: var(--tap); min-width: 14rem; flex: 1 1 14rem; }
.ledger li:has(.fine-reverse){flex-wrap:wrap}
.fine-reverse{flex-basis:100%}
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0 0 14px; }
.icon-picker legend { font-weight: 650; margin-bottom: 6px; padding: 0; }
.icon-picker label { display: grid; place-items: center; min-height: 52px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.icon-picker label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon-picker .icon { width: 28px; height: 28px; }
.pool-row { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.pool-row .grow, .person-row .grow { flex: 1 1 auto; min-width: 0; }
.pool-row.is-archived { opacity: 0.65; }
.pool-row .acts, .person-row .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.chores-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.chores-row-reward input { width: 5.5rem; }
.chores-filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.secret-card { border-left: 4px solid var(--caution); }
.secret-card code { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; }

/* Sign-in, kept so the current login page still matches the shell. */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter) 40px; }
.signin-card { width: 100%; max-width: 400px; }
.signin-brand { text-align: center; margin-bottom: 18px; }
.signin-brand .mark { width: 56px; height: 56px; border-radius: 17px; font-size: 1.25rem; margin: 0 auto 10px; }
.signin-brand p { color: var(--ink-soft); }

@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 print {
  .masthead, .bottom-nav, .toast-region, .pool-rail, .chip-menu, .sheet, .drawer, .week-toolbar { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  .board-scroll { overflow: visible; border: 0; }
  .board-table { min-width: 1190px; }
  .card, .chore-card, .check-card { box-shadow: none; break-inside: avoid; }
}

/* Stats */
.stats-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stats-board li { display: grid; grid-template-columns: 32px 1fr auto; grid-template-areas: "av name count" "av bar bar" "av sub sub"; gap: 4px 10px; align-items: center; }
.stats-board .avatar { grid-area: av; }
.stats-board strong { grid-area: name; }
.stats-count { grid-area: count; font-weight: 700; }
.stats-bar { grid-area: bar; display: block; height: 8px; border-radius: var(--radius-pill); background: var(--brand-tint); overflow: hidden; }
.stats-bar > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.stats-sub { grid-area: sub; color: var(--ink-soft); font-size: .9rem; }
.badge-leader { background: var(--accent); color: #1a1400; border-radius: var(--radius-pill); padding: 2px 8px; font-size: .8rem; font-weight: 700; margin-left: 6px; }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th, .stats-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table tfoot td { font-weight: 700; border-bottom: 0; }
.stats-graph { width: 100%; height: auto; }
.stats-graph .grid { stroke: var(--line); stroke-width: 1; }
.stats-graph text { fill: var(--ink-soft); font-size: 11px; }
.stats-line { stroke: var(--ink-faint); }
.stats-line-total, .swatch[data-colour="total"] { stroke: var(--ink-faint); background: var(--ink-faint); }
.stats-graph circle[data-colour="total"] { fill: var(--ink-faint); }
.stats-line[data-colour="rose"] { stroke: #b5326b; } .stats-graph circle[data-colour="rose"] { stroke: #b5326b; fill: #b5326b; }
.stats-line[data-colour="amber"] { stroke: #9a6108; } .stats-graph circle[data-colour="amber"] { stroke: #9a6108; fill: #9a6108; }
.stats-line[data-colour="teal"] { stroke: #126b70; } .stats-graph circle[data-colour="teal"] { stroke: #126b70; fill: #126b70; }
.stats-line[data-colour="indigo"] { stroke: #3f5bd9; } .stats-graph circle[data-colour="indigo"] { stroke: #3f5bd9; fill: #3f5bd9; }
.stats-line[data-colour="green"] { stroke: #1f7043; } .stats-graph circle[data-colour="green"] { stroke: #1f7043; fill: #1f7043; }
.stats-line[data-colour="plum"] { stroke: #6c3fa0; } .stats-graph circle[data-colour="plum"] { stroke: #6c3fa0; fill: #6c3fa0; }
.stats-line[data-colour="slate"] { stroke: #4a5666; } .stats-graph circle[data-colour="slate"] { stroke: #4a5666; fill: #4a5666; }
.stats-graph polyline, .stats-line { fill: none !important; }
.stats-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0; margin: 8px 0 0; color: var(--ink-soft); font-size: .9rem; }
.stats-legend .swatch { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.swatch[data-colour="rose"] { background: #b5326b; } .swatch[data-colour="amber"] { background: #9a6108; } .swatch[data-colour="teal"] { background: #126b70; } .swatch[data-colour="indigo"] { background: #3f5bd9; } .swatch[data-colour="green"] { background: #1f7043; } .swatch[data-colour="plum"] { background: #6c3fa0; } .swatch[data-colour="slate"] { background: #4a5666; }
.stats-avg { margin: 8px 0 0; color: var(--ink-soft); }
/* Desktop Week board: wide and compact (owner, 18 Oct 2026) */
@media (min-width: 1200px) {
  .shell-wide { max-width: none; padding: 0 24px; }
  .shell-wide .page-head { margin-bottom: 8px; }
  .week-chrome { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .week-chrome .state-legend { margin: 0; }
  .week-chrome .week-toolbar { margin-bottom: 0; }
  .board-table { min-width: 1190px; }
  .board-row { grid-template-columns: 140px repeat(7, minmax(150px, 1fr)); }
  .board-colhead, .board-corner { min-height: 36px; background: var(--raised); }
  .board-cell {
    min-height: 72px; padding: 4px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; align-content: start;
  }
  .board-chip {
    display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content); grid-template-rows: auto auto; align-items: center; gap: 2px 8px;
    min-height: 64px; padding: 6px 36px 6px 8px; margin-bottom: 0;
  }
  .board-chip:has(.board-chip-roundel) { padding-left: 8px; }
  .board-chip .board-chip-roundel { position: relative; left: auto; top: auto; width: 28px; height: 28px; grid-row: 1 / span 2; align-self: center; }
  .board-chip .board-chip-roundel .chip-icon { width: 22px; height: 22px; }
  .board-chip .board-chip-title { grid-column: 2 / span 2; grid-row: 1; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.95rem; line-height: 1.25; }
  .board-chip .state-word { grid-column: 2; grid-row: 2; font-size: 0.75rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .board-chip .board-chip-pay { grid-column: 3; grid-row: 2; justify-self: end; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .board-chip .kebab { min-width: 28px; min-height: 28px; top: 2px; right: 2px; }
  .week-shell { grid-template-columns: 340px minmax(0, 1fr); }
  .pool-rail { padding: 10px; }
  .pool-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
  .pool-group + .pool-group { margin-top: 0; }
  .pool-group { padding: 8px; }
  .pool-group > summary { min-height: 36px; font-size: 0.85rem; }
  .pool-chip { min-height: 36px; padding: 4px 8px 4px 28px; margin-bottom: 4px; }
  .pool-chip:has(.board-chip-roundel) { padding-left: 28px; }
  .pool-chip .board-chip-roundel { width: 20px; height: 20px; left: 4px; top: 8px; }
  .pool-chip .board-chip-roundel .chip-icon { width: 16px; height: 16px; }
  .pool-chip .board-chip-title { font-size: 0.8rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .pool-chip .board-chip-pay { font-size: 0.7rem; }
}