/* Tick — chore board.
 *
 * Deliberately the same visual language as Do and Navigate: the .app
 * shell, the sticky underlined wordmark, cream cards with a hairline
 * border, badge pills. It's one suite and this is the eighth app in it,
 * not a separate product.
 *
 * Two things it does differently, both because of where it runs:
 *   - Tap targets never go below 56px. The Family Hub's touchscreen is
 *     meaningfully worse than a phone's and there's no hover to fall
 *     back on. Every action is an explicit, obvious button — nothing is
 *     a tap-the-whole-card gesture you have to guess at.
 *   - Nothing is held in memory that a reload would lose, because the
 *     fridge sleeps and wakes on its own and reloads when it does.
 */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream-bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

.app[hidden], .pairing[hidden], [hidden] { display: none !important; }

.app { max-width: 1100px; margin: 0 auto; padding-bottom: 40px; }

/* ---------- header (mirrors Do/Navigate) ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(243,236,225,0.92);
  backdrop-filter: blur(8px);
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; margin: 0 0 4px; text-decoration: none; color: var(--ink);
}
.wordmark .underline { position: relative; }
.wordmark .underline::after {
  content: ""; position: absolute; left: 2px; right: -4px; bottom: -4px;
  height: 6px; background: var(--timber); opacity: 0.28;
  border-radius: var(--r-pill); transform: rotate(-0.6deg);
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.today-chip {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--timber-dark); background: var(--timber-tint);
  padding: 6px 14px; border-radius: var(--r-pill); white-space: nowrap;
}
.offline-chip {
  background: var(--cat-terracotta-tint); color: var(--cat-terracotta);
  border-radius: var(--r-pill); padding: 6px 12px; font-size: 13px; font-weight: 600;
}
.subtitle-row { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px 34px; gap: 10px; }
.subtitle { font-size: 12px; color: var(--ink-soft); margin: 0; }
.link { font-size: 12px; color: var(--timber); font-weight: 600; text-decoration: none; }

/* ---------- who's holding the screen ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.person-chip {
  border: 1px solid var(--border); background: var(--cream-card);
  color: var(--ink-soft); font-family: var(--font-body); font-weight: 600;
  font-size: 15px; padding: 10px 18px; min-height: 44px;
  border-radius: var(--r-pill); cursor: pointer;
}
.person-chip.active { background: var(--timber); border-color: var(--timber); color: #fff; }
.person-chip.theme-sage.active { background: var(--cat-sage); border-color: var(--cat-sage); }
.person-chip.theme-terracotta.active { background: var(--cat-terracotta); border-color: var(--cat-terracotta); }
.person-chip.theme-ochre.active { background: var(--cat-ochre); border-color: var(--cat-ochre); }
.person-chip.theme-blue.active { background: var(--cat-blue); border-color: var(--cat-blue); }
.person-chip.theme-plum.active { background: var(--cat-plum); border-color: var(--cat-plum); }

/* ---------- sections ---------- */
main { padding: 0 20px; }
section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { font-family: var(--font-display); font-size: 17px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }

/* ---------- a job ---------- */
.card {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.card .top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card .ctitle { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 0 0 8px; }
.card .value { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--timber-dark); white-space: nowrap; }

.badge-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); }
.badge.who { background: var(--timber-tint); color: var(--timber-dark); }
.badge.who.theme-sage { background: var(--cat-sage-tint); color: var(--cat-sage); }
.badge.who.theme-blue { background: var(--cat-blue-tint); color: var(--cat-blue); }
.badge.who.theme-plum { background: var(--cat-plum-tint); color: var(--cat-plum); }
.badge.who.theme-ochre { background: var(--cat-ochre-tint); color: var(--cat-ochre); }
.badge.who.theme-terracotta { background: var(--cat-terracotta-tint); color: var(--cat-terracotta); }
.badge.due { background: var(--cat-blue-tint); color: var(--cat-blue); }
.badge.due.overdue { background: var(--cat-terracotta-tint); color: var(--cat-terracotta); }
.badge.room { background: var(--cream-bg); color: var(--ink-soft); border: 1px solid var(--border); }
.badge.waiting { background: var(--cat-sage-tint); color: var(--cat-sage); }
/* An unrated chore is an unrated one, not a low-priority one — the same
   distinction the Atlas placement contract draws, and the same dashed
   unclaimed-looking chip Do uses for it. */
.badge.unplaced { background: var(--cream-bg); color: var(--ink-soft); border: 1px dashed var(--border); }

