/* ── Login ────────────────────────────────────────────────────────────── */
.login-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: var(--color-bg); }
.login-wrap { width: 100%; max-width: 400px; padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.login-card { background: var(--color-bg-card); border: 1px solid var(--color-border);  border-radius: var(--radius-lg); padding: 2rem; width: 100%; box-shadow: var(--shadow-overlay); }
.login-card__header { text-align: center; margin-bottom: 1.5rem; }
.login-card__icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.login-card__title { font-size: 1.75rem; margin-bottom: 0.25rem; }
.login-card__sub { color: var(--color-text-secondary); font-size: 0.9rem; }
.login-card__link { margin-top: 1rem; text-align: center; font-size: 0.88rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-footer { font-size: 0.78rem; color: var(--color-text-muted); }
/* A ruled line with the word sitting on it, the way a divider is drawn on
   paper, keeping the SSO button clearly apart from the password form. */
.login-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 1rem; color: var(--color-text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.login-divider::before,
.login-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }

/* ── Pills, badges and chips ──────────────────────────────────────────
   The app labels things in a dozen places: stock levels, expiry dates,
   reorder points, list roles, pending state. They all draw from two sizes
   so that any row of them lines up on a single baseline. */
.pill,
.badge,
.item-list__stock,
.item-list__aisle,
.item-list__pending,
.inv-expiry-badge,
.inv-item__min,
.inv-item__outflag,
.compartment__low,
.compartment__expiry {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px; padding: 0 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 600; line-height: 1.2;
  white-space: nowrap; vertical-align: middle;
}

/* Larger, tappable chips used for filters and quick-add. */
.chip,
.inv-pill,
.staple-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-h-sm); padding: 0 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg-card); color: var(--color-text-secondary);
  box-shadow: var(--shadow-control);
  font-size: 0.85rem; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
@media (hover: hover) and (pointer: fine) {
  .chip:hover,
  .inv-pill:hover,
  .staple-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-control-hover); }
}
.chip:active,
.inv-pill:active,
.staple-chip:active { transform: translateY(1px); box-shadow: var(--shadow-control-pressed); }
.chip--on,
.inv-pill--active {
  background: var(--color-accent); border-color: var(--color-accent);
  color: var(--color-on-accent); font-weight: 600;
}

/* ── Mini Calendar ────────────────────────────────────────────────────── */
.mini-cal { user-select: none; }
.mini-cal__dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.mini-cal__dow-label { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; padding: 0.25rem 0; }
.mini-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-cal__day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1;
  font-size: 0.82rem; background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--color-text);
  position: relative; transition: background var(--transition);
}
.mini-cal__day:hover { background: var(--color-bg-secondary); }
.mini-cal__day--other { color: var(--color-text-muted); opacity: 0.5; }
.mini-cal__day--today { border-color: var(--color-today-border); background: var(--color-today-bg); font-weight: 700; }
.mini-cal__day--selected { background: var(--color-accent); color: var(--color-on-accent); border-color: var(--color-accent); }
.mini-cal__day--has-events {}
.mini-cal__weather { font-size: 0.62rem; line-height: 0.8; margin-top: 1px; }
.mini-cal__dot { position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--color-event-bg); }
.mini-cal__day--selected .mini-cal__dot { background: var(--color-on-accent); }

/* ── Day events (under mini cal) ─────────────────────────────────────── */
.day-events { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--color-border-light); }
.day-events__heading { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--color-text-secondary); }
.day-events__weather {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.5rem; padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm); background: var(--color-bg-secondary);
  color: var(--color-text-secondary); font-size: 0.78rem;
}
.day-events__weather strong { margin-left: auto; white-space: nowrap; }
.day-events__empty { font-size: 0.85rem; color: var(--color-text-muted); }
.day-events__list { display: flex; flex-direction: column; gap: 0.3rem; }
.day-events__item {
  display: flex; flex-direction: column;
  padding: 0.4rem 0.5rem; border-radius: var(--radius-sm);
  background: var(--color-bg-secondary); cursor: pointer;
  transition: background var(--transition);
}
.day-events__item:hover { background: var(--color-border-light); }
.day-events__time { font-size: 0.72rem; color: var(--color-text-muted); }
.day-events__title { font-size: 0.88rem; font-weight: 600; }
.day-events__loc { font-size: 0.75rem; color: var(--color-text-secondary); }

/* ── Day hover popup ─────────────────────────────────────────────────── */
.day-hover-popup {
  position: absolute; z-index: 60;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  padding: 0.45rem 0.6rem;
  min-width: 140px; max-width: 240px;
  pointer-events: none;
}
.day-hover-popup__date {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}
.day-hover-popup__weather {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0 0.3rem;
  color: var(--color-text-secondary); font-size: 0.72rem;
  white-space: nowrap;
}
.day-hover-popup__weather span:last-child { margin-left: auto; }
.day-hover-popup__item {
  display: flex; gap: 0.4rem; align-items: baseline;
  padding: 0.1rem 0; border-top: 1px solid var(--color-border-light);
}
.day-hover-popup__item:first-of-type { border-top: none; }
.day-hover-popup__time { font-size: 0.7rem; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; }
.day-hover-popup__title { font-size: 0.83rem; font-weight: 600; line-height: 1.3; }

/* ── Full Calendar ────────────────────────────────────────────────────── */
.cal-page { display: flex; flex-direction: column; position: relative; }
.cal-pinned { display: flex; flex-direction: column; gap: 0.75rem; flex-shrink: 0; }
.cal-scroll { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }

@media (min-width: 641px) {
  .cal-page {
    height: calc(100dvh - var(--nav-h) - var(--footer-h) - 3rem);
    overflow: hidden;
  }
  .cal-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 140px; /* always show enough for upcoming events heading + a few rows */
  }
  /* Cell height scales with viewport so the grid never crowds out cal-scroll.
     320px covers nav + footer + header rows + gaps + the 140px cal-scroll min. */
  .cal-cell {
    min-height: clamp(54px, calc((100dvh - 320px) / 6), 110px);
  }
}
.cal-header { display: flex; align-items: center; gap: 0.75rem; }
.cal-title { font-size: 1.5rem; flex: 1; }
.cal-add-btn { margin-left: auto; }
.cal-footer { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.5rem; font-size: 0.82rem; flex-wrap: wrap; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid--header { border-bottom: 2px solid var(--color-border); }
.cal-grid__dow { text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--color-text-secondary); padding: 0.35rem 0; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-grid--body { border-left: 1px solid var(--color-border-light); }

.cal-cell {
  min-height: 54px; padding: 0.3rem;
  border-right: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer; transition: background var(--transition);
  background: var(--color-bg-card);
  overflow: hidden;
}
.cal-cell:hover { background: var(--color-bg-secondary); }
.cal-cell--other { background: var(--color-bg); opacity: 0.6; }
.cal-cell--today { background: var(--color-today-bg); border-color: var(--color-today-border); }
.cal-cell--weekend .cal-cell__num { color: var(--color-accent); }
.cal-cell__head { display: flex; align-items: center; justify-content: space-between; gap: 0.2rem; margin-bottom: 0.25rem; }
.cal-cell__num { font-size: 0.82rem; font-weight: 600; color: var(--color-text-secondary); line-height: 1; font-variant-numeric: tabular-nums; }
.cal-cell__weather { display: flex; align-items: center; gap: 0.15rem; font-size: 0.68rem; line-height: 1; color: var(--color-text-muted); white-space: nowrap; }
.cal-cell__weather-temps { font-size: 0.58rem; }
.cal-cell--today .cal-cell__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; background: var(--color-today-border); color: var(--color-on-accent);
  border-radius: 50%; font-weight: 700;
}
.cal-cell__events { display: flex; flex-direction: column; gap: 2px; }

.cal-event {
  background: var(--color-event-chip-bg); color: var(--color-event-chip-text);
  font-size: 0.72rem; font-weight: 500; line-height: 1.3;
  padding: 2px 5px 2px 6px;
  border-left: 3px solid var(--color-event-bg);
  border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: opacity var(--transition);
}
.cal-event:hover { opacity: 0.8; }
.cal-event--recurring { opacity: 0.9; }

/* ── Responsive calendar: compact text (≤880px) ─────────────────────── */
@media (max-width: 880px) {
  .cal-header { gap: 0.4rem; }
  .cal-title { font-size: 1.15rem; }
  .cal-add-btn { flex-shrink: 0; }

  /* Day-of-week labels: single letter only */
  .cal-grid__dow { font-size: 0; letter-spacing: 0; padding: 0.2rem 0; }
  .cal-grid__dow::first-letter { font-size: 0.65rem; }

  /* Shorter cells, tighter padding, smaller event pills */
  .cal-cell { min-height: 64px; padding: 0.2rem; }
  .cal-cell__num { font-size: 0.75rem; }
  .cal-event { font-size: 0.65rem; padding: 1px 4px 1px 5px; }
}

/* ── Responsive calendar: dots only (≤500px) ────────────────────────── */
@media (max-width: 500px) {
  .cal-header { gap: 0.3rem; }
  .cal-title { font-size: 1.0rem; }

  .cal-cell { min-height: 44px; padding: 0.15rem; }
  .cal-cell__events { flex-direction: row; flex-wrap: wrap; gap: 2px; justify-content: center; }
  .cal-event {
    width: 6px; height: 6px; min-width: 6px;
    background: var(--color-event-bg);
    border-left: none; border-radius: 50%; padding: 0;
    font-size: 0; text-indent: -9999px; overflow: hidden;
  }
  .cal-cell__num { font-size: 0.72rem; }
  .cal-cell__weather-temps { display: none; }
  .cal-cell__weather { font-size: 0.62rem; }
}

/* ── Landscape mobile: remove fixed heights, let .main scroll ─────────── */
@media screen and (max-height: 500px) and (min-width: 641px) {
  .cal-page { height: auto; overflow: visible; }
  .cal-scroll { overflow-y: visible; flex: none; }
  .cal-cell { min-height: 40px; }
  .board__left { max-height: none; overflow: visible; }
  .board__panel--shopping { max-height: none; }
  .board__panel--shopping .item-list { overflow-y: visible; }
  .board__panel--upcoming { overflow: visible; }
  .board__panel--upcoming .upcoming__list { overflow-y: visible; }
  .page-layout { height: auto; overflow: visible; }
  .list-main { overflow: visible; }
  .list-content .item-list--full { overflow-y: visible; }
}

/* ── Day hover popup on full calendar ─────────────────────────────────── */
.day-hover-popup--cal { pointer-events: none; }

