:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --line: #e4e0d7;
  --fg: #22211f;
  --muted: #6d6a63;
  --accent: #345267;

  --mike: #2f6fd6;
  --mike-tint: #e3ecfb;
  --mike-ink: #1d4a96;
  --molly: #c2417a;
  --molly-tint: #f8e3ec;
  --molly-ink: #8e2756;
  --fend-tint: #eeece6;
  --open-line: #b8b3a8;
  --grind: #f2e3bf;
  --warn: #f5dccb;

  --radius: 12px;
  --radius-sm: 8px;
  --gap: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a18;
    --panel: #252421;
    --line: #3a3833;
    --fg: #efede8;
    --muted: #a19d94;
    --accent: #9cc0d8;
    --mike: #6d9ef0;
    --mike-tint: #213252;
    --mike-ink: #b9d0f8;
    --molly: #e57aa8;
    --molly-tint: #4a2334;
    --molly-ink: #f5c0d6;
    --fend-tint: #33312d;
    --open-line: #5f5b53;
    --grind: #4d4227;
    --warn: #4e3426;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a18;
  --panel: #252421;
  --line: #3a3833;
  --fg: #efede8;
  --muted: #a19d94;
  --accent: #9cc0d8;
  --mike: #6d9ef0;
  --mike-tint: #213252;
  --mike-ink: #b9d0f8;
  --molly: #e57aa8;
  --molly-tint: #4a2334;
  --molly-ink: #f5c0d6;
  --fend-tint: #33312d;
  --open-line: #5f5b53;
  --grind: #4d4227;
  --warn: #4e3426;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 var(--font);
}

