/* v3 "Evening Nest" identity: deep spruce green + warm paper + amber, serif
   display headings, crisp corners, and bordered flat surfaces — a deliberate
   break from v1/v2's terracotta-gradient soft-pill look. */
:root {
  --bg: #f4f1ea;
  --card: #fdfcf9;
  --card-2: #eae4d6;
  --card-glass: rgba(253, 252, 249, 0.86);
  --ink: #26312e;
  --muted: #6e7a72;
  --accent: #2e5f58;
  --accent-2: #e8a13d;
  --accent-ink: #f9f6ee;
  --danger: #b0503f;
  --warn: #a06b1f;
  --ok: #4d7a58;
  --teal: #3f6f5f;
  --border: rgba(38, 49, 46, 0.14);
  --gradient: linear-gradient(135deg, #2e5f58 0%, #45806f 100%);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(38, 49, 46, 0.06);
  --shadow-md: 0 6px 18px rgba(38, 49, 46, 0.10);
  --shadow-lg: 0 12px 28px rgba(46, 95, 88, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141c19;
    --card: #1c2622;
    --card-2: #25322c;
    --card-glass: rgba(20, 28, 25, 0.86);
    --ink: #edf1e9;
    --muted: #97a49a;
    --border: rgba(255, 255, 255, 0.10);
    /* Accent + status colors lightened for dark surfaces — the light-theme
       values fall below readable contrast at small sizes. */
    --accent: #6fae9c;
    --accent-2: #ecb45c;
    --danger: #d98873;
    --warn: #d0a355;
    --ok: #8db892;
    --teal: #82b0a0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.48);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.50);
  }
}

:root[data-theme="light"] {
  --bg: #f4f1ea;
  --card: #fdfcf9;
  --card-2: #eae4d6;
  --card-glass: rgba(253, 252, 249, 0.86);
  --ink: #26312e;
  --muted: #6e7a72;
  --accent: #2e5f58;
  --accent-2: #e8a13d;
  --danger: #b0503f;
  --warn: #a06b1f;
  --ok: #4d7a58;
  --teal: #3f6f5f;
  --border: rgba(38, 49, 46, 0.14);
  --shadow-sm: 0 1px 3px rgba(38, 49, 46, 0.06);
  --shadow-md: 0 6px 18px rgba(38, 49, 46, 0.10);
  --shadow-lg: 0 12px 28px rgba(46, 95, 88, 0.24);
}

:root[data-theme="dark"] {
  --bg: #141c19;
  --card: #1c2622;
  --card-2: #25322c;
  --card-glass: rgba(20, 28, 25, 0.86);
  --ink: #edf1e9;
  --muted: #97a49a;
  --accent: #6fae9c;
  --accent-2: #ecb45c;
  --danger: #d98873;
  --warn: #d0a355;
  --ok: #8db892;
  --teal: #82b0a0;
  --border: rgba(255, 255, 255, 0.10);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.50);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
}

/* ---------- Screen stack ---------- */
/* Every screen is a fixed, full-viewport layer. navStack depth decides which
   class applies: the current screen slides fully into view, the screen right
   underneath it stays mounted (dimmed, offset) for the slide transition, and
   anything deeper is unmounted visually. */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% -8%, rgba(46, 95, 88, 0.08), transparent 55%),
    var(--bg);
  transition: transform 0.32s cubic-bezier(.32, .72, 0, 1), filter 0.32s ease;
  will-change: transform;
}

.screen-offstage {
  display: none;
}

.screen-current {
  display: flex;
  transform: translateX(0);
  filter: brightness(1);
}

.screen-under {
  display: flex;
  transform: translateX(-24%);
  filter: brightness(0.82);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .screen {
    transition: none;
  }
}

.topbar {
  flex: none;
  padding: calc(20px + env(safe-area-inset-top)) 20px 16px;
  background: var(--card-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.screen-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
  background: var(--card-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.back-btn {
  /* 44px minimum tap target — teen QA flagged the old 36px circle as the
     hardest thing to hit one-handed. */
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.back-btn .icon-svg {
  width: 20px;
  height: 20px;
}

.back-btn:active {
  transform: scale(0.92);
}

.screen-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  flex: 1;
}

.screen-header-spacer {
  width: 44px;
  flex: none;
}

.topbar h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.who-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
}

.content {
  flex: 1;
  min-height: 0;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.topbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 2px;
}

.icon-btn svg {
  width: 21px;
  height: 21px;
}

.icon-btn:active {
  transform: scale(0.92);
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Wraps an icon button so a badge can sit on its corner (the data-icon boot
   pass replaces button innerHTML, so the badge can't live inside it). */
.icon-btn-wrap {
  position: relative;
  display: inline-flex;
}

.icon-btn-wrap .hub-tile-badge {
  top: -4px;
  right: -4px;
}

/* ---------- Icon system ---------- */

.icon-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Home: "Up Next" hero ---------- */
/* The single most urgent thing across reminders, warranties, oil changes, and
   appointments — one prominent, unmistakably-tappable card, replacing what
   used to be a grid of identical boxes. */

.home-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--gradient);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s ease;
}

.home-hero:active {
  transform: scale(0.98);
}

.home-hero-icon {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.22);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-hero-icon svg {
  width: 55%;
  height: 55%;
}

.home-hero-text {
  flex: 1;
  min-width: 0;
}

.home-hero-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 250, 245, 0.75);
}

.home-hero-title {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-ink);
  line-height: 1.25;
}

.home-hero-meta {
  margin: 3px 0 0;
  font-size: 13px;
  color: rgba(255, 250, 245, 0.85);
}