/* ── Day View overlay ────────────────────────────────────────────────── */
.dayview-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dayview {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  width: 100%; max-width: 600px;
  max-height: 85vh; display: flex; flex-direction: column;
}
.dayview__header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--color-border-light);
}
.dayview__title { flex: 1; font-size: 1.1rem; }
.dayview__weather {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.45rem; border-radius: var(--radius-sm);
  background: var(--color-bg-secondary); color: var(--color-text-secondary);
  font-size: 0.75rem; white-space: nowrap;
}
.dayview__allday {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
}
.dayview__allday-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  color: var(--color-text-muted); min-width: 50px; padding-top: 0.15rem;
}
.dayview__allday-events { display: flex; flex-wrap: wrap; gap: 0.35rem; flex: 1; }
.dayview__hours {
  flex: 1; overflow-y: auto; padding: 0;
}
.dayview__timeline {
  position: relative;
}
.dayview__row {
  display: flex; align-items: stretch; height: 52px;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer; transition: background var(--transition);
  box-sizing: border-box;
}
.dayview__row:hover { background: var(--color-bg-secondary); }
.dayview__time {
  width: 55px; min-width: 55px;
  font-size: 0.75rem; color: var(--color-text-muted);
  padding: 0.35rem 0.5rem; text-align: right;
  border-right: 1px solid var(--color-border-light);
  font-variant-numeric: tabular-nums;
}
.dayview__slot { flex: 1; }
.dayview__event-layer {
  position: absolute;
  inset: 0 0 0 55px;
  pointer-events: none;
}
.dayview__event {
  background: var(--color-event-chip-bg); color: var(--color-event-chip-text);
  padding: 0.25rem 0.5rem 0.25rem 0.6rem;
  border-left: 3px solid var(--color-event-bg);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: opacity var(--transition);
  display: flex; flex-direction: column;
}
.dayview__event--timed {
  position: absolute;
  left: 0.5rem; right: 0.5rem;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: auto;
  z-index: 1;
}
.dayview__event:hover { opacity: 0.8; }
.dayview__event--allday {
  background: var(--color-event-chip-bg); color: var(--color-event-chip-text);
  padding: 0.2rem 0.5rem 0.2rem 0.6rem;
  border-left: 3px solid var(--color-event-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dayview__event-time { font-size: 0.7rem; opacity: 0.65; }
.dayview__event-title { font-size: 0.85rem; font-weight: 600; }
.dayview__event-loc { font-size: 0.72rem; opacity: 0.75; }

/* ── Household notes ───────────────────────────────────────────────── */
.note-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--color-border-light);
}
.note-form__text {
  resize: vertical;
  min-height: 5rem;
}
.note-form__footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem;
}
.note-form__expiry .field__input { width: auto; }
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
}
.sticky-note {
  position: relative;
  min-height: 105px;
  padding: 0.8rem 1.8rem 0.65rem 0.85rem;
  border: 1px solid var(--color-border); border: 1px solid color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
  border-radius: 2px 2px var(--radius-sm) var(--radius-sm);
  background: var(--color-bg-card); background: color-mix(in srgb, var(--color-accent) 9%, var(--color-bg-card));
  box-shadow: var(--shadow-raised);
  display: flex;
  flex-direction: column;
}
.sticky-note::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 28%;
  width: 44%;
  height: 8px;
  background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-accent) 20%, transparent);
}
.sticky-note__unpin {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap);
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
}
.sticky-note__unpin:hover { color: var(--color-danger); }
.sticky-note__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-list);
  line-height: 1.4;
  flex: 1;
}
.sticky-note__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.65rem;
  color: var(--color-text-muted);
  font-size: 0.68rem;
}

@media (max-width: 480px) {
  .note-form__footer { align-items: stretch; flex-direction: column; }
  .note-form__expiry { justify-content: space-between; }
  .note-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dayview-backdrop { padding: 0.5rem; align-items: flex-start; }
  .dayview { max-width: none; max-height: calc(100dvh - 1rem); border-radius: var(--radius); }
  .dayview__header { padding: 0.75rem 0.85rem 0.55rem; }
}

/* ── Itinerary (upcoming events) ─────────────────────────────────────── */
.itinerary { margin-top: 0.75rem; }
.itinerary__title {
  font-size: 1rem; color: var(--color-text-secondary);
  margin-bottom: 0.5rem; padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border-light);
}
.itinerary__empty { font-size: 0.85rem; color: var(--color-text-muted); font-style: italic; }
/* Every "nothing here yet" line reads the same, wherever it appears. */
.upcoming__empty,
.notes-panel__empty,
.item-list__empty,
.compartment__empty,
.ts-empty,
.stats-empty,
.ts-intro,
.stats-intro,
.inv-intro { font-size: 0.9rem; }
.ts-intro, .stats-intro, .inv-intro {
  color: var(--color-text-secondary); margin-bottom: 1rem;
}
.upcoming__empty,
.notes-panel__empty,
.item-list__empty,
.compartment__empty,
.ts-empty,
.stats-empty {
  color: var(--color-text-muted); font-style: italic; padding: 0.75rem 0;
}
.stats-empty a, .ts-empty a { color: var(--color-accent); }
.itinerary__list { display: flex; flex-direction: column; gap: 2px; }
.itinerary__item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid var(--color-border-light);
}
.itinerary__item:hover { background: var(--color-bg-secondary); }
.itinerary__item:last-child { border-bottom: none; }
.itinerary__date-col {
  display: flex; flex-direction: column; align-items: center;
  min-width: 40px;
  background: var(--color-bg-secondary); border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
}
.itinerary__day { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.itinerary__dow { font-size: 0.65rem; text-transform: uppercase; color: var(--color-text-muted); font-weight: 600; }
.itinerary__detail { display: flex; flex-direction: column; flex: 1; }
.itinerary__event-title { font-size: 0.9rem; font-weight: 600; }
.itinerary__event-time { font-size: 0.75rem; color: var(--color-text-muted); }
.itinerary__event-loc { font-size: 0.75rem; color: var(--color-text-secondary); }

/* ── Upcoming events panel (board left column) ───────────────────────── */
.upcoming__list { display: flex; flex-direction: column; }
.upcoming__item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--color-border-light);
}
.upcoming__item:last-child { border-bottom: none; }
.upcoming__date-col {
  display: flex; flex-direction: column; align-items: center;
  min-width: 36px;
  background: var(--color-bg-secondary); border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem; flex-shrink: 0;
}
.upcoming__day { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.upcoming__dow { font-size: 0.62rem; text-transform: uppercase; color: var(--color-text-muted); font-weight: 600; letter-spacing: 0.02em; }
.upcoming__detail { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.upcoming__event-title { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming__event-meta { font-size: 0.72rem; color: var(--color-text-muted); }
.upcoming__event-loc { font-size: 0.72rem; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Shopping list ────────────────────────────────────────────────────── */
.add-item { margin-bottom: 0.75rem; }
.add-item__row { display: flex; gap: 0.5rem; align-items: flex-start; }
.add-item__field { flex: 1; position: relative; }
.add-item__error { font-size: 0.78rem; color: var(--color-danger); padding: 0.2rem 0; }

.item-list { display: flex; flex-direction: column; }
.item-list--full { gap: 2px; }
.item-list__empty { text-align: center; }
.item-list__item {
  display: flex; align-items: center; gap: 0.5rem;
  min-height: 44px;
  /* The list is a scrolling column flex container, so a row left to shrink is
     squashed back to that min-height once the list overflows, and anything on a
     second line spills out over the item below. The scrollbar does this job. */
  flex-shrink: 0;
  padding: 0.3rem 0.5rem; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition);
}
.item-list__item:hover { background: var(--color-bg-secondary); }
.item-list__item:last-child { border-bottom: none; }
.item-list__item--checked .item-list__text { text-decoration: line-through; color: var(--color-checked); opacity: 0.75; }
.item-list__item--pending { opacity: 0.68; }

.check-box {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg); font-size: 0.75rem; color: var(--color-accent);
  transition: background var(--transition), border-color var(--transition);
}
.check-box--checked { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.item-list__check {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  margin-left: calc(var(--tap) / -4);
  background: none; border: none; padding: 0; border-radius: var(--radius-sm);
}
.item-list__text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 0.95rem; font-family: var(--font-list); }
/* The text carries a long-press menu; without these, iOS and Silk also select
   the word and pop up their copy callout over it. */
.item-list__text { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.item-list__stock {
  border-color: var(--color-border); background: var(--color-bg-card);
  color: var(--color-text-secondary); cursor: pointer;
}
.item-list__stock--done { color: var(--color-success); border-color: var(--color-success); }
.item-list__aisle { border-color: var(--color-border); background: var(--color-bg-secondary); color: var(--color-text-muted); }
.item-list__row { display: contents; }
/* Desktop keeps the labels inline beside the name; the phone layout below
   gathers them onto their own line, which is what the wrapper is for. */
.item-list__meta { display: contents; }
.item-list__section {
  padding: 0.5rem 0.25rem 0.25rem; margin-top: 0.25rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.item-list__section:first-child { margin-top: 0; }
.item-list__more {
  border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; border-radius: var(--radius-sm);
}
.item-list__more:hover, .item-list__more:focus-visible { color: var(--color-text); background: var(--color-border-light); }
.item-list__expire { font-size: 0.72rem; color: var(--color-text-muted); white-space: nowrap; }
.item-list__pending {
  background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-warning) 16%, transparent);
  color: var(--color-warning); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.item-list__del {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  background: none; border: none; color: var(--color-text-muted);
  font-size: 0.9rem; padding: 0; border-radius: var(--radius-sm);
  opacity: 0; transition: opacity var(--transition), color var(--transition);
}
.item-list__item:hover .item-list__del,
.item-list__del:focus-visible { opacity: 1; }
.item-list__del:hover { color: var(--color-danger); }
/* Touch devices have no hover, so the control would never appear at all. */
@media (hover: none) {
  .item-list__del { opacity: 0.55; }
}
.item-list__more {
  width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; padding: 0;
}

/* ── Focused shopping trip ──────────────────────────────────────────── */
.trip-toolbar {
  display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0;
  padding: 0.55rem 0.65rem; margin-bottom: 0.65rem;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-bg-card); box-shadow: var(--shadow-raised);
}
.trip-toolbar__title { display: flex; flex: 1; min-width: 0; flex-direction: column; line-height: 1.25; }
.trip-toolbar__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-heading); }
.trip-toolbar__title span { color: var(--color-text-muted); font-size: 0.76rem; }
.trip-toolbar__finish { flex-shrink: 0; }
.shopping-trip .list-standard-header, .shopping-trip .list-vis-panel, .shopping-trip .staples { display: none !important; }
.shopping-trip .list-content .add-item { margin-bottom: 0.5rem; }
.shopping-trip .item-list__item {
  min-height: 58px; padding: 0.55rem 0.65rem; gap: 0.75rem;
  border: 1px solid var(--color-border-light); border-radius: var(--radius); margin-bottom: 0.35rem;
  background: var(--color-bg-card);
}
.shopping-trip .item-list__check { align-self: stretch; align-items: center; padding: 0 0.2rem; }
.shopping-trip .check-box { width: 30px; height: 30px; min-width: 30px; font-size: 1rem; }
.shopping-trip .item-list__text { font-size: 1.12rem; font-weight: 600; }
.shopping-trip .item-list__del, .shopping-trip .item-list__expire, .shopping-trip .item-list__more, .shopping-trip .item-list__aisle { display: none; }
.shopping-trip .item-list__item--checked { opacity: 0.55; background: var(--color-bg-secondary); }
.shopping-trip .item-list__section { font-size: 0.85rem; padding-top: 0.75rem; }
body.shopping-trip-active .nav, body.shopping-trip-active .footer { display: none; }
body.shopping-trip-active .main {
  max-width: 760px; height: 100vh; height: 100dvh; overflow: hidden;
  padding: max(0.5rem, env(safe-area-inset-top, 0px)) max(0.5rem, env(safe-area-inset-right, 0px)) max(0.5rem, env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-left, 0px));
}
body.shopping-trip-active .page-layout { height: 100%; grid-template-columns: 1fr; }
body.shopping-trip-active .sidebar { display: none; }
body.shopping-trip-active .list-content .item-list--full { padding-bottom: 1rem; scroll-padding-bottom: 1rem; }
body.shopping-trip-active .kb-toast-region { bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)); }
body.shopping-trip-active .kb-offline-banner { top: 0; }

