/* pages.css — page-specific rules, scoped by body[data-page] (FE-2.1).
   The recipe page is the signature (CM-0.6): mono eyebrow → Archivo title → meta
   strip → stations → numbered method → Worth knowing → credit footer. Every other
   page borrows from that hierarchy and nothing out-shouts it. */

/* ---------- landing ---------- */

body[data-page="landing"] .hero {
  display: grid;
  gap: var(--sp-5);
  align-items: center;
  padding-block: var(--sp-6);
}
body[data-page="landing"] .hero h1 {
  font-size: var(--tx-4);
}
body[data-page="landing"] .hero p.lede {
  font-size: var(--tx-1);
  color: var(--muted);
}
body[data-page="landing"] .hero-shot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
}
body[data-page="landing"] .steps {
  display: grid;
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}
body[data-page="landing"] .step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
/* A real sequence, so a real number (CM-0.4) — set as a mono numeral, not a badge. */
body[data-page="landing"] .step-n {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--tx-1);
  font-weight: 600;
  letter-spacing: var(--tracking-mono);
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-3);
}
@media (min-width: 768px) {
  body[data-page="landing"] .hero {
    grid-template-columns: 1fr 1fr;
  }
  body[data-page="landing"] .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- auth pages ---------- */

body[data-auth="public"] .auth-card {
  max-width: 26rem;
  margin-inline: auto;
}
.auth-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  font-size: var(--tx--1);
}

/* ---------- onboarding ---------- */

body[data-page="onboarding"] .onb-progress {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
body[data-page="onboarding"] .onb-dot {
  flex: 1 1 0;
  height: 4px;
  border-radius: 0;
  background: var(--border);
}
body[data-page="onboarding"] .onb-dot.on {
  background: var(--accent);
}
body[data-page="onboarding"] .onb-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: space-between;
  margin-top: var(--sp-5);
  flex-wrap: wrap;
}

/* ---------- dashboard ---------- */

.expiring-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
}
.expiring-strip a {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: var(--tx--1);
}
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  display: grid;
  gap: var(--sp-3);
  margin-block: var(--sp-4);
}
.filter-bar .field {
  margin-bottom: 0;
}
@media (min-width: 768px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 768px) {
  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .recipe-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- inventory ---------- */

.inv-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: var(--sp-4);
  overflow: hidden;
}
.inv-group > summary {
  cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  color: var(--accent);
  background: var(--surface-2);
}
.inv-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border);
  min-height: var(--tap);
  flex-wrap: wrap;
}
.inv-row .inv-name {
  flex: 1 1 8rem;
  min-width: 0;
  font-weight: 600;
}
.inv-row .inv-qty {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: var(--tx--1);
  font-variant-numeric: tabular-nums;
}
.inv-row .inv-custom {
  font-style: italic;
  color: var(--muted);
}
.inv-actions {
  display: flex;
  gap: var(--sp-1);
  margin-left: auto;
}
.inv-add {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.inv-details {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
}
@media (min-width: 768px) {
  .inv-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.bulk-row {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-2);
  background: var(--surface);
}
@media (min-width: 768px) {
  .bulk-row {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    align-items: end;
  }
}

/* ================= recipe detail — the signature (CM-0.6, CM-1.7) ================= */

body[data-page="recipe"] .hero-img {
  width: 100%;
  max-height: 24rem;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: var(--sp-5);
}
body[data-page="recipe"] .rc-head h1 {
  font-size: var(--tx-4);
  max-width: 22ch;
}
body[data-page="recipe"] .rc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-block: var(--sp-3);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-block: var(--sp-3) var(--sp-5);
}
body[data-page="recipe"] .recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block: var(--sp-4);
}
body[data-page="recipe"] .recipe-cols {
  display: grid;
  gap: var(--sp-5);
}
@media (min-width: 768px) {
  body[data-page="recipe"] .recipe-cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ---- stations (CM-1.7): one block per group_label ---- */

.station + .station {
  margin-top: var(--sp-5);
}
.station-h,
.worth-h {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  font-weight: 600;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--accent);
  margin-bottom: var(--sp-2);
}
.worth-h {
  border-bottom-color: var(--border);
}
.ing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ing-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
  min-height: var(--tap);
}
.ing-list li:last-child {
  border-bottom: 0;
}
.ing-qty {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.ing-prep {
  color: var(--muted);
}
/* Legacy ungrouped heading, kept so a recipe with no group_label is untouched. */
.ing-group {
  font-weight: 700;
  margin-top: var(--sp-3);
}

/* ---- numbered method (CM-1.7) ---- */

.steps-list {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}
.steps-list > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: var(--sp-3);
  padding-block: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.steps-list > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--tx-1);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.steps-list > li:last-child {
  border-bottom: 0;
}
.step-headline {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--accent);
  margin-bottom: var(--sp-1);
}
/* `.step-text` wraps the prose so the [M3] translation toggle can swap it whole. */
.step-body > p + p,
.step-text > p + p {
  margin-top: var(--sp-2);
}
.step-body img {
  margin-top: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* CM-1.5: consecutive same-tag steps read as one movement. */
.step-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  font-weight: 600;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px var(--sp-2);
  margin-bottom: var(--sp-2);
}
.steps-list > li[data-tag-run="mid"],
.steps-list > li[data-tag-run="end"] {
  border-top: 0;
  padding-top: var(--sp-2);
}
.steps-list > li[data-tag-run="start"],
.steps-list > li[data-tag-run="mid"] {
  border-bottom: 0;
  padding-bottom: var(--sp-2);
}
.steps-list > li[data-tag-run] .step-body {
  border-left: 2px solid var(--accent-soft);
  padding-left: var(--sp-3);
}

