/* views.css — pantry / matcher / planner / explorer / cooklog / decoder screen styles.
   Spaza Modern (rebrand v2.0): sticker prices, till-slip shopping list, market warmth. */

/* ================= HOME v2 (P-530, owner-picked Oct 23) ================= */
/* Matcher REMOVED from home (owner directive). Home = destination index:
   hero + CTA matrix + fast lane. Tokens unchanged. Responsive doctrine:
   fixed-count grid tracks per breakpoint (no auto-fill 1fr). */

.hero-v2 {
  position: relative;
  overflow: hidden;
  background: var(--clr-card);
  border: 3px solid var(--clr-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sticker);
  padding: clamp(22px, 5vw, 40px) clamp(18px, 4vw, 36px);
  margin-top: var(--sp-4);
}
.hero-v2::before {
  /* market-dot texture */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  background-image: radial-gradient(var(--clr-brand) 2px, transparent 2px);
  background-size: 26px 26px;
}
.hero-eyebrow {
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: var(--clr-brand-strong);
  text-transform: uppercase;
} /* P-558: small bold text takes the AA-safe strong per P-312 */
.hero-v2 h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 8vw, 4.2rem);
  line-height: 1.04;
  margin: var(--sp-2) 0 var(--sp-2);
  max-width: 18ch;
  text-transform: none;
}
.hero-v2 h1 em {
  font-style: normal;
  color: var(--clr-brand);
}
.hero-sub {
  color: var(--clr-ink-soft);
  max-width: 52ch;
  font-weight: 600;
  font-size: 1.02rem;
}
.hero-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--sp-4);
}
.hero-sticker {
  transform: rotate(var(--sticker-tilt));
  background: var(--clr-sun);
  border: var(--line-weight, 2px) solid var(--clr-ink);
  border-radius: var(--r-md);
  padding: 6px 16px;
  color: var(--on-sun);
  font-weight: 800;
  font-size: 1.3rem;
  margin-left: auto;
}
.hero-sticker small {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-sun);
}
.btn-x {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--clr-brand);
  color: var(--on-brand); /* P-558: per-theme AA */
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-md);
  padding: 12px 20px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.14);
  min-height: var(--tap);
}
.btn-x.ghosty {
  background: var(--clr-card);
  color: var(--clr-ink);
  border-color: var(--clr-line);
} /* P-558 */
.btn-x:hover {
  background: var(--clr-brand-strong);
  color: var(--clr-cream);
}

.matrix-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: var(--sp-6) 0 var(--sp-3);
}
.matrix-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
}
.matrix-head span {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
}

.cta-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) {
  .cta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .cta-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.cta-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--clr-card);
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-3);
  text-align: left;
  text-decoration: none;
  color: var(--clr-ink);
  min-height: 180px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--clr-ink) 10%, transparent);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.cta-card:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  box-shadow: 7px 7px 0 var(--clr-brand-soft);
}
.cta-card .badge-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--clr-sun);
  border: 2px solid var(--clr-ink);
}
.cta-card svg {
  width: 34px;
  height: 34px;
  stroke: var(--clr-brand);
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cta-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
}
.cta-card p {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
  flex: 1;
}
.cta-card .go {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--clr-brand-strong);
  letter-spacing: 0.04em;
} /* P-532 a11y: 4.5:1 on card */

.fast-lane {
  margin-top: var(--sp-6);
  border: 3px dashed var(--clr-brand);
  border-radius: var(--r-lg);
  background: var(--clr-brand-soft);
  padding: var(--sp-4);
}
.fast-lane h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
}
.fl-sub {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
  font-weight: 600;
  margin: 4px 0 var(--sp-3);
}
.fl-steps {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .fl-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}
.fl-step {
  background: var(--clr-card);
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.fl-n {
  font-family: var(--font-display);
  color: var(--clr-ink);
  font-size: 1.15rem;
} /* P-532 a11y: ink on sun-yellow sticker */
.fl-step h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 2px 0;
}
.fl-step p {
  font-size: 0.83rem;
  color: var(--clr-ink-soft);
}
.fl-chips {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}
.fl-chips button {
  background: var(--clr-card);
  color: var(--clr-ink);
  border: 1px solid var(--clr-line);
  min-height: var(--tap); /* P-108: 44px floor */
}
.fl-chips button.on {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-color: var(--clr-brand);
  box-shadow: var(--shadow-sticker);
}

/* ================= PANTRY ================= */
/* Day 2.1 refresh (owner feedback Oct 9): English-only names, card rows,
   44px targets everywhere, no inherited global button/input styling leaking in.
   Rule of thumb for this block: any control inside the pantry sets its OWN
   background/colour/size explicitly — the global `button` (orange, white text)
   and `input` (100% wide, 44px tall) rules are too greedy for dense rows. */

.pantry-head {
  margin-bottom: var(--sp-4);
}
.pantry-head .lede {
  margin-top: var(--sp-1);
}

.pantry-layout {
  display: grid;
  gap: var(--sp-4);
}
@media (min-width: 880px) {
  .pantry-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: start;
  }
  /* P-562: the full-catalog Add panel sticks AND scrolls itself — the whole
     494-item registry is explorable without ever leaving the kitchen view. */
  .pantry-search-panel {
    position: sticky;
    top: calc(var(--sticky-offset, 72px) + var(--sp-2));
    max-height: calc(100vh - var(--sticky-offset, 72px) - var(--sp-4));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.panel-title h2 {
  margin: 0;
}
.panel-title .count-pill {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--clr-brand-strong);
  background: var(--clr-brand-soft);
  border-radius: var(--r-pill);
  padding: 2px 10px;
}

/* ---- P-537: matcher recipe search bar ---- */
.msearch-wrap {
  max-width: 560px;
}

/* ---- search field ---- */
.search-field {
  position: relative;
}
.search-field input[type="search"] {
  padding-left: 40px;
  border: 2px solid var(--clr-line);
  border-radius: var(--r-md);
  background: var(--clr-card);
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}
.search-field input[type="search"]:focus {
  border-color: var(--clr-brand);
  box-shadow: 0 0 0 3px var(--clr-brand-soft);
  outline: none;
}
.search-field::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 15px;
  height: 15px;
  margin-top: -9px;
  border: 2px solid var(--clr-ink-soft);
  border-radius: 50%;
  pointer-events: none;
}
.search-field::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 50%;
  width: 7px;
  height: 2px;
  margin-top: 6px;
  background: var(--clr-ink-soft);
  transform: rotate(45deg);
  pointer-events: none;
}

/* ---- aisle groups ---- */
.aisle-group {
  margin-bottom: var(--sp-4);
}
.aisle-group:last-child {
  margin-bottom: 0;
}
.aisle-group h4 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-ink-soft);
  margin: 0 0 var(--sp-2);
}
.aisle-group h4::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--clr-line);
}
.aisle-count {
  order: 2;
  font-size: 0.7rem;
  background: var(--clr-sun-soft);
  color: var(--clr-ink-soft);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

/* ---- suggestion rows (add flow) ---- */
.sugg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-2);
  background: var(--clr-card);
  color: var(--clr-ink); /* P-558: explicit, but token-based */
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  box-shadow: none;
  text-align: left;
  font-weight: 400;
  transition:
    border-color var(--t-fast),
    background var(--t-fast),
    transform var(--t-fast);
}
.sugg:hover {
  background: var(--clr-brand-soft);
  color: var(--clr-ink);
  border-color: var(--clr-brand);
}
.sugg:active {
  transform: scale(0.99);
}
.sugg-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.sugg-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-ink);
  overflow-wrap: anywhere;
}
.sugg-hint {
  font-size: 0.76rem;
  color: var(--clr-ink-soft);
  font-weight: 500;
}
.sugg-add {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-brand);
  color: var(--on-brand);
  font-size: 1rem;
  font-weight: 800; /* P-558 */
  transition: transform var(--t-fast);
}
.sugg:hover .sugg-add {
  transform: rotate(90deg) scale(1.08);
}

/* ---- pantry rows: one card per ingredient ---- */
.pantry-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  transition:
    border-color var(--t-fast),
    background var(--t-fast);
}
.pantry-item:last-child {
  margin-bottom: 0;
}
.pantry-item.is-low {
  border-color: var(--clr-sun);
  background: var(--clr-sun-soft);
}
.pi-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.pi-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pi-name {
  font-size: 1rem;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pi-nick-tag,
.pi-tag {
  flex: 0 0 auto;
}
.pi-hint {
  font-size: 0.76rem;
  color: var(--clr-ink-soft);
}
.pi-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-self: end;
}

.pantry-item .stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--clr-line);
  border-radius: var(--r-sm);
  background: var(--clr-card);
  overflow: hidden;
}
.pantry-item .qty-input {
  width: 68px;
  min-height: var(--tap);
  padding: 0 4px;
  text-align: center;
  border: 0;
  border-radius: 0;
  font-weight: 700;
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pantry-item .qty-input::-webkit-outer-spin-button,
.pantry-item .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.step-btn {
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-sunken);
  color: var(--clr-ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  touch-action: none;
  user-select: none; /* pointer events drive hold/long-press */
  transition:
    background var(--t-fast),
    color var(--t-fast);
}
.step-btn:hover {
  background: var(--clr-brand-soft);
  color: var(--clr-brand-strong);
}
.step-btn:active {
  background: var(--clr-sun-soft);
  transform: none;
}
.step-btn:focus-visible {
  outline: 3px solid var(--clr-focus);
  outline-offset: -3px;
}

.pantry-item select.unit-sel {
  width: auto;
  min-width: 74px;
  min-height: var(--tap);
  padding: 0 var(--sp-2);
  font-weight: 700;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.pantry-remove {
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  background: transparent;
  color: var(--clr-ink-soft);
  border: 1px solid var(--clr-line);
  box-shadow: none;
  font-size: 0.95rem;
}
.pantry-remove:hover {
  background: var(--clr-red-soft);
  color: var(--clr-red-text);
  border-color: var(--clr-red);
}

/* "Running low" pill toggle — replaces the raw 44px checkbox */
.low-pill {
  grid-column: 1 / -1;
  justify-self: start;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 var(--sp-3);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--clr-ink-soft);
  background: var(--clr-sun-soft);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  transition:
    background var(--t-fast),
    color var(--t-fast),
    border-color var(--t-fast);
}
.low-pill--auto {
  /* P-112: the flag is auto-detected — badge, not a control */
  cursor: default;
  color: var(--clr-coin);
  background: var(--clr-sun-soft);
  border-color: var(--clr-sun);
}
.low-pill--auto::before {
  background: var(--clr-amber);
}
.low-pill input {
  /* visually hidden but still focusable + screen-reader labelled */
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  margin: 0;
  min-height: 0;
  cursor: pointer;
}
.low-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9bfae;
  transition: background var(--t-fast);
}
.low-pill:has(input:checked) {
  background: var(--clr-sun-soft);
  color: var(--clr-coin);
  border-color: var(--clr-sun);
}
.low-pill:has(input:checked)::before {
  background: var(--clr-amber);
}
.low-pill:has(input:focus-visible) {
  outline: 3px solid var(--clr-focus);
  outline-offset: 2px;
}

/* ---- counter card (P-104T) ----
   Self-contained card: eyebrow + headline + stat pills + ONE CTA. The sun-yellow number
   sticker has its own breathing room, and the filter lives inside the list panel below,
   so nothing sits flush against the sticker any more (owner feedback Oct 9). */
