/* ============================================================
   ScaleChef — static UI shell stylesheet
   Precision-instrument restraint. No decoration, no kitsch.
   ============================================================ */

/* ---------- Tokens: complete light palette on :root ---------- */
:root {
  color-scheme: light dark;

  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #efede8;
  --ink: #1b1d1f;
  --ink-2: #52565a;
  --ink-3: #83878c;
  --line: #dcd9d2;
  --line-strong: #b9b5ac;

  --accent: #17663f;
  --accent-strong: #10502f;
  --accent-ink: #ffffff;
  --accent-soft: #e4efe6;

  --warn-ink: #7a5200;
  --warn-bg: #faf1d7;
  --warn-line: #e0ca8c;

  --danger: #b3261e;

  --focus: #17663f;
  --shadow: 0 1px 2px rgba(20, 22, 24, 0.06), 0 4px 16px rgba(20, 22, 24, 0.05);

  --radius: 12px;
  --radius-sm: 9px;
  --control-h: 52px;
  --tab-bar-h: 68px;
  --rail-w: 92px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Dark theme: token overrides only ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1c1e21;
    --surface-2: #24272b;
    --ink: #ecedee;
    --ink-2: #a9aeb4;
    --ink-3: #7d8288;
    --line: #33373c;
    --line-strong: #4a4f55;

    --accent: #4cc38a;
    --accent-strong: #66d19d;
    --accent-ink: #0b2818;
    --accent-soft: #1b2f24;

    --warn-ink: #e8c468;
    --warn-bg: #2a2414;
    --warn-line: #57491f;

    --danger: #f28b82;

    --focus: #4cc38a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

[hidden] { display: none !important; }

img, svg { max-width: 100%; }

h1, h2, h3, p, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- App frame ---------- */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  padding-top: calc(0.85rem + env(safe-area-inset-top));
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}
.wordmark-mark { color: var(--accent); flex: none; }

.header-context {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#app-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.25rem 1.1rem calc(var(--tab-bar-h) + env(safe-area-inset-bottom) + 1.5rem);
}

section[data-screen] { padding-top: 0.4rem; }

/* ---------- Headings / screen chrome ---------- */
.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.screen-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.section-title {
  font-size: 0.85rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 1.6rem 0 0.6rem;
}

.context-line {
  color: var(--ink-2);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  padding: 0 1.1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--ink);
  background: transparent;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:active { background: var(--accent-strong); }

.btn-quiet {
  border-color: var(--line-strong);
  background: var(--surface);
}
.btn-quiet:active { background: var(--surface-2); }

.btn-danger-quiet {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--danger);
}

.btn-block { width: 100%; margin-top: 0.75rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-list { display: grid; gap: 0.7rem; }

/* Recipe cards */
.recipe-card {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.45rem;
}

.recipe-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  min-height: 56px;
}
.recipe-card-body:active { background: var(--surface-2); }

.recipe-card-main { display: grid; gap: 0.2rem; min-width: 0; }

.recipe-name {
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.recipe-meta {
  font-size: 0.88rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.74rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.14rem 0.5rem;
  border-radius: 99px;
}

.recipe-card-scale { align-self: center; flex: none; }

/* ---------- Search + chips ---------- */
.search-row {
  position: relative;
  margin-bottom: 0.8rem;
}
.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
#recipe-search {
  width: 100%;
  height: var(--control-h);
  padding: 0 1rem 0 2.9rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
}
#recipe-search::placeholder { color: var(--ink-3); }

.chip-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 0.6rem;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 99px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  touch-action: manipulation;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* ---------- Forms ---------- */
.form-card { padding: 1.1rem; }

.field { display: grid; gap: 0.35rem; min-width: 0; }

.field > label,
.field > span:first-child {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.optional {
  font-weight: 500;
  color: var(--ink-3);
  text-transform: none;
  font-size: 0.8rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 0.9rem;
  align-items: end;
}
.field-wide { grid-column: 1 / -1; margin-bottom: 0.9rem; }

input[type="text"],
input[type="number"],
input[type="search"],
select {
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  height: var(--control-h);
  padding: 0 0.85rem;
  width: 100%;
  min-width: 0;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

/* remove spinners — chefs type, they don't nudge */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 1.15rem) 55%,
    calc(100% - 0.75rem) 55%;
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

.input-affix {
  position: relative;
  display: block;
}
.input-affix .affix {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 0.92rem;
  pointer-events: none;
}
.input-affix input { padding-right: 4.6rem; }

/* ---------- Segmented controls ---------- */
.toggle-row {
  display: grid;
  gap: 1.1rem;
  margin-top: 1.1rem;
}

.segmented > legend {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
  padding: 0;
}

.segmented-options {
  display: flex;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  width: 100%;
}

.segment { flex: 1; display: block; min-width: 0; }

.segment input { position: absolute; opacity: 0; pointer-events: none; }

.segment label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 0.35rem;
  border-radius: calc(var(--radius-sm) - 3px);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 430px) {
  .segment label { font-size: 0.88rem; letter-spacing: -0.01em; padding: 0 0.25rem; }
}