.home-hero-chevron {
  display: flex;
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--accent-ink);
  opacity: 0.85;
}

.home-hero.home-hero-empty {
  background: var(--card);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

.home-hero.home-hero-empty:active {
  transform: none;
}

.home-hero-empty .home-hero-icon {
  background: var(--card-2);
  color: var(--ok);
}

.home-hero-empty .home-hero-eyebrow {
  color: var(--muted);
}

.home-hero-empty .home-hero-title {
  color: var(--ink);
}

.home-hero-empty .home-hero-meta {
  color: var(--muted);
}

/* ---------- Hub: section tile grid ---------- */
/* Navigation chrome deliberately looks different from content cards: a
   2-column grid of compact tiles with a per-section accent color, instead of
   the full-width item-card rows the content lists use. */

.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Equal-height rows — tiles with wrapped metas were making rows ragged. */
  grid-auto-rows: 1fr;
  gap: 12px;
}

.hub-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  /* min-width: 0 lets the 1fr grid tracks shrink below the meta text's
     intrinsic single-line width — without it the grid blows out sideways. */
  min-width: 0;
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.hub-tile:active {
  transform: scale(0.97);
}

.hub-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hub-tile-icon svg {
  width: 55%;
  height: 55%;
}

.hub-tile-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.hub-tile-meta {
  margin: -4px 0 0;
  max-width: 100%;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.hub-tile-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Per-section accents — a stable color identity per section for wayfinding,
   drawn from the spruce/amber/clay family of the v3 palette. */
.hub-tile.sec-today .hub-tile-icon { color: #a06b1f; background: rgba(160, 107, 31, 0.14); }
.hub-tile.sec-reminders .hub-tile-icon { color: #2e5f58; background: rgba(46, 95, 88, 0.12); }
.hub-tile.sec-devices .hub-tile-icon { color: #4a6d8c; background: rgba(74, 109, 140, 0.14); }
.hub-tile.sec-garage .hub-tile-icon { color: #9c5a3c; background: rgba(156, 90, 60, 0.14); }
.hub-tile.sec-appointments .hub-tile-icon { color: #6d5687; background: rgba(109, 86, 135, 0.14); }
.hub-tile.sec-shopping .hub-tile-icon { color: #4d7a58; background: rgba(77, 122, 88, 0.15); }
.hub-tile.sec-status .hub-tile-icon { color: #55806e; background: rgba(85, 128, 110, 0.14); }
.hub-tile.sec-homefacts .hub-tile-icon { color: #8a6d3f; background: rgba(138, 109, 63, 0.15); }
.hub-tile.sec-contacts .hub-tile-icon { color: #a86a4a; background: rgba(168, 106, 74, 0.15); }
.hub-tile.sec-household .hub-tile-icon { color: #6e7a72; background: rgba(110, 122, 114, 0.16); }

@media (prefers-color-scheme: dark) {
  .hub-tile.sec-status .hub-tile-icon { color: #8fb8a5; }
  .hub-tile.sec-today .hub-tile-icon { color: #d0a355; }
  .hub-tile.sec-reminders .hub-tile-icon { color: #6fae9c; }
  .hub-tile.sec-devices .hub-tile-icon { color: #86a9c7; }
  .hub-tile.sec-garage .hub-tile-icon { color: #c98a68; }
  .hub-tile.sec-appointments .hub-tile-icon { color: #a58cc4; }
  .hub-tile.sec-shopping .hub-tile-icon { color: #8db892; }
  .hub-tile.sec-homefacts .hub-tile-icon { color: #b3945f; }
  .hub-tile.sec-contacts .hub-tile-icon { color: #c98f6d; }
  .hub-tile.sec-household .hub-tile-icon { color: #97a49a; }
}

:root[data-theme="dark"] .hub-tile.sec-status .hub-tile-icon { color: #8fb8a5; }
:root[data-theme="dark"] .hub-tile.sec-today .hub-tile-icon { color: #d0a355; }
:root[data-theme="dark"] .hub-tile.sec-reminders .hub-tile-icon { color: #6fae9c; }
:root[data-theme="dark"] .hub-tile.sec-devices .hub-tile-icon { color: #86a9c7; }
:root[data-theme="dark"] .hub-tile.sec-garage .hub-tile-icon { color: #c98a68; }
:root[data-theme="dark"] .hub-tile.sec-appointments .hub-tile-icon { color: #a58cc4; }
:root[data-theme="dark"] .hub-tile.sec-shopping .hub-tile-icon { color: #8db892; }
:root[data-theme="dark"] .hub-tile.sec-homefacts .hub-tile-icon { color: #b3945f; }
:root[data-theme="dark"] .hub-tile.sec-contacts .hub-tile-icon { color: #c98f6d; }
:root[data-theme="dark"] .hub-tile.sec-household .hub-tile-icon { color: #97a49a; }

:root[data-theme="light"] .hub-tile.sec-status .hub-tile-icon { color: #55806e; }
:root[data-theme="light"] .hub-tile.sec-today .hub-tile-icon { color: #a06b1f; }
:root[data-theme="light"] .hub-tile.sec-reminders .hub-tile-icon { color: #2e5f58; }
:root[data-theme="light"] .hub-tile.sec-devices .hub-tile-icon { color: #4a6d8c; }
:root[data-theme="light"] .hub-tile.sec-garage .hub-tile-icon { color: #9c5a3c; }
:root[data-theme="light"] .hub-tile.sec-appointments .hub-tile-icon { color: #6d5687; }
:root[data-theme="light"] .hub-tile.sec-shopping .hub-tile-icon { color: #4d7a58; }
:root[data-theme="light"] .hub-tile.sec-homefacts .hub-tile-icon { color: #8a6d3f; }
:root[data-theme="light"] .hub-tile.sec-contacts .hub-tile-icon { color: #a86a4a; }
:root[data-theme="light"] .hub-tile.sec-household .hub-tile-icon { color: #6e7a72; }

/* ---------- Reminders ---------- */

.reminder-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.reminder-item.done {
  opacity: 0.45;
}

.reminder-item.removing {
  opacity: 0;
  transform: translateX(40px);
}

.reminder-item.highlight-flash {
  animation: highlight-flash 1.6s ease;
}

@keyframes highlight-flash {
  0%, 100% { box-shadow: var(--shadow-sm); background: var(--card); }
  20% { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); background: var(--card-2); }
}

.reminder-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  color: var(--accent);
  border-radius: 14px;
}

.reminder-icon svg {
  width: 50%;
  height: 50%;
}

.reminder-text {
  flex: 1;
  min-width: 0;
}

.reminder-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 3px;
}

.reminder-title.done {
  text-decoration: line-through;
}

.reminder-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.reminder-meta.urgent {
  color: var(--danger);
  font-weight: 600;
}

.reminder-meta.soon {
  color: var(--warn);
  font-weight: 600;
}

.reminder-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.reminder-assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  background: rgba(61, 107, 104, 0.14);
  color: var(--teal);
}

.reminder-streak {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(184, 135, 58, 0.16);
  color: var(--warn);
}

.reminder-streak .btn-icon {
  width: 12px;
  height: 12px;
  margin-right: 0;
}

/* The kid streak chip renders its star svg bare (no .btn-icon wrapper) —
   size it explicitly so it can't fall back to the 300x150 svg default. */
.reminder-streak > svg {
  width: 12px;
  height: 12px;
}

.reminder-link-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(46, 95, 88, 0.12);
  color: var(--accent);
  cursor: pointer;
}

/* Quiet "set by Mom/Dad" provenance chip on assigned chores. */
.setby-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(110, 122, 114, 0.14);
  color: var(--muted);
}

/* ---------- Babysitter Care Card ----------
   Emergency-first: big text, big tap targets, amber-edged so it reads as
   "the important card" without screaming. */
.care-card {
  background: var(--card);
  border: 2px solid var(--accent-2);
  border-radius: 18px;
  padding: 16px;
  /* 12px above and below — the hub's standard rhythm (.content/.hub-grid
     gaps), so the card doesn't sit flush on the hero or float off Today. */
  margin: 12px 0;
}

.care-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.care-card-icon {
  display: inline-flex;
  color: var(--accent-2);
}

.care-card-icon svg { width: 20px; height: 20px; }

.care-card-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  margin: 0;
}

.care-kid {
  padding: 10px 0;
  border-top: 1px solid var(--card-2);
}

.care-kid-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.care-kid-line {
  margin: 2px 0;
  font-size: 14px;
  line-height: 1.45;
}

.care-allergy strong { color: var(--danger); }

.care-address {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-2);
  font-size: 15px;
  line-height: 1.4;
}

.care-phones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.care-phone {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.care-phone-name { font-weight: 700; font-size: 14px; }

.care-phone-label { font-size: 11px; opacity: 0.75; }

.care-phone-number { font-size: 13px; opacity: 0.9; }

.care-note-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.care-note-btn svg { width: 16px; height: 16px; }

/* Off duty: same card, muted edge — locked, not alarming. */
.care-card-off { border-color: var(--card-2); }

.care-card-off .care-card-icon { color: var(--muted); }

.care-off-msg {
  margin-bottom: 12px;
  color: var(--muted);
}

.care-until {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  text-align: right;
}

/* Tonight Card: the per-visit brief, set apart in amber. */
.care-tonight {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 161, 61, 0.12);
  border: 1px solid rgba(232, 161, 61, 0.4);
}

.care-tonight-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  margin: 0 0 6px;
}

.sit-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Weekly-schedule day picker. */
.day-chip-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.day-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--card-2);
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Med-given log block on the Care Card. */
.care-medlog {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-2);
}

.care-medlog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.care-medlog-btn {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.care-medlog-by { color: var(--muted); }

.sit-btn-row .secondary-button { flex: 1; margin: 0; }

.current-user-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gradient);
  color: var(--accent-ink);
  vertical-align: middle;
}

/* ---------- Household member avatars ---------- */

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

.avatar-md {
  width: 46px;
  height: 46px;
  font-size: 15px;
}

.avatar-xl {
  width: 76px;
  height: 76px;
  font-size: 26px;
  box-shadow: var(--shadow-sm);
}

.avatar-xs {
  width: 16px;
  height: 16px;
  font-size: 8px;
}

.check-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.check-btn svg {
  width: 18px;
  height: 18px;
}

.check-btn:active {
  transform: scale(0.9);
}

.check-btn.checked {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  margin-top: 60px;
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* ---------- Reminders: urgency buckets ---------- */

.bucket-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.reminder-bucket {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bucket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 6px 8px;
  margin: 0 -8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Collapsed buckets get a stronger visual pull — this is the "tap to see
   more" affordance, so it should read as an active control, not a label. */
.bucket-header.collapsed {
  background: var(--card-2);
  color: var(--accent);
}

.bucket-count {
  display: inline-block;
  background: var(--card-2);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
}

.bucket-header.collapsed .bucket-count {
  background: var(--card);
  color: var(--accent);
}

.bucket-chevron {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.bucket-header.collapsed .bucket-chevron {
  transform: rotate(-90deg);
}

.bucket-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bucket-items.collapsed {
  display: none;
}

/* ---------- Reminders: calendar mode ---------- */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cal-month-label {
  margin: 0;
  font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 700;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 2px 0;
}

.cal-day {
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.cal-day.cal-blank {
  visibility: hidden;
}

.cal-day.cal-today {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2);
}

.cal-day.cal-selected {
  background: var(--gradient);
  border-color: transparent;
  color: var(--accent-ink);
}

.cal-dots {
  display: flex;
  gap: 3px;
  height: 5px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-dot-auto {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--teal);
}

.cal-selected .cal-dot {
  background: var(--accent-ink);
}

.cal-selected .cal-dot-auto {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--accent-ink);
}

/* ---------- Horizontal browsing shelves (Devices / Garage / Bikes) ---------- */
/* Deliberately not used by Reminders — checking off a task suits vertical
   scanning better than horizontal swiping, so those stay plain lists. */

:root {
  --shelf-card-w: 150px;
}

.bucket-shelf {
  display: flex !important;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
}

.bucket-shelf::-webkit-scrollbar {
  display: none;
}

.shelf-card {
  position: relative;
  flex: 0 0 var(--shelf-card-w);
  scroll-snap-align: start;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: left;
}

.shelf-card .item-chevron {
  position: absolute;
  top: 12px;
  right: 12px;
  align-self: auto;
}

/* Shelf cards carry a trimmed-down payload (name + one status line); clamp
   both so long names can't stretch a whole row of siblings. */
.shelf-card .item-title {
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-card .item-meta {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shelf-group-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 4px 0 0;
}

.shelf-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  background: transparent;
  box-shadow: none;
}

.shelf-add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  padding: 24px 8px;
}

.shelf-add-btn .btn-icon-lg {
  width: 30px;
  height: 30px;
}

/* ---------- Add item ---------- */

#capture-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 20px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  max-width: 320px;
  line-height: 1.4;
}

.hint-tight {
  margin: 2px 0 8px;
  max-width: none;
  text-align: left;
}

#scanning-view,
#receipt-scanning-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#receipt-scanning-view {
  flex: none;
  padding: 14px 0;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 26px;
  height: 26px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scanning-text {
  color: var(--muted);
  font-size: 15px;
}

.photo-preview-wrap {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  max-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.photo-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

#result-view,
#vehicle-result-view,
#vehicle-manual-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.detected-badge {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(92, 138, 92, 0.14);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  margin: 0 0 10px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 12px;
}

.field-input {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="date"].field-input,
input[type="time"].field-input {
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- Times-of-day editor (Add/Edit Reminder) ---------- */

.time-slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.time-slot-row .field-input {
  flex: 1;
  margin-top: 0;
}

/* ---------- Icon picker (Add Device) ---------- */

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.icon-picker-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-picker-btn svg {
  width: 55%;
  height: 55%;
}

.icon-picker-btn:active {
  transform: scale(0.92);
}

.icon-picker-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: var(--accent-ink);
}

.save-button {
  background: var(--gradient);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  width: 100%;
}

.save-button:active {
  transform: scale(0.98);
}

.danger-button {
  background: var(--danger);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  width: 100%;
}

.danger-button:active {
  transform: scale(0.98);
}

.confirm-message {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.4;
}

.secondary-button {
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  border: none;
  padding: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.secondary-button:active {
  opacity: 0.55;
}

.saved-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.saved-check {
  width: 64px;
  height: 64px;
  color: var(--ok);
}

.saved-text {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  /* 88px keeps the toast clear of the FAB (58px tall + 20px inset). */
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 20;
  opacity: 0;
  box-shadow: var(--shadow-md);
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ---------- Search + filters (Devices) ---------- */

.search-input {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  margin: 2px 0 8px;
}

.chip {
  flex: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.chip.active {
  background: var(--gradient);
  border-color: transparent;
  color: var(--accent-ink);
}

.chip:active {
  transform: scale(0.95);
}

/* ---------- Generic item list (Devices / Garage / Settings) ---------- */

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-bottom-pad {
  padding-bottom: 80px;
}

.section-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 4px 0 0;
}

.shopping-bought-heading {
  margin-top: 20px;
}

.today-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 6px;
}

.item-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.item-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  color: var(--accent);
  border-radius: 14px;
}

.item-icon svg {
  width: 50%;
  height: 50%;
}

.item-text {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 3px;
}

.item-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.category-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
}

.category-tag.appliances {
  background: rgba(46, 95, 88, 0.12);
  color: var(--accent);
}

.category-tag.electronics {
  background: rgba(61, 107, 104, 0.16);
  color: var(--teal);
}

.category-tag.other {
  background: rgba(138, 122, 108, 0.18);
  color: var(--muted);
}

.category-tag.vehicle {
  background: rgba(46, 95, 88, 0.12);
  color: var(--accent);
}

/* ---------- Floating action button ---------- */

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 15;
  transition: transform 0.15s ease;
}

.fab svg {
  width: 24px;
  height: 24px;
}

.fab:active {
  transform: scale(0.92);
}

@media (min-width: 480px) {
  .fab {
    right: calc(50% - 215px + 20px);
  }
}

/* ---------- Bottom sheets (add-flows) ---------- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 60;
}

.sheet-scrim.active {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  /* Hidden once offscreen so the top edge/shadow can't peek in at the
     bottom of tall screens; the delay keeps the slide-out animation. */
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(.32, .72, 0, 1), visibility 0s linear 0.32s;
}

.sheet.active {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.32s cubic-bezier(.32, .72, 0, 1);
}

.sheet-handle {
  flex: none;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  margin: 10px auto 2px;
}

.sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

/* The icon circle is scoped to the header ✕ — .sheet-close on its own is
   just close *behavior*, so Done/Cancel text buttons can reuse it without
   inheriting the circle look. */
.sheet-header .sheet-close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-header .sheet-close svg {
  width: 14px;
  height: 14px;
}

/* The Cancel button in the confirm sheet is a full-width text button. */
#confirm-cancel-btn {
  width: 100%;
}

.sheet .content {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* ---------- Device / vehicle detail ---------- */

.item-card.clickable {
  cursor: pointer;
}

.item-card.clickable:active {
  transform: scale(0.98);
}

.item-chevron {
  align-self: center;
  color: var(--muted);
  display: flex;
}

.item-chevron svg {
  width: 18px;
  height: 18px;
}

.manual-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
}

.detail-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
  text-align: center;
}

.detail-icon {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  color: var(--accent);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

.detail-icon svg {
  width: 46%;
  height: 46%;
}

.detail-name {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.detail-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px 18px;
  box-shadow: var(--shadow-sm);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.detail-value {
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}

.manual-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.manual-heading {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.cost-total {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 12px;
}

.manual-attached-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border-radius: 12px;
  padding: 12px 14px;
}

.manual-attached-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--card);
  color: var(--accent);
}

.manual-attached-icon svg {
  width: 55%;
  height: 55%;
}

.manual-attached-label {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.manual-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0;
}

.manual-divider::before,
.manual-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.import-file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.danger-text {
  color: var(--danger);
}

/* ---------- Small inline icons (buttons / badges) ---------- */

.btn-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 2px;
}

.btn-icon-lg {
  display: inline-flex;
  width: 34px;
  height: 34px;
}

/* ---------- Receipt / vehicle photo capture ---------- */

.receipt-choice-row {
  display: flex;
  gap: 10px;
}

.receipt-choice-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

.receipt-choice-btn:active {
  transform: scale(0.96);
}

.receipt-attached-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border-radius: 14px;
  padding: 10px 12px;
}

.receipt-thumb {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
}

/* ---------- Photo galleries (Device / Vehicle) ---------- */

.photo-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #000;
}

.gallery-thumb {
  width: 100%;
  height: 100%;
  min-height: var(--shelf-card-w);
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.gallery-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.gallery-remove-btn svg {
  width: 12px;
  height: 12px;
}

.receipt-attached-text {
  min-width: 0;
}

.receipt-attached-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.receipt-attached-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.vehicle-photo-wrap {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.vehicle-photo {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  background: #000;
}

.vehicle-photo-placeholder {
  height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.vehicle-photo-placeholder .btn-icon-lg {
  width: 34px;
  height: 34px;
}

.vehicle-photo-placeholder p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Choice buttons (Add Item / Add Vehicle) ---------- */

#vehicle-choice-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
}

.choice-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.choice-row .choice-button {
  flex: 1;
  padding: 22px 10px;
}

.choice-row .choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.choice-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.choice-button:active {
  transform: scale(0.97);
}

.choice-button-secondary {
  font-family: inherit;
}

.choice-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--card-2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-icon svg {
  width: 52%;
  height: 52%;
}

.choice-label {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.choice-sub {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Settings ---------- */

.segmented-control {
  display: flex;
  background: var(--card-2);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}

.segment {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 10px;
  cursor: pointer;
}

.segment.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.settings-row-label {
  font-size: 15px;
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  min-width: 46px;
  border-radius: 999px;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.toggle-switch.active {
  background: var(--accent);
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

.remove-member-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.remove-member-btn svg {
  width: 15px;
  height: 15px;
}

.remove-member-btn:active {
  transform: scale(0.9);
}

/* ---------- Kid Mode ---------- */

.kid-switch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-2);
  border-radius: var(--radius);
  padding: 10px 10px 10px 16px;
  margin-bottom: 14px;
}

.kid-switch-banner > span {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

/* "Switch back" requires a press-and-hold (a light friction gate so a kid
   can't tap their way back to the parent hub) — the fill bar communicates
   the hold progress. */
.kid-switch-btn {
  position: relative;
  overflow: hidden;
  background: var(--card);
  color: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.kid-switch-btn .hold-fill {
  position: absolute;
  inset: 0;
  background: rgba(232, 161, 61, 0.35);
  transform: scaleX(0);
  transform-origin: left;
}

.kid-switch-btn.holding .hold-fill {
  transform: scaleX(1);
  transition: transform 1.2s linear;
}

.kid-switch-btn .hold-label {
  position: relative;
}

.kid-hero {
  margin-bottom: 4px;
  cursor: default;
}

.kid-hero:active {
  transform: none;
}

/* Lifetime streak-points total, always visible on the kid hero. */
.kid-points-badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 8px 12px;
  min-width: 56px;
  color: var(--accent-ink);
}

.kid-points-star {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.kid-points-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.kid-points-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.home-hero-empty .kid-points-badge {
  background: var(--card-2);
  color: var(--ink);
}

/* Kid-mode headings drop the tiny-uppercase "enterprise label" treatment for
   sentence-case ink at a friendlier size, and body type runs one size up. */
.kid-heading {
  font-size: 17px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin: 10px 0 0;
}

.kid-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 0;
  color: var(--muted);
}

.kid-empty p {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.kid-empty-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  opacity: 0.75;
}

.kid-chore-card {
  padding: 18px;
}

.kid-chore-card .item-title {
  font-size: 17px;
}

.kid-chore-card .item-meta {
  font-size: 14px;
}

/* A repeating chore completed today stays visible but locked — softened,
   with its check filled in — so the kid keeps seeing the win. */
.kid-chore-done {
  opacity: 0.72;
}

.kid-chore-done .item-meta {
  color: var(--ok);
  font-weight: 600;
}

.kid-dismiss-btn {
  align-self: center;
  border: none;
  background: var(--card-2);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.kid-dismiss-btn:active {
  transform: scale(0.95);
}

/* Share (move to household list) — kept clearly apart from the check circle
   after teen QA flagged the mis-tap risk on private items. */
.share-item-btn {
  padding: 11px 16px;
  margin-right: 6px;
}

/* Proper button treatment for list-clearing actions (was a bare text link
   that every teen tester read as either an error or a trap). */
.clear-list-btn {
  align-self: flex-start;
  border: 1px solid rgba(176, 80, 63, 0.35);
  background: rgba(176, 80, 63, 0.08);
  color: var(--danger);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.clear-list-btn:active {
  transform: scale(0.96);
}

.kid-chore-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 16px;
}

.kid-chore-icon svg {
  width: 60%;
  height: 60%;
}

.kid-streak {
  margin-top: 6px;
}

.kid-check-btn {
  width: 60px;
  height: 60px;
  min-width: 60px;
}

.kid-check-btn svg {
  width: 24px;
  height: 24px;
}

@keyframes kid-chore-done-flash {
  0% { background: var(--card); }
  30% { background: rgba(90, 158, 118, 0.28); transform: scale(1.02); }
  100% { background: var(--card); transform: scale(1); }
}

.kid-chore-done-flash {
  animation: kid-chore-done-flash 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  .kid-chore-done-flash {
    animation: none;
  }
}

.kid-appt-card {
  background: var(--card-2);
  box-shadow: none;
}

.kid-readonly-tag {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  white-space: nowrap;
}

.kid-readonly-tag svg {
  width: 13px;
  height: 13px;
}

.kid-ask-btn {
  width: 100%;
  margin-top: 4px;
}

.kid-status-pending {
  color: var(--warn);
  font-weight: 600;
}

.kid-status-approved {
  color: var(--ok);
  font-weight: 600;
}

.kid-status-denied {
  color: var(--muted);
}

.confetti-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -8%;
  font-size: 24px;
  animation: confetti-fall 1.6s ease-in forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(340deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-burst {
    display: none;
  }
}

.shopping-request-card {
  background: var(--card-2);
}

.shopping-request-actions {
  display: flex;
  gap: 8px;
  align-self: center;
}

.request-approve-btn,
.request-deny-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.request-approve-btn {
  background: var(--ok);
  color: #fff;
}

.request-approve-btn svg {
  width: 16px;
  height: 16px;
}

.request-deny-btn {
  background: var(--card);
  color: var(--muted);
}

.request-deny-btn svg {
  width: 15px;
  height: 15px;
}

.request-approve-btn:active,
.request-deny-btn:active {
  transform: scale(0.9);
}

/* ---------- "Roost Live" appliance status board ---------- */

.status-card {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.status-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
}

.status-badge {
  align-self: flex-start;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
}

.status-updated {
  font-size: 12px;
}

.status-pills {
  display: flex;
  gap: 6px;
}

.status-pill {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.status-pill:active {
  transform: scale(0.95);
}

.status-pill.active {
  border-color: currentColor;
}

/* Shared per-state tints (badge + active pill). */
.status-tint-dirty { background: rgba(160, 107, 31, 0.16); color: var(--warn); }
.status-tint-running { background: rgba(74, 109, 140, 0.18); color: #4a6d8c; }
.status-tint-clean { background: rgba(77, 122, 88, 0.16); color: var(--ok); }
.status-tint-emptied { background: rgba(110, 122, 114, 0.16); color: var(--muted); }

@media (prefers-color-scheme: dark) {
  .status-tint-running { color: #86a9c7; }
}
:root[data-theme="dark"] .status-tint-running { color: #86a9c7; }
:root[data-theme="light"] .status-tint-running { color: #4a6d8c; }

.status-reminders {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.status-reminders-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.status-reminder-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.status-reminder-icon {
  display: inline-flex;
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.status-reminder-title {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Kid home entry points — full-width card buttons into shared screens.
   Stacked tiles get the same 12px gap the item lists use. */
.kid-status-tile {
  width: 100%;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.kid-status-tile + .kid-status-tile {
  margin-top: 12px;
}

/* ---------- Member detail ---------- */

.member-phone-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.member-rx-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

/* ---------- Playful kid layout (the "New Look") ---------- */

.kid-p-progress-track {
  margin-top: 10px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.kid-p-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #fff;
  transition: width 0.4s ease;
}

.kid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kid-grid-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: 20px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.kid-grid-btn:active {
  transform: scale(0.96);
}

.kid-grid-btn .hub-tile-badge {
  top: 10px;
  right: 10px;
}

.kid-grid-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.kid-grid-icon svg {
  width: 55%;
  height: 55%;
}

.kgi-comingup { color: #6d5687; background: rgba(109, 86, 135, 0.14); }
.kgi-status { color: #55806e; background: rgba(85, 128, 110, 0.14); }
.kgi-household { color: #4a6d8c; background: rgba(74, 109, 140, 0.14); }

@media (prefers-color-scheme: dark) {
  .kgi-comingup { color: #a58cc4; }
  .kgi-status { color: #8fb8a5; }
  .kgi-household { color: #86a9c7; }
}
:root[data-theme="dark"] .kgi-comingup { color: #a58cc4; }
:root[data-theme="dark"] .kgi-status { color: #8fb8a5; }
:root[data-theme="dark"] .kgi-household { color: #86a9c7; }
:root[data-theme="light"] .kgi-comingup { color: #6d5687; }
:root[data-theme="light"] .kgi-status { color: #55806e; }
:root[data-theme="light"] .kgi-household { color: #4a6d8c; }

.kid-grid-btn-primary {
  background: var(--gradient);
  border-color: transparent;
  color: var(--accent-ink);
}

.kgi-ask {
  color: var(--accent-ink);
  background: rgba(255, 255, 255, 0.22);
}

/* Extra-large chore cards for the playful list. */
.kid-xl .kid-chore-card {
  padding: 20px;
}

.kid-xl .kid-chore-icon {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 18px;
}

.kid-xl .item-title {
  font-size: 19px;
}

.kid-xl .item-meta {
  font-size: 15px;
}

.kid-xl .kid-check-btn {
  width: 64px;
  height: 64px;
  min-width: 64px;
}

.kid-xl .kid-check-btn svg {
  width: 26px;
  height: 26px;
}

/* ---------- Device edit approval ---------- */

.device-pending-note {
  margin: 0;
  background: rgba(160, 107, 31, 0.12);
  color: var(--warn);
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 12px;
}

.edit-review-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
}

.edit-review-arrow {
  color: var(--muted);
  margin: 0 2px;
}

/* ---------- The Roost Shop ---------- */

.shop-get-btn {
  align-self: center;
  flex: none;
  border: none;
  background: var(--gradient);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.shop-get-btn:active {
  transform: scale(0.94);
}

/* Point notices from a parent on the kid home. */
#kid-notices:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.kid-notice-plus .item-icon {
  color: var(--ok);
  background: rgba(77, 122, 88, 0.15);
}

.kid-notice-minus .item-icon {
  color: var(--warn);
  background: rgba(160, 107, 31, 0.14);
}

.cashout-worth {
  margin: 10px 0 2px;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.shop-short-label {
  align-self: center;
  flex: none;
  min-width: 104px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-2);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Points ledger rows in the shop. */
.points-log-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 2px;
}

.points-log-delta {
  flex: none;
  min-width: 34px;
  font-weight: 800;
}

.points-log-reason {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* New/Classic chooser sheet. */
.kid-layout-choice {
  width: 100%;
}

.kid-layout-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---------- Teen home ---------- */

/* Teens see the same grid, but Devices and Garage drop to the end —
   "my stuff first, household noise second." */
.hub-grid.teen-grid .sec-devices { order: 8; }
.hub-grid.teen-grid .sec-garage { order: 9; }

#teen-notices:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0;
}

#teen-my-day {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.teen-points-card {
  width: 100%;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius-lg);
  margin-top: 4px;
}

.teen-points-card .item-icon {
  color: #a06b1f;
  background: rgba(160, 107, 31, 0.14);
}

/* "My Color" swatches in Settings. */
.my-color-swatch {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}

.my-color-swatch:active {
  transform: scale(0.9);
}

.my-color-swatch.active {
  border-color: var(--card);
  box-shadow: 0 0 0 2px var(--ink);
}

/* Per-field "Display to Household" switch in the member form. */
.vis-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--card-2);
  border-radius: 10px;
}

.vis-row-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* "What the Sitter Sees" panel: one block per member, locked safety rows. */
.sitter-vis-member {
  margin-top: 12px;
}

.sitter-vis-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.sitter-vis-role {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 4px;
}

.vis-locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.vis-locked svg {
  width: 14px;
  height: 14px;
}

/* ---------- Home Facts & Contacts ---------- */

.fact-value {
  font-size: 15px;
  font-weight: 700;
  margin: 2px 0 0;
}

.contact-call-btn {
  align-self: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: rgba(92, 138, 92, 0.15);
  color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.contact-call-btn svg {
  width: 20px;
  height: 20px;
}

.contact-call-btn:active {
  transform: scale(0.92);
}

@media (min-width: 480px) {
  body {
    display: flex;
    justify-content: center;
    background: #101613;
  }
  .screen {
    left: 50%;
    right: auto;
    width: 430px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
  }
  .screen-current {
    transform: translateX(-50%);
  }
  .screen-under {
    transform: translateX(-74%);
  }
  .sheet {
    left: 50%;
    right: auto;
    width: 430px;
    transform: translate(-50%, 100%);
  }
  .sheet.active {
    transform: translate(-50%, 0);
  }
  .toast {
    max-width: 430px;
  }
}

/* ---------- v3 identity layer ---------- */

/* Editorial serif for display text; UI text stays sans. */
.topbar h1,
.screen-header h2,
.sheet-header h2,
.home-hero-title,
.detail-name,
.saved-text {
  font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.topbar h1 {
  font-size: 26px;
}

/* Flat, bordered surfaces instead of v2's floating shadow cards. */
.item-card,
.reminder-item,
.hub-tile,
.result-card,
.detail-card,
.manual-section,
.settings-row {
  border: 1px solid var(--border);
}

/* A small amber tick marks section starts - the one recurring flourish. */
.section-heading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-2);
  margin-right: 8px;
  vertical-align: middle;
}

/* Hero eyebrow picks up the amber accent on the spruce panel. */
.home-hero-eyebrow {
  color: var(--accent-2);
}

/* Kid Mode gets the warm amber version of the hero panel. */
.kid-hero {
  background: linear-gradient(135deg, #a06b1f 0%, #cf9540 100%);
}

/* ---------- Install banner (PWA helper) ---------- */

#install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

#install-banner.hidden {
  display: none;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
}

.install-banner-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.install-banner-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}

.install-banner-btn {
  background: var(--gradient);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

/* ---------- Cloud gate (sign in / household setup) ---------- */

#cloud-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  padding: 48px 20px calc(40px + env(safe-area-inset-bottom));
}

#cloud-gate.hidden {
  display: none;
}

.cloud-gate-inner {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cloud-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 44px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin: 8px 0 0;
}

.cloud-tagline {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 10px;
}

#cloud-gate .result-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cloud-signup-tip {
  margin: 6px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cloud-signup-tip strong {
  color: var(--ink);
  font-weight: 600;
}

.cloud-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin: 4px 0 0;
}

.cloud-invite-code {
  font-size: 24px;
  letter-spacing: 4px;
  font-family: Georgia, 'Times New Roman', serif;
}

/* Kid Mode Lock PIN entry */
.pin-input {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 14px;
  padding-left: 26px; /* visually recenters the letter-spaced digits */
}

/* Emoji as an icon (user-picked, replaces the SVG set) */
.emoji-icon {
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-picker-emoji-btn {
  font-size: 20px;
  line-height: 1;
}

.icon-picker-emoji-input {
  width: 72px;
  text-align: center;
  font-size: 22px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--ink);
}

/* Roost Live add/edit (parent-configurable board devices) */
.live-preset-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.live-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.live-preset-btn:active { transform: scale(0.97); }

.live-preset-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
}

.live-preset-icon svg { width: 16px; height: 16px; }

.live-state-row { display: flex; align-items: center; gap: 8px; }
.live-state-row .field-input { flex: 1; }

.live-state-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  border: 1px solid var(--border);
}

.status-edit-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

/* Swipe-to-delete (reminders list) */
.swipe-row {
  position: relative;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.swipe-delete-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 88px;
  visibility: hidden;
  border: none;
  background: var(--danger);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 12px 12px 0;
  cursor: pointer;
}

/* The revealed button lives just past the row's right edge — clip the list
   so it never widens the page. */
#reminder-list { overflow-x: clip; }

/* Split hub tile: Appointments | Chores stack inside one grid cell as two
   compact rows — a quarter-width column can't fit the word "Appointments",
   so each half lays out horizontally: icon beside its two text lines. */
.hub-tile-split {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.hub-tile-split .hub-tile {
  flex: 1;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.hub-tile-split .hub-tile-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
}

.hub-tile-split-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hub-tile-split .hub-tile-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-tile-split .hub-tile-meta {
  margin: 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hub-tile.sec-chores .hub-tile-icon { color: #4d7a58; background: rgba(77, 122, 88, 0.14); }
@media (prefers-color-scheme: dark) {
  .hub-tile.sec-chores .hub-tile-icon { color: #7fae8c; }
}
:root[data-theme="dark"] .hub-tile.sec-chores .hub-tile-icon { color: #7fae8c; }
:root[data-theme="light"] .hub-tile.sec-chores .hub-tile-icon { color: #4d7a58; }

/* Chores page: one group per person */
.chore-group { margin-bottom: 20px; }

.chore-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.chore-group-head h4 {
  margin: 0;
  font-size: 15px;
}

.chore-group-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.chore-group-home {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.chore-group-home svg { width: 16px; height: 16px; }

.chore-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: clip; /* swipe-to-delete button parks past the row edge */
}

/* Hub layout editing */
#hub-layout-row { margin-top: 12px; }

.hub-editing > * {
  animation: hubWiggle 0.4s ease-in-out infinite alternate;
}

.hub-editing > *:nth-child(even) { animation-delay: 0.2s; }

@keyframes hubWiggle {
  from { transform: rotate(-0.5deg); }
  to { transform: rotate(0.5deg); }
}

.hub-grid > .hub-selected {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: var(--radius);
  transform: scale(0.97);
  animation: none;
}

#hub-edit-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 26px rgba(20, 28, 25, 0.22);
  display: flex;
  align-items: center;
  gap: 12px;
}

#hub-edit-bar.hidden { display: none; }

#hub-edit-bar p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  flex: 1;
}

.hub-edit-actions { display: flex; gap: 8px; }

.hub-edit-actions .save-button,
.hub-edit-actions .secondary-button {
  width: auto;
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
}

/* Kid check-off verification */
.verify-strip {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verify-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verify-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}

.verify-approve {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  flex: none;
}

.verify-deny {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex: none;
}

.kid-check-btn.kid-check-pending {
  font-size: 16px;
  border-style: dashed;
}

.kid-check-btn.kid-check-locked {
  color: var(--muted);
  opacity: 0.7;
}

.kid-check-btn.kid-check-locked svg {
  width: 16px;
  height: 16px;
}

/* Password fields: the reveal "eye" */
.pw-field {
  position: relative;
}

.pw-field .field-input {
  width: 100%;
  padding-right: 46px;
  box-sizing: border-box;
}

.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

/* Support form */
textarea.field-input {
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
  min-height: 90px;
}

/* Legal links (gate footer + About) */
.gate-legal {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}

.gate-legal a,
.about-link {
  color: var(--muted);
  text-decoration: underline;
}

/* Logged-out landing view */
.landing-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.landing-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.landing-feature p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.landing-emoji {
  font-size: 22px;
  line-height: 1.2;
  flex: none;
}
