/* ============================================================
   Joey Chores — theme tokens imported from website/css/styles.css
   (navy headings, coral accents, mint CTAs, soft pastels)
   ============================================================ */

:root {
  --navy: #33306b;
  --navy-soft: #55519a;
  --coral: #f8696b;
  --coral-dark: #e4504f;
  --pink: #f9c0c4;
  --pink-soft: #fdeaeb;
  --peri: #8b8bd8;
  --peri-light: #c9c9f2;
  --lav-wash: #f3f2fb;
  --mint: #63e6a9;
  --mint-light: #b9f4d9;
  --yellow: #ffd469;
  --yellow-soft: #ffedbe;
  --cream: #fff3e4;
  --paper: #fffdfb;
  --ink: #4a4766;
  --danger: var(--coral-dark);
  --radius: 20px;
  --shadow: 0 10px 30px rgba(51, 48, 107, 0.10);
  --shadow-soft: 0 6px 18px rgba(51, 48, 107, 0.07);
  --font-head: 'Baloo 2', 'Nunito', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --tap: 44px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--lav-wash);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
}

h1, h2, h3 { font-family: var(--font-head); color: var(--navy); line-height: 1.15; font-weight: 700; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
.muted { color: var(--navy-soft); }

button { font: inherit; }
button svg { display: block; }
/* Any class that sets display (.btn, .select-bar…) would otherwise beat the
   UA's [hidden] rule and show a "hidden" element. */
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--peri); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons ---------- */
/* Every button that can hold an icon centers its content on both axes —
   an SVG icon has no text baseline to lean on, so without this it drifts
   off-center in a way plain text glyphs don't. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  background: var(--peri-light);
  color: var(--navy);
  transition: background-color 150ms ease, transform 100ms ease;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:disabled:active { transform: none; }
.btn-primary { background: var(--mint); }
.btn-primary:hover:not(:disabled) { background: var(--mint-light); }
.btn-danger { background: var(--pink-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--navy-soft); }
.btn-wide { width: 100%; }
.btn.icon-only { width: var(--tap); padding: 0; flex-shrink: 0; }

/* ---------- login ---------- */
/* [hidden] beats a bare .login-wrap{display:grid} at equal specificity only
   if we let it: scope display to :not([hidden]) so the JS hidden toggle
   actually hides this, instead of leaving it stacked above the app. */
.login-wrap {
  min-height: 100dvh;
  padding: 1rem;
}
.login-wrap:not([hidden]) {
  display: grid;
  place-items: center;
}
.login-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  width: min(380px, 100%);
  text-align: center;
}
.login-blob {
  width: 72px; height: 72px;
  margin: 0 auto 0.75rem;
  border-radius: 50% 46% 54% 50% / 52% 50% 50% 48%;
  background: var(--mint-light);
  display: grid; place-items: center;
  font-size: 2rem;
}
.login-card form { margin-top: 1.25rem; text-align: left; }
.login-card label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.login-card input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--peri-light);
  border-radius: 12px;
  font: inherit;
  margin-bottom: 0.75rem;
  background: var(--paper);
}
.login-card input:focus { border-color: var(--peri); outline: none; }
.field-error { color: var(--danger); font-weight: 600; margin: -0.25rem 0 0.75rem; }
.shake { animation: shake 0.3s; }
@keyframes shake {
  25% { transform: translateX(-6px); } 75% { transform: translateX(6px); }
}

/* ---------- app shell ---------- */
.app-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1rem;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}
.view-root {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem calc(4.5rem + env(safe-area-inset-bottom));
}
.tabbar {
  /* Above the sheet (11) and its backdrop (10): navigation must always be
     reachable, even mid-sheet — closing a lingering sheet in one tap is
     the whole point of the fix that made navigate-while-a-sheet-is-open
     close it automatically (see app.js renderView). A lower z-index here
     let the backdrop swallow that tap before it reached the tab link. */
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  display: flex;
  background: var(--paper);
  box-shadow: 0 -4px 18px rgba(51,48,107,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--navy-soft);
  transition: color 150ms ease;
}
.tab span { font-size: 0.7rem; font-weight: 700; }
.tab[aria-current="page"] { color: var(--coral); }
.tab:active { transform: scale(0.94); }