.pantry-counter {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  justify-content: space-between;
  box-shadow: var(--shadow-sticker);
  margin-bottom: var(
    --sp-6
  ); /* real separation from the panel + filter below */
}
.pc-copy {
  display: grid;
  gap: var(--sp-2);
  min-width: 0;
  flex: 1 1 260px;
}
.pc-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-brand);
} /* P-558 */
.pc-line {
  display: block;
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 700;
} /* P-312 a11y: 20px bold = large text, 3.55:1 passes */ /* taller line box: the rotated sticker never collides with neighbours */
.pc-num {
  display: inline-block;
  background: var(--clr-sun);
  color: var(--on-sun);
  border-radius: var(--r-sm);
  padding: 2px 12px;
  margin: 0 4px;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: 1.5rem;
  transform: rotate(var(--sticker-tilt));
  box-shadow: var(--shadow-sticker);
}
.pc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.pc-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--clr-brand-soft);
  color: var(--clr-ink);
} /* P-558: fixed-alpha overlay broke themes */
.pc-pill--warn {
  background: var(--clr-sun);
  color: var(--on-sun);
}
.pantry-counter .pc-cta {
  background: var(--clr-card);
  color: var(--clr-brand-strong);
  box-shadow: var(--shadow-sticker);
  flex-shrink: 0;
}
.pantry-counter .pc-cta:hover {
  background: var(--clr-brand-soft);
}

/* ---- pantry filter bar: the thing you reach for in a full pantry (P-104T) ---- */
.pantry-title-row {
  align-items: center;
  flex-wrap: wrap;
}
.pantry-viewtools {
  display: flex;
  gap: var(--sp-2);
}
.pantry-filterbar {
  position: sticky;
  top: calc(var(--sticky-offset, 72px) + var(--sp-2));
  z-index: 5; /* stays reachable while scrolling a long pantry */
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--clr-card);
  border: 2.5px solid var(--clr-ink);
  border-radius: var(--r-md);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-3);
  box-shadow: 3px 3px 0 var(--clr-sun); /* sticker offset: reads as THE control, distinct from the orange counter */
  transition:
    box-shadow var(--t-fast),
    transform var(--t-fast);
}
.pantry-filterbar[hidden] {
  display: none;
}
.pantry-filterbar:focus-within {
  box-shadow: 3px 3px 0 var(--clr-brand);
  transform: translate(-1px, -1px);
}
.pf-icon {
  display: inline-flex;
  color: var(--clr-ink);
  flex-shrink: 0;
}
#pantry-filter {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: 50px;
  border: 0;
  background: transparent;
  padding: 0 var(--sp-1);
  box-shadow: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-ink);
  outline: none;
}
#pantry-filter::placeholder {
  color: var(--clr-ink-soft);
  font-weight: 500;
}
.pf-count {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--clr-brand-strong);
  background: var(--clr-brand-soft);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pf-count:empty {
  display: none;
}

/* status chips under the filter */
.pantry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.pantry-chips[hidden] {
  display: none;
}
.pchip {
  min-height: 36px;
  padding: 0 var(--sp-3);
  font-size: 0.8rem;
  background: var(--clr-card);
  color: var(--clr-ink);
  border: 1.5px solid var(--clr-line);
  box-shadow: none;
}
.pchip:hover {
  background: var(--clr-brand-soft);
}
.pchip.on {
  background: var(--clr-ink);
  color: var(--clr-card);
  border-color: var(--clr-ink);
} /* P-546b: near-white ink chip needs dark text in dark mode */
.pchip-n {
  font-size: 0.7rem;
  background: color-mix(in srgb, var(--clr-ink) 8%, transparent);
  border-radius: var(--r-pill);
  padding: 0 7px;
}
.pchip.on .pchip-n {
  background: color-mix(in srgb, var(--clr-card) 22%, transparent);
}
.pi-tag {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-coin);
  background: var(--clr-sun-soft);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  margin-left: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.pantry-item.is-soon {
  border-left: 4px solid var(--clr-sun);
}

/* ---- toolbar under the list ---- */
.pantry-tools {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--clr-line);
}

/* ---- 320px: stack the control cluster under the name ---- */
@media (max-width: 520px) {
  .pantry-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .pi-controls {
    justify-self: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: var(--sp-2);
  }
  .pantry-item .stepper,
  .pantry-item select.unit-sel,
  .pantry-remove {
    flex-shrink: 0;
  }
  .pantry-item .qty-input {
    width: 64px;
  }
  .pantry-remove {
    margin-left: auto;
  }
}
/* P-610: aisle headers are sticky-safe targets for scroll-into-view */
.aisle-group,
.missing-line {
  scroll-margin-top: calc(var(--sticky-offset, 0px) + 10px);
}

/* ================= MATCHER ================= */
/* ---- P-111 TUNE PANEL (facet filter bar) ---- */
.dial-panel {
  display: grid;
  gap: var(--sp-3);
}
.tune-panel {
  display: grid;
  gap: var(--sp-3);
}
.tune-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  min-height: var(--tap);
  list-style: none;
  cursor: pointer;
}
.tune-panel > summary::-webkit-details-marker {
  display: none;
}
.tune-chev {
  margin-left: auto;
  color: var(--clr-brand-strong);
  font-size: 0.9rem;
  transition: transform var(--t-fast);
}
.tune-panel[open] > .tune-head .tune-chev {
  transform: rotate(180deg);
}
.tune-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--clr-sun);
  color: var(--on-sun);
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.tune-badge[hidden] {
  display: none;
}
.tune-badge.tick,
#results-title.tick {
  animation: tick-pulse 120ms ease-out;
}
@keyframes tick-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tune-badge.tick,
  #results-title.tick {
    animation: none;
  }
}
/* P-207 stale-plan banner — derived artifacts must never lie about being current */
.plan-stale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  border: 1.5px dashed var(--clr-coin);
  border-radius: var(--r-md);
  background: var(--clr-coin-soft);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
}

/* P-206 budget-starved banner (T2, real form) */
.budget-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  border: 1.5px dashed var(--clr-brand, #ea580c);
  border-radius: var(--r-md);
  background: var(--clr-brand-soft);
  padding: var(--sp-3) var(--sp-4);
}
.budget-note-cta {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--clr-brand, #ea580c);
  font-weight: 700;
  text-decoration: underline;
}

/* P-206: held-back fold — greyed recipes stay visible, honest, one glance each */
.off-fold {
  border: 1px solid var(--clr-line, #e8d9c3);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  background: var(--clr-cream, #fff8f0);
}
.off-fold summary {
  cursor: pointer;
  font-weight: 600;
}
.off-list {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.off-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-top: 1px dashed var(--clr-line);
}
.off-title {
  font-size: 0.92rem;
}
.off-chip {
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--r-pill, 999px);
  border: 1.5px solid var(--clr-ink, #23150a);
  background: var(--clr-sun, #fbbf24);
  transform: rotate(var(--sticker-tilt));
}
.off-more {
  padding: var(--sp-2) 0;
}

/* P-201 skeleton CARDS — shaped like matcher cards so the wait reads as layout,
   not as a spinner. They only appear after a real 150ms wait. */
.skeleton-card {
  padding: var(--sp-4);
  display: grid;
  gap: var(--sp-3);
}
.skeleton-card .sk {
  border-radius: var(--r-sm);
  background: var(--clr-sunken);
  overflow: hidden;
  position: relative;
}
.skeleton-card .sk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: shimmer 1.1s infinite;
}
.skeleton-card .sk-head {
  height: 20px;
  width: 45%;
}
.skeleton-card .sk-line {
  height: 12px;
  width: 92%;
}
.skeleton-card .sk-short {
  width: 68%;
}
.skeleton-card .sk-row {
  height: 28px;
  width: 55%;
  border-radius: var(--r-pill);
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-card .sk::after {
    animation: none;
  }
}
.tune-body {
  display: grid;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  margin-top: var(--sp-2);
  border-top: 1px dashed var(--clr-line);
}
.tune-l {
  margin: 0;
  font-size: var(--fs-small);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-ink-soft);
}
.tune-plate {
  display: grid;
  gap: var(--sp-1);
}
.tune-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0 2px;
}

/* facet chips: live counts in a small bubble; zero-reach chips dim but stay clickable */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1.5px solid var(--clr-line);
  border-radius: 999px;
  background: var(--clr-card);
  color: var(--clr-ink);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
  transition:
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast),
    transform var(--t-fast);
}
.fchip:hover {
  border-color: var(--clr-brand);
  color: var(--clr-brand-strong);
  background: var(--clr-cream);
} /* P-305 FIX: explicit bg — the global button:hover orange fill made the brand text unreadable */
.fchip:active {
  transform: scale(0.97);
}
.fchip.on {
  background: var(--clr-brand);
  border-color: var(--clr-brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sticker);
} /* P-312 a11y */
.fchip.on .fc-n {
  background: rgba(127, 127, 127, 0.18);
  color: var(--on-brand);
} /* P-312 a11y */
/* P-112 fix: hover used to repaint ON chips with dark text on the orange fill —
   unreadable. ON chips darken their fill instead and stay white. */
.fchip.on:hover,
.fchip.on:active {
  background: var(--clr-brand);
  border-color: var(--clr-brand-strong);
  color: var(--on-brand);
  box-shadow:
    var(--shadow-sticker),
    inset 0 0 0 2px var(--clr-brand-strong);
}
.fchip.on:hover .fc-n {
  background: var(--clr-brand-soft);
  color: var(--clr-ink);
}
.fchip.zero {
  opacity: 0.45;
}
.fchip.zero:hover {
  opacity: 1;
}
.fc-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--clr-brand-soft);
  color: var(--clr-brand-strong);
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.fc-n:empty {
  display: none;
}

.tune-tools {
  display: flex;
  align-items: end;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.tune-sort {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-small);
  font-weight: 800;
  color: var(--clr-ink-soft);
}
.tune-surprise {
  margin-left: auto;
}

/* active-filter summary chips (one tap removes one filter) */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.active-filters[hidden] {
  display: none;
}
.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1.5px dashed var(--clr-brand);
  border-radius: 999px;
  background: var(--clr-sun-soft);
  color: var(--clr-ink);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
}
.af-chip span {
  color: var(--clr-brand-strong);
  font-weight: 900;
}
.af-chip:hover {
  border-style: solid;
  background: var(--clr-sun);
} /* P-305 FIX: explicit bg — was inheriting the global orange fill */

/* P-112: floating back-to-top button (toast sits bottom-center; this sits bottom-right) */
.scroll-top {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: var(--clr-brand);
  color: var(--on-brand);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sticker);
  z-index: 80;
  opacity: 0;
  transform: translateY(10px);
  visibility: hidden;
  transition:
    opacity var(--t-fast),
    transform var(--t-fast),
    visibility var(--t-fast),
    background var(--t-fast);
}
.scroll-top.show {
  opacity: 1;
  transform: none;
  visibility: visible;
}
.scroll-top:hover {
  background: var(--clr-brand-strong);
}

/* 🎲 Surprise me reveal */
@keyframes card-pulse {
  0% {
    outline: 4px solid var(--clr-sun);
    outline-offset: 4px;
    transform: scale(1);
  }
  30% {
    outline-offset: 10px;
    transform: scale(1.012);
  }
  100% {
    outline: 4px solid transparent;
    outline-offset: 4px;
    transform: scale(1);
  }
}
.mcard.pulse {
  animation: card-pulse 1.6s ease-out 2;
  z-index: 5;
}