.done-btn {
  margin-top: auto;
  width: 100%; min-height: 56px;
  border: none; border-radius: var(--r-md);
  background: var(--timber); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.done-btn:active { transform: scale(0.98); }
.done-btn[disabled] { opacity: 0.6; cursor: default; }

.card.done { background: var(--cat-sage-tint); border-color: var(--cat-sage); }
.card.done .ctitle { text-decoration: line-through; opacity: 0.7; }
.undo-btn {
  margin-top: auto; width: 100%; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: transparent; color: var(--ink-soft);
  font-family: var(--font-body); font-size: 14px; cursor: pointer;
}

/* maintenance urgency */
.urg-bar { height: 6px; border-radius: var(--r-pill); background: var(--timber-tint); margin-bottom: 12px; overflow: hidden; }
.urg-fill { height: 100%; background: var(--cat-sage); border-radius: var(--r-pill); }
.card.overdue .urg-fill { background: var(--cat-terracotta); }

/* ---------- agenda ---------- */
.agenda { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.agenda-item {
  background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
  border-left: 4px solid var(--cat-blue);
}
.agenda-item.household_event { border-left-color: var(--cat-ochre); }
.agenda-item.project { border-left-color: var(--timber); }
.agenda-when { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.agenda-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 2px; }
.agenda-detail { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

/* ---------- balances ---------- */
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.bal {
  background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.bal-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.bal-amount { font-family: var(--font-display); font-weight: 700; font-size: 24px; display: block; margin-top: 2px; }
.bal-pending { font-size: 12px; color: var(--ink-soft); }

/* ---------- empty / pairing ---------- */
.empty-state { text-align: center; padding: 22px; border: 1px dashed var(--border); border-radius: var(--r-md); }
.empty-state .headline { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin: 0 0 4px; }
.empty-state .sub { font-size: 13px; color: var(--ink-soft); margin: 0; }

.pairing { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.pairing-card { background: var(--cream-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-md); text-align: center; }
.pairing-card h1 { font-family: var(--font-display); font-size: 34px; margin: 0 0 8px; }
.muted { color: var(--ink-soft); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .done-btn:active { transform: none; }
}


/* ---------- avatars (matches Do's person chips and card footers) ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  color: #fff; background: var(--timber); flex: 0 0 auto;
}
.avatar.theme-sage { background: var(--cat-sage); }
.avatar.theme-terracotta { background: var(--cat-terracotta); }
.avatar.theme-ochre { background: var(--cat-ochre); }
.avatar.theme-blue { background: var(--cat-blue); }
.avatar.theme-plum { background: var(--cat-plum); }
.avatar.theme-timber { background: var(--timber); }

.person-chip { display: inline-flex; align-items: center; gap: 8px; }
.person-chip.active .avatar { background: rgba(255,255,255,0.28); }

.card-foot {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; font-size: 14px; color: var(--ink-soft); font-weight: 600;
}

/* Phones: one column, and the header links stop competing for space. */
@media (max-width: 640px) {
  .cards, .agenda, .balances { grid-template-columns: 1fr; }
  .subtitle-row { margin-left: 0; flex-direction: column; gap: 2px; }
  main { padding: 0 14px; }
  .app-header { padding: 14px 14px 12px; }
}


/* ---------- status / error, deliberately outside .app ---------- */
.status { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.status[hidden] { display: none !important; }
.status-card {
  background: var(--cream-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-md);
  text-align: center; max-width: 520px;
}
.status-card h1 { font-family: var(--font-display); font-size: 32px; margin: 0 0 10px; }
.status-card p { margin: 0 0 6px; }
.status-retry {
  margin-top: 14px; min-height: 52px; padding: 0 28px;
  border: none; border-radius: var(--r-md); background: var(--timber); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; cursor: pointer;
}


/* ---------- bin week ----------
 * Real bin-lid colours rather than palette tints. Everywhere else in the
 * suite a colour is decorative and the token palette is right; here the
 * colour IS the information — someone glances over from the kettle and
 * needs to read it as the actual bin in the driveway, not as a tasteful
 * ochre. Only place in the app that departs from tokens.css, deliberately.
 */
/* Lives in the top-right under the date chip, so the first thing read on
   the board is still today's jobs. */
.header-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bin-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
}
.bin-strip[hidden] { display: none !important; }
.bin-lead { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.bin-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  padding: 6px 14px; border-radius: var(--r-pill);
  border: 1px solid rgba(58,46,36,.14); white-space: nowrap;
}
/* Wastebasket emoji (U+1F5D1 U+FE0F). The chip's background still carries
   the colour, so the glyph is reinforcement rather than the only signal —
   which matters if the fridge's font renders it monochrome, or not at
   all. A missing glyph costs nothing here; a missing colour would. */
.bin-chip::before {
  content: "\1F5D1\FE0F";
  font-size: 15px;
  line-height: 1;
  /* Emoji fonts ignore currentColor, so this stays legible on both chips. */
  filter: saturate(0.9);
}
.bin-chip.yellow { background: #F7D75A; color: #6B5310; }
.bin-chip.red    { background: #C64B3C; color: #FFF1EE; }
.bin-when { font-size: 12px; color: var(--ink-soft); text-align: right; }
.bin-when.tonight { color: var(--cat-terracotta); font-weight: 700; }