/* ---------- date nav ---------- */
.date-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.date-nav .date-label { font-family: var(--font-head); font-weight: 700; color: var(--navy); text-align: center; flex: 1; min-width: 0; }

/* ---------- cards ---------- */
.group-block { margin-bottom: 1.25rem; }
.group-title {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.chore-card {
  width: 100%;
  display: flex; align-items: center; gap: 0.75rem;
  text-align: left;
  background: var(--paper);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  min-height: 64px;
  cursor: pointer;
}
.chore-card { transition: transform 100ms ease, box-shadow 100ms ease, background-color 150ms ease; }
.chore-card:active { transform: scale(0.985); }
.chore-card .emoji { font-size: 1.4rem; flex-shrink: 0; }
.chore-card .name {
  font-weight: 700; color: var(--navy);
  flex: 1;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chore-card.done { background: var(--mint-light); }
.chore-card.done .name { text-decoration: line-through; text-decoration-thickness: 2px; }

/* The sub-label ("Removed from this day", "Logged — not on schedule") needs
   its own line. Only cards that carry one drop the single-line ellipsis, so
   ordinary cards keep their fixed height. */
.chore-card .name:has(.sub) { white-space: normal; overflow: visible; }
.chore-card .sub {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--navy-soft);
}

/* A day the family called off: present enough to click, quiet enough that it
   never reads as a job still to do. */
.chore-card.removed {
  background: transparent;
  box-shadow: none;
  border: 1px dashed rgba(51, 48, 107, 0.25);
}
.chore-card.removed .emoji { opacity: 0.5; }
.chore-card.removed .name { color: var(--navy-soft); font-weight: 600; }
.put-back {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--peri);
  white-space: nowrap;
  flex-shrink: 0;
}
.points-chip {
  background: var(--yellow-soft);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.tick {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--navy);
  flex-shrink: 0;
}
@keyframes pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.tick.fresh { animation: pop 0.35s ease-out; }

.member-dot {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 0.85rem;
  margin-left: -6px;
  border: 2px solid var(--paper);
  flex-shrink: 0;
}

/* colour classes for members/groups */
.c-navy { background: var(--peri-light); }
.c-coral { background: var(--pink); }
.c-pink { background: var(--pink-soft); }
.c-peri { background: var(--peri-light); }
.c-mint { background: var(--mint-light); }
.c-yellow { background: var(--yellow-soft); }

/* ---------- overdue strip ---------- */
.overdue {
  background: var(--yellow-soft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.overdue summary { font-weight: 700; cursor: pointer; min-height: 28px; }
.overdue .chore-card { box-shadow: none; border: 1px solid var(--yellow); }

/* ---------- empty / loading / error ---------- */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--navy-soft);
}
.empty .big { font-size: 2.2rem; margin-bottom: 0.5rem; }
.skeleton {
  height: 64px;
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: linear-gradient(90deg, #ecebf7 25%, #f7f6fd 50%, #ecebf7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 1rem;
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease;
  z-index: 6;
}
.fab:hover { background: var(--coral-dark); }
.fab:active { transform: scale(0.94); }

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(51,48,107,0.35);
  z-index: 10;
}
.sheet {
  /* bottom sits ABOVE the bottom tab bar (56px), not under it: the sheet
     used to extend behind the tab bar, so a tap meant for "Calendar" or
     any other tab landed on the sheet's own body instead — the tab looked
     unresponsive and the sheet looked stuck "over" whatever page was
     underneath. Desktop puts the tabbar in a left sidebar instead, so it
     goes back to bottom:0 there (see the desktop shell override below). */
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 11;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 -10px 30px rgba(51,48,107,0.2);
  padding: 0.75rem 1.25rem 1.25rem;
  max-height: calc(85dvh - 56px - env(safe-area-inset-bottom));
  overflow-y: auto;
  max-width: 640px;
  margin: 0 auto;
}
.sheet-handle {
  width: 44px; height: 5px;
  border-radius: 999px;
  background: var(--peri-light);
  margin: 0 auto 0.75rem;
}
.sheet h2 { margin-bottom: 0.75rem; }
.sheet form label, .sheet .lbl { display: block; font-weight: 700; margin: 0.75rem 0 0.3rem; }
.sheet input[type="text"], .sheet input[type="date"], .sheet select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--peri-light);
  border-radius: 12px;
  font: inherit;
  background: var(--paper);
}
.sheet .row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.sheet .actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.sheet .actions .btn { flex: 1; }