@media (max-width: 560px) {
  /* 4 controls now (sort, favourites, surprise, reset): flex-wrap beats a rigid
     grid here — chips keep their natural widths and wrap onto a second row. */
  .tune-surprise {
    margin-left: 0;
  }
  .scroll-top {
    width: 44px;
    height: 44px;
  }
}
.budget-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
input[type="range"].budget {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  padding: 0;
}
input[type="range"].budget::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--clr-brand) var(--fill, 40%),
    #f4ead9 var(--fill, 40%)
  );
}
input[type="range"].budget::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--clr-sun);
  border: 3px solid var(--clr-ink);
  box-shadow: var(--shadow-2);
  cursor: grab;
}
input[type="range"].budget::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: var(--clr-sunken);
}
input[type="range"].budget::-moz-range-progress {
  height: 12px;
  border-radius: 999px;
  background: var(--clr-brand);
}
input[type="range"].budget::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--clr-sun);
  border: 3px solid var(--clr-ink);
  box-shadow: var(--shadow-2);
  cursor: grab;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.recipe-card {
  background: var(--clr-card);
  border: var(--line-weight, 1px) solid var(--clr-line);
  border-radius: var(--rad-card);
  padding: var(--sp-4);
  transition:
    box-shadow var(--t-fast),
    transform var(--t-fast);
  animation: cardIn var(--t-med) both;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.recipe-card:hover {
  box-shadow: var(--shadow-2);
  transform: rotate(-0.3deg);
}
.recipe-card .top {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  align-items: start;
  flex-wrap: wrap;
}
.recipe-card .title {
  font-size: 1.1rem;
  font-weight: 800;
}
.recipe-card .meta {
  color: var(--clr-ink-soft);
  font-size: var(--fs-small);
}
/* STICKER PRICE — the per-plate figure on every recipe card (Amendment A1) */
.recipe-card .money {
  display: inline-block;
  background: var(--clr-brand);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  padding: 0.22em 0.8em 0.22em 1.15em;
  clip-path: polygon(0 50%, 9% 0, 100% 0, 100% 100%, 9% 100%);
  filter: drop-shadow(
    2px 2px 0 color-mix(in srgb, var(--clr-ink) 18%, transparent)
  );
  transform: rotate(var(--sticker-tilt));
}
.recipe-card .money.money--warn {
  background: var(--clr-amber);
}
.recipe-card .money.money--over {
  background: var(--clr-red);
}

/* mini price-tag for missing-item prices and explorer rows */
.missing-line .price,
.price-table .price {
  display: inline-block;
  background: var(--clr-sun);
  color: var(--on-sun);
  font-weight: 900;
  padding: 1px 8px 1px 12px;
  clip-path: polygon(0 50%, 10px 0, 100% 0, 100% 100%, 10px 100%);
}

.missing-line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 4px 0;
  font-size: var(--fs-small);
  border-bottom: 1px dashed var(--clr-line);
  align-items: center;
}
.missing-line .price {
  white-space: nowrap;
}
.detail-body {
  border-top: 1px solid var(--clr-line);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
}
.ing-cost {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  padding: 2px 0;
}
.steps li {
  margin-left: 1.1em;
  margin-bottom: 0.4em;
}
.ineligible-note {
  font-size: var(--fs-small);
  color: var(--clr-red-text);
}

/* ================= PLANNER ================= */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: var(--sp-2);
}
.day-cell {
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  min-height: 96px;
}
.day-cell .d {
  font-weight: 900;
  color: var(--clr-ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.day-cell .meal-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-top: 2px;
}
.day-cell.empty-day {
  display: grid;
  place-items: center;
  color: var(--clr-ink-soft);
  font-size: var(--fs-small);
}

.budget-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--clr-sunken);
  overflow: hidden;
}
.budget-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--clr-ok);
  transition:
    width var(--t-med),
    background var(--t-med);
}
.budget-bar.near > i {
  background: var(--clr-amber);
}
.budget-bar.over > i {
  background: var(--clr-red);
}

.totals {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
  align-items: end;
}
.totals .stat .lbl {
  font-size: var(--fs-small);
  color: var(--clr-ink-soft);
}

/* TILL SLIP — the consolidated shopping list is a real slip (Amendment A1 signature) */
.slip {
  font-family: var(--font-slip);
  max-width: 440px;
  margin: 0 auto;
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  box-shadow: var(--shadow-2);
  padding: 0;
  overflow: hidden;
}
.slip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: 12px 14px 8px;
  font-family: var(--font-ui);
  border-bottom: 2px dashed var(--clr-line);
}
.slip-head .slip-brand {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--clr-brand-strong);
  font-size: 1.1rem;
  line-height: 1;
}
.slip-head .slip-sub {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
  font-family: var(--font-slip);
}
.slip .shop-line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 4px 14px;
  font-size: 0.86rem;
  border-bottom: 1px dashed var(--clr-line);
  align-items: center;
  font-family: inherit;
  width: 100%;
  text-align: left;
  color: inherit;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
}
.slip .shop-line .n {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.slip .shop-line .sub {
  color: var(--clr-ink-soft);
  font-size: 0.7rem;
}
.slip .shop-line .money {
  font-family: inherit;
  font-size: 0.98rem;
}
.slip.checking .shop-line {
  cursor: pointer;
}
.slip.checking .shop-line:hover {
  background: var(--clr-cream);
}
.slip.checking .shop-line:focus-visible {
  outline: 3px solid var(--clr-brand);
  outline-offset: -3px;
}
.slip .shop-line.checked .n,
.slip .shop-line.checked .sub {
  text-decoration: line-through;
  color: var(--clr-ink-soft);
}
.slip .shop-line.checked .money {
  color: var(--clr-ink-soft);
}
.slip .total-line {
  border-top: 2px dashed var(--clr-ink);
  border-bottom: none;
  padding-top: 8px;
}
.slip .total-line .money {
  font-size: 1.2rem;
}

/* P-302 #1: collapsible aisle sections — native <details>, slip-styled */
.aisle-sec summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  padding: 7px 14px 5px;
  cursor: pointer;
  user-select: none;
  border-top: 2px dashed var(--clr-line);
  list-style: none;
  font-family: var(--font-slip);
  text-transform: uppercase;
}
.aisle-sec summary::-webkit-details-marker {
  display: none;
}
.aisle-sec summary .as-name {
  font-weight: 700;
  letter-spacing: 0.09em;
  font-size: 0.82rem;
}
.aisle-sec summary .as-name::before {
  content: "▸ ";
  color: var(--clr-ink-soft);
  display: inline-block;
  transition: transform var(--t-fast);
}
.aisle-sec[open] summary .as-name::before {
  transform: rotate(90deg);
}
.aisle-sec summary .as-meta {
  color: var(--clr-ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}
.aisle-sec summary:focus-visible {
  outline: 3px solid var(--clr-brand);
  outline-offset: -3px;
}
.aisle-sec[open] summary {
  border-top-color: var(--clr-ink);
}
.aisle-sec .shop-line:last-of-type {
  border-bottom: none;
}
.aisle-sec:not([open]) .shop-line {
  display: none;
}

/* P-302 #3: slip signature — actions, progress, barcode strip */
/* P-307: the two take-to-store actions, equal weight, wrap-safe on any width */
.slip-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.slip-actions .ghost {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
@media (max-width: 440px) {
  .slip-actions .ghost {
    flex: 1 1 100%;
  }
}
.slip-progress {
  text-align: center;
  font-family: var(--font-slip);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--clr-ink-soft);
  padding: 6px 0 2px;
  border-top: 1px dashed var(--clr-line);
}
.slip-bar {
  height: 30px;
  margin: 8px 22px 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--clr-ink) 0 2px,
    transparent 2px 4px,
    var(--clr-ink) 4px 7px,
    transparent 7px 9px,
    var(--clr-ink) 9px 10px,
    transparent 10px 14px
  );
  opacity: 0.75;
}
.slip-foot {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--clr-ink-soft);
  padding: 10px 0 12px;
}
.slip::after {
  /* perforated bottom edge */
  content: "";
  display: block;
  height: 10px;
  background:
    linear-gradient(-45deg, var(--clr-cream) 7px, transparent 0),
    linear-gradient(45deg, var(--clr-cream) 7px, transparent 0);
  background-position: left bottom;
  background-repeat: repeat-x;
  background-size: 12px 12px;
}

/* ================= EXPLORER ================= */
/* ---- P-406/P-417: price explorer hero, controls, chips, aligned tags ---- */
.px-hero {
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-lg);
  padding: clamp(20px, 4vw, 40px);
  margin-bottom: var(--sp-4);
  border-top: 5px solid var(--clr-brand);
}
.px-hero h1 {
  margin-bottom: var(--sp-2);
}
.px-lede {
  font-size: 0.95rem;
  color: var(--clr-ink-soft);
  margin: 0 0 var(--sp-2);
  max-width: 60ch;
}
.px-more {
  margin: 0 0 var(--sp-2);
}
.px-more summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--clr-brand-strong);
} /* P-558 */
.px-more summary:hover {
  text-decoration: underline;
}
.px-more .px-copy {
  margin-top: var(--sp-2);
}
.px-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
}
.px-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.px-copy h2 {
  font-size: 1.15rem;
  margin: var(--sp-6) 0 var(--sp-2);
}
.px-copy p {
  margin: 0 0 var(--sp-3);
  max-width: 68ch;
  line-height: 1.65;
}
.px-fresh {
  margin-top: var(--sp-6);
  padding: var(--sp-4);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  background: var(--clr-card);
  display: grid;
  gap: var(--sp-2);
}
.px-fresh strong {
  color: var(--clr-brand-strong);
} /* P-558: small bold = strong variant */
.px-fresh-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.px-fresh-title {
  font-family: "Anton", "Impact", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.px-fresh-stats {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
  flex-wrap: wrap;
}
.px-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--clr-sunken);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}
.px-stat-n {
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.px-stat-k {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
}
.px-fresh-sub {
  font-size: 0.82rem;
  color: var(--clr-ink-soft);
  margin: 0;
}
.px-fresh-cta {
  justify-self: start;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
}
.px-tier-line {
  color: var(--clr-ink-soft);
  font-size: 0.78rem;
}
.px-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
}
.px-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 0;
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: 8px 12px;
}
.px-search input {
  border: none;
  background: transparent;
  font: inherit;
  width: 100%;
  min-width: 0;
  outline: none;
}
.px-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--clr-ink-soft);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.px-chip {
  border: 1px solid var(--clr-line);
  border-radius: 999px;
  background: var(--clr-card);
  color: var(
    --clr-ink
  ); /* P-558: global button color is on-brand — wrong on card bg */
  padding: 6px 16px;
  font-weight: 700;
  cursor: pointer;
}
.px-chip.on {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-color: var(--clr-ink);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}
.px-aisle {
  display: block;
  font-size: 0.75rem;
}
.px-count {
  margin: var(--sp-3) 0 0;
  font-size: 0.8rem;
}
/* P-417: price tags line up — right-aligned column + tabular numerals +
   a fixed-width pill so R9.55 and R129.99 occupy the same shape. */