/* ---- header ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 18px; }
.tabs { display: flex; background: var(--line); border-radius: 999px; padding: 3px; }
.tab {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.tab[aria-current="page"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}
.status { color: var(--muted); }
.status.error { color: var(--molly-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow { font-size: 13px; color: var(--muted); margin: 0 0 2px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 12px; font-weight: 650; letter-spacing: -0.01em; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-Mike { background: var(--mike); }
.dot-Molly { background: var(--molly); }
.dot-Open { border: 1.5px dashed var(--open-line); }

.tag { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.foot { margin-top: 20px; font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; margin: 0; }

/* ---- summary tiles ---- */
.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 0;
}
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-num { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat-num small { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ---- week: anchors + legend ---- */
.week-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.anchors { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.anchors li {
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
}
.anchors .label { color: var(--muted); }
.anchors .unset { color: var(--muted); font-style: italic; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- slots (shared by both week layouts) ---- */
.slot {
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  border: 1.5px solid transparent;
}
.slot-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.slot-who { font-size: 15px; font-weight: 600; }
.who-Mike { background: var(--mike-tint); }
.who-Mike .slot-who { color: var(--mike-ink); }
.who-Molly { background: var(--molly-tint); }
.who-Molly .slot-who { color: var(--molly-ink); }
.who-Fend, .who-Other { background: var(--fend-tint); }
.who-Open { border-style: dashed; border-color: var(--open-line); }
.who-Open .slot-who { color: var(--muted); font-weight: 500; }

/* ---- week: phone day cards ---- */
.days { display: grid; gap: var(--gap); }
.day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.day-name { font-weight: 600; }
.day-date { color: var(--muted); font-size: 13px; margin-left: 6px; font-weight: 400; }
.row-label { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.dinner-row { margin-bottom: 10px; }
.dinner-row .slot { flex-direction: row; align-items: center; justify-content: space-between; }
.dog-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.day-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.day-note::before { content: "Note: "; font-weight: 600; }

/* ---- week: desktop calendar ---- */
.cal { display: none; }

.rule {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 12px;
}

/* ---- cards ---- */
.page-head { margin-bottom: 12px; }
.page-head h1 { margin-bottom: 0; }
.search {
  width: 100%;
  font: inherit;
  font-size: 16px; /* stops iOS zooming in */
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--fg);
  margin-bottom: 12px;
}

.person-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 14px;
}
.switch-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.switch-btn[aria-selected="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.switch-btn .count { font-variant-numeric: tabular-nums; opacity: 0.7; }

.owner-cols { display: grid; gap: 16px; align-items: start; }
.owner-col { display: none; min-width: 0; }
.owner-col.active { display: block; }
.col-head { display: none; }

.card-group + .card-group { margin-top: 16px; }
.suit-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.card-group-grind .suit-head { color: var(--fg); }
.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-group-grind .card-list { border-color: color-mix(in srgb, var(--grind) 70%, var(--line)); }
.card-list > li + li { border-top: 1px solid var(--line); }
.card summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 44px;
  font-size: 15px;
}
.card summary::-webkit-details-marker { display: none; }
.card-name { flex: 1; min-width: 0; }
.card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--fend-tint); color: var(--muted); white-space: nowrap; }
.badge-grind { background: var(--grind); color: var(--fg); }
.badge-warn { background: var(--warn); color: var(--fg); }

.chev { color: var(--muted); transition: transform 0.15s; font-size: 10px; flex: none; }
.card[open] .chev { transform: rotate(90deg); }
.card-body { padding: 0 12px 12px 30px; font-size: 14px; }
.card-body p { margin: 0 0 8px; }
.card-body h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.card-body ul { margin: 0; padding-left: 18px; }
.card-body li { margin-bottom: 3px; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ======================================================================
   Wide screens: calendar grid for the week, owner columns side by side.
   ====================================================================== */
@media (min-width: 760px) {
  .wrap { padding-top: 20px; }
  h1 { font-size: 30px; margin-bottom: 0; }

  .week-head, .page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
  }
  .week-head .summary { margin: 0; width: min(520px, 55%); gap: var(--gap); }
  .page-head .search { width: min(320px, 40%); margin: 0; }

  .days { display: none; }
  .cal {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .cal col.cal-labels { width: 128px; }
  .cal th, .cal td { padding: 6px; vertical-align: middle; text-align: left; }
  .cal thead th, .cal-corner { border-bottom: 1px solid var(--line); padding: 10px 8px 8px; }
  .cal tbody tr + tr > * { border-top: 1px solid var(--line); }
  .cal td + td, .cal th + td, .cal th + th, .cal td + th { border-left: 1px solid var(--line); }

  .cal-day { font-weight: 600; }
  .cal-dow { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
  .cal-date { font-size: 22px; font-weight: 600; line-height: 1.1; margin-right: 6px; }
  .cal-day.is-today .cal-dow, .cal-day.is-today .cal-date { color: var(--accent); }
  .cal .is-today { background: color-mix(in srgb, var(--accent) 7%, transparent); }

  .cal-label { padding-left: 12px !important; }
  .cal-label span { display: block; font-size: 14px; font-weight: 600; }
  .cal-label small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
  .cal-row-dinner .cal-label span { font-size: 15px; }
  .cal-row-dinner td { padding-top: 8px; padding-bottom: 8px; }
  .cal-row-dog .slot { min-height: 40px; }
  .cal .slot { padding: 6px 9px; }
  .cal .slot-who { font-size: 14px; }
  .cal-note { font-size: 12px; color: var(--muted); line-height: 1.3; }

  .person-switch { display: none; }
  .owner-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
  .owner-col { display: block; }
  .col-head {
    display: block;
    position: sticky;
    top: 57px;
    z-index: 2;
    background: var(--bg);
    padding: 6px 0 10px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 12px;
  }
  .owner-col-Mike .col-head { border-bottom-color: var(--mike); }
  .owner-col-Molly .col-head { border-bottom-color: var(--molly); }
  .owner-col-Open .col-head { border-bottom: 2px dashed var(--open-line); }
  .col-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 650; }
  .col-sub { font-size: 13px; color: var(--muted); }
  .card summary { font-size: 14px; padding: 9px 10px; }
  .card-body { padding-left: 28px; }
}

/* ======================================================================
   Shared controls
   ====================================================================== */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }

.input {
  font: inherit;
  font-size: 16px; /* stops iOS zooming in */
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--fg);
  min-width: 0;
  min-height: 42px;
}
.input:focus, .search:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
.input-small { font-size: 13px; padding: 4px 6px; min-height: 30px; }