/* Destructive action, kept below the fold of the normal task and separated by
   a rule so it is never the thing a thumb lands on by accident. */
.sheet-danger {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(51, 48, 107, 0.12);
}
.sheet-note {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--navy-soft);
}

/* chips */
.chip {
  display: inline-flex; align-items: center;
  min-height: var(--tap);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--peri-light);
  background: var(--paper);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease;
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] { background: var(--mint); border-color: var(--mint); }
.chip-sm { min-height: 36px; padding: 0.2rem 0.7rem; }

.stepper { display: flex; align-items: center; gap: 0.75rem; }
.stepper button {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border-radius: 50%; border: none;
  background: var(--peri-light); cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease;
}
.stepper button:active { transform: scale(0.9); }
.stepper output { font-weight: 700; min-width: 2ch; text-align: center; }

/* ---------- setup lists ---------- */
.setup-row {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.55rem;
  min-height: 60px;
}
.setup-row .name { flex: 1; min-width: 0; font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-row .sub { display: block; font-weight: 400; font-size: 0.8rem; color: var(--navy-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  flex-shrink: 0;
  border: none; background: transparent;
  color: var(--navy-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 100ms ease;
}
.icon-btn:hover { background: var(--lav-wash); color: var(--navy); }
.icon-btn:active { transform: scale(0.9); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 1.4rem 0 0.6rem; }

/* day chips row */
.day-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.preview-line { font-size: 0.85rem; color: var(--navy-soft); margin-top: 0.4rem; }

/* ---------- toast + offline ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  z-index: 20;
  gap: 0.8rem; align-items: center;
  max-width: min(92vw, 480px);
}
.toast:not([hidden]) { display: flex; }
.toast button { background: none; border: none; color: var(--yellow); font-weight: 700; cursor: pointer; min-height: 32px; }
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--yellow);
  color: var(--navy);
  text-align: center;
  font-weight: 700;
  padding: 0.4rem;
  z-index: 30;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .tick.fresh { animation: none; }
  .shake { animation: none; }
}

/* ---------- published-group indicator ---------- */
.icon-btn.active { color: var(--mint); }
.icon-btn.active:hover { background: var(--mint-light); color: var(--navy); }

/* ---------- linked-calendar strip (Today view) ---------- */
.cal-strip { margin-bottom: 1rem; }
.cal-strip-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--navy-soft);
  padding: 0.2rem 0;
}
.cal-strip-row.done .cal-summary { text-decoration: line-through; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-time { font-weight: 700; color: var(--navy); flex-shrink: 0; }
.cal-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- calendar view ---------- */
.cal-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  margin-bottom: 1.25rem;
}
.cal-weekday { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--navy-soft); padding-bottom: 0.2rem; }
.cal-day {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  aspect-ratio: 1; min-height: 44px;
  border: none; border-radius: 12px;
  background: var(--paper);
  padding: 0.3rem 0.1rem;
  cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease;
}
.cal-day:active { transform: scale(0.94); }
.cal-day.outside { opacity: 0.4; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--coral); }
.cal-day.selected { background: var(--lav-wash); }
.cal-day-num { font-weight: 700; font-size: 0.82rem; color: var(--navy); }
.cal-underline { width: 60%; height: 3px; border-radius: 999px; background: var(--peri); }
.cal-dots { display: flex; align-items: center; gap: 2px; }
.cal-dots .cal-dot { width: 10px; height: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--navy); }
.cal-more { font-size: 0.6rem; font-weight: 700; color: var(--navy-soft); }

.cal-week { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }
.cal-week-day {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 0.7rem 0.9rem;
}
.cal-week-day.selected { box-shadow: inset 0 0 0 2px var(--coral); }
.cal-week-head {
  display: block; width: 100%; text-align: left;
  font-family: var(--font-head); font-weight: 700; color: var(--navy);
  background: none; border: none; padding: 0 0 0.4rem; cursor: pointer;
}