.segment input:checked + label {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.segment input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.buffer-custom-wrap {
  margin-top: 0.6rem;
  max-width: 160px;
}
.buffer-custom-wrap input { padding-right: 2.4rem; }

/* ---------- Stats ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-unit {
  font-size: 0.95rem;
  font-weight: 550;
  color: var(--ink-2);
  letter-spacing: 0;
}

/* Quantities are the hero content */
.qty { font-variant-numeric: tabular-nums; }
.qty-dim { color: var(--ink-2); }

/* ---------- Data tables ---------- */
.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table thead th {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table tbody th {
  font-weight: 600;
  font-size: 1.02rem;
}

.data-table .num { text-align: right; white-space: nowrap; }

.data-table td.qty {
  font-size: 1.25rem;
  font-weight: 700;
}
.data-table td.qty-dim { font-size: 1rem; }

.prep-note {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-3);
}

.flag-badge {
  display: inline-block;
  vertical-align: 0.1em;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
  white-space: nowrap;
}

/* ---------- Warnings ---------- */
.warnings { display: grid; gap: 0.6rem; margin-top: 0.9rem; }
.warnings:empty { display: none; }

.warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  color: var(--warn-ink);
  padding: 0.8rem 1rem;
  font-size: 0.98rem;
  font-weight: 550;
}

/* ---------- Batch / pan plans ---------- */
.batch-card { padding: 1rem 1.1rem; }

.batch-context {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin-bottom: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.batch-options { display: grid; gap: 0.55rem; }

.batch-option {
  display: grid;
  gap: 0.1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
}

.batch-option.is-default {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.batch-count {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.batch-desc {
  font-size: 0.92rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.batch-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-ink);
  background: var(--accent);
  padding: 0.14rem 0.5rem;
  border-radius: 99px;
}

/* ---------- Ingredient editor rows ---------- */
.ingredient-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 0.7rem;
}

.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.field-name { grid-column: span 6; }
.field-qty { grid-column: span 3; }
.field-unit { grid-column: span 3; }
.field-prep { grid-column: span 6; }
.field-cost { grid-column: span 3; }
.field-yield { grid-column: span 3; }

.btn-remove-row {
  grid-column: span 6;
  justify-self: end;
  min-height: 44px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.editor-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}
.editor-actions .btn-primary { flex: 1; min-width: 200px; }

/* ---------- Import: paste a recipe ---------- */
#import-text {
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.85rem;
  width: 100%;
  min-width: 0;
  min-height: 15rem;
  resize: vertical;
}
#import-text::placeholder { color: var(--ink-3); }

.field-hint {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-3);
}

.import-paste-actions { margin-top: 0; align-items: center; }

.btn-link {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  padding: 0 0.5rem;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
}
.btn-link:active { color: var(--accent-strong); }

/* Review rows: name / qty / unit / prep + confidence note + remove */
.import-row.is-low {
  border-color: var(--warn-line);
  border-left: 4px solid var(--warn-line);
}

.import-grid .row-note {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--warn-ink);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* D12 — the lines we couldn't read, verbatim */
.unparsed-title { color: var(--warn-ink); }

.unparsed-hint {
  font-size: 0.88rem;
  color: var(--ink-2);
  margin: -0.2rem 0 0.6rem;
}

.unparsed-list {
  border-color: var(--warn-line);
  padding: 0.25rem 0;
}

.unparsed-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
}
.unparsed-line + .unparsed-line { border-top: 1px solid var(--line); }