@media (max-width: 520px) {
  .trip-toolbar { gap: 0.4rem; padding: 0.45rem; }
  .trip-toolbar__exit { padding-inline: 0.45rem; font-size: 0.78rem; }
  .trip-toolbar__finish { padding-inline: 0.55rem; }
  .shopping-trip .item-list__item { min-height: 64px; }
}

/* Desktop: pin panel header + add-item, scroll only the item list */
@media (min-width: 641px) {
  .board__panel--shopping {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--nav-h) - var(--footer-h) - 3rem);
  }
  /* The shared widget partials wrap their variable content in
     .board-widget__body, so the dashboard can give each widget exactly one
     scroll region. On the classic Board that wrapper has to be transparent to
     layout: it must pass both the flex sizing and the min-height:0 down to the
     list. Without this it is a plain block of natural height, the list below
     has nothing to scroll within, and the items spill straight out past the
     panel's max-height. */
  .board__panel--shopping > .board-widget__body,
  .board__panel--upcoming > .board-widget__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  /* Staples sit between the add row and the list, pinned like the header: the
     household's usual items should stay put under the box you type into
     rather than scrolling away with the list. */
  .board__panel--shopping > .staples { flex: none; }
  .board__panel--shopping .item-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  /* Left column: constrain height so upcoming panel rounds off above footer */
  .board__left {
    max-height: calc(100vh - var(--nav-h) - var(--footer-h) - 3rem);
    overflow: hidden;
  }
  .board__panel--upcoming {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .board__panel--upcoming .upcoming__list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .list-content .item-list--full,
  .board__panel--shopping .item-list {
    padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 24px);
    scroll-padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 24px);
  }
}

/* ── Staples quick-add ────────────────────────────────────────────────── */
.staples { margin: -0.25rem 0 0.75rem; }
.staples__toggle {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: none; border: none; padding: 0.15rem 0;
  font-size: 0.74rem; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer;
  transition: color var(--transition);
}
.staples__toggle:hover { color: var(--color-accent); }
.staples__arrow { display: inline-block; transition: transform var(--transition); }
.staples__arrow--open { transform: rotate(180deg); }
.staples__content { padding-top: 0.35rem; }
/* Pinned under the add row on the Board, but never at the cost of the list:
   a long staples block scrolls inside itself instead of pushing every item
   off the bottom of a short panel. The full Lists page keeps it uncapped. */
.board__panel--shopping .staples {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.board__panel--shopping .staples__content {
  max-height: 12rem;
  overflow-y: auto;
  /* A capped block will always clip a row of chips somewhere. Fading the last
     few pixels into the rule below makes that read as "more to scroll"
     rather than as a row that has been sliced in half. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.1rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.1rem), transparent);
}
.staples__heading {
  margin: 0.3rem 0 0.25rem; font-size: 0.72rem; font-weight: 600;
  color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.035em;
}
.staples__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-top: 0.35rem; }
.staple-chip {
  font-family: var(--font-list); text-transform: capitalize;
  background: var(--color-bg-secondary); color: var(--color-text);
}
.staple-chip:hover { border-color: var(--color-accent); color: var(--color-accent); }
.staple-chip--on,
.staple-chip--on:hover {
  opacity: 0.45; cursor: default; text-decoration: line-through;
  border-color: var(--color-border); color: var(--color-text);
}
.replenishment { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.55rem; }
.replenishment__item {
  display: flex; align-items: stretch; overflow: hidden;
  background: var(--color-bg-secondary); border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.replenishment__add {
  display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: flex-start;
  gap: 0.05rem; padding: 0.45rem 0.65rem; background: none; border: 0;
  color: var(--color-text); cursor: pointer; text-align: left;
}
.replenishment__add:hover .replenishment__name { color: var(--color-accent); }
.replenishment__name { font-family: var(--font-list); font-size: 0.9rem; text-transform: capitalize; }
.replenishment__reason { font-size: 0.72rem; color: var(--color-text-muted); }
.replenishment__action {
  width: 2.2rem; background: none; border: 0; border-left: 1px solid var(--color-border);
  color: var(--color-text-muted); cursor: pointer; font-size: 1rem;
}
.replenishment__action:hover { color: var(--color-accent); background: var(--color-bg-card); }
.replenishment__muted { margin-top: 0.6rem; color: var(--color-text-muted); font-size: 0.74rem; }
.replenishment__muted summary { cursor: pointer; }

/* ── Inline label + control ───────────────────────────────────────────
   "In stock [ 2 ]", "Expiry [ date ]", "Expires [ date ]" and friends all
   read the same, whichever form they sit in. */
.inline-label,
.inv-add__detail,
.inv-expiry-edit label,
.note-form__expiry {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--color-text-secondary); font-size: 0.82rem;
  white-space: nowrap;
}

/* ── Autocomplete ─────────────────────────────────────────────────────── */
.autocomplete__list {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 150;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-overlay);
  overflow: hidden; max-height: 220px; overflow-y: auto;
}
@media (max-width: 640px) {
  .autocomplete__list { max-height: min(220px, 35vh); }
}
.autocomplete__item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.75rem; font-size: 0.9rem;
  cursor: pointer; transition: background var(--transition);
  text-transform: capitalize;
}
.autocomplete__item:hover, .autocomplete__item--active { background: var(--color-bg-secondary); color: var(--color-accent); }
.autocomplete__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.autocomplete__remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; flex: 0 0 1.35rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-muted);
  font-size: 1rem; line-height: 1;
}
.autocomplete__remove:hover {
  background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  color: var(--color-danger);
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
}
.modal__header {
  display: flex; align-items: center;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--color-border-light);
}
.modal__title { flex: 1; font-size: 1.1rem; }
.modal__close {
  background: none; border: none; font-size: 1.4rem;
  color: var(--color-text-muted); line-height: 1; padding: 0 0.25rem;
}
.modal__close:hover { color: var(--color-text); }
.modal__body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal__meta { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--color-text-secondary); font-style: italic; }
.modal__footer { flex-wrap: wrap; padding: 0.75rem 1.25rem 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; border-top: 1px solid var(--color-border-light); }
.modal__footer .btn--danger { margin-right: auto; }
@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-start;
    padding: 0.5rem;
    overflow-y: auto;
  }
  .modal {
    max-width: none;
    max-height: calc(100dvh - 1rem);
    border-radius: var(--radius);
  }
  .modal__header { padding: 0.75rem 0.85rem 0.55rem; }
  .modal__body { padding: 0.75rem 0.85rem; gap: 0.55rem; }
  .modal__footer {
    padding: 0.65rem 0.85rem 0.8rem;
    flex-wrap: wrap;
  }
  .modal__footer .btn { flex: 1 1 auto; }
  .relnotes__body { max-height: calc(100dvh - 9rem); }
}

/* ── Release notes modal ─────────────────────────────────────────────── */
.relnotes__modal { max-width: 560px; }
.relnotes__version {
  font-size: 0.8rem; font-family: monospace;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em; margin-left: 0.5rem;
  vertical-align: middle;
}
.relnotes__date { font-size: 0.75rem; color: var(--color-text-muted); margin-left: 0.5rem; font-weight: 400; vertical-align: middle; }
.relnotes__body { max-height: 60vh; overflow-y: auto; }
.relnotes__section { display: flex; flex-direction: column; gap: 0.35rem; }
.relnotes__section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary); }
.relnotes__list { display: flex; flex-direction: column; gap: 0.3rem; padding-left: 1.1rem; list-style: disc; }
.relnotes__list li { font-size: 0.9rem; color: var(--color-text); }