/* ---------- stats ---------- */
.table-scroll { overflow-x: auto; margin-bottom: 1.25rem; -webkit-overflow-scrolling: touch; }
.stats-table { border-collapse: collapse; width: 100%; min-width: 420px; }
.stats-table th, .stats-table td { padding: 0.5rem 0.7rem; text-align: center; }
.stats-table th[scope="row"] { text-align: left; font-weight: 700; color: var(--navy-soft); white-space: nowrap; }
.stats-table thead, .stats-table tr:first-child { }
.stats-table tr:first-child th { font-family: var(--font-head); color: var(--navy); font-weight: 700; }
.stats-table tr:first-child .member-dot { display: block; margin: 0 auto 0.2rem; }
.stats-table tr:nth-child(even) { background: var(--lav-wash); }
.stats-table tr:first-child { background: none; }
.stats-table td { font-weight: 700; color: var(--navy); }

.streak-chip { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 700; }
.badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; }
.badge-bronze { background: #e7b98f; color: #7a4a1f; }
.badge-silver { background: #dcdce6; color: #55519a; }
.badge-gold { background: var(--yellow); color: #7a5a00; }
.badge-rainbow { background: linear-gradient(135deg, var(--coral), var(--yellow), var(--mint), var(--peri)); color: #fff; }

.group-progress { margin-bottom: 0.8rem; }
.group-progress-label { display: flex; align-items: center; justify-content: space-between; font-size: 0.88rem; font-weight: 700; color: var(--navy); margin-bottom: 0.3rem; }
.progress-track { height: 8px; border-radius: 999px; background: var(--lav-wash); overflow: hidden; }
.progress-fill { height: 100%; background: var(--mint); border-radius: 999px; transition: width 300ms ease; }

/* ============================================================
   DESKTOP SHELL (>= 880px) — same markup, repositioned. The
   tabbar becomes a left sidebar; the header and view-root fill
   the rest. Below 880px nothing in this block applies: phone
   layout is untouched.
   ============================================================ */
@media (min-width: 880px) {
  h1 { font-size: 1.7rem; }

  #app-view {
    display: grid;
    grid-template-columns: 224px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  /* Explicit placement, not auto-flow: source order is header, view-root,
     tabbar, which auto-placement would pack into an unintended 3rd column
     (tabbar can't share row 1 col 1 with header, so it spills sideways). */
  .app-header { grid-column: 2; grid-row: 1; }
  .view-root { grid-column: 2; grid-row: 2; }
  .tabbar {
    grid-column: 1;
    /* relative, not static: z-index is a no-op on a static element (it
       never creates a stacking context), which would leave the sidebar
       reachable-looking but actually swallowed by the sheet backdrop. */
    position: relative;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-items: stretch;
    width: 224px;
    padding: 1.5rem 0.75rem;
    box-shadow: 1px 0 0 rgba(51,48,107,0.06);
    gap: 0.2rem;
  }
  .tabbar::before {
    content: "🦘 Joey Chores";
    font-family: var(--font-head); font-weight: 800; color: var(--navy);
    font-size: 1.05rem;
    padding: 0.5rem 0.9rem 1.2rem;
  }
  .tab {
    flex-direction: row; justify-content: flex-start; gap: 0.7rem;
    min-height: 46px;
    padding: 0 0.9rem;
    border-radius: 12px;
  }
  .tab span { font-size: 0.92rem; }
  .tab[aria-current="page"] { background: var(--pink-soft); }
  .app-header { padding: 1.1rem 2rem; }
  /* width:100% is load-bearing here: the base rule's margin:0 auto, applied
     to a grid item with an otherwise-auto width, resolves via shrink-to-fit
     (sized to content) rather than filling the column — a real CSS Grid
     gotcha, not a hypothetical one (measured 564px instead of 1176px). */
  .view-root { width: 100%; max-width: 1180px; padding: 1.5rem 2rem calc(2rem + env(safe-area-inset-bottom)); }
  .fab { right: 2rem; bottom: 2rem; }
  .table-scroll { overflow-x: visible; }
  /* The tabbar is a left sidebar here, not a bottom bar, so nothing at the
     bottom of the viewport needs clearing — reverses the mobile offset. */
  .sheet { bottom: 0; border-radius: var(--radius) var(--radius) 0 0; max-height: 85dvh; }
}

/* ---------- calendar: two-pane on desktop ---------- */
@media (min-width: 880px) {
  .cal-layout { display: flex; align-items: flex-start; gap: 1.75rem; }
  .cal-main { flex: 1; min-width: 0; }
  .cal-detail {
    width: 340px; flex-shrink: 0;
    position: sticky; top: 1.5rem;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
  }
  .cal-day { min-height: 96px; align-items: stretch; text-align: left; padding: 0.5rem 0.5rem; gap: 0.25rem; }
  .cal-day-num { align-self: flex-start; }
  .cal-dots { display: none; } /* dots are the mobile-density fallback */
  .cal-day-names { display: flex; flex-direction: column; gap: 2px; width: 100%; }
  .cal-day-chore {
    font-size: 0.68rem; font-weight: 700; color: var(--navy-soft);
    background: var(--lav-wash);
    border-radius: 5px;
    padding: 1px 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .cal-day-chore.done { background: var(--mint-light); color: #1d7d52; text-decoration: line-through; }
  .cal-more-text { font-size: 0.65rem; color: var(--navy-soft); font-weight: 700; }
  .cal-week { flex-direction: row; }
  .cal-week-day { flex: 1; min-width: 0; }
}
@media (max-width: 879.98px) {
  .cal-day-names { display: none; } /* named list is the desktop-density upgrade */
}

/* ---------- today: side rail on desktop ---------- */
@media (min-width: 880px) {
  .today-layout { display: flex; align-items: flex-start; gap: 1.75rem; }
  .today-main { flex: 1; min-width: 0; }
  .today-side {
    width: 300px; flex-shrink: 0;
    position: sticky; top: 1.5rem;
    display: flex; flex-direction: column; gap: 1.25rem;
  }
  .today-side .cal-strip {
    background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft);
    padding: 1rem 1.1rem; margin-bottom: 0;
  }
}

/* ---------- day tally: side rail on desktop, foot of the list on phones ---------- */
.side-card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 1rem 1.1rem;
}
.side-card h3 { font-size: 0.9rem; margin-bottom: 0.6rem; }
.side-card .tally-sum { font-size: 0.85rem; color: var(--navy-soft); margin-bottom: 0.5rem; }
.side-tally-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.85rem; }
.side-tally-row .name { flex: 1; font-weight: 700; color: var(--navy); }
.side-tally-row.total { border-top: 1px solid rgba(51,48,107,0.12); margin-top: 0.4rem; padding-top: 0.5rem; }
.side-tally-row.total .name { color: var(--navy-soft); }
.today-main > .side-card { margin: 1.5rem 0 1rem; }

/* ---------- multi-select: tick off a list in one go ---------- */
.today-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin: -0.5rem 0 0.75rem;
  min-height: var(--tap);
}
.today-tools .hint { font-size: 0.85rem; font-weight: 700; color: var(--navy-soft); }
.today-tools .tools-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
/* Long-press enters select mode; without this the phone shows its own
   text-selection / callout menu on top of ours. */
.chore-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.select-box {
  display: none;
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--peri-light);
  place-items: center;
  color: var(--navy);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.selecting .chore-card:not(.done):not(.removed) .select-box { display: inline-grid; }
.selecting .chore-card:not(.done):not(.removed) .emoji { display: none; }
.selecting .chore-card.done { opacity: 0.55; }
.chore-card.selected { box-shadow: 0 0 0 2px var(--mint), var(--shadow-soft); background: var(--mint-light); }
.select-box svg { opacity: 0; }
.chore-card.selected .select-box { background: var(--mint); border-color: var(--mint); }
.chore-card.selected .select-box svg { opacity: 1; }
.selecting .fab { display: none; }
.select-bar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 6;
  background: var(--paper);
  box-shadow: 0 -6px 20px rgba(51,48,107,0.14);
  padding: 0.7rem 1rem 0.8rem;
}
.select-bar-inner { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.6rem; }
.select-bar .who { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.select-bar .who .lbl { font-size: 0.8rem; font-weight: 700; color: var(--navy-soft); margin-right: 0.2rem; }
.select-bar .who .muted { margin-left: auto; font-weight: 700; font-size: 0.85rem; }
.select-bar .actions { display: flex; gap: 0.6rem; }
.select-bar .actions .btn { flex: 1; }
.select-bar .actions .btn-primary { flex: 2; }
/* The bar covers the foot of the list; leave room so the last card and the
   tally can still be scrolled into view. */
.selecting { padding-bottom: 8rem; }
@media (min-width: 880px) {
  .select-bar { left: 224px; bottom: 0; }
}