.px-table th.num,
.px-table td.num {
  text-align: right;
}
.price-tag {
  display: inline-block;
  min-width: 5.5em;
  text-align: center;
  background: var(--clr-sun);
  color: var(--on-sun);
  border-radius: var(--rad-ctl);
  border: var(--line-weight, 1px) solid var(--clr-ink);
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--clr-ink) 60%, transparent);
}
.px-row {
  cursor: pointer;
}
.px-row:hover,
.px-row:focus-visible {
  background: var(--clr-brand-soft);
  outline: none;
}
/* ---- P-404: decoder review queue — inline line editor ---- */
/* P-447: draft panel - Spaza Modern sticker edition (replaces P-446 block) */
.decode-result {
  position: relative;
  overflow: hidden;
  border-top: 4px solid var(--clr-brand);
}
.decode-result::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  background-image: radial-gradient(var(--clr-brand) 1.6px, transparent 1.6px);
  background-size: 22px 22px;
}
.dec-title-input {
  width: 100%;
  font-family: "Anton", "Impact", sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  text-transform: none;
  background: transparent;
  border: none;
  border-bottom: 3px dashed
    color-mix(in srgb, var(--clr-brand) 45%, transparent);
  color: var(--clr-ink);
  padding: 4px 2px 8px;
  border-radius: 0;
}
.dec-title-input:focus {
  outline: none;
  border-bottom-style: solid;
  border-bottom-color: var(--clr-brand);
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-sun) 12%, transparent);
}
.dec-meta-edit {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
  align-items: center;
}
.dec-meta-edit label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--clr-sun);
  color: var(--on-sun);
  padding: 4px 12px 4px 10px;
  transform: rotate(-1.4deg);
  border-radius: 6px;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--clr-ink) 14%, transparent);
  font-weight: 600;
  font-size: 0.85rem;
}
.dec-meta-edit input {
  width: 64px;
  border: 1px dashed color-mix(in srgb, var(--clr-ink) 35%, transparent);
  border-radius: 6px;
  background: var(--clr-cream);
  padding: 2px 6px;
  font-weight: 700;
  text-align: center;
}
.dec-meta-edit input:focus {
  outline: 2px solid var(--clr-brand);
  outline-offset: 1px;
  border-style: solid;
}
.missing-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-cream) 55%, var(--clr-card));
  border: 1px solid var(--clr-line);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 6px 0;
  position: relative;
  transition: box-shadow 0.15s;
}
.missing-line:hover {
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--clr-brand) 16%, transparent);
}
.dec-row-qty {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.dec-qty {
  width: 74px;
  border: 1px solid color-mix(in srgb, var(--clr-ink) 18%, transparent);
  border-radius: 8px;
  background: var(--clr-cream);
  padding: 4px 6px;
  font-weight: 700;
  text-align: right;
}
.dec-unit {
  border: 1px solid color-mix(in srgb, var(--clr-ink) 18%, transparent);
  border-radius: 8px;
  background: var(--clr-cream);
  padding: 4px 6px;
  font-weight: 600;
  color: var(--clr-ink);
}
.dec-qty:focus,
.dec-unit:focus {
  outline: 2px solid var(--clr-brand);
  outline-offset: 1px;
}
.dec-ing-name {
  flex: 1 1 160px;
  font-weight: 600;
  color: var(--clr-brand);
  font-size: 0.95rem;
  min-width: 0;
}
.dec-row-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}
.dec-swap {
  border: 1px dashed var(--clr-brand);
  color: var(--clr-brand);
  background: transparent;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.dec-swap:hover {
  background: var(--clr-brand);
  color: var(--clr-cream);
  border-style: solid;
}
.dec-rm,
.dec-step-rm {
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--clr-ink) 40%, transparent);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}
.dec-rm:hover,
.dec-step-rm:hover {
  color: var(--clr-danger, #b91c1c);
  background: rgba(185, 28, 28, 0.08);
}
.dec-swap-open .dec-suggest,
.dec-fix .dec-suggest {
  order: 99;
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed color-mix(in srgb, var(--clr-ink) 15%, transparent);
  margin-top: 4px;
}
.dec-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 10px 0;
  list-style: none;
}
.dec-step-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-cream) 55%, var(--clr-card));
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--clr-ink) 10%, transparent);
  padding: 10px 12px;
  position: relative;
  transition: box-shadow 0.15s;
}
.dec-step-card:hover {
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--clr-brand) 16%, transparent);
}
.dec-step-num {
  font-family: "Anton", "Impact", sans-serif;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--clr-ink); /* P-410 Safari <16.2 fallback */
  color: color-mix(in srgb, var(--clr-brand) 38%, transparent);
  min-width: 22px;
}
.dec-step {
  flex: 1;
  border: none;
  background: transparent;
  resize: vertical;
  color: var(--clr-ink);
  font: inherit;
  padding: 4px 0;
  min-height: 44px;
}
.dec-step:focus {
  outline: none;
  background: color-mix(in srgb, var(--clr-sun) 10%, transparent);
  border-radius: 6px;
}
.dec-step-add {
  border: 2px dashed color-mix(in srgb, var(--clr-brand) 50%, transparent);
  color: var(--clr-brand);
  background: transparent;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.dec-step-add:hover {
  background: var(--clr-brand);
  color: var(--clr-cream);
  border-style: solid;
}
.dec-fix input.dec-edit {
  border: 1px dashed rgba(185, 28, 28, 0.5);
  border-radius: 8px;
  background: var(--clr-card);
  padding: 4px 8px;
  min-width: 120px;
}

/* ---- P-610: decoder mobile UX — tappable, unzooming, visible search ---- */
.dec-swap-search {
  flex: 1 1 100%;
  min-width: 0;
  font-size: 16px; /* 16px stops iOS focus-zoom */
  padding: 10px 12px;
  border: 1px solid var(--clr-line);
  border-radius: var(--r-sm);
  background: var(--clr-card);
  color: var(--clr-ink);
}
.dec-swap-search:focus {
  outline: 2px solid var(--clr-brand);
  outline-offset: 1px;
}
.dec-picker {
  flex-basis: 100%;
}
.dec-picker .px-chip {
  min-height: var(--tap);
} /* full tap targets on phones */
.dec-suggest {
  flex-basis: 100%;
}
@media (max-width: 560px) {
  .missing-line {
    font-size: 0.9rem;
  }
  .dec-row-qty {
    flex: 0 0 auto;
  }
  .dec-row-actions {
    margin-left: 0;
  }
  .dec-step-move {
    display: inline-flex;
    gap: 2px;
  }
  .dec-step-rm {
    flex: 0 0 auto;
  }
}

/* P-417/P-418: ingredient compare modal — compacted per owner review */
#ing-modal .mp-head {
  margin-bottom: var(--sp-2);
}
#ing-modal .mp-head .mp-title {
  font-size: 1.15rem;
}
#ing-modal .mp-head .mp-sub {
  font-size: 0.8rem;
}
.ing-pantry {
  background: var(--clr-brand-soft);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
.ing-pantry strong {
  font-weight: 900;
}
#ing-modal .mpd-h {
  margin: var(--sp-3) 0 var(--sp-1);
  font-size: 0.72rem;
}
.ing-compare {
  font-size: 0.85rem;
}
.ing-compare th,
.ing-compare td {
  padding: 6px 8px;
}
.ing-compare td strong {
  font-size: 0.85rem;
}
.ing-compare .best-row {
  background: var(--clr-brand-soft);
}
.ing-compare .best-row td,
.ing-compare .best-row .muted {
  color: var(--clr-ink);
} /* P-558: muted text failed AA on the tinted row */
.ing-compare .best-row .px-src {
  color: var(--clr-ink);
} /* estimate marker keeps its glyph, drops the tinted-row amber */
.ing-compare .price-tag {
  min-width: 4.6em;
  font-size: 0.85rem;
  padding: 1px 6px;
  box-shadow: 1px 1px 0 color-mix(in srgb, var(--clr-ink) 60%, transparent);
}
.best-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--clr-sun);
  color: #451a03;
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}
.ing-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  margin-top: 10px;
}
.ing-recipe {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--clr-ink);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.ing-recipe strong {
  font-size: 0.9rem;
  line-height: 1.25;
}
.ing-recipe:hover {
  border-color: var(--clr-brand);
  background: var(--clr-brand-soft);
}
.ing-recipe .muted {
  font-size: 0.74rem;
}
.ing-recipes + * {
  margin-top: 0;
}
#ing-match-now {
  margin: 12px 0 2px;
}
.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
.price-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-ink-soft);
  padding: var(--sp-2) var(--sp-2);
  border-bottom: 2px solid var(--clr-line);
}
.price-table td {
  padding: var(--sp-2);
  border-bottom: 1px solid var(--clr-line);
  vertical-align: middle;
} /* P-418b: default is baseline — multi-line cells
  (store + best-price badge) pushed single-line neighbours UP out of center */
.price-table .price {
  white-space: nowrap;
}
.price-table .stale {
  color: var(--clr-amber-text);
}
.table-wrap {
  overflow-x: auto;
}

/* ================= COOK LOG ================= */
/* ---- P-403: streak heatmap + kitchen-at-a-glance ---- */
.hm-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.hm-days span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--clr-ink-soft);
  text-align: center;
}
.hm-grid {
  display: grid;
  gap: 4px;
}
.hm-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.hm-card {
  position: relative;
}
.hm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
}
.hm-head h2 {
  margin: 0;
}
.hm-window {
  font-weight: 700;
  color: var(--clr-brand);
}
.hm-personality,
.kg-personality {
  margin: 0 0 var(--sp-3);
  font-weight: 600;
}
.kg-personality {
  border-left: 3px solid var(--clr-sun);
  padding-left: 10px;
  font-size: 0.95rem;
}
.hm-cell {
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--clr-line);
  cursor: pointer;
  padding: 0;
  transition: transform var(--t-fast, 0.15s);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
}
.hm-cell:hover {
  transform: scale(1.08);
}
/* P-415 contrast: the day-of-month digit must stay readable on every intensity.
   Dark stone on the paper/pale-sun cells, near-black brown on the deep sun —
   both pairs clear 4.5:1 at this size. */