/* ── Settings ────────────────────────────────────────────────────────── */
.settings-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-raised);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.settings-section__title { font-size: 1.05rem; margin-bottom: 0.25rem; }
.settings-desc { font-size: 0.88rem; color: var(--color-text-secondary); }
.section-header { display: flex; flex-wrap: wrap; gap: var(--space-control); align-items: center; justify-content: space-between; }
.ics-url-row { display: flex; gap: 0.5rem; }
.ics-url-input { font-size: 0.78rem; font-family: monospace; }
.pwa-diagnostics { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 0.45rem; }
.pwa-diagnostics > div { padding: 0.5rem 0.6rem; border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); background: var(--color-bg-secondary); min-width: 0; }
.pwa-diagnostics dt { color: var(--color-text-muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.pwa-diagnostics dd { font-size: 0.84rem; font-weight: 600; }
.pwa-diagnostics__scope { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Theme picker ────────────────────────────────────────────────────── */
.theme-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-bg); cursor: pointer;
  transition: border-color var(--transition);
  min-width: 70px;
}
.theme-swatch--active { border-color: var(--color-accent); }
.theme-swatch__label { font-size: 0.75rem; color: var(--color-text-secondary); }

/* Theme preview dots on swatches */
[data-theme="kraft"] .theme-swatch__dot,
.theme-swatch[data-theme="kraft"] .theme-swatch__dot { background: #7a4928; width: 20px; height: 20px; border-radius: 50%; }
.theme-swatch[data-theme="chalkboard"] .theme-swatch__dot { background: #1e2d1e; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #c8b870; }
.theme-swatch[data-theme="slate"] .theme-swatch__dot { background: #1a2030; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #6888d8; }
.theme-swatch[data-theme="grove"] .theme-swatch__dot { background: #3a7a3a; width: 20px; height: 20px; border-radius: 50%; }
.theme-swatch[data-theme="berry"] .theme-swatch__dot { background: #7a3c90; width: 20px; height: 20px; border-radius: 50%; }
.theme-swatch[data-theme="broadsheet"] .theme-swatch__dot { background: #fff; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #000; }
.theme-swatch[data-theme="blackout"] .theme-swatch__dot { background: #000; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #000; }

/* ── Font picker ─────────────────────────────────────────────────────── */
.settings-section__subtitle { font-size: 0.85rem; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.25rem; }
.font-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.font-swatch {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-bg); cursor: pointer; text-align: left;
  transition: border-color var(--transition);
  min-width: 120px;
}
.font-swatch--active { border-color: var(--color-accent); }
.font-swatch__label { font-size: 0.72rem; color: var(--color-text-secondary); font-family: var(--font-body); }
.font-swatch__preview { font-size: 1rem; color: var(--color-text); }

/* ── Admin ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 2px solid var(--color-border); font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.04em; }
.table td { padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--color-border-light); vertical-align: middle; }
.table__row--inactive { opacity: 0.55; }
.table__actions { display: flex; gap: 0.4rem; align-items: center; }
.table--users { table-layout: fixed; }
.table--users th,
.table--users td { overflow: hidden; }
.table__col-name { width: 10%; }
.table__col-email { width: 31%; }
.table__col-role { width: 11.5%; }
.table__col-status { width: 12.5%; }
.table__col-mfa { width: 9%; }
.table__col-actions { width: 26%; }
.table__text-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}
.table__email {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table--users .table__actions {
  overflow: visible;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}
.table--users .btn--xs { padding-inline: 0.45rem; }
.admin-form { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 0.75rem; }
.admin-form__title { font-size: 0.95rem; }
.admin-form__btns { display: flex; gap: 0.5rem; }
.nightly-backups { margin-bottom: var(--space-card); }
.nightly-backups__list { list-style: none; margin: var(--space-control) 0 0; padding: 0; }
.nightly-backups__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem var(--space-card); padding: 0.4rem 0; border-bottom: 1px dashed var(--color-border); }
.nightly-backups__row .link-btn { margin-left: auto; }

.badge { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge--admin { background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-accent) 20%, transparent); color: var(--color-accent); }
.badge--user { background: var(--color-bg-secondary); color: var(--color-text-secondary); }
.badge--active { background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.badge--inactive { background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-danger) 15%, transparent); color: var(--color-danger); }

/* ── WS offline indicator ────────────────────────────────────────────── */
.ws-status--offline { background: var(--color-bg-card); background: color-mix(in srgb, var(--color-danger) 15%, var(--color-bg-card)); color: var(--color-danger); }
.ws-status--online { background: var(--color-bg-card); background: color-mix(in srgb, var(--color-success) 15%, var(--color-bg-card)); color: var(--color-success); }

/* ── Notification mode picker ────────────────────────────────────────── */
.notif-mode-list { display: flex; flex-direction: column; gap: 0.4rem; }
.notif-mode-item {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.notif-mode-item:hover { background: var(--color-bg-secondary); }
.notif-mode-item--active { border-color: var(--color-accent); background: var(--color-bg); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-bg)); }
.notif-mode-item__label { font-size: 0.9rem; font-weight: 600; }
.notif-mode-item__desc { font-size: 0.78rem; color: var(--color-text-secondary); }

/* ── List visibility panel ───────────────────────────────────────────── */
.list-vis-panel { margin-bottom: 0.75rem; }
.vis-details { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg-secondary); }
.vis-details__summary {
  padding: 0.5rem 0.75rem; cursor: pointer; list-style: none;
  font-size: 0.82rem; font-weight: 600; color: var(--color-text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.4rem;
}
.vis-details__summary::before { content: '▶'; font-size: 0.65rem; transition: transform var(--transition); }
details[open] .vis-details__summary::before { transform: rotate(90deg); }
.vis-details__body { padding: 0.75rem; border-top: 1px solid var(--color-border-light); display: flex; flex-direction: column; gap: 0.5rem; }
.vis-user-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.25rem; }
.vis-user-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; cursor: pointer; }
.vis-user-item__email { font-size: 0.75rem; color: var(--color-text-muted); }

.aisle-order-list { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.aisle-order-list__row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.88rem; }
.aisle-order-list__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aisle-order-list__actions { display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.aisle-order-add { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.aisle-order-add .field__input { flex: 1; }

/* ── MFA ─────────────────────────────────────────────────────────────── */
.mfa-qr { display: flex; justify-content: center; margin: 1rem 0; }
.mfa-qr svg { width: min(220px, 100%); height: auto; border-radius: var(--radius); background: #fff; padding: 0.5rem; }
.mfa-manual { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg-secondary); margin-top: 0.5rem; }
.mfa-manual summary { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.85rem; color: var(--color-text-secondary); list-style: none; }
.mfa-manual summary::before { content: '▶ '; font-size: 0.65rem; }
details[open].mfa-manual summary::before { content: '▼ '; }
.mfa-manual__body { padding: 0.75rem; border-top: 1px solid var(--color-border-light); display: flex; flex-direction: column; gap: 0.5rem; }
.mfa-secret { display: block; font-family: monospace; font-size: 1rem; letter-spacing: 0.1em; word-break: break-all; padding: 0.5rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); user-select: all; }
.mfa-backup-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; margin: 1rem 0; }
.mfa-backup-code { display: block; text-align: center; font-family: monospace; font-size: 1rem; letter-spacing: 0.12em; padding: 0.5rem 0.75rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); user-select: all; }
.mfa-disable-details { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg-secondary); margin-top: 0.75rem; }
.mfa-disable-details > summary { padding: 0.5rem 0.75rem; cursor: pointer; list-style: none; display: inline-block; }
.mfa-disable-form { padding: 0.75rem; border-top: 1px solid var(--color-border-light); display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Weather panel ────────────────────────────────────────────────────── */
.weather-panel__header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.75rem; }
.weather-panel__loc { font-size: 0.78rem; color: var(--color-text-muted); flex: 1; text-align: right; }
.weather-panel__current { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.weather-panel__icon { font-size: 2.4rem; line-height: 1; }
.weather-panel__temp { font-size: 2.6rem; font-weight: 700; font-family: var(--font-heading); color: var(--color-text); line-height: 1; }
.weather-panel__desc { font-size: 0.9rem; color: var(--color-text-secondary); margin-bottom: 0.5rem; }
.weather-panel__meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 0.25rem; }
.weather-panel__forecast { display: flex; gap: 0.25rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--color-border-light); }
.weather-panel__day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.35rem 0.1rem; border-radius: var(--radius-sm); background: var(--color-bg-secondary); }
.weather-panel__day-name { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.weather-panel__day-icon { font-size: 1.2rem; line-height: 1; }
.weather-panel__day-temps { font-size: 0.68rem; color: var(--color-text-secondary); text-align: center; white-space: nowrap; }
.weather-panel--empty .weather-panel__desc { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 0.5rem; }

/* ── Time Since ───────────────────────────────────────────────────────── */
.ts-add { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.ts-add__name { flex: 1; min-width: 200px; }
.ts-add__vis { flex: 0 0 auto; width: auto; }
.ts-add__schedule { flex: 0 0 175px; width: 175px; }
.ts-add__assignee { flex: 0 0 auto; width: auto; }
/* Clipped at its own edge and given a floor to sit on, for the same
   reason as .ts-add__when below: WebKit sizes the editable fields inside
   a date control from their content and lets them spill over whatever is
   to the right of it. */
.ts-add__starts { flex: 0 1 11rem; width: 11rem; min-width: 0; max-width: 100%; overflow: hidden; }
.ts-add__starts::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.ts-add__starts::-webkit-datetime-edit { min-width: 0; overflow: hidden; }
.ts-add__rotation { flex: 0 0 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.ts-add__rotation .field__label { margin: 0; }
.ts-sort { width: auto; }

.ts-grid { --card-min: 220px; }
/* Card grid and card surface. Time Since, Time Until, Stats and Meals all
   draw the same card, so they share one definition rather than three copies. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min, 250px)), 1fr));
  gap: var(--space-card);
  margin-top: var(--space-card);
}
.card,
.watch-card,
.stats-card,
.meal-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);

  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .watch-card:hover,
  .meal-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised-hover);
  }
}
/* Card head: name grows, badges and the options menu sit tight to the right. */
.card__head,
.watch-card__head,
.stats-card__head,
.meal-card__head {
  display: flex; align-items: center; gap: 0.4rem;
  min-height: var(--control-h-sm);
}
.card__name,
.watch-card__name,
.stats-card__name,
.meal-card__name {
  font-family: var(--font-heading);
  font-size: 1.05rem; font-weight: 600; line-height: 1.25;
  flex: 1; min-width: 0; word-break: break-word;
}
.watch-card__vis { font-size: 0.85rem; flex-shrink: 0; }
.watch-card__elapsed { font-size: 1.4rem; font-weight: 700; color: var(--color-accent); }
/* A chore shown on Time Since is a read-out, not a control. Holding it back a
   little keeps the watches, which can still be acted on, as the page's subject. */
.watch-card--readonly .watch-card__elapsed { font-size: 1.15rem; }
.ts-chores { margin-top: var(--space-section); }
/* On a chore card the counter is context, not the headline: what the household
   needs to read first is whether the job is due, so it stays the smaller line. */
.watch-card__elapsed--chore { font-size: 0.95rem; font-weight: 600; }
.watch-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-control); margin-top: auto; }
.watch-card__reset { width: 100%; }
.watch-card__routine-meta { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.78rem; color: var(--color-text-secondary); }
.watch-card__routine-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto; }
.watch-card__routine-actions .btn { flex: 1; white-space: nowrap; }
.watch-card__routine-settings { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.55rem; border-radius: var(--radius-sm); background: var(--color-bg-secondary); }
.watch-card__routine-row { display: flex; align-items: center; gap: 0.4rem; color: var(--color-text-secondary); font-size: 0.85rem; }
.watch-card__routine-row .field__input { width: 7rem; }
.watch-card--routine-recent { border-color: var(--color-success); }
.watch-card--routine-soon { border-color: var(--color-warning); }
.watch-card--routine-overdue { border-color: var(--color-danger); }
.watch-card--routine-recent .watch-card__elapsed { color: var(--color-success); }
.watch-card--routine-soon .watch-card__elapsed { color: var(--color-warning); }
.watch-card--routine-overdue .watch-card__elapsed { color: var(--color-danger); }
/* A chore card's big line is "last done", not a countdown, so the state
   colour goes on the due line instead; a red "last done 2 days ago" reads
   as though the doing of it were the problem. */