.unparsed-text {
  flex: 1;
  min-width: 12rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.unparsed-actions {
  display: flex;
  gap: 0.5rem;
  flex: none;
}
.unparsed-actions .btn {
  min-height: 44px;
  font-size: 0.9rem;
  padding: 0 0.8rem;
}

/* ---------- Events ---------- */
.event-card { padding: 1.1rem; }

.event-head { margin-bottom: 0.4rem; }

.event-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.event-meta {
  font-size: 0.92rem;
  color: var(--ink-2);
  margin-top: 0.1rem;
}

.event-stats {
  margin-top: 0.8rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.event-stats .stat {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
  padding: 0.7rem 0.75rem;
}
.event-stats .stat-value { font-size: 1.6rem; }

.event-menu {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.event-menu-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid var(--line);
}

.menu-item-name { font-weight: 600; font-size: 1.02rem; }

.menu-item-qty {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}
.menu-unit { font-size: 0.85rem; font-weight: 550; color: var(--ink-2); }

.event-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
.event-actions .btn-primary { flex: 1; min-width: 180px; }

/* ---------- Shopping list ---------- */
.shop-group { margin-bottom: 0.4rem; }

.shop-items { padding: 0.25rem 0; }

.shop-item + .shop-item { border-top: 1px solid var(--line); }

.shop-item label {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  min-height: 56px;
  cursor: pointer;
}

.shop-item input[type="checkbox"] {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.shop-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 1.05rem;
  display: grid;
  gap: 0.1rem;
}

.shop-note {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-3);
}

.ap-note { color: var(--warn-ink); font-weight: 600; }

.shop-item-qty {
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
}

.shop-item input:checked ~ .shop-item-name,
.shop-item input:checked ~ .shop-item-qty {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

/* ---------- Tab bar (phone) ---------- */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tab-bar-h) + env(safe-area-inset-bottom));
}

.tab {
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 48px;
  touch-action: manipulation;
}

.tab[aria-current="page"] { color: var(--accent); }

.tab svg { flex: none; }

/* ---------- Wide screens: side rail + roomier layout ---------- */
@media (min-width: 900px) {
  body { padding-left: var(--rail-w); }

  #tab-bar {
    top: 0;
    bottom: 0;
    right: auto;
    width: var(--rail-w);
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
    align-content: center;
    gap: 0.4rem;
    border-top: 0;
    border-right: 1px solid var(--line);
    padding: 1rem 0.5rem;
  }

  .tab {
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.25rem;
  }
  .tab[aria-current="page"] { background: var(--accent-soft); }

  #app-main {
    padding: 0.5rem 2.5rem 3rem;
  }

  h1 { font-size: 2rem; }

  .field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .toggle-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    align-items: start;
  }

  .ingredient-grid {
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  }
  .ingredient-grid > * { grid-column: auto; }
  .btn-remove-row { align-self: end; }

  /* Import review rows: fewer fields than the editor, own template */
  .import-grid {
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.8fr) minmax(0, 0.9fr) minmax(0, 1.8fr) auto;
  }
  .import-grid .btn-remove-row { grid-column: 5; grid-row: 1; }
  .import-grid .row-note { grid-column: 1 / -1; grid-row: 2; }

  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #event-list { grid-template-columns: 1fr; max-width: 720px; }

  #shopping-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.5rem;
    align-items: start;
  }

  #scale-results .stat-row { max-width: 560px; }
}

@media (min-width: 1200px) {
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Print: the prep sheet is a real feature ---------- */
.print-header { display: none; }

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --ink: #000000;
    --ink-2: #222222;
    --ink-3: #444444;
    --line: #999999;
    --line-strong: #000000;
    --accent: #000000;
    --accent-soft: #ffffff;
    --accent-ink: #ffffff;
    --warn-ink: #000000;
    --warn-bg: #ffffff;
    --warn-line: #000000;
    --shadow: none;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 12pt;
    padding: 0;
  }

  #app-header,
  #tab-bar,
  .no-print,
  button,
  form { display: none !important; }

  section[hidden] { display: none !important; }

  #app-main { max-width: none; padding: 0; }

  .print-header {
    display: block;
    border-bottom: 3px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 1.2rem;
  }
  .print-title {
    font-size: 22pt;
    font-weight: 750;
    letter-spacing: -0.01em;
  }
  .print-meta {
    font-size: 12pt;
    margin-top: 0.2rem;
    font-variant-numeric: tabular-nums;
  }

  .card,
  .recipe-card,
  .ingredient-row,
  .stat,
  .batch-option {
    box-shadow: none;
    border-color: #999;
    break-inside: avoid;
  }

  .table-scroll { overflow: visible; }

  .data-table th,
  .data-table td { border-color: #999; padding: 0.5rem 0.7rem; }

  .data-table td.qty { font-size: 14pt; }

  .stat-value { font-size: 18pt; }

  .section-title {
    color: #000;
    margin-top: 1.2rem;
    break-after: avoid;
  }

  .warnings .warning {
    border: 1.5px solid #000;
    border-left-width: 5px;
    font-weight: 600;
  }

  .batch-option.is-default { border: 2px solid #000; }
  .batch-badge { background: #000; color: #fff; }

  .shop-group { break-inside: avoid; }
  .shop-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16pt; height: 16pt;
    border: 1.5pt solid #000;
    border-radius: 3pt;
  }

  a { color: #000; text-decoration: none; }
}