.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  padding: 9px 14px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-small { font-size: 13px; padding: 4px 10px; min-height: 30px; font-weight: 500; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.icon-btn {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  flex: none;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--fg); background: var(--fend-tint); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.chip .icon { width: 14px; height: 14px; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--open-line);
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex: none;
}
.check .icon { width: 16px; height: 16px; stroke-width: 3; }
.check:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 50%, transparent); }
.check.is-checked { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.group-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.item-group { margin-bottom: 18px; }
.item-group-overdue .group-head { color: var(--molly-ink); }
.items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.items > li + li { border-top: 1px solid var(--line); }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  min-height: 52px;
}
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-size: 15px; }
.item-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.item-list { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.item-list:hover { color: var(--fg); text-decoration: underline; }
.item-list .dot { width: 8px; height: 8px; }
.item-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.item.is-done .item-title { text-decoration: line-through; color: var(--muted); }

.prio { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.prio-High { background: var(--warn); color: var(--fg); }
.prio-Medium { background: var(--grind); color: var(--fg); }
.prio-Low { background: var(--fend-tint); color: var(--muted); }
.limit { font-variant-numeric: tabular-nums; }
.limit.at-limit { color: var(--fg); }

.done-group > summary { cursor: pointer; list-style: none; }
.done-group > summary::-webkit-details-marker { display: none; }
.done-group > summary::after { content: "Show"; font-weight: 500; text-transform: none; letter-spacing: 0; }
.done-group[open] > summary::after { content: "Hide"; }

.callout {
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 16px;
}

.add-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.add-form > .input { flex: 1 1 100%; }
.add-extras { display: flex; gap: 8px; flex: 1 1 auto; min-width: 0; }
.add-extras .input { flex: 1; }
.add-form .btn { flex: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 10px 10px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 20;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-btn { font: inherit; font-weight: 600; background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 4px 6px; }

/* ======================================================================
   Navigation: bottom tab bar on phones, top tabs on wide screens
   ====================================================================== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.bottom-nav .icon { width: 22px; height: 22px; }
.bottom-nav a[aria-current="page"] { color: var(--accent); }
.top .tabs { display: none; }
.wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ======================================================================
   Lists
   ====================================================================== */
.lists-layout.is-detail .lists-nav { display: none; }
.lists-layout.is-index .lists-main { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 6px;
  min-height: 46px;
}
.nav-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.nav-name { flex: 1; min-width: 0; font-size: 15px; }
.nav-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-upcoming { font-weight: 600; }
.nav-upcoming .nav-count { background: var(--fg); color: var(--bg); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.nav-group { margin-top: 18px; }
.nav-group-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 6px 2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.nav-group-head small { text-transform: none; letter-spacing: 0; font-weight: 400; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); text-decoration: none; font-size: 15px; margin: 0 0 10px -4px; padding: 4px; }
.back .icon { width: 18px; height: 18px; }

.list-head { margin-bottom: 14px; }
.list-head h1 { margin-bottom: 4px; }
.list-owner { margin: 0; font-size: 14px; font-weight: 500; }
.list-owner .dot { margin-right: 6px; vertical-align: 0; }
.list-owner .muted { font-weight: 400; }
.prio-head-High { color: var(--fg); }
.list-blurb { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

.checklist-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.progress { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s; }
.progress-label { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.card-lists { display: flex; flex-wrap: wrap; gap: 6px; }
.list-link { font-size: 13px; color: var(--accent); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }

/* ======================================================================
   Shopping
   ====================================================================== */
.shop-count { margin: 0; color: var(--muted); font-size: 14px; }
.add-form-shop { margin-bottom: 8px; }
.me-line { font-size: 13px; color: var(--muted); margin: 0 0 16px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.me-btn {
  font: inherit;
  font-size: 13px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.me-btn.active { border-color: var(--line); background: var(--panel); color: var(--fg); font-weight: 600; }
.me-btn .dot { width: 8px; height: 8px; }

.shop-section { margin-bottom: 16px; break-inside: avoid; }
.shop-section.all-got .group-head { opacity: 0.6; }
.shop-item { padding-right: 4px; min-height: 54px; }
.item-tap {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 8px 0;
  text-align: left;
  cursor: pointer;
}
.shop-item .item-title { font-size: 16px; }
.shop-item .dot { width: 8px; height: 8px; opacity: 0.8; }

.last-trip { margin-top: 8px; }
.last-trip .group-head .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.readd { display: flex; flex-wrap: wrap; gap: 6px; }

.shop-bar {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 10px 10px 16px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
  z-index: 4;
  font-size: 15px;
}

/* ======================================================================
   Wide screens for the new views
   ====================================================================== */
@media (min-width: 760px) {
  .top .tabs { display: flex; }
  .bottom-nav { display: none; }
  .wrap { padding-bottom: 40px; }
  .toast { bottom: 24px; }

  .add-form { flex-wrap: nowrap; }
  .add-form > .input { flex: 1 1 auto; }
  .add-extras { flex: 0 1 auto; }
  .add-form-shop .add-extras { flex: 0 0 220px; }

  .lists-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; }
  .lists-layout .lists-nav, .lists-layout .lists-main { display: block !important; }
  .lists-nav { position: sticky; top: 72px; }
  .lists-main .back { display: none; }
  .nav-item { background: transparent; border-color: transparent; margin-bottom: 2px; padding: 8px 10px; min-height: 0; }
  .nav-item:hover { background: var(--panel); }
  .nav-item.active { background: var(--panel); border-color: var(--line); box-shadow: none; }
  .nav-name { font-size: 14px; }
  .list-detail, .upcoming { max-width: 760px; }

  .shop-sections { columns: 2; column-gap: var(--gap); }
  .shop-bar { bottom: 16px; }
}
@media (min-width: 1100px) {
  .shop-sections { columns: 3; }
}

/* ---- not connected yet ---- */
.setup { max-width: 520px; margin: 12vh auto 0; text-align: center; }
.setup p { margin: 0 0 10px; }
body[data-view="setup"] .bottom-nav, body[data-view="setup"] .top .tabs { display: none; }

/* ---- local dev: data source strip ---- */
.dev-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  background: var(--fend-tint);
  border-radius: var(--radius-sm);
  padding: 6px 6px 6px 12px;
  margin-bottom: 14px;
}
.dev-strip-live { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); }

/* ---- sign-in and setup screens ---- */
.setup .btn { margin-top: 8px; }
.btn-google { min-width: 220px; min-height: 48px; font-size: 16px; }
.check-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 4px; font-weight: 500; }
.check-row input { width: 18px; height: 18px; }

/* ======================================================================
   Week editing
   ====================================================================== */
button.slot {
  font: inherit;
  color: inherit;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
}
button.slot:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
button.slot:active { transform: scale(0.97); }
button.slot:focus-visible, .note-btn:focus-visible, .day-note-btn:focus-visible, .anchor-btn:focus-visible, .pick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.week-nav { display: flex; gap: 6px; margin-top: 8px; }
.nav-arrow { padding: 4px 8px; text-decoration: none; }
.nav-next .icon { transform: rotate(180deg); }
.week-nav .btn { text-decoration: none; }

.week-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.tag-past { color: var(--muted); }
.callout-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

.anchor-btn {
  font: inherit;
  font-size: 13px;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.anchors li:has(.anchor-btn) { padding: 0; }
.anchors .anchor-btn { padding: 4px 11px; border-radius: 999px; }
.anchors .anchor-btn:hover { background: var(--fend-tint); }

.day-note-btn {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 0 0;
  margin-top: 4px;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.day-note-btn.is-empty { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.note-btn {
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  background: none;
  border: 1px dashed transparent;
  border-radius: 6px;
  width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  text-align: left;
  cursor: pointer;
}
.note-btn.is-empty { color: transparent; }
.cal-row-notes td:hover .note-btn.is-empty, .note-btn.is-empty:focus-visible { color: var(--muted); border-color: var(--line); }
.note-btn:hover { background: var(--fend-tint); }

/* ---- picker sheet ---- */
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 100%;
  background: var(--panel);
  color: var(--fg);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 40px rgb(0 0 0 / 0.25);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.35); }
.sheet[open] { animation: sheet-up 0.18s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.sheet-title { font-size: 18px; margin: 0; }
.sheet-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.sheet-foot { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.pick-list { display: grid; gap: 6px; }
.pick {
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.pick:hover { border-color: var(--open-line); }
.pick.is-current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.pick-label { flex: 1; font-weight: 600; }
.pick-hint { font-size: 13px; color: var(--muted); }
.pick-check { width: 18px; height: 18px; color: var(--accent); }
.pick-Mike { background: var(--mike-tint); }
.pick-Molly { background: var(--molly-tint); }
.pick-Fend { background: var(--fend-tint); }
.dot-Fend { background: var(--open-line); }
.dot-Day { background: var(--accent); }

.note-input { width: 100%; resize: vertical; min-height: 80px; }

@media (min-width: 760px) {
  .sheet {
    margin: auto;
    width: min(420px, calc(100% - 32px));
    border-radius: 16px;
  }
  .cal .slot { min-height: 40px; }
}
button.slot.who-Open { background: transparent; }

/* ======================================================================
   Card editing
   ====================================================================== */
.owner-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.owner-switch-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-right: 2px; }
.owner-opt {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.owner-opt:hover { border-color: var(--open-line); color: var(--fg); }
.owner-opt.is-current { color: var(--fg); }
.owner-opt-Mike.is-current { background: var(--mike-tint); border-color: var(--mike); color: var(--mike-ink); }
.owner-opt-Molly.is-current { background: var(--molly-tint); border-color: var(--molly); color: var(--molly-ink); }
.owner-opt-Open.is-current { border-style: dashed; border-color: var(--open-line); }
.owner-opt .dot { width: 8px; height: 8px; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.card-foot .card-meta { margin: 0; }
.card-notes { color: var(--muted); }

.wild-toggle { margin-top: 20px; }
.wild-cards { margin-top: 12px; max-width: 520px; }
.wild-note { font-size: 13px; margin: 0 0 10px; }

.card-form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-form textarea { resize: vertical; font-size: 15px; line-height: 1.4; }
.sheet:has(.card-form) { max-height: 92vh; }
.sheet:has(.card-form) .sheet-inner { overflow-y: auto; max-height: 92vh; }
@media (min-width: 760px) {
  .sheet:has(.card-form) { width: min(560px, calc(100% - 32px)); }
}

/* ---- card setup: ready flag and filter ---- */
.setup-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.setup-bar .chips { margin-bottom: 0; }
.setup-progress { display: flex; align-items: center; gap: 8px; min-width: 180px; flex: 0 1 260px; }
.setup-hint { font-size: 13px; margin: 0 0 12px; }
.missing { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.ready-mark { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--accent); }
.ready-mark .icon { width: 14px; height: 14px; stroke-width: 3; }
.card-actions { display: flex; gap: 6px; }
.ready-btn.is-ready { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-color: var(--accent); color: var(--fg); }
.ready-btn .icon { width: 14px; height: 14px; stroke-width: 3; }
.ready-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.ready-check input { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.ready-check strong { margin-right: 4px; }

/* ---- shopping: edit an item ---- */
.shop-edit-form { display: grid; gap: 12px; }
.shop-item .icon-btn { padding: 8px 6px; }

/* ======================================================================
   Week: two grids, shopping days
   ====================================================================== */
.cal-wrap { display: none; }
.cal-section + .cal-section { margin-top: 22px; }
.cal-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; }
.cal-section-head h2 { font-size: 17px; margin: 0; font-weight: 650; }
.cal-section-sub { font-size: 13px; color: var(--muted); }

.shop-toggle {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1.5px dashed transparent;
  border-radius: var(--radius-sm);
  width: 100%;
  min-height: 36px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-align: left;
}
.shop-toggle .icon { width: 16px; height: 16px; flex: none; }
.shop-toggle:not(.is-on) { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.shop-toggle:not(.is-on):hover { border-color: var(--line); color: var(--muted); }
.shop-toggle.is-on { background: var(--grind); color: var(--fg); }
.shop-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shop-toggle.on-card { margin: -4px 0 10px; min-height: 40px; border-color: var(--line); color: var(--muted); font-weight: 500; }
.shop-toggle.on-card.is-on { border-color: transparent; color: var(--fg); font-weight: 600; }

.shop-day { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.shop-day .icon { width: 22px; height: 22px; color: var(--accent); margin-top: 1px; }
.shop-day p { margin: 0; }
.shop-day-title { font-size: 15px; }
.shop-day-sub { font-size: 13px; color: var(--muted); margin-top: 2px !important; }
.shop-day.is-today { border-left-color: var(--molly); }
.shop-day-unset .icon { color: var(--muted); }

@media (min-width: 760px) {
  .cal-wrap { display: block; }
  .cal-row-shop td { padding-top: 4px; padding-bottom: 4px; }
}