.hm-0 {
  background: var(--clr-brand-soft);
  color: #57534e;
}
.hm-1 {
  background: var(--clr-sun-soft);
  color: var(--clr-ink);
}
.hm-2 {
  background: var(--clr-sun);
  color: #451a03;
}
.hm-3 {
  background: var(--clr-amber);
  color: var(--on-amber);
}
.hm-today {
  outline: 2px solid var(--clr-brand);
  outline-offset: 1px;
}
.hm-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  font-size: 0.66rem;
  color: var(--clr-ink-soft);
  margin-top: 8px;
}
.hm-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}
.hm-hint {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 8px;
}
.hm-detail {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--clr-brand-soft);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  line-height: 1.5;
}
.kg-row {
  display: flex;
  gap: var(--sp-4);
  align-items: baseline;
  padding: 6px 0;
  flex-wrap: wrap;
}
.kg-l {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--clr-ink-soft);
  flex: 0 0 110px;
}
.kg-good {
  color: var(--clr-brand-strong, #c2410c);
  font-weight: 800;
}
.kg-warn {
  color: var(--clr-amber, #b45309);
  font-weight: 800;
}

/* ---- P-415: kitchen-glance bars/tags, history controls ---- */
.kg-row--bars {
  align-items: flex-end;
}
.kg-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  flex: 1 1 180px;
  min-width: 0;
}
.kg-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
}
.kg-bar i {
  width: 100%;
  max-width: 26px;
  border-radius: 3px 3px 0 0;
  background: var(--clr-sun);
}
.kg-bar--hot i {
  background: var(--clr-brand);
}
.kg-bar span {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--clr-ink-soft);
}
.kg-busy {
  font-size: 0.75rem;
  flex: 0 1 100%;
}
.kg-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.kg-tags i {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
}
.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: var(--sp-2) 0 var(--sp-3);
}
.log-controls-spacer {
  flex: 1 1 auto;
}
.log-filter {
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--clr-line);
  background: var(--clr-card);
  color: var(--clr-ink);
}
.ghost.small.danger {
  color: var(--clr-red-text);
  border-color: var(--clr-red);
}
.ghost.small.danger[data-armed="1"],
.ghost.small.danger:hover {
  background: #b91c1c;
  color: var(--clr-cream, #fff8f0);
}
.log-open {
  cursor: pointer;
}
.log-open:hover,
.log-open:focus-visible {
  background: var(--clr-brand-soft);
  border-radius: var(--r-md);
  outline: none;
}

.log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--sp-4);
}
.stat-tile {
  background: var(--clr-card);
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.stat-tile .lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-ink-soft);
  font-weight: 800;
}
/* ---- P-416: cooking report + level tier ---- */
.report-card {
  background: var(--clr-brand-soft);
  border: 1px solid var(--clr-line);
}
.report-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-3);
}
.report-head h2 {
  margin: 0;
}
.stat-tile--level {
  border-left: 4px solid var(--clr-brand);
}
.lvl-title {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--clr-sun);
  color: #451a03;
  font-size: 0.78rem;
  font-weight: 800;
  vertical-align: middle;
}
.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: var(--sp-2);
}
.badge {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  background: var(--clr-card);
}
.badge.locked {
  opacity: 0.45;
  filter: grayscale(1);
}
/* ---- P-402: sticker medal family + unlock burst ---- */
.medal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  font-size: 24px;
  background: var(--clr-brand);
  color: var(--clr-cream);
  border: 2px solid var(--clr-ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--clr-ink) 85%, transparent);
  transform: rotate(var(--tilt, 0deg));
}
.medal .lock-mini {
  display: none;
}
.badge.locked .medal {
  background: var(--clr-muted, #eee);
}
.badge.locked .medal .lock-mini {
  display: block;
  position: absolute;
  right: -7px;
  bottom: -7px;
  font-size: 15px;
}
.badge.locked .medal {
  filter: grayscale(1);
  opacity: 0.6;
}
.badge.locked .medal .lock-mini {
  opacity: 1;
}
#unlock-burst {
  position: fixed;
  right: var(--sp-4);
  bottom: var(--sp-6);
  z-index: 90;
  max-width: min(420px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
#unlock-burst:not(.on) {
  display: none;
}
.ub-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--clr-card);
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-md);
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--clr-ink) 90%, transparent);
  transform: rotate(var(--tilt, 0deg));
}
.ub-badge strong {
  display: block;
  font-family: var(--f-display);
  letter-spacing: 0.02em;
}
.ub-badge span {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
}
.ub-badge .medal {
  width: 40px;
  height: 40px;
  font-size: 20px;
}
@keyframes ub-pop {
  0% {
    transform: scale(0.6) rotate(var(--tilt, 0deg));
    opacity: 0;
  }
  70% {
    transform: scale(1.05) rotate(var(--tilt, 0deg));
  }
  100% {
    transform: scale(1) rotate(var(--tilt, 0deg));
    opacity: 1;
  }
}
#unlock-burst.on .ub-badge {
  animation: ub-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  #unlock-burst.on .ub-badge {
    animation: none;
  }
  .medal,
  .ub-badge {
    transform: none;
  }
}
.badge .medal {
  font-size: 1.3rem;
}
.badge .t {
  font-weight: 800;
  font-size: 0.9rem;
}
.badge .d {
  font-size: 0.75rem;
  color: var(--clr-ink-soft);
}
.xp-bar {
  height: 10px;
  background: var(--clr-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.xp-bar > i {
  display: block;
  height: 100%;
  background: var(--clr-sun);
}
.log-entry {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--clr-line);
  flex-wrap: wrap;
}

/* ================= DECODER ================= */
.decode-result .confidence {
  margin: var(--sp-2) 0;
}
.unresolved li {
  color: var(--clr-red-text);
  font-size: var(--fs-small);
}
.review-note {
  background: var(--clr-amber-soft);
  color: var(--clr-amber);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
  font-weight: 700;
}

/* ---- P-104S: readiness sections, staples banner, pantry polish ---- */
.readiness-h {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  margin: var(--sp-4) 0 var(--sp-2);
}
.readiness-h:first-child {
  margin-top: 0;
}
.readiness-note {
  font-size: 0.72rem;
  font-weight: 400;
  margin-left: 0.25rem;
}
.readiness-section .recipe-card {
  margin-bottom: var(--sp-3);
}
.off-note {
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--clr-line);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
}
.staples-note {
  font-size: 0.72rem;
  padding: 0 var(--sp-1);
}
details.show-more > summary {
  cursor: pointer;
  text-align: center;
  color: var(--clr-ink-soft);
  padding: var(--sp-2);
  border: 1px dashed var(--clr-line);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  margin-bottom: var(--sp-3);
  list-style: none;
}
details.show-more > summary::before {
  content: "＋ ";
}
details.show-more[open] > summary::before {
  content: "− ";
}
details.aisle-group > summary.aisle-h {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: var(--sp-2);
  list-style: none;
}
details.aisle-group > summary.aisle-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--clr-line);
}
details.aisle-group > summary.aisle-h::before {
  content: "▾";
  color: var(--clr-ink-soft);
  font-size: 0.8rem;
  transition: transform 0.15s;
}
details.aisle-group:not([open]) > summary.aisle-h::before {
  transform: rotate(-90deg);
}
details.aisle-group > .pantry-item:first-of-type {
  margin-top: 0;
}
.staples-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1.5px solid var(--clr-sun);
  background: var(--clr-sun-soft);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.sb-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 240px;
  font-size: 0.85rem;
  min-width: 0;
}
.sb-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
#pantry-filter {
  width: 100%;
  margin-bottom: var(--sp-3);
}

/* ================= MATCHER v2 (P-104T) ================= */

/* meal chips */
.meal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.meal-chip {
  min-height: 44px;
  padding: 0 var(--sp-4);
  font-size: 0.9rem;
  background: var(--clr-card);
  color: var(--clr-ink);
  border: 2px solid var(--clr-line);
  box-shadow: none;
}
.meal-chip:hover {
  background: var(--clr-brand-soft);
}
.meal-chip.on {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-color: var(--clr-brand);
  box-shadow: var(--shadow-sticker);
}
.meal-chip.auto:not(.on) {
  border-color: var(--clr-brand);
  border-style: dashed;
} /* "suggested for this time of day" */

/* smart-shop unlock strip */
.unlock-strip {
  background: var(--clr-sun-soft);
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: 3px 3px 0 var(--clr-ink);
}
.unlock-strip[hidden] {
  display: none;
}
.us-h {
  font-weight: 900;
  margin-bottom: var(--sp-3);
}
.us-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--sp-3);
}
.us-item {
  background: var(--clr-card);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
  display: grid;
  gap: 2px;
  min-width: 0;
}
.us-n {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--clr-brand-strong);
}
.us-ex {
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

/* ---- the recipe card ---- */
.mcard {
  padding: var(--sp-6);
  display: grid;
  gap: var(--sp-4);
  border: 1.5px solid var(--clr-line);
  border-left-width: 6px;
  border-radius: var(--r-lg);
}
.mcard:hover {
  transform: none;
  box-shadow: var(--shadow-2);
}
.mcard.readiness-ready {
  border-left-color: var(--clr-ok);
}
.mcard.readiness-almost {
  border-left-color: var(--clr-sun);
}
.mcard.readiness-stretch {
  border-left-color: var(--clr-line);
}
.mcard.readiness-off {
  opacity: 0.7;
}

.mc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
}
.mc-head-main {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: var(--sp-2);
}
.mc-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.mc-status {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--clr-ink);
  color: var(--clr-card);
} /* P-546b: dark text on near-white ink chip in dark mode */
.readiness-ready .mc-status {
  background: var(--clr-ok);
}
.readiness-almost .mc-status {
  background: var(--clr-sun);
  color: var(--on-sun);
}
.mc-kind {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-ink-soft);
}
.mc-flag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--clr-sun-soft);
  color: var(--clr-ink-soft);
}
.mc-flag--fav {
  background: var(--clr-sun-soft);
  color: #78350f;
}
.mc-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.mc-have {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-ink-soft);
}
.readiness-ready .mc-have {
  color: var(--clr-ok-text);
}

/* match ring: 88px box, r=36 ring, number 1.1rem => 8px+ of measured clear padding around the digits.
   The "match" caption makes the percentage self-explanatory. */
.mring {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}
.mring svg {
  display: block;
}
.mring-track {
  fill: none;
  stroke: var(--clr-sunken);
  stroke-width: 7;
}
.mring-arc {
  fill: none;
  stroke: var(--clr-brand);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--t-med);
}
.readiness-ready .mring-arc {
  stroke: var(--clr-ok);
}
.mring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1;
  padding: 16px;
}
.mring-label strong {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--clr-ink);
  font-variant-numeric: tabular-nums;
}
.mring-label small {
  font-size: 0.65rem;
  font-weight: 800;
  margin-left: 1px;
}
.mring-label span {
  margin-top: 3px;
  font-size: 0.56rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clr-ink-soft);
}

/* fact row */
.mc-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-3) 0;
  border-top: 1px dashed var(--clr-line);
  border-bottom: 1px dashed var(--clr-line);
}
.mc-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--clr-ink);
}
.mc-fact--price {
  margin-left: auto;
  gap: var(--sp-2);
}
.mc-fact--price .money {
  display: inline-block;
  font-size: 1.25rem;
}
.mc-per {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--clr-ink-soft);
}

.mc-need {
  display: grid;
  gap: 2px;
}
.mc-need-h {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-2);
  font-weight: 900;
  font-size: 0.85rem;
  margin-bottom: var(--sp-1);
}
.mc-need-total {
  color: var(--clr-brand-strong);
}
.mc-staples {
  margin: 0;
  font-size: 0.78rem;
  color: var(--clr-ink-soft);
}

.mc-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
}
.mc-open {
  flex: 1 1 auto;
  min-height: 48px;
  background: var(--clr-ink);
  color: var(--clr-cream);
} /* P-558: cream flips with ink in dark */
.mc-open:hover {
  background: var(--clr-ink-soft);
}
.mc-fav {
  width: 48px;
  min-height: 48px;
  padding: 0;
  font-size: 1.3rem;
  background: var(--clr-card);
  color: var(--clr-ink);
  border: 2px solid var(--clr-line);
  box-shadow: none;
}
.mc-fav:hover {
  background: var(--clr-sun-soft);
}
.mc-fav.on {
  background: var(--clr-sun);
  border-color: var(--clr-ink);
}

/* ---- expanded recipe ---- */
.mc-detail {
  border-top: 2px solid var(--clr-ink);
  padding-top: var(--sp-4);
  display: grid;
  gap: var(--sp-3);
}
.mc-detail[hidden] {
  display: none;
}
.md-plates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  background: var(--clr-cream);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.md-plates-l {
  font-weight: 800;
  font-size: 0.85rem;
}
.md-stepper {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--clr-card);
}
.md-step {
  min-height: 44px;
  width: 44px;
  padding: 0;
  border-radius: 0;
  background: var(--clr-sunken);
  color: var(--clr-ink);
  box-shadow: none;
  font-size: 1.2rem;
}
.md-step:hover {
  background: var(--clr-brand-soft);
}
.md-plates-n {
  min-width: 40px;
  text-align: center;
  font-weight: 900;
  font-size: 1.15rem;
}
.md-plates-unit {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
  font-weight: 700;
}
.md-total {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.md-h {
  margin: var(--sp-2) 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  font-size: 1rem;
}
.md-legend {
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  gap: var(--sp-2);
}
.ls {
  padding: 1px 8px;
  border-radius: var(--r-pill);
}
.ls-have {
  background: var(--clr-ok-soft);
  color: #15803d;
}
.ls-none {
  background: var(--clr-sun-soft);
  color: #78350f;
}

/* ingredient checklist */
.ing-lines {
  display: grid;
}
.ing-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 0;
  border-bottom: 1px dashed var(--clr-line);
  font-size: 0.9rem;
}
.ing-state {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 900;
  background: var(--clr-sun-soft);
  color: var(--clr-ink-soft);
}
.st-have .ing-state {
  background: var(--clr-ok);
  color: var(--on-ok);
}
.st-short .ing-state {
  background: var(--clr-sun);
  color: var(--on-sun);
}
.st-none .ing-state {
  background: var(--clr-card);
  border: 2px solid var(--clr-brand);
  color: var(--clr-brand-strong);
}
.st-none .ing-name {
  font-weight: 800;
}
.ing-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ing-qty {
  font-size: 0.8rem;
  white-space: nowrap;
}
.ing-price {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.md-steps {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: var(--sp-2);
  line-height: 1.5;
}
.md-cook {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
}
.md-cook .cook-btn {
  min-height: 52px;
  font-size: 1rem;
  padding: 0 var(--sp-6);
}

/* cook log: celebrate the entry you just made */
.log-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.log-again {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1px solid var(--clr-brand);
  border-radius: var(--r-sm);
  font-weight: 800;
}
.log-again:hover {
  background: var(--clr-brand-soft);
}
.log-entry.just-cooked {
  background: var(--clr-sun-soft);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  animation: justIn 900ms ease both;
}
.jc-tag {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--clr-ink);
  color: var(--clr-card);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  margin: 0 6px;
} /* P-546b */
@keyframes justIn {
  0% {
    transform: scale(0.96);
    opacity: 0;
  }
  60% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}