.watch-card__due { font-weight: 600; }

/* The money a points balance is worth, when the household has set a rate.
   Deliberately quieter than the points: points are what the app counts, this
   is a translation of them. */
.stats-tile__money { display: block; font-size: 0.78rem; font-weight: 600; color: var(--color-text-secondary); }

/* What the household's own chores would pay at the rate being set. Ruled
   rows, like the rest of the paper surfaces, rather than a boxed-out table. */
.points-examples { margin: 0.25rem 0 0.5rem; }
.points-examples__list { margin: 0.25rem 0 0; padding: 0; list-style: none; max-width: 26rem; }
.points-examples__list li { display: flex; justify-content: space-between; gap: var(--space-control); padding: 0.3rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.85rem; }
.points-examples__list li:last-child { border-bottom: 0; }
.points-examples__value { color: var(--color-text-secondary); white-space: nowrap; }
.watch-card--routine-soon .watch-card__elapsed--chore,
.watch-card--routine-overdue .watch-card__elapsed--chore { color: var(--color-accent); }
.watch-card--routine-soon .watch-card__due { color: var(--color-warning); }
.watch-card--routine-overdue .watch-card__due { color: var(--color-danger); }
.watch-card__timer-adjust { display: flex; gap: 0.4rem; margin-top: auto; }
.watch-card__timer-adjust .btn { flex: 1; }
.watch-card__adjust { display: flex; flex-direction: column; gap: 0.4rem; }
.watch-card__adjust-btns { display: flex; flex-wrap: wrap; gap: var(--space-control); }
/* ── Options menu (the ⋮ button and its dropdown) ─────────────────────
   One component, used by Time Since, Time Until, Meals and Stock. The
   legacy per-page class names are kept as aliases so markup can migrate
   gradually. */
.menu, .watch-card__menu, .inv-menu { position: relative; flex-shrink: 0; }
.menu__dots, .watch-card__dots, .inv-menu__dots {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap);
  background: none; border: none; cursor: pointer;
  color: var(--color-text-secondary); font-size: 1.25rem; line-height: 1;
  padding: 0; border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.menu__dots:hover, .watch-card__dots:hover, .inv-menu__dots:hover {
  color: var(--color-text); background: var(--color-bg-secondary);
}
.menu__dropdown, .watch-card__dropdown, .inv-menu__dropdown {
  position: absolute; right: 0; top: 100%; z-index: 100;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  min-width: 11rem; padding: 0.25rem 0;
  /* Never grow taller than the screen, whatever a page puts inside it. */
  max-height: min(60vh, 22rem); overflow-y: auto;
}
.menu__dropdown button, .watch-card__dropdown button, .inv-menu__dropdown button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 0.45rem 0.85rem; font-size: 0.9rem; color: var(--color-text);
}
.menu__dropdown button:hover, .watch-card__dropdown button:hover, .inv-menu__dropdown button:hover {
  background: var(--color-bg-secondary);
}
.menu__del:hover, .watch-card__del-opt:hover, .inv-menu__del:hover { color: var(--color-danger) !important; }
/* A labelled control inside a dropdown, e.g. the Stock "Looks like" picker. */
.menu__field {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.5rem 0.85rem 0.6rem;
  margin: 0.25rem 0;
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}
.menu__field > span {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.menu__field .field__input { min-width: 12rem; }

.menu__meta, .watch-card__meta {
  padding: 0.35rem 0.85rem 0.45rem; font-size: 0.78rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 0.2rem; white-space: nowrap;
}

/* Compact board panel */
.watch-list { display: flex; flex-direction: column; gap: 0.4rem; }
.watch-list__item {
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
  padding: 0.4rem 0.5rem; border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
}
.watch-list__detail { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.watch-list__name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-list__elapsed { font-size: 0.78rem; color: var(--color-accent); font-weight: 600; }
.watch-list__section-title { margin: 0.55rem 0 0.3rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.watch-list__item--routine-recent { border-left: 3px solid var(--color-success); }
.watch-list__item--routine-soon { border-left: 3px solid var(--color-warning); }
.watch-list__item--routine-overdue { border-left: 3px solid var(--color-danger); }
.watch-list__item--routine-soon .watch-list__elapsed { color: var(--color-warning); }
.watch-list__item--routine-overdue .watch-list__elapsed { color: var(--color-danger); }

@media (max-width: 640px) {
  .ts-add__schedule, .ts-add__assignee, .ts-add__starts { flex: 1 1 145px; width: auto; }
  .ts-sort { max-width: 9.5rem; }
}

@media (min-width: 641px) {
  .board__panel--watches { flex-shrink: 0; }
  .board__panel--watches .watch-list { max-height: 9rem; overflow-y: auto; }
  .board__panel--countdown { flex-shrink: 0; }
  .board__panel--countdown .watch-list { max-height: 9rem; overflow-y: auto; }
}

/* ── Time Until (countdowns) ─────────────────────────────────────────── */
/* Constrain WebKit's intrinsic date control width inside its flex item. */
.ts-add__when-wrap { position: relative; flex: 0 1 15rem; width: 15rem; min-width: 0; max-width: 100%; }
.ts-add__when { display: block; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; min-height: 2.75rem; }
.ts-add__when::-webkit-date-and-time-value { min-width: 0; text-align: left; }
/* Safari and iPadOS size the editable fields inside a datetime-local control
   from their own content and let them spill straight out of the box, over
   whatever sits to the right of it. Clip at the control's own edge so the
   date can never be painted on top of the Shared/Private select. */
.ts-add__when { overflow: hidden; }
.ts-add__when::-webkit-datetime-edit { min-width: 0; overflow: hidden; }

/* Below desktop width the add row becomes a grid rather than one flex line.
   A grid track cannot be squeezed by a control that refuses to shrink, so the
   name gets a line of its own and the date picker, the visibility select and
   the button each keep their own space on an iPad or a phone. */
@media (max-width: 1024px) {
  .ts-add--countdown {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    align-items: center;
  }
  .ts-add--countdown .ts-add__name { grid-column: 1 / -1; min-width: 0; }
  .ts-add--countdown .ts-add__when-wrap { flex: none; width: auto; }
  .ts-add--countdown .ts-add__vis { width: 100%; }
  .ts-add--countdown .btn--primary { grid-column: 1 / -1; }
}
.ts-add__when-hint {
  position: absolute; left: 0.68rem; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); font-size: 0.95rem; pointer-events: none;
}

.cd-timers {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  margin-top: 0.75rem;
}
.cd-timers__label { font-size: 0.85rem; color: var(--color-text-muted); margin-right: 0.25rem; }

/* A finished countdown glows to draw the eye */
.watch-card--done {
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 1px var(--color-accent),
    var(--shadow-raised);
}
.watch-card--done .watch-card__elapsed { color: var(--color-danger); }
/* Marked with a left edge like every other state in this list. An outline is
   painted outside the box and takes no space, so two finished timers in a row
   had their rings meet across the 0.4rem gap and read as one heavy bar welding
   the cards together, which is worse the more of them have finished. */
.watch-list__item--done {
  border-left: 3px solid var(--color-danger);
}
.watch-list__item--done .watch-list__elapsed { color: var(--color-danger); }

/* ── Sound toggles (settings) ────────────────────────────────────────── */
.sound-list { display: flex; flex-direction: column; gap: 0.6rem; }
.sound-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border);
}
.sound-item__detail { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 0.15rem; }
.sound-item__label { font-weight: 600; }
.sound-item__desc { font-size: 0.82rem; color: var(--color-text-muted); }
.sound-item__controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Notification area toggles + quiet hours (settings) ──────────────── */
.notif-area-list { display: flex; flex-direction: column; gap: 0.6rem; }
.notif-area-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border);
}
.notif-area-item__label { font-weight: 600; }
.quiet-hours-fields { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* Time display picker: one row per wording, chosen like a radio group but
   sized like the sound rows above it. */
.time-format-list { display: flex; flex-direction: column; gap: 0.6rem; }
.time-format {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.time-format:hover { border-color: var(--color-accent); }
.time-format--on { border-color: var(--color-accent); background: var(--color-bg-card); }
.time-format input { width: var(--control-h-xs); height: var(--control-h-xs); flex-shrink: 0; accent-color: var(--color-accent); }
.time-format__detail { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 0.15rem; }
.time-format__label { font-weight: 600; }
.time-format__desc { font-size: 0.82rem; color: var(--color-text-muted); }
.time-format:focus-within { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.toggle {
  position: relative; width: 44px; height: 24px; flex-shrink: 0;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--color-border);
  transition: background var(--transition);
}
.toggle--on { background: var(--color-accent); }
.toggle__knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform var(--transition);
}
.toggle--on .toggle__knob { transform: translateX(20px); }

/* ── Stats page ──────────────────────────────────────────────────────── */

.stats-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.stats-seg { display: inline-flex; border: 2px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-bg-card); }
.stats-seg__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-h-sm);
  background: none; border: none; cursor: pointer;
  padding: 0 0.85rem; font-size: 0.85rem; font-weight: 600; line-height: 1.2;
  color: var(--color-text-secondary);
}
.stats-seg__btn + .stats-seg__btn { border-left: 1px solid var(--color-border); }
.stats-seg__btn:hover { background: var(--color-bg-secondary); }
.stats-seg__btn--on { background: var(--color-accent); color: var(--color-on-accent); }
.stats-seg__btn--on:hover { background: var(--color-accent); }

.stats-section__title { font-family: var(--font-heading); font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }

.stats-grid { --card-min: 300px; }
.stats-grid--wide { --card-min: 320px; }
.stats-card__vis { font-size: 0.85rem; flex-shrink: 0; }
.stats-card__hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: -0.35rem; }