/* ---- "Worth knowing" + credit footer (CM-1.7) ---- */

.worth-knowing {
  margin-top: var(--sp-6);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius);
  background: var(--surface);
}
.worth-knowing p + p {
  margin-top: var(--sp-3);
}
.recipe-credit {
  margin-top: var(--sp-6);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---- kitchen mode (FE-8.4) + cook mode (CM-1.1) ---- */

body.kitchen-mode .ing-list,
body.kitchen-mode .steps-list {
  font-size: 1.25em;
  line-height: 1.6;
}
body.kitchen-mode .ing-list input[type="checkbox"],
body.kitchen-mode .steps-list input[type="checkbox"] {
  width: 1.6rem;
  height: 1.6rem;
}

.cook-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.cook-bar[hidden] {
  display: none;
}
.serving-stepper {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.serving-stepper .ss-value {
  font-family: var(--font-mono);
  font-size: var(--tx-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 3.5ch;
  text-align: center;
}
.cook-progress {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.ing-list li.is-ticked .grow,
.steps-list > li.is-ticked .step-body,
.steps-list > li.is-ticked .step-headline {
  text-decoration: line-through;
  color: var(--muted);
}
.step-tick {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--tx--1);
  color: var(--muted);
  cursor: pointer;
}

/* ---- per-step timers (CM-1.4) ---- */

.step-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.timer-readout {
  font-family: var(--font-mono);
  font-size: var(--tx-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent);
  min-width: 5.5ch;
}
.step-timer.is-running,
.timer-chip.is-running {
  border-color: var(--danger);
}
.step-timer.is-running .timer-readout,
.timer-chip.is-running .timer-readout {
  color: var(--danger);
}
.step-timer.is-done,
.timer-chip.is-done {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.step-timer.is-done .timer-readout,
.timer-chip.is-done .timer-readout {
  color: var(--danger);
  animation: lacquer-pulse 1.1s ease-in-out infinite;
}
/* CM-0.5: the finished timer is the one animated moment in the system. */
@keyframes lacquer-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* the running-timers strip stays put while the method scrolls (CM-1.4) */
.timer-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--nav-h);
  z-index: 45;
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border-top: 1px solid var(--danger);
}
.timer-strip[hidden] {
  display: none;
}
@media (min-width: 768px) {
  .timer-strip {
    bottom: 0;
  }
}
.timer-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.timer-chip .timer-readout {
  font-size: var(--tx-0);
  min-width: 5ch;
}
.timer-chip .timer-label {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- recipe editor ---------- */

.editor-grid {
  display: grid;
  gap: var(--sp-3);
}
@media (min-width: 768px) {
  .editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ed-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  background: var(--surface);
  display: grid;
  gap: var(--sp-2);
}
.ed-row-tools {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  align-items: center;
}
.ed-group-row {
  background: var(--surface-2);
}
.meter {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.meter.bad {
  color: var(--danger);
}
.meter.good {
  color: var(--ok);
}
/* progressive disclosure (OV-P1.2 / CM-2.1): step details and recipe notes are
   collapsed affordances, never required fields */
.ed-more {
  border-top: 1px dashed var(--border);
  padding-top: var(--sp-2);
}
.ed-more > summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--tx--1);
  font-weight: 600;
  color: var(--link);
}
.ed-more[open] > summary {
  margin-bottom: var(--sp-2);
}
.ed-more-grid {
  display: grid;
  gap: var(--sp-2);
}
@media (min-width: 768px) {
  .ed-more-grid {
    grid-template-columns: 2fr 1fr 1fr;
    align-items: start;
  }
}
.ed-more-grid .field {
  margin-bottom: 0;
}
.ed-parse-note {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ed-parse-note[hidden] {
  display: none;
}

/* ---------- my recipes / lists ---------- */

.list-rows {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.list-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-wrap: wrap;
}
.list-row .grow {
  flex: 1 1 12rem;
}

/* ---------- settings / admin ---------- */

body[data-page="settings"] section[data-tabpanel],
body[data-page="admin"] section[data-tabpanel] {
  max-width: 44rem;
}
body[data-page="admin"] section[data-tabpanel] {
  max-width: none;
}
.kv-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--sp-3);
}
.kv-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-4);
}
.kv-tile .kv-v {
  font-family: var(--font-mono);
  font-size: var(--tx-3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.kv-tile .kv-k {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.admin-row .body-verbatim {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: var(--sp-2);
  margin-block: var(--sp-2);
}
.code {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  background: var(--surface-2);
  padding: 2px var(--sp-1);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

/* ---------- my ideas ---------- */

.idea-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.idea-row .idea-body {
  margin-top: var(--sp-2);
}

/* ---------- error pages (404/500, boot-lite) ---------- */

body[data-page="404"] main,
body[data-page="500"] main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}
body[data-page="404"] .err-code,
body[data-page="500"] .err-code {
  font-family: var(--font-mono);
  font-size: var(--tx-4);
  font-weight: 600;
  letter-spacing: var(--tracking-mono);
  color: var(--accent);
}

/* ---------- [M2] job progress (FE-10.2) ---------- */

.job-progress {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.job-line {
  align-items: center;
  gap: var(--sp-2);
}
.job-status {
  font-weight: 600;
}
.job-detail {
  overflow-wrap: anywhere;
}

/* ---------- [M2] shopping list (FE-9.18) ---------- */

.shop-add form {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-2);
}
.shop-section {
  margin-block: var(--sp-4);
}
.shop-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.shop-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-wrap: wrap;
}
.shop-row .shop-tick {
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
}
.shop-row .shop-name {
  font-weight: 600;
}
.shop-row .shop-from {
  display: block;
}
.shop-footer {
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ---------- [M2] favourites grid ---------- */

.fav-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ---------- [M2] cooked modal (OV-T4) ---------- */

.ckd-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}
.ckd-row uyl-qty-unit {
  flex: 1 1 12rem;
}
.ckd-extra summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}

/* ---------- [M2] reviews & comments (FE-9.11) ---------- */

.social-row {
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.social-row.is-reply {
  margin-inline-start: var(--sp-5);
  border-inline-start: 3px solid var(--accent);
}
.social-row .row {
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ---------- [M2] add-missing control (OV-T3) ---------- */

.add-missing-row {
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}
.add-missing-row input[type="number"] {
  width: 5rem;
}

/* ---------- [M2] notifications (FE-9.23) ---------- */

.notif-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.notif-row.is-unread {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.notif-ico {
  font-size: var(--tx-1);
  line-height: 1;
}
.notif-msg {
  font-weight: 600;
}
/* the lacquer's job: what demands attention (CM-0.1) */
.notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex: 0 0 auto;
  margin-top: var(--sp-1);
}

/* ---------- [M2] admin queue + work order ---------- */

.admin-thumb {
  max-height: 8rem;
  border-radius: var(--radius);
}
.work-order {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-2);
  margin-block: var(--sp-2);
}
.work-order summary {
  cursor: pointer;
  font-weight: 600;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}

/* ================= [M3] meal planner (FE-9.19) ================= */

.plan-bar {
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.plan-week {
  font-size: var(--tx-1);
  white-space: nowrap;
}
.plan-empty {
  margin-bottom: var(--sp-4);
}

/* @360px (the default): one section per day, slot rows beneath it. The DOM is
   emitted day-major precisely so this needs no rules at all beyond spacing. */
.plan-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.plan-slot-h {
  display: none;
}
.plan-day-h {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--accent);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.plan-day-date {
  color: var(--muted);
  letter-spacing: 0.06em;
}
.plan-cell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-start;
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.plan-cell-slot {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-add {
  min-width: var(--tap);
  min-height: var(--tap);
  align-self: stretch;
}
.plan-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  text-align: start;
  padding: var(--sp-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
  min-height: var(--tap);
}
.plan-chip:hover {
  border-color: var(--accent);
}
.plan-chip-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius);
  flex: 0 0 auto;
}
.plan-chip-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}
.plan-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.plan-chip-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-chip-meta {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.plan-result {
  justify-content: space-between;
  text-align: start;
}
.plan-results {
  max-height: 45vh;
  overflow-y: auto;
}

/* ≥768px: the same cells, placed into the slot × day table by their coordinates. */
@media (min-width: 768px) {
  .plan-grid {
    display: grid;
    grid-template-columns: minmax(5.5rem, auto) repeat(7, minmax(9rem, 1fr));
    gap: var(--sp-2);
    min-width: 60rem;
  }
  .plan-cell-slot {
    display: none;
  }
  .plan-slot-h {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: var(--tx--1);
    letter-spacing: var(--tracking-mono);
    text-transform: uppercase;
    color: var(--accent);
    grid-column: 1;
  }
  .plan-day-h {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-top: 0;
    border-top: 0;
    grid-row: 1;
  }
  .plan-slot-h[data-slot="0"] { grid-row: 2; }
  .plan-slot-h[data-slot="1"] { grid-row: 3; }
  .plan-slot-h[data-slot="2"] { grid-row: 4; }
  .plan-slot-h[data-slot="3"] { grid-row: 5; }
  .plan-cell[data-slot="0"] { grid-row: 2; }
  .plan-cell[data-slot="1"] { grid-row: 3; }
  .plan-cell[data-slot="2"] { grid-row: 4; }
  .plan-cell[data-slot="3"] { grid-row: 5; }
  .plan-day-h[data-day="0"],
  .plan-cell[data-day="0"] { grid-column: 2; }
  .plan-day-h[data-day="1"],
  .plan-cell[data-day="1"] { grid-column: 3; }
  .plan-day-h[data-day="2"],
  .plan-cell[data-day="2"] { grid-column: 4; }
  .plan-day-h[data-day="3"],
  .plan-cell[data-day="3"] { grid-column: 5; }
  .plan-day-h[data-day="4"],
  .plan-cell[data-day="4"] { grid-column: 6; }
  .plan-day-h[data-day="5"],
  .plan-cell[data-day="5"] { grid-column: 7; }
  .plan-day-h[data-day="6"],
  .plan-cell[data-day="6"] { grid-column: 8; }
}

/* ================= [M3] feed (FE-9.20) ================= */

.feed-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.feed-byline {
  display: flex;
  gap: var(--sp-1);
}

/* ================= [M3] profiles & follows (FE-9.21/9.22) ================= */

.profile-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: var(--tx-3);
  flex: 0 0 auto;
}
.profile-username {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.profile-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  max-width: 34rem;
}
.profile-count {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  text-decoration: none;
  color: inherit;
}
a.profile-count:hover {
  border-color: var(--accent);
}
.profile-recipes-h {
  margin-bottom: var(--sp-3);
}
.follow-row {
  align-items: center;
}

/* ================= [M3] recipe books (14 BN-1) ================= */

.books-create {
  margin-bottom: var(--sp-5);
}
.books-create form {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.book-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--motion) ease;
}
.book-card:hover {
  border-color: var(--accent);
}
.book-cover {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  background: var(--surface-2);
}
.book-cover.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--tx-3);
}
.book-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
}
.book-name {
  font-family: var(--font-display);
  font-size: var(--tx-1);
  font-weight: var(--weight-heading);
  letter-spacing: -0.012em;
  color: var(--accent);
}
.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.book-hero {
  margin-bottom: var(--sp-4);
}
.book-private-note {
  margin-bottom: var(--sp-3);
}
.book-grid {
  margin-top: var(--sp-4);
}
.book-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
/* CM-0.4: a number only where the sequence is real — and in a book it is. */
.book-position {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  font-weight: 600;
  letter-spacing: var(--tracking-mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.book-entry-tools {
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.book-picker-list {
  max-height: 40vh;
  overflow-y: auto;
}
.book-pick {
  justify-content: space-between;
  text-align: start;
}

/* ================= [M3] cook's notes (14 BN-2) ================= */

.note-mine {
  border-left: 3px solid var(--accent);
}
.note-box {
  width: 100%;
  min-height: 5rem;
}
.note-controls {
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.note-status {
  font-family: var(--font-mono);
  font-size: var(--tx--1);
  letter-spacing: 0.06em;
}
.note-chip-host:empty {
  display: none;
}
.note-row .note-author {
  font-weight: 600;
}
.note-body {
  margin-top: var(--sp-2);
}
.note-body p + p {
  margin-top: var(--sp-2);
}
.note-capture textarea {
  width: 100%;
}
/* BN-2.3: pinned under the cook bar, quiet but impossible to scroll past. */
.cook-note {
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
  border: 1px solid var(--accent);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.cook-note[hidden] {
  display: none;
}
.cook-note p + p {
  margin-top: var(--sp-2);
}

/* ================= [M3] translation (AI-3) ================= */

.translation-row {
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.translation-control {
  align-items: center;
  gap: var(--sp-2);
}
.translation-label[hidden] {
  display: none;
}

/* ================= [M3] offline read-cache (FE-11.6) ================= */

body.is-stale [data-stale-banner] {
  margin-bottom: var(--sp-4);
}

/* ================= [M3] bulk "add all to book" + admin dispatch ================= */

.bulk-book-bar {
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.dispatch-host:empty {
  display: none;
}
.dispatch-host {
  margin-top: var(--sp-2);
}

/* ================= [M4a] "Hide, don't destroy" — Deleted views (FE-15) ================= */

/* The drawer is wider than a confirm dialog: it holds a list, and at 360 px it
   fills the viewport rather than sitting in a box inside a box (FE-8.2). */
dialog.uyl-dialog.del-drawer {
  width: min(44rem, calc(100vw - var(--sp-3) * 2));
  max-height: min(85vh, 48rem);
  overflow-y: auto;
}

.del-policy {
  margin-bottom: var(--sp-2);
  max-width: 60ch;
}
.del-filters {
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
/* A chip that is also a button: the pill look of `.chip` plus a real hit area. */
.chip-btn {
  min-height: var(--tap);
  padding-inline: var(--sp-3);
  cursor: pointer;
  font: inherit;
  font-size: var(--tx--1);
}
.chip-btn[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

.del-list {
  margin-bottom: var(--sp-3);
}
.del-row .del-title {
  font-weight: 600;
}
.del-actions {
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.del-blocked {
  max-width: 34ch;
}
.del-row-moderated {
  display: block;
}
.del-moderated p {
  margin-top: var(--sp-1);
}

.books-overflow:empty,
.shop-overflow:empty,
#inv-overflow:empty {
  display: none;
}
.books-overflow,
.shop-overflow {
  justify-content: flex-end;
  margin-bottom: var(--sp-2);
}

/* ================= [M4a] feedback context disclosure (FE-6.11a / FBK-5.1a) ================= */

.fb-context {
  margin-block: var(--sp-3);
}
.fb-context p {
  max-width: 54ch;
}
.fb-context-detail summary,
.fb-context-admin summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.fb-context-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-2);
}
.fb-context-list dt {
  font-weight: 600;
}
.fb-context-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.fb-context-admin {
  margin-block: var(--sp-2);
}
.fb-where {
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ================= [M4b] history, revisions, variants, shares (spec 15) ================= */

/* HV-3.5 — the History section is the recipe's paperwork. Quiet by default:
   collapsed to five rows, its own rows are hairline-separated rather than boxed,
   and cook mode removes it from the page entirely (no clutter while cooking). */
body.cook-mode .recipe-history {
  display: none;
}
.recipe-history {
  margin-top: var(--sp-5);
}
.hist-list {
  margin-top: var(--sp-3);
}
.hist-row {
  align-items: baseline;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: var(--sp-3) 0;
}
.hist-row:first-child {
  border-top: 0;
}
.hist-when {
  font-family: var(--font-mono);
  flex: 0 0 auto;
  min-width: 7.5rem;
}
.hist-what {
  display: block;
}
.hist-meta {
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.hist-private {
  background: var(--accent-soft);
  border-color: transparent;
}
.hist-compare {
  align-self: flex-start;
}
.hist-more {
  margin-top: var(--sp-3);
}

/* the comparison view — list of versions beside what changed */
.rev-cols {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) {
  .rev-cols {
    grid-template-columns: minmax(16rem, 22rem) 1fr;
  }
}
.rev-head {
  margin-bottom: var(--sp-4);
}
.rev-row.is-current {
  border-color: var(--accent);
}
.rev-number {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  font-size: var(--tx--1);
}
.rev-meta,
.rev-chooser {
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.rev-restore {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* the diff itself (HV-2.6). Three states, and none of them is signalled by colour
   alone: every row carries a word ("Added") and a marker glyph (FE-13.3). */
.rev-diff {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.diff-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.diff-h {
  font-size: var(--tx-0);
  margin: 0;
}
.diff-row {
  display: flex;
  gap: var(--sp-2);
  align-items: baseline;
  flex-wrap: wrap;
  padding: var(--sp-2);
  border-left: 3px solid var(--border);
  background: var(--surface-2);
}
.diff-added {
  border-left-color: var(--ok);
}
.diff-removed {
  border-left-color: var(--danger);
}
.diff-changed,
.diff-moved {
  border-left-color: var(--warn);
}
.diff-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  flex: 0 0 auto;
}
.diff-chip {
  flex: 0 0 auto;
}
.diff-text {
  flex: 1 1 12rem;
  overflow-wrap: anywhere;
}
.diff-field {
  font-weight: 600;
  margin-right: var(--sp-2);
}
.diff-fromto del {
  text-decoration: line-through;
  color: var(--muted);
}
.diff-fromto ins {
  text-decoration: none;
  font-weight: 600;
}
.diff-arrow {
  color: var(--muted);
}
.diff-fields {
  display: block;
}
.diff-prose {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.diff-prose p {
  margin: 0;
}

/* variants (HV-4.5): provenance, and the "the original has moved on" banner */
.variant-host:empty {
  display: none;
}
.variant-parent p,
.variant-diverged p {
  margin: 0 0 var(--sp-2);
}
.variant-diff {
  margin-top: var(--sp-3);
}
.variant-card,
.shared-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.variant-line {
  margin: 0;
}

/* the share dialog (HV-4.8) and its list of named people */
.share-dialog {
  min-width: min(28rem, 80vw);
}
.share-add input[type="text"] {
  flex: 1 1 12rem;
}
.share-row {
  align-items: center;
}