/* ---- mobile: minmax(0,1fr) tracks + wrap triggers (standing rule) ---- */
@media (max-width: 520px) {
  .mcard {
    padding: var(--sp-4);
  }
  .mc-head {
    gap: var(--sp-3);
  }
  .mc-title {
    font-size: 1.15rem;
  }
  .mc-fact--price {
    margin-left: 0;
    width: 100%;
  }
  .ing-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }
  .ing-qty {
    grid-column: 2;
    grid-row: 2;
  }
  .ing-price {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
  .md-total {
    margin-left: 0;
    width: 100%;
  }
  .pantry-counter {
    padding: var(--sp-4);
  }
  .pc-cta {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mring-arc,
  .log-entry.just-cooked,
  .recipe-card {
    animation: none;
    transition: none;
  }
}

/* ---------------- P-301: planner day cells + meal picker ---------------- */
/* Day cells became <button>s — reset UA button chrome so they still read as cards */
button.day-cell {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
}
button.day-cell:focus-visible {
  outline: 3px solid var(--clr-brand);
  outline-offset: 2px;
  border-color: var(--clr-brand);
}
.cell-pricing {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px var(--sp-2);
  margin-top: 2px;
}
.cell-pricing .cell-total {
  font-size: 0.92rem;
  font-weight: 800;
}
.cell-pricing .cell-plates {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--clr-ink-soft);
  font-weight: 700;
}

/* P-305: THE WEEK — the meal story on the till slip */
.slip-week {
  padding: 2px 0 6px;
}
.slip-sec-title {
  font-family: var(--font-slip);
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  text-align: center;
  color: var(--clr-ink-soft);
  padding: 8px 0 4px;
  border-bottom: 2px dashed var(--clr-line);
}
.slip .week-line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  align-items: center;
  padding: 5px 14px 4px;
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--clr-line);
  font-family: var(--font-slip);
}
.slip .week-line .w-day {
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-right: 2px;
}
.slip .week-line .w-title {
  font-weight: 700;
}
.slip .week-line .sub {
  color: var(--clr-ink-soft);
  font-size: 0.68rem;
}
.slip .week-line .money {
  font-family: inherit;
  font-size: 0.95rem;
}
.slip .week-line.pantry-note {
  border-top: 1px dashed var(--clr-line);
  margin-top: 4px;
}
.slip .week-line.pantry-note .n {
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.stat--pantry {
  border-left: 3px solid var(--clr-sun);
  padding-left: var(--sp-2);
}

.day-cell .swap-hint,
.day-cell .plan-hint {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
  margin-top: 2px;
  font-weight: 600;
}
.day-cell.empty-day .plan-hint {
  font-size: 0.8rem;
  align-self: center;
}
button.day-cell:hover {
  border-color: var(--clr-brand);
  background: var(--clr-cream);
} /* P-305 FIX: explicit bg — global button:hover painted the card solid orange with dark text */

/* native dialog styled as a Spaza panel */
.meal-picker {
  border: 1px solid var(--clr-line);
  border-radius: var(--r-lg);
  background: var(--clr-card);
  color: var(--clr-ink);
  padding: var(--sp-4);
  width: min(94vw, 30rem);
  max-height: min(86vh, 42rem);
  box-shadow: 0 20px 60px color-mix(in srgb, var(--clr-ink) 25%, transparent);
}
/* P-307 FIX: the flex column layout MUST apply only to the OPEN dialog —
   an author `display:flex` on the bare class overrides the UA's
   `dialog:not([open]) { display:none }`, leaving a closed, invisible-
   looking dialog that still intercepts every click under it. */
.meal-picker[open] {
  display: flex;
  flex-direction: column;
}
.meal-picker::backdrop {
  background: color-mix(in srgb, var(--clr-ink) 45%, transparent);
}
.mp-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.mp-title {
  font-weight: 900;
  font-size: 1.05rem;
}
.mp-head .ghost {
  flex: none;
}
#mp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 58vh;
  padding-right: 4px;
}
.mp-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto; /* name shrinks+wraps, cost never clipped */
  gap: 3px 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  background: var(--clr-paper, var(--clr-card));
  color: var(--clr-ink);
  cursor: pointer;
  overflow-wrap: anywhere;
  min-height: 56px;
}
.mp-option .mp-main {
  min-width: 0;
}
.mp-option .mp-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  /* P-308: long dish names never blow the row — ellipsis caps them; the title
     attribute and the detail modal carry the full name */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.mp-option .mp-meta {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
  font-variant-numeric: tabular-nums;
}
.mp-option .mp-cost {
  text-align: right;
  align-self: center;
}
.mp-add,
.mp-free,
.mp-over {
  display: inline-block;
  font-weight: 800;
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
}
.mp-add {
  color: var(--clr-brand-strong);
  background: var(--clr-brand-soft);
}
.mp-free {
  color: var(--clr-ok);
  background: rgba(44, 138, 74, 0.12);
}
.mp-over {
  color: var(--clr-red);
  background: var(--clr-red-soft);
}
@media (max-width: 420px) {
  /* small phones: the cost pill moves under the meta line */
  .mp-option {
    grid-template-columns: minmax(0, 1fr);
  }
  .mp-option .mp-cost {
    text-align: left;
    margin-top: 1px;
  }
}
.mp-option:focus-visible {
  outline: 3px solid var(--clr-brand);
  outline-offset: 2px;
  border-color: var(--clr-brand);
  background: var(--clr-cream);
}
.mp-option:hover:not(:disabled) {
  border-color: var(--clr-brand);
  background: var(--clr-cream);
}
.mp-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.mp-option.mp-clear {
  border-style: dashed;
  background: var(--clr-cream);
  min-height: 0;
  padding: 8px 14px;
}
.mp-option.mp-clear .mp-name {
  color: var(--clr-ink-soft);
  font-size: 0.85rem;
}
.mp-option.mp-clear .mp-cost {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
}
.mp-foot {
  font-size: 0.72rem;
  margin-top: var(--sp-3);
  text-align: center;
}

/* ---------------- P-307: picker v3 — minimal rows + detail modal ---------------- */
/* Row: name + one quiet meta line + cost pill. Everything else is one tap away. */
#mp-list .mp-option .mp-meta {
  font-size: 0.72rem;
  margin-top: 2px;
}
#mp-list .mp-option .mp-cost {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.mp-cost .mp-add,
.mp-cost .mp-free,
.mp-cost .mp-over {
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.mp-cost .mp-add {
  color: var(--clr-brand-strong);
  border-color: var(--clr-brand);
  background: var(--clr-brand-soft);
}
.mp-cost .mp-free {
  color: var(--clr-ok-text, #1c7a3d);
  border-color: var(--clr-ok, #2c8a4a);
  background: var(--clr-ok-soft, #e8f5ec);
}
.mp-cost .mp-over {
  color: var(--clr-red);
  border-color: var(--clr-red);
  background: var(--clr-red-soft);
  opacity: 0.85;
}

/* Detail modal — reads like the recipe cards, not like a receipt */
.mpd {
  width: min(94vw, 34rem);
  max-height: min(86vh, 46rem);
}
#mpd-body {
  overflow-y: auto;
}
.mpd-money {
  /* P-409: auto-fit + minmax(0,1fr) packs zero-width tracks on narrow viewports
     (standing mobile rule — only fixed-count tracks may use 0,1fr). */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: var(--sp-2);
  margin: var(--sp-3) 0 var(--sp-2);
}
.mpd-stat {
  border: 1px solid var(--clr-line);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mpd-stat .lbl {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--clr-ink-soft);
}
.mpd-stat strong {
  font-size: 1.05rem;
}
.mpd-meta {
  font-size: 0.78rem;
  margin-bottom: var(--sp-2);
}
.mpd-h {
  font-size: 0.8rem;
  margin: var(--sp-3) 0 var(--sp-1);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mpd-ing {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mpd-ing li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 5px 0;
  border-bottom: 1px dashed var(--clr-line);
  font-size: 0.88rem;
  min-width: 0;
}
.mpd-ing li span:first-child {
  overflow-wrap: anywhere;
}
.mpd-ing li .muted {
  flex: 0 0 auto;
  font-size: 0.78rem;
}
.mpd-staple {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--clr-ink-soft);
  border: 1px solid var(--clr-line);
  padding: 0 5px;
  border-radius: var(--r-pill);
  margin-left: 4px;
}
.mp-blocked {
  margin-top: var(--sp-2);
  padding: var(--sp-2);
  border: 1px dashed var(--clr-red);
  border-radius: var(--r-md);
}
.mpd-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 2px dashed var(--clr-line);
}
.mpd-actions .btn {
  flex: 1 1 60%;
  min-width: 0;
}
.mpd-actions .ghost {
  flex: 1 1 30%;
  min-width: 0;
}
@media (max-width: 420px) {
  .mpd-actions .btn,
  .mpd-actions .ghost {
    flex: 1 1 100%;
  }
}

/* ---------------- P-310a: saved plans ---------------- */
.sp-title {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.sp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto; /* standing rule: 1fr never blows out */
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.4rem;
  border-top: 1px dashed var(--clr-line);
}
.sp-row:first-of-type {
  border-top: 0;
}
.sp-info {
  min-width: 0;
}
.sp-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-meta {
  font-size: 0.82rem;
}
.sp-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
@media (max-width: 560px) {
  .sp-row {
    grid-template-columns: minmax(0, 1fr);
  } /* actions wrap under the name */
  .sp-actions {
    justify-content: flex-start;
  }
}

/* P-310b: disabled buttons must LOOK disabled — #save-plan before a plan
   exists is the visible case; generic native rule, no hardcoded colors. */
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* P-310c (owner request): the save dialog's body class had NO rule at all, so
   the plan-name label sat flush against the "Save plan" button — one clustered
   block. Grid gap (sp-4 = 1rem) gives the button its own visual weight and the
   input breathing room; scoped to #save-plan-dialog so the detail modal's
   denser body is untouched. */
#save-plan-dialog .mpd-body {
  display: grid;
  gap: var(--sp-4);
}

/* P-448: swap search, add-ingredient, undo toast, library table, polished removes */
.dec-swap-search {
  flex: 1 1 12rem;
  border: 1px solid color-mix(in srgb, var(--clr-ink) 18%, transparent);
  border-radius: 8px;
  background: var(--clr-card);
  padding: 5px 10px;
  font: inherit;
}
.dec-swap-search:focus {
  outline: 2px solid var(--clr-brand);
  outline-offset: 1px;
}
.dec-add-ing {
  width: auto;
  margin: 8px 0 2px;
}
.dec-fix[data-idx="new"] {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--clr-brand) 50%, transparent);
  background: var(--clr-card);
}
/* the polished remove button: circular ghost, centered, consistent everywhere */
.dec-rm,
.dec-step-rm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid color-mix(in srgb, var(--clr-ink) 14%, transparent);
  background: transparent;
}
.dec-rm:hover,
.dec-step-rm:hover {
  color: var(--on-red, #fff);
  background: var(--clr-danger, #b91c1c);
  border-color: var(--clr-danger, #b91c1c);
}
.dec-step-card .dec-step-rm {
  align-self: flex-start;
  margin-top: 2px;
}
/* review notes */
.dec-note {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
/* decoded library table */
.dec-lib-table {
  display: grid;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--clr-ink) 12%, transparent);
  border-radius: 10px;
  overflow: hidden;
}
.dec-lib-head,
.dec-lib-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.5rem 5rem 4rem 2.5rem;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
}
.dec-lib-head {
  color: var(--clr-ink);
  background: color-mix(in srgb, var(--clr-sun) 30%, var(--clr-cream));
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dec-lib-row {
  border-top: 1px solid var(--clr-line);
  background: var(--clr-card);
}
.dec-lib-row:hover {
  background: color-mix(in srgb, var(--clr-sun) 8%, var(--clr-card));
}
.dec-lib-title {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.dec-lib-row .dec-row-actions {
  margin-left: 0;
  justify-self: end;
}
/* undo toast action */
#toast #toast-undo {
  margin-left: 10px;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--clr-cream);
  background: transparent;
  color: var(--clr-cream);
  font-weight: 700;
  cursor: pointer;
}
#toast #toast-undo:hover {
  background: var(--clr-cream);
  color: var(--clr-ink);
}
/* responsive: narrow phones — columns fold, rows wrap (P-448) */
@media (max-width: 560px) {
  .dec-lib-head,
  .dec-lib-row {
    grid-template-columns: minmax(0, 1fr) 3.4rem 4rem 3.2rem 2.2rem;
    padding: 9px 10px;
    font-size: 0.92rem;
  }
  .dec-row-qty {
    flex-basis: 100%;
    justify-content: flex-start;
  }
  .dec-ing-name {
    flex-basis: calc(100% - 76px);
  }
  .dec-row-actions {
    margin-left: 0;
  }
  .dec-meta-edit {
    gap: 8px;
  }
  .dec-meta-edit label {
    transform: rotate(-0.8deg);
  }
}