.stats-tiles { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stats-tile {
  flex: 1 1 5.5rem; min-width: 0;
  display: flex; flex-direction: column; gap: 0.1rem;
  background: var(--color-bg-secondary); border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
}
.stats-tile__value { font-size: 1.15rem; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.stats-tile__label { font-size: 0.72rem; color: var(--color-text-muted); }

.stats-chart { width: 100%; }
.stats-chart__empty { color: var(--color-text-muted); font-size: 0.85rem; padding: 1rem 0; }
.stats-svg { display: block; width: 100%; height: auto; }
.stats-svg__grid { stroke: var(--color-border-light); stroke-width: 1; }
.stats-svg__tick { fill: var(--color-text-muted); font-size: 11px; font-family: var(--font-body); }
.stats-svg__peak { fill: var(--color-text-secondary); font-size: 11px; font-weight: 600; font-family: var(--font-body); }
.stats-svg__bar { fill: var(--color-accent); }
.stats-svg__bar--lift { fill: var(--color-accent-hover); }
.stats-svg__hit { fill: transparent; cursor: pointer; outline-offset: -2px; }

.stats-tip {
  position: fixed; z-index: 300; pointer-events: none;
  display: flex; flex-direction: column; gap: 0.05rem;
  background: var(--color-bg-card); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-overlay);
  padding: 0.3rem 0.55rem; font-size: 0.8rem;
}
.stats-tip strong { color: var(--color-text); font-size: 0.9rem; }
.stats-tip span { color: var(--color-text-secondary); }

.stats-text { font-size: 0.9rem; color: var(--color-text-secondary); display: flex; flex-direction: column; gap: 0.5rem; }
.stats-table { border-collapse: collapse; font-size: 0.82rem; width: 100%; max-width: 20rem; }
.stats-table th { text-align: left; color: var(--color-text-muted); font-weight: 600; padding: 0.2rem 0.6rem 0.2rem 0; border-bottom: 1px solid var(--color-border-light); }
.stats-table td { padding: 0.2rem 0.6rem 0.2rem 0; border-bottom: 1px solid var(--color-border-light); font-variant-numeric: tabular-nums; }

.stats-items { list-style: none; display: flex; flex-direction: column; }
.stats-items__row { border-bottom: 1px solid var(--color-border-light); }
.stats-items__row:last-child { border-bottom: none; }
.stats-items__btn {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 0.45rem 0.15rem; font-size: 0.9rem; color: var(--color-text);
  border-radius: var(--radius-sm);
}
.stats-items__btn:hover { background: var(--color-bg-secondary); }
.stats-items__name { flex: 1; min-width: 0; font-family: var(--font-list); text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-items__counts { flex-shrink: 0; font-size: 0.78rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.stats-items__chev { flex-shrink: 0; font-size: 0.7rem; color: var(--color-text-muted); transition: transform var(--transition); }
.stats-items__chev--open { transform: rotate(180deg); }
.stats-items__detail { padding: 0.15rem 0.15rem 0.6rem; }

/* ── Meals page ───────────────────────────────────────────────────────── */
.meal-grid { --card-min: 250px; }
.meal-card__fav {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  margin-left: calc(var(--tap) / -4);
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 0; border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}
.meal-card__fav--on { color: var(--color-accent); }
.meal-card__link { font-size: 0.82rem; align-self: flex-start; }
.meal-card__ingredients { font-size: 0.83rem; color: var(--color-text-secondary); font-family: var(--font-list); }
.meal-card__planned { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.meal-plan-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: var(--color-event-chip-bg); color: var(--color-event-chip-text);
  border-left: 3px solid var(--color-event-bg);
  border-radius: 7px; padding: 1px 6px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.meal-plan-chip__remove {
  background: none; border: none; cursor: pointer; padding: 0 0 0 1px;
  font-size: 0.9rem; line-height: 1; color: inherit; opacity: 0.65;
}
.meal-plan-chip__remove:hover { opacity: 1; }
.meal-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-control); margin-top: auto; }

/* Structured recipe ingredients: shopping item first, free-text amount second. */
.meal-ingredients-editor { display: flex; flex-direction: column; gap: 0.45rem; }
.meal-ingredient-row {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(7rem, 1fr) 2rem;
  align-items: center; gap: 0.45rem;
}
.meal-ingredient-row--head {
  color: var(--color-text-muted); font-size: 0.75rem; font-weight: 600;
  padding: 0 0.15rem;
}
.meal-ingredient-item { position: relative; min-width: 0; }
.meal-ingredient-item .autocomplete__list { z-index: 20; }
.meal-ingredient-remove {
  border: 0; background: none; color: var(--color-text-muted); cursor: pointer;
  font-size: 1.35rem; line-height: 1; padding: 0.25rem;
}
.meal-ingredient-remove:hover { color: var(--color-danger); }
.meal-ingredient-add { align-self: flex-start; }

/* Ingredient picker in the "add to list" modal */
.meal-pick { list-style: none; display: flex; flex-direction: column; max-height: 40vh; overflow-y: auto; }
.meal-pick__item { border-bottom: 1px solid var(--color-border-light); }
.meal-pick__item:last-child { border-bottom: none; }
.meal-pick__label {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.15rem; cursor: pointer;
  font-size: 0.92rem; font-family: var(--font-list);
}
.meal-pick__item--onlist .meal-pick__label { color: var(--color-text-muted); cursor: default; }
.meal-pick__text { min-width: 0; }
.meal-pick__amount { margin-left: auto; color: var(--color-text-muted); font-size: 0.8rem; white-space: nowrap; }
.meal-pick__note { margin-left: auto; font-size: 0.72rem; color: var(--color-text-muted); white-space: nowrap; }
.meal-pick__detail { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.meal-pick__desc {
  font-size: 0.78rem; color: var(--color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal--narrow { max-width: 360px; }

/* Text/CSV meal import: a desktop convenience, hidden on phone-width screens
   where pasting a block of text is impractical. */
.desktop-only { display: inline-flex; }
@media (max-width: 640px) {
  .desktop-only { display: none; }
}
.import-text__example {
  background: var(--color-bg-inset, var(--color-bg-card));
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  overflow-x: auto;
  margin: 0 0 0.6rem;
}
.import-text__area { font-family: monospace; font-size: 0.85rem; resize: vertical; }

@media (max-width: 520px) {
  .meal-ingredient-row { grid-template-columns: minmax(0, 1.35fr) minmax(6rem, 0.85fr) 1.5rem; gap: 0.3rem; }
}

/* ── Meal planner (tabs, filters, week grid) ─────────────────────────── */
.meals-tabs {
  display: flex; gap: 0; width: 100%; max-width: 360px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.meals-tab {
  flex: 1; min-height: var(--control-h); padding: 0.5rem 0; text-align: center;
  background: none; border: none; cursor: pointer;
  font-size: 0.88rem; font-weight: 600;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
  border-bottom: 2px solid transparent;
}
.meals-tab--active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  background: var(--color-bg-secondary);
}

.meals-filter { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }
.meals-filter__search { flex: 1; min-width: 0; }

.meal-pick__label--button {
  background: none; border: none; width: 100%; text-align: left;
  font: inherit; color: inherit;
}

.meal-planner__toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.85rem;
}
.meal-planner__nav { display: flex; align-items: center; gap: 0.4rem; }

.meal-planner__days {
  display: flex; gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}
.meal-planner__days::-webkit-scrollbar { display: none; }
.meal-planner__day {
  flex: 0 0 85%;
  min-width: 0;
  scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  background-color: var(--color-bg-card);
  box-shadow: var(--shadow-raised);
}
.meal-planner__day--today { border-color: var(--color-accent);  }
.meal-planner__day-head { font-weight: 600; font-size: 0.85rem; color: var(--color-text-secondary); }
.meal-planner__add {
  align-self: flex-start;
  background: none; border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm); cursor: pointer;
  padding: 0.3rem 0.6rem; margin-top: auto;
  font-size: 0.8rem; color: var(--color-text-muted);
}
.meal-planner__add:hover { color: var(--color-accent); border-color: var(--color-accent); }

.meal-plan-chip--block { display: flex; align-self: stretch; justify-content: space-between; white-space: normal; }
.meal-plan-chip__actions { display: inline-flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.meal-plan-chip__move {
  background: none; border: none; cursor: pointer; padding: 0 0 0 1px;
  font-size: 0.9rem; line-height: 1; color: inherit; opacity: 0.65;
}
.meal-plan-chip__move:hover { opacity: 1; }

@media (min-width: 900px) {
  .meal-planner__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    overflow: visible;
    scroll-snap-type: none;
  }
  .meal-planner__day { flex: none; }
}

/* ── Meals on the calendars ───────────────────────────────────────────── */
.cal-meal {
  background: var(--color-bg-secondary); color: var(--color-text-secondary);
  font-size: 0.72rem; font-weight: 500; line-height: 1.3;
  padding: 2px 5px 2px 6px;
  border-left: 3px dashed var(--color-accent);
  border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 880px) {
  .cal-meal { font-size: 0.65rem; padding: 1px 4px 1px 5px; }
}
@media (max-width: 500px) {
  .cal-meal {
    width: 6px; height: 6px; min-width: 6px;
    background: var(--color-accent);
    border-left: none; border-radius: 50%; padding: 0;
    font-size: 0; text-indent: -9999px; overflow: hidden;
  }
}
.dayview__event--meal { cursor: default; }
.mini-cal__dots { position: absolute; bottom: 2px; display: flex; gap: 3px; }
.mini-cal__dots .mini-cal__dot { position: static; }
.mini-cal__dot--meal { background: var(--color-accent); }

/* ── Meals this week (Board panel) ────────────────────────────────────── */
.meal-week { list-style: none; display: flex; flex-direction: column; }
.meal-week__item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.1rem;
  border-bottom: 1px solid var(--color-border-light);
}
.meal-week__item:last-child { border-bottom: none; }
.meal-week__day { flex-shrink: 0; width: 5.2rem; font-size: 0.78rem; font-weight: 600; color: var(--color-text-muted); }
.meal-week__name { flex: 1; min-width: 0; font-size: 0.9rem; font-family: var(--font-list); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-week__add { flex-shrink: 0; white-space: nowrap; }

/* ── Stock (fridge/freezer/cupboard inventory) ────────────────────────── */

.inv-new-place { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.inv-new-place__name { flex: 1; min-width: 180px; }
.inv-new-place__kind { flex: 0 0 auto; width: auto; }

.inv-search { max-width: 38rem; margin: 0 0 0.85rem; }
.inv-search__input { width: 100%; }
.inv-search-results {
  max-width: 46rem; margin-bottom: 1rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-bg-card); box-shadow: var(--shadow-raised);
}
.inv-search-results__list { list-style: none; margin: 0; padding: 0.3rem 0.75rem; }
.inv-search-results__list li + li { border-top: 1px dashed var(--color-border-light); }
.inv-search-result {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  width: 100%; min-height: var(--tap); padding: 0.55rem 0.25rem;
  border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.inv-search-result:hover .inv-search-result__name,
.inv-search-result:focus-visible .inv-search-result__name { text-decoration: underline; }
.inv-search-result__name { font-family: var(--font-list); font-size: 1.02rem; text-transform: capitalize; }
.inv-search-result__detail { color: var(--color-text-muted); font-size: 0.82rem; text-align: right; }

.inv-navigation {
  position: sticky; top: calc(var(--nav-h) + 0.25rem); z-index: 15;
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.75rem; padding: 0.25rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-bg-card);
  background: color-mix(in srgb, var(--color-bg-card) 88%, transparent);
}
.inv-navigation__arrow {
  flex: 0 0 var(--tap); min-height: var(--tap);
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--color-text); font-size: 1.3rem;
  opacity: 0.7; cursor: pointer;
}
.inv-navigation__arrow:hover:not(:disabled),
.inv-navigation__arrow:focus-visible { opacity: 1; border-color: var(--color-border); }
.inv-navigation__arrow:disabled { opacity: 0.2; cursor: default; }
.inv-pills { display: flex; flex: 1; min-width: 0; overflow-x: auto; gap: 0.4rem; padding: 0.2rem; }
.inv-pills .chip { flex: 0 0 auto; }
.inv-pill__count { opacity: 0.7; font-size: 0.78rem; }
.inv-pill--active .inv-pill__count { opacity: 0.85; }

/* One horizontal shelf at every width, so a full fridge never buries a cupboard. */
.inv-carousel {
  display: flex; align-items: flex-start; gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}
.inv-carousel::-webkit-scrollbar { display: none; }

/* The kind watermark and tint are painted as backgrounds rather than as a
   pseudo-element. Backgrounds are clipped to the border box for free and
   always sit behind content, so the card needs neither `overflow: hidden`
   nor a stacking context, either of which would trap the options dropdown
   inside the card. */
.compartment {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);
  padding: 0.9rem 0.9rem 1.1rem;
  background-color: var(--color-bg-card);
  background-image:
    var(--inv-mark, none),
    linear-gradient(var(--inv-tint, transparent), var(--inv-tint, transparent));
  background-repeat: no-repeat, no-repeat;
  background-position: right -22px bottom -22px, 0 0;
  background-size: 132px 132px, auto;
  box-shadow: var(--shadow-raised);
}

/* Per-kind treatment: tint layered under the theme plus a faint watermark.
   Kinds are defined once in app/routers/inventory.py; keep the two in step. */
.compartment--fridge   { --inv-tint: rgba(105, 155, 195, 0.12);  --inv-accent: #4e7ba6; --inv-mark: url('/static/icons/mark-fridge.svg'); }
.compartment--freezer  { --inv-tint: rgba(96, 141, 224, 0.14);   --inv-accent: #4a6ec2; --inv-mark: url('/static/icons/mark-frost.svg'); }
.compartment--cupboard { --inv-tint: rgba(172, 122, 62, 0.13);   --inv-accent: #8a6434; --inv-mark: url('/static/icons/mark-pantry.svg'); }
.compartment--fruit    { --inv-tint: rgba(126, 170, 80, 0.13);   --inv-accent: #5f8a33; --inv-mark: url('/static/icons/mark-fruit.svg'); }
.compartment--bread    { --inv-tint: rgba(196, 160, 100, 0.14);  --inv-accent: #8d6c35; --inv-mark: url('/static/icons/mark-bread.svg'); }
.compartment--spice    { --inv-tint: rgba(212, 132, 48, 0.14);   --inv-accent: #a35f13; --inv-mark: url('/static/icons/mark-spice.svg'); }
.compartment--drinks   { --inv-tint: rgba(150, 90, 140, 0.12);   --inv-accent: #7d4a74; --inv-mark: url('/static/icons/mark-drinks.svg'); }
.compartment--bathroom { --inv-tint: rgba(95, 175, 180, 0.12);   --inv-accent: #3f8b91; --inv-mark: url('/static/icons/mark-bathroom.svg'); }
.compartment--medicine { --inv-tint: rgba(190, 110, 110, 0.12);  --inv-accent: #9e4b4b; --inv-mark: url('/static/icons/mark-medicine.svg'); }
.compartment--cleaning { --inv-tint: rgba(90, 175, 150, 0.12);   --inv-accent: #37836b; --inv-mark: url('/static/icons/mark-cleaning.svg'); }
.compartment--pets     { --inv-tint: rgba(152, 152, 92, 0.13);   --inv-accent: #6f7033; --inv-mark: url('/static/icons/mark-pets.svg'); }
.compartment--garage   { --inv-tint: rgba(130, 140, 150, 0.13);  --inv-accent: #5d6875; --inv-mark: url('/static/icons/mark-garage.svg'); }

.compartment__head {
  display: flex; align-items: center; gap: 0.5rem;
  border-bottom: 2px solid var(--inv-accent, var(--color-border));
  padding-bottom: 0.4rem; margin-bottom: 0.6rem;
}
.compartment__name {
  font-family: var(--font-heading); font-size: 1.25rem;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compartment__low {
  color: var(--color-on-warning); background: var(--color-warning); font-weight: 700;
}
.compartment__expiry {
  color: var(--color-on-danger); background: var(--color-danger); font-weight: 700;
}
.compartment__collapse {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 32px;
  border: 1px solid var(--color-border); border-radius: 50%;
  background: var(--color-bg-card); color: var(--color-text); cursor: pointer;
}
.compartment--collapsed { padding-bottom: 0.55rem; background-position: right -42px bottom -42px, 0 0; }
.compartment--collapsed .compartment__head { margin-bottom: 0; border-bottom-width: 0; padding-bottom: 0; }

.compartment__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.inv-add__details { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; margin-top: 0.5rem; }
.inv-add__detail .field__input { width: 4.4rem; min-width: 4.4rem; }
.inv-add__detail .inv-add__date { width: 9.5rem; min-width: 9.5rem; }
.inv-add__hint { font-size: 0.75rem; color: var(--color-text-muted); }

.inv-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.6rem;
  min-height: 46px;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--color-border-light);
}
.inv-item:last-child { border-bottom: none; }
/* Name and its labels share one line and wrap together; the quantity
   controls hold their own column on the right at every width. */
.inv-item__info {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.45rem;
  flex: 1 1 8rem; min-width: 0;
}
.inv-item__name {
  font-family: var(--font-list); font-size: 1.02rem; line-height: 1.3;
  min-width: 0; overflow-wrap: anywhere; text-transform: capitalize;
  background: none; border: none; padding: 0; color: inherit; text-align: left;
  cursor: pointer; border-radius: var(--radius-sm, 4px);
}
.inv-item__name:hover, .inv-item__name:focus-visible { text-decoration: underline; }
.inv-item--low .inv-item__name { color: var(--color-warning); font-weight: 600; }
.inv-item--expiry-soon { border-left: 3px solid var(--color-warning); padding-left: 0.4rem; }
.inv-item--expired { border-left: 3px solid var(--color-danger); padding-left: 0.4rem; background: var(--color-bg-secondary); background: color-mix(in srgb, var(--color-danger) 7%, transparent); }
.inv-expiry-badge {
  border-color: var(--color-border); background: var(--color-bg-card);
  color: var(--color-text-muted); cursor: pointer;
}
.inv-expiry-badge--soon, .inv-expiry-badge--today { border-color: var(--color-warning); color: var(--color-warning); font-weight: 700; }
.inv-expiry-badge--expired { border-color: var(--color-danger); background: var(--color-danger); color: var(--color-on-danger); font-weight: 700; }
.inv-expiry-badge--none { opacity: 0.62; }
.inv-expiry-edit, .inv-expiry-actions {
  flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  padding: 0.4rem; border-radius: var(--radius-sm); background: var(--color-bg-secondary);
  font-size: 0.78rem; color: var(--color-text-secondary);
}
.inv-expiry-edit input[type="date"] { width: 9.5rem; min-width: 9.5rem; }
.inv-expiry-edit input[type="number"] { width: 4.4rem; min-width: 4.4rem; }
.inv-expiry-actions > span { font-weight: 700; color: var(--color-danger); margin-right: auto; }
.inv-item__min {
  background: none; border-style: dashed; border-color: var(--color-border);
  color: var(--color-text-muted); cursor: pointer;
}
.inv-item__min:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.inv-item__minedit { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; }
.inv-item__min-input { width: 4rem; min-width: 4rem; }
.inv-item__controls {
  display: flex; align-items: center; gap: 0.4rem;
  flex-shrink: 0; margin-left: auto;
}
.inv-stepper { display: flex; align-items: center; gap: 0.1rem; }
.inv-stepper__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0; border-radius: 50%;
  border: 1px solid var(--color-border); background: var(--color-bg-card); color: var(--color-text);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  transition: background var(--transition);
}
.inv-stepper__btn:hover:not(:disabled) { background: var(--color-bg-secondary); }
.inv-stepper__btn:disabled { opacity: 0.35; cursor: not-allowed; }
.inv-item__qty { min-width: 2em; text-align: center; font-weight: 700; font-size: 1.05rem; }
.inv-item--low .inv-item__qty { color: var(--color-warning); }
.inv-item__outflag {
  min-height: var(--control-h-sm); padding: 0 0.7rem;
  color: var(--color-on-danger); background: var(--color-danger);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.inv-item__del {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  background: none; border: none; color: var(--color-text-muted);
  font-size: 1.1rem; cursor: pointer; padding: 0; border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.inv-item__del:hover { color: var(--color-danger); background: var(--color-bg-secondary); }

/* Matches .kb-toast so a Stock message looks like every other message. */
.inv-toast {
  position: fixed; z-index: 260; left: 50%;
  bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 0.75rem);
  transform: translateX(-50%);
  display: flex; align-items: center; min-height: 48px;
  width: max-content; max-width: min(calc(100% - 1rem), 560px);
  padding: 0.6rem 0.85rem; border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-nav-bg); color: var(--color-nav-text);
  box-shadow: 0 6px 22px var(--color-shadow);
  font-size: 0.88rem;
}

@media (min-width: 900px) {
  .compartment { flex-basis: calc((100% - 0.75rem) / 2); }
}
@media (min-width: 1300px) {
  .compartment { flex-basis: calc((100% - 1.5rem) / 3); }
}

@media (max-width: 560px) {
  .inv-search-result { align-items: center; }
  .inv-expiry-badge--none { font-size: 0; width: 26px; min-width: 26px; padding: 0; }
  .inv-expiry-badge--none::after { content: '\1F4C5'; font-size: 0.8rem; }
}

/* ── Global quick add (phone footer button + sheet) ───────────────────────────────── */
.quickadd-fab {
  display: none;
  flex: 0 0 40px;
  width: 40px; height: 40px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--color-accent); color: var(--color-on-accent);
  border: none; font-size: 1.8rem; line-height: 1;
  box-shadow: var(--shadow-overlay);
}
.quickadd-fab:active { transform: scale(0.94); }
@media (max-width: 640px) {
  .quickadd-fab { display: flex; }
}

.quickadd-sheet .modal__header { gap: 0.5rem; }
.quickadd-sheet form { display: flex; flex-direction: column; gap: 0.75rem; }
.quickadd-sheet .modal__footer { flex-wrap: wrap; padding: 0; border-top: none; margin-top: 0.25rem; }
.quickadd-types {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem;
}
.quickadd-type {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.85rem 0.5rem; border-radius: var(--radius);
  border: 1px solid var(--color-border); background: var(--color-bg-secondary);
  color: var(--color-text); font-size: 0.82rem;
}
.quickadd-type--last { border-color: var(--color-accent); }
.quickadd-type__icon { font-size: 1.6rem; }
.quickadd-presets {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
}

/* Reward balances and history remain usable on narrow phones. */
.stats-tile dd { margin: 0; }
.rewards-history { overflow-x: auto; }
.stats-card progress { width: 100%; accent-color: var(--color-accent); }

/* Rewards use the same paper cards and ruled heading on either page. */
.rewards-panel { margin-top: var(--space-section); }
.page-narrow > .rewards-panel { margin-top: 0; }
.rewards-panel .settings-section { margin-bottom: var(--space-card); }
.reward-card__cost { flex-shrink: 0; white-space: nowrap; font-size: 0.85rem; }
.reward-card__description { color: var(--color-text-secondary); font-size: 0.9rem; overflow-wrap: anywhere; }
.reward-card .action-row { margin-top: auto; padding-top: var(--space-control); border-top: 1px solid var(--color-border-light); }
/* Reversed bonuses keep their row; the tag says why the sum looks lighter. */
.rewards-history__reversed { display: block; color: var(--color-text-secondary); font-style: italic; }
.rewards-history__reverse { display: block; margin-top: 0.25rem; }
/* The Board's points widget: the balance is the headline, in the heading hand. */
.points-balance {
  flex-shrink: 0; white-space: nowrap;
  font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; color: var(--color-accent);
}

.suggestion-row strong { margin-right: var(--space-control); }

/* Ruled suggestion entries on the admin paper sheet. */
.suggestion-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-control); padding-block: var(--space-control); border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }

/* Below the desktop sidebar, routines and timers join the calendar column.
   Let the page grow so those paper panels cannot be clipped by a height cap.
   Narrower than 1024px only: from 1024px up, the sidebar layout in base.css
   moves routines/timers into their own column, so this squeeze never applies
   there and the board never needs to grow past one screen. */
@media (min-width: 641px) and (max-width: 1023px) {
  .board__left { max-height: none; overflow: visible; min-width: 0; }
  .board__left > .board__panel { flex-shrink: 0; }
  .board__panel--upcoming { overflow: visible; }
  .board__panel--upcoming .upcoming__list { overflow-y: visible; }
}

/* Keep both sheets readable on a landscape tablet without shrinking the UI. */
@media (min-width: 901px) and (max-width: 1023px) {
  .board { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); }
}

/* A ruled stock sheet, with small paper tabs for quantity changes. */
.inv-table-wrap {
  overflow-x: auto;
  margin: var(--space-card) 0;
  padding: var(--space-control) var(--space-card) var(--space-card);
  border: 1px solid var(--color-border);
  border-radius: 3px 5px 4px 2px;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-raised);
}
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th, .inv-table td {
  text-align: left;
  padding: .65rem .8rem;
  border-bottom: 1px solid var(--color-border-light);
}
.inv-table thead th {
  white-space: nowrap;
  border-bottom: 2px solid var(--color-border);
}
.inv-table thead .btn {
  padding-left: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}
.inv-table tbody th {
  font-family: var(--font-list);
  font-size: 1.1rem;
  font-weight: normal;
  min-width: 9rem;
}
.inv-table tbody td { color: var(--color-text-secondary); }
.inv-table tbody tr:last-child > * { border-bottom: 0; }
.inv-table__stepper { gap: var(--space-control); }
.inv-table__stepper .inv-item__qty {
  color: var(--color-text);
  font-family: var(--font-list);
  font-variant-numeric: tabular-nums;
}
.inv-table__stepper .inv-stepper__btn {
  width: var(--control-h-sm);
  height: var(--control-h-sm);
  border-radius: 2px 4px 3px 2px;
  box-shadow: var(--shadow-control);
  font-family: var(--font-heading);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.inv-table__stepper .inv-stepper__btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-control-hover);
}
.inv-table__stepper .inv-stepper__btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--shadow-control-pressed);
}
.inv-table tbody .inv-table__attention { color: var(--color-danger); font-weight: 600; }
@media (pointer: coarse) {
  .inv-table__stepper .inv-stepper__btn { width: var(--tap); height: var(--tap); }
}

.inv-table__date {
  min-height: var(--control-h-sm);
  padding: var(--space-control);
  border: 0;
  border-bottom: 1px dashed var(--color-border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-family: var(--font-list);
}
.inv-table__date:disabled { opacity: .5; }

/* Give phone shopping names a full line, with labels beneath them. */
@media (max-width: 640px) {
  .item-list__item {
    display: grid;
    grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
    column-gap: 0.35rem;
    row-gap: 0.2rem;
  }
  .item-list__check { grid-column: 1; grid-row: 1; align-self: start; }
  .item-list__text { grid-column: 2; grid-row: 1; align-self: center; line-height: 1.4; }
  .item-list__more { grid-column: 3; grid-row: 1; align-self: start; }
  .item-list__del { display: none; }
  /* One shared line under the name, wrapping only when the labels run out of
     room. Placed as a single grid item, because separate ones in the same
     column would each claim a row of their own and stack up. */
  .item-list__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    grid-column: 2 / -1;
    grid-row: 2;
    min-width: 0;
  }
  .item-list__stock, .item-list__aisle, .item-list__pending, .item-list__expire {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .shopping-trip .item-list__more { display: inline-flex; }
  .aisle-order-list__row { flex-wrap: wrap; padding-block: 0.35rem; }
  .aisle-order-list__name { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
  .aisle-order-list__actions { flex-wrap: wrap; gap: 0.4rem; }
  .aisle-order-list__actions .btn { min-height: var(--tap); min-width: var(--tap); }
  .aisle-order-add .field__input { min-width: 0; }
  #aisle-editor { scroll-margin-top: 5rem; }
}

.chore-time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.chore-time-row .field__input { flex: 1; min-width: 7rem; width: auto; }
.chore-time-row .field__label { margin: 0; }

/* ── Screensaver ──────────────────────────────────────────────────────────
   Read from across the room: a photo edge to edge, a big clock, and paper
   cards pinned over the picture the way notes go on a fridge door. */
html.screensaver-open, html.screensaver-open body { overflow: hidden; }
.screensaver {
  position: fixed; inset: 0; z-index: 1000;
  background: #000; color: #fff;
  overflow: hidden; cursor: none;
  transition: opacity 500ms ease;
}
.screensaver:focus { outline: none; }
.screensaver--leaving { opacity: 0; }
.screensaver__photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transition: opacity 1.5s ease;
}
.screensaver__photo--shown { opacity: 1; }
/* A soft shade along the bottom, so the clock stays readable over a sky. */
.screensaver::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}
.screensaver__info, .screensaver__hint { z-index: 1; }
.screensaver__info {
  position: absolute;
  left: clamp(1rem, 4vw, 3rem); right: clamp(1rem, 4vw, 3rem); bottom: clamp(1rem, 5vh, 3rem);
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem;
  transition: transform 2s ease;
}
.screensaver__clock { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65), 0 0 2px rgba(0, 0, 0, 0.8); }
.screensaver__time {
  font-family: var(--font-heading); font-weight: 600;
  font-size: clamp(4rem, 13vw, 10rem); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.screensaver__date { font-size: clamp(1.2rem, 2.8vw, 2rem); margin-top: 0.4rem; }
.screensaver__cards { display: flex; flex-direction: column; gap: 0.75rem; width: min(100%, 28rem); }
.screensaver__card {
  background: var(--color-bg-card); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 0.9rem 1.2rem 1rem;
  box-shadow: var(--shadow-overlay);
}
.screensaver__card--pinned { border-left: 6px solid var(--color-accent); }
.screensaver__card-title {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 0.3rem; margin-bottom: 0.5rem;
}
.screensaver__list { display: flex; flex-direction: column; gap: 0.3rem; }
.screensaver__row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
}
.screensaver__row-name { font-family: var(--font-list); overflow-wrap: anywhere; }
.screensaver__row-value {
  color: var(--color-text-secondary); font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.screensaver__card--pinned .screensaver__row-value { color: var(--color-text); font-size: 1.25em; }
.screensaver__row--done .screensaver__row-value { color: var(--color-danger); }
.screensaver__more { color: var(--color-text-muted); font-size: 1rem; }
.screensaver__feature-main { font-family: var(--font-list); font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.25; }
.screensaver__feature-sub { color: var(--color-text-secondary); font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
.screensaver__hint {
  position: absolute; top: 1rem; right: 1.25rem;
  font-size: 0.9rem; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  opacity: 0;
  animation: screensaver-hint 6s ease forwards;
}
@keyframes screensaver-hint {
  0%, 75% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* With no album yet, the clock and cards sit on the theme's own paper. */
.screensaver--plain { background: var(--color-bg); color: var(--color-text); }
.screensaver--plain .screensaver__photo,
.screensaver--plain::after { display: none; }
.screensaver--plain .screensaver__clock,
.screensaver--plain .screensaver__hint { text-shadow: none; }
.screensaver--plain .screensaver__info { top: 0; bottom: 0; align-items: center; justify-content: space-around; }

@media (max-width: 640px) {
  .screensaver__info { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .screensaver, .screensaver__photo, .screensaver__info { transition: none; }
}

/* Settings: the household album. */
.photo-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.photo-album__item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--color-border); background: var(--color-bg-secondary); }
.photo-album__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-album__remove {
  position: absolute; top: 0.25rem; right: 0.25rem;
  width: var(--control-h-sm); height: var(--control-h-sm);
  border-radius: 50%; border: 1px solid var(--color-border);
  background: var(--color-bg-card); color: var(--color-text);
  font-size: 1rem; line-height: 1;
}