/* P-436: onboarding — entry copy, sample chips, help overlay */
.dec-help-link {
  background: none;
  border: none;
  color: var(--clr-brand-strong);
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
} /* P-558 */
.dec-help-link:hover {
  color: var(--clr-ink);
}
.dec-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: var(--sp-2);
}
.dec-samples .px-chip {
  border: 1.5px dashed color-mix(in srgb, var(--clr-brand) 55%, transparent);
  background: var(--clr-card);
  color: var(--clr-brand-strong);
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
} /* P-558 */
.dec-samples .px-chip:hover {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-style: solid;
}
.dec-help {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--clr-ink) 45%, transparent);
  padding: var(--sp-3);
}
.dec-help[hidden] {
  display: none;
}
.dec-help-card {
  position: relative;
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  background: var(--clr-cream);
  border-radius: 14px;
  border-top: 5px solid var(--clr-brand);
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--clr-ink) 30%, transparent);
}
.dec-help-card h2 {
  font-family: "Anton", "Impact", sans-serif;
  font-size: 1.4rem;
  margin-bottom: var(--sp-2);
}
.dec-help-card h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-brand);
  margin: var(--sp-3) 0 var(--sp-1);
}
.dec-help-card p {
  font-size: 0.95rem;
  line-height: 1.55;
}
.dec-help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--clr-line);
  background: var(--clr-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.dec-help-close:hover {
  background: var(--clr-danger, #b91c1c);
  color: var(--on-red, #fff);
  border-color: transparent;
}
@media (max-width: 560px) {
  .dec-help-card {
    padding: var(--sp-3);
  }
  .dec-samples .muted {
    flex-basis: 100%;
  }
}

/* P-449: onboarding + review-note polish */
.dec-entry-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dec-help-link {
  background: var(--clr-card);
  border: 1.5px solid color-mix(in srgb, var(--clr-brand) 45%, transparent);
  border-radius: 999px;
  padding: 5px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--clr-brand-strong);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--clr-ink) 8%, transparent);
  transition: all 0.15s;
}
.dec-help-link:hover {
  background: var(--clr-brand);
  color: var(--on-brand);
  border-style: solid;
  transform: rotate(-1deg);
}
.dec-help-card {
  position: relative;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  background: var(--clr-cream);
  border-radius: 16px;
  border: 2px solid var(--clr-ink);
  box-shadow:
    8px 8px 0 var(--clr-brand),
    0 24px 60px color-mix(in srgb, var(--clr-ink) 35%, transparent);
  padding: 36px 40px 42px;
}
.dec-help-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 5px;
  background: var(--clr-sun);
  border-radius: 0 0 6px 6px;
}
.dec-help-card h2 {
  font-family: "Anton", "Impact", sans-serif;
  font-size: 1.5rem;
  margin: var(--sp-3) 0 var(--sp-2);
  letter-spacing: 0.01em;
  padding-right: 40px;
}
.dec-help-card h3 {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--clr-cream);
  background: var(--clr-brand);
  padding: 3px 12px;
  border-radius: 999px;
  margin: var(--sp-3) 0 var(--sp-1);
}
.dec-help-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--clr-ink);
}
.dec-help-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--clr-ink);
  background: var(--clr-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  z-index: 2;
  transition: all 0.15s;
}
.dec-help-close:hover {
  background: var(--clr-ink);
  color: var(--clr-cream);
}
/* review notes: proper card hierarchy (was all-orange on cream) */
.dec-note {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-sun) 22%, var(--clr-card));
  border: 1px solid var(--clr-line);
  border-left: 4px solid var(--clr-brand);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 6px 0;
  font-size: 0.9rem;
}
.dec-note-line {
  font-weight: 700;
  color: var(--clr-ink);
}
.dec-note .chip.warn {
  background: var(--clr-brand);
  color: var(--clr-cream);
  font-size: 0.78rem;
}
.dec-note-rm {
  margin-left: auto;
  border: 1px solid var(--clr-line);
  background: var(--clr-card);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dec-note-rm:hover {
  background: var(--clr-danger, #b91c1c);
  color: var(--on-red, #fff);
  border-color: transparent;
}
@media (max-width: 560px) {
  .dec-help-card {
    padding: var(--sp-3);
    max-height: 88vh;
  }
  .dec-note-rm {
    margin-left: 0;
  }
}

/* P-437: oven chip + serve-with strip (draft panel) */
.dec-oven {
  background: var(--clr-ink);
  color: var(--clr-cream);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  transform: rotate(1deg);
}
.dec-servewith {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: var(--sp-2) 0;
}
.dec-serve-chip {
  background: color-mix(in srgb, var(--clr-sun) 45%, var(--clr-card));
  border: 1px solid color-mix(in srgb, var(--clr-ink) 15%, transparent);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 600;
}
@media (max-width: 560px) {
  .dec-help-card {
    padding: 24px 20px 30px;
  }
  .dec-help-card h2 {
    padding-right: 34px;
  }
}

/* P-450: drag-to-reorder steps */
.dec-step-num {
  cursor: grab;
  touch-action: none;
}
.dec-step-num:active {
  cursor: grabbing;
}
.dec-step-card.dragging {
  opacity: 0.45;
}
.dec-step-card.drag-over {
  outline: 2px dashed var(--clr-brand);
  outline-offset: 2px;
}
.dec-step-move {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
.dec-step-move button {
  background: var(--clr-cream);
  border: 1px solid var(--clr-ink);
  border-radius: var(--r-sm);
  font-size: 11px;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
}
.dec-step-move button:hover:not([disabled]) {
  background: var(--clr-brand);
  color: var(--on-brand);
}
.dec-step-move button[disabled] {
  opacity: 0.3;
  cursor: default;
}
@media (max-width: 560px) {
  .dec-step-move {
    flex-direction: row;
  }
}

/* P-439: confidence tier band chip (advice; gate banner unchanged) */
.dec-conf-band {
  font-weight: 700;
}
.dec-conf-high {
  background: var(--clr-ok);
  color: var(--on-ok);
}
.dec-conf-good {
  background: var(--clr-sun);
  color: var(--on-sun);
}
.dec-conf-low {
  background: var(--clr-danger, #b91c1c);
  color: #fff;
}

/* P-451: per-plate price chip — sticker-money treatment */
.dec-price-chip {
  display: inline-block;
  background: var(--clr-brand);
  color: #fff8f0;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 4px;
  transform: rotate(-1.5deg);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--clr-ink) 85%, transparent);
}
.dec-price-none {
  background: var(--clr-sun);
  color: #1c1917;
  transform: none;
  font-weight: 600;
}
.dec-lib-head {
  grid-template-columns: minmax(0, 1.4fr) 56px minmax(0, 1fr) 64px 48px 36px !important;
}
.dec-lib-row {
  grid-template-columns: minmax(0, 1.4fr) 56px minmax(0, 1fr) 64px 48px 36px !important;
}
@media (max-width: 560px) {
  .dec-lib-head,
  .dec-lib-row {
    grid-template-columns: minmax(0, 1.3fr) 44px minmax(0, 1fr) 56px 40px 32px !important;
    font-size: 0.78rem;
  }
}

/* P-440: dedupe prompt */
.dec-dedupe {
  background: color-mix(in srgb, var(--clr-sun) 22%, var(--clr-cream));
  border-radius: 8px;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
}
.dec-dedupe-copy {
  margin: 0 0 var(--sp-2);
  font-weight: 600;
}
.dec-dedupe-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.dec-dedupe-actions button {
  font: inherit;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 6px;
  border: 2px solid var(--clr-ink, #1c1917);
  background: var(--clr-brand);
  color: #fff8f0;
}
.dec-dedupe-actions .dec-dedupe-anyway {
  background: transparent;
  color: var(--clr-ink, #1c1917);
}
.dec-dedupe-actions button:hover {
  transform: rotate(-1deg);
}

/* P-452: cook-gate note (smaller-batch offer / hard block) */
.md-cook-note {
  margin-top: var(--sp-2);
}
.md-cook-note[hidden] {
  display: none;
}
.md-cook-note p {
  margin: 0 0 var(--sp-1);
  font-weight: 600;
}
.md-cook-note--short {
  background: color-mix(in srgb, var(--clr-sun) 25%, var(--clr-cream));
  border-left: 3px solid var(--clr-sun);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
}
.md-cook-note--block {
  background: color-mix(in srgb, var(--clr-brand) 12%, var(--clr-cream));
  border-left: 3px solid var(--clr-brand);
  border-radius: 8px;
  padding: var(--sp-2) var(--sp-3);
}
.md-cook-note ul {
  margin: var(--sp-1) 0 var(--sp-2);
  padding-left: 1.1em;
}
.md-cook-note li {
  margin-bottom: 2px;
}
.md-cook-note button {
  font: inherit;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 6px;
  border: 2px solid var(--clr-ink, #1c1917);
  background: var(--clr-brand);
  color: #fff8f0;
  margin-right: var(--sp-2);
}
.md-cook-note button.md-step-cancel {
  background: transparent;
  color: var(--clr-ink, #1c1917);
}
.md-cook-note button:hover {
  transform: rotate(-1deg);
}

/* P-453: decoded recipe card */
.dm-meta {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.dm-meta label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--clr-ink, #1c1917);
  opacity: 0.75;
}
.dm-meta input {
  font: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  padding: 6px 10px;
  border: 2px solid var(--clr-ink, #1c1917);
  border-radius: 6px;
  background: var(--clr-cream);
  width: 100%;
}
.dm-lines,
.dm-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}
.dm-line {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 70px 90px minmax(70px, auto) 30px;
  gap: var(--sp-1);
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--clr-cream) 82%, #fff);
  border: 1px solid color-mix(in srgb, var(--clr-ink, #1c1917) 14%, transparent);
}
.dm-line input[type="number"],
.dm-line select {
  font: inherit;
  padding: 4px 6px;
  border: 1.5px solid
    color-mix(in srgb, var(--clr-ink, #1c1917) 30%, transparent);
  border-radius: 6px;
  background: var(--clr-cream);
  width: 100%;
}
.dm-ing-name {
  font-weight: 600;
}
.dm-cost {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dm-unpriced {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  margin-left: 6px;
  cursor: pointer;
  border-radius: 999px;
  border: 1.5px dashed var(--clr-brand);
  background: color-mix(in srgb, var(--clr-sun) 30%, var(--clr-cream));
  color: var(--clr-ink, #1c1917);
}
.dm-unpriced:hover {
  transform: rotate(-1.5deg);
}
.dm-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 30px;
  gap: var(--sp-1);
  align-items: start;
}
.dm-step-n {
  font-family: var(--font-display, Anton, sans-serif);
  font-size: 18px;
  color: var(--clr-brand);
  padding-top: 4px;
}
.dm-step-txt {
  font: inherit;
  width: 100%;
  resize: vertical;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid
    color-mix(in srgb, var(--clr-ink, #1c1917) 22%, transparent);
  background: var(--clr-cream);
}
.dm-rm-line,
.dm-rm-step {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--clr-ink, #1c1917);
  opacity: 0.55;
}
.dm-rm-line:hover,
.dm-rm-step:hover {
  opacity: 1;
  color: var(--clr-brand);
}
.dm-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 2px dashed
    color-mix(in srgb, var(--clr-ink, #1c1917) 20%, transparent);
}
.dm-footer .md-cook-note {
  flex-basis: 100%;
}
.dm-legend-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  opacity: 0.8;
}
#dm-save {
  font: inherit;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 6px;
  border: 2px solid var(--clr-ink, #1c1917);
  background: var(--clr-ink, #1c1917);
  color: var(--clr-cream);
}
@media (max-width: 640px) {
  .dm-meta {
    grid-template-columns: minmax(0, 1fr);
  }
  .dm-line {
    grid-template-columns: minmax(0, 1.6fr) 60px 76px 26px;
  }
  .dm-cost {
    display: none;
  }
}

/* P-441: research queue cards */
/* auto-fill sizes tracks from the MINIMUM, so minmax(0, 1fr) packs unlimited
   zero-width tracks and the whole grid collapses (live bug Oct 21 — only
   fixed-count tracks may use minmax(0, 1fr)). */
.gap-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--sp-2);
}
.gap-card {
  border: 2px solid var(--clr-ink, #1c1917);
  border-radius: 10px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-cream) 84%, #fff);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gap-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
}
.gap-tier {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border-radius: 999px;
}
.gap-tier--now .gap-tier {
  background: var(--clr-brand);
  color: #fff8f0;
}
.gap-tier--next .gap-tier {
  background: var(--clr-sun);
  color: var(--clr-ink, #1c1917);
}
.gap-tier--watch .gap-tier {
  background: color-mix(in srgb, var(--clr-ink, #1c1917) 12%, transparent);
}
.gap-tier--now {
  border-color: var(--clr-brand);
  box-shadow: 3px 3px 0 var(--clr-brand);
}
.gap-tier--next {
  box-shadow: 3px 3px 0 var(--clr-sun);
}
.gap-cand {
  font-family: var(--font-display, Anton, sans-serif);
  font-size: 20px;
  letter-spacing: 0.02em;
}
.gap-score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.55;
}
.gap-cat {
  font-size: 13px;
}
.gap-suggest {
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-brand);
}
.gap-card-meta {
  font-size: 12px;
}
.gap-handled {
  align-self: flex-start;
  margin-top: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--clr-ink, #1c1917);
  background: transparent;
}
.gap-handled:hover {
  transform: rotate(-1.5deg);
  background: var(--clr-sun);
}
@media (max-width: 640px) {
  .gap-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* P-441b: the till list (zero-demand price cards) */
.gap-till {
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 10px;
  background: var(--clr-cream); /* P-410 Safari <16.2 fallback */
  background: color-mix(in srgb, var(--clr-sun) 18%, var(--clr-cream));
  border: 1px dashed
    color-mix(in srgb, var(--clr-ink, #1c1917) 40%, transparent);
}
.gap-till p {
  margin: 0 0 var(--sp-2);
}
.gap-till-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* P-454: per-suggestion dismissal on ambiguous cards */
.gap-amb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}
.gap-amb-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--clr-ink, #1c1917);
  background: transparent;
}
.gap-amb-btn:hover {
  transform: rotate(-1.5deg);
  background: var(--clr-sun);
}

/* P-414 price-freshness layer: verified-date age tiers + cheapest-store hints */
.px-src {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}
.px-src--verified {
  background: color-mix(in srgb, var(--clr-ok) 16%, transparent);
  color: var(--clr-ok-text);
}
.px-src--estimated {
  background: color-mix(in srgb, var(--clr-coin) 18%, transparent);
  color: var(--clr-coin);
}
.px-tier-line {
  color: var(--clr-ink-soft, var(--clr-ink));
  opacity: 0.8;
  font-size: 13px;
  margin-left: 6px;
}

.px-age {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
}
.px-age--fresh {
  background: var(--clr-cream);
  background: color-mix(in srgb, var(--clr-sun) 22%, transparent);
  color: var(--clr-ink);
}
.px-age--aging {
  background: var(--clr-cream);
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: var(--clr-ink);
}
.px-age--stale {
  background: var(--clr-cream);
  background: color-mix(in srgb, #dc2626 14%, transparent);
  color: #b91c1c;
}
.px-age--estimate {
  background: var(--clr-cream);
  background: color-mix(in srgb, var(--clr-ink) 10%, transparent);
  color: var(--clr-ink-soft);
}
.px-hint {
  background: var(--clr-cream);
  border: 1.5px dashed var(--clr-brand);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--clr-sun) 14%, var(--clr-cream));
  color: var(--clr-ink);
  padding: 4px 12px;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.px-hint:hover {
  background: var(--clr-cream);
  background: color-mix(in srgb, var(--clr-sun) 26%, var(--clr-cream));
}
.px-hint-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--clr-brand);
  color: var(--on-brand);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}

/* ================= P-531 SITE GUIDE (illustrated, static, no video) ================= */
.guided-demo {
  position: relative;
  overflow: hidden;
  background: var(--clr-card);
  border: 3px solid var(--clr-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sticker);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.gd-head h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  margin: var(--sp-1) 0 2px;
}
.gd-tag {
  display: inline-block;
  transform: rotate(var(--sticker-tilt));
  background: var(--clr-sun);
  border: 2px solid var(--clr-ink);
  border-radius: 999px;
  color: var(--on-sun);
  padding: 2px 12px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gd-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
}
.gd-nav button {
  min-height: var(--tap);
  padding: 10px 22px;
  font-weight: 800;
}
#gd-stage {
  margin-top: var(--sp-3);
}
/* demo re-uses live component styles (.chips, .slip, .missing-line) for honesty:
   what you see in the demo is what the views really render. */
#gd-stage .demo-pantry {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
#gd-stage .demo-pantry .qt-chip.on {
  cursor: default;
}
#gd-stage .demo-note {
  font-size: 0.78rem;
  color: var(--clr-ink-soft);
  margin-top: var(--sp-2);
}

.guide-sec {
  background: var(--clr-card);
  border: 2px solid var(--clr-ink);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-2);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--clr-ink) 10%, transparent);
}
.guide-sec summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.guide-sec summary::-webkit-details-marker {
  display: none;
}
.guide-sec summary:focus-visible {
  outline: 3px solid var(--clr-brand);
  outline-offset: -3px;
}
.guide-sec .gs-name {
  font-weight: 800;
  font-size: 0.98rem;
}
.guide-sec .gs-name::before {
  content: "▸ ";
  color: var(--clr-brand);
  display: inline-block;
  transition: transform var(--t-fast);
}
.guide-sec[open] summary .gs-name::before {
  transform: rotate(90deg);
}
.guide-sec .gs-meta {
  font-size: 0.72rem;
  color: var(--clr-ink-soft);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.g-step {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
}
.g-step + .g-step {
  border-top: 1px dashed var(--clr-line);
}
.g-step .g-n {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--clr-sun);
  border: 2px solid var(--clr-ink);
  border-radius: 999px;
  color: var(--on-sun);
  font-family: var(--font-display);
  font-size: 0.95rem;
  transform: rotate(var(--sticker-tilt));
}
.g-step h4 {
  font-size: 0.92rem;
  font-weight: 800;
}
.g-step p {
  font-size: 0.85rem;
  color: var(--clr-ink-soft);
}

/* P-532 a11y: fl-step/g-step headings demoted+restyled to h3 (valid order h1>h2>h3) */
.fl-step h3.fl-h,
.g-step h3.g-h {
  font-size: 0.92rem;
  font-weight: 800;
  margin: 2px 0;
}

/* P-533: guide section one-line intros (Groq variants, owner-picked) */
.gs-intro {
  margin: 2px 6px 10px;
  font-size: 0.86rem;
  color: var(--clr-ink-soft, #57534e);
}
.px-honesty {
  font-weight: 600;
}

/* P-534: packs badge — the amount in the shopper's own unit ("≈ 1.5 tins") */
.pi-packs {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--clr-brand-strong);
  white-space: nowrap;
}

/* ---------------- P-535: pantry dossier + filters ---------------- */
.pi-main {
  cursor: pointer;
}
.pi-main:focus-visible {
  outline: 2px solid var(--clr-brand, #ea580c);
  outline-offset: 2px;
  border-radius: 6px;
}
.pi-tag {
  cursor: pointer;
}
.pi-nick-tag {
  font-weight: 400;
  font-size: 0.72em;
  color: var(--clr-ink-soft);
}
.pantry-aisles {
  margin-top: -2px;
}
.pchip--aisle {
  border-style: dashed;
}
.ing-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}
.ing-soon {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--clr-sun, #fbbf24) 22%, transparent);
  font-size: 0.92em;
  line-height: 1.45;
}
.ing-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 4px;
}
.if-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8em;
  color: var(--clr-ink-soft);
}
.if-field input,
.if-field textarea {
  font: inherit;
  color: inherit;
  padding: 7px 9px;
  border: 1px solid var(--clr-line);
  border-radius: var(--rad-ctl);
  background: var(--clr-card);
}
.if-pack {
  display: flex;
  gap: 6px;
}
.if-pack input:first-child {
  flex: 1 1 60px;
}
.if-pack input:last-child {
  flex: 0 0 64px;
}
.if-field--wide,
.if-actions {
  grid-column: 1 / -1;
}
.if-actions {
  display: flex;
  gap: 8px;
}
@media (max-width: 560px) {
  .ing-form {
    grid-template-columns: 1fr;
  }
}
#ing-match-now {
  margin: 6px 0 2px;
}
.fc-x {
  margin-left: 6px;
  font-weight: 700;
}
.chip.stale {
  text-decoration: underline wavy;
}

/* ---- P-545 settings: kitchen profile + budget defaults + look & feel ---- */
/* P-558 SETTINGS LAYOUT — every control is a full-width labeled field; chips sit
   in a fixed 2x2 / 4-across grid (no auto-fit, per the mobile-track standing
   rule) so nothing truncates or rag-wraps. */
.st-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0 var(--sp-2);
}
.st-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--clr-ink);
  min-width: 0;
}
.st-field input[type="number"] {
  border: 1px solid var(--clr-line);
  background: var(--clr-cream);
  border-radius: var(--rad-ctl);
  padding: 8px 10px;
  font: inherit;
  font-weight: 600;
  min-width: 0;
}
.st-chip {
  width: 100%;
  justify-content: flex-start;
}
#view-settings .st-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: var(--sp-3) 0 var(--sp-2);
}
@media (min-width: 640px) {
  #view-settings .st-chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .st-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.st-h {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-ink);
  opacity: 0.75;
}
.st-hint {
  font-size: 0.8rem;
  line-height: 1.5;
}
/* P-557 SETTINGS CONTROL GRID — one height, one rhythm. Every interactive chip
   (checkbox pill, radio pill, pill-with-select) is a 44px-tap pill with the
   same padding, so no row mixes tall and short controls again. */
.st-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}
.st-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border: var(--line-weight, 1px) solid var(--clr-line);
  background: var(--clr-cream);
  border-radius: var(--rad-ctl);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.st-chip:has(input:checked) {
  border-color: var(--clr-brand);
  background: var(--clr-brand-soft);
}
.st-chip input {
  accent-color: var(--clr-brand);
  margin: 0;
  flex: 0 0 auto;
}
.st-select {
  appearance: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0 var(--sp-1) 0 0;
  min-height: 100%;
  cursor: pointer;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.st-field select {
  width: 100%;
  appearance: none;
  border: var(--line-weight, 1px) solid var(--clr-line);
  background: var(--clr-cream);
  border-radius: var(--rad-ctl);
  padding: 0 var(--sp-3);
  min-height: var(--tap);
  font: inherit;
  font-weight: 600;
  color: var(--clr-ink);
}
.st-field input[type="number"],
.st-field select {
  min-height: var(--tap);
  box-sizing: border-box;
}
