/* Magic Red Pot design system — tokens and components per DESIGN.md */

:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f4efe7;
  --ink: #2a2420;
  --ink-muted: #6b6158;
  --line: #e6ded3;
  /* Accent = the red of the logo pot (white text on it: 6.4:1). */
  --accent: #b8161a;
  --accent-hover: #9a1114;
  --accent-ink: #ffffff;
  --accent-soft: #fce4e2;
  --success: #2f6b3a;
  --success-soft: #e3f1e3;
  --warning: #8a5a00;
  --warning-soft: #fff1d6;
  --danger: #a3261b;
  --danger-soft: #fbe3e0;
  --ing-bg: #fff1d6; --ing-ink: #6e4300; --ing-line: #ebc37a;
  --tool-bg: #e5eef7; --tool-ink: #264766; --tool-line: #a9c2dc;
  --sub-bg: #e3f1e3; --sub-ink: #275a2e; --sub-line: #a7cfa9;
  --timer-bg: #f5e4ee; --timer-ink: #74264f; --timer-line: #d9a9c3;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.8125rem; --fs-sm: 0.9375rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.75rem;
  --fs-2xl: clamp(2rem, 4vw, 2.75rem);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgb(42 36 32 / .06), 0 1px 1px rgb(42 36 32 / .04);
  --shadow-2: 0 6px 20px rgb(42 36 32 / .10);
  --gutter: 16px;
  --maxw: 1200px;
  --header-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191614; --surface: #231f1c; --surface-2: #2c2724; --ink: #f2ece4; --ink-muted: #b8ada2;
    --line: #3a332e; --accent: #ff8a80; --accent-hover: #ffa89f; --accent-ink: #1a1010; --accent-soft: #3d1c1c;
    --success: #8fd19c; --success-soft: #1b2e1e; --warning: #f2c46b; --warning-soft: #3a2c12;
    --danger: #ff9a8f; --danger-soft: #3d1f1c;
    --ing-bg: #3a2c12; --ing-ink: #ffd891; --ing-line: #6e5424;
    --tool-bg: #1c2a38; --tool-ink: #a9cdf2; --tool-line: #36506a;
    --sub-bg: #1b2e1e; --sub-ink: #a6ddac; --sub-line: #355b3a;
    --timer-bg: #35202b; --timer-ink: #f2b1d3; --timer-line: #5e3549;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 6px 20px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 960px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-md)/1.55 var(--font-ui);
  min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s-3); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-2xl); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-lg); font-weight: 650; }
h3 { font-size: var(--fs-md); font-weight: 650; }
p { margin: 0 0 var(--s-3); }
.muted { color: var(--ink-muted); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

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

.skip-link { position: absolute; left: var(--s-2); top: -100px; z-index: 100; background: var(--surface); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
.skip-link:focus { top: var(--s-2); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
main { flex: 1; padding: var(--s-5) 0 var(--s-8); }
.stack > * + * { margin-top: var(--s-4); }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: var(--s-4); min-height: var(--header-h); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: var(--s-2); }
.brand__logo { width: 40px; height: 40px; flex: none; margin-block: -6px; }
.brand--stacked { flex-direction: column; gap: var(--s-2); }
.brand--stacked .brand__logo { width: 112px; height: 112px; margin: 0; }
.nav { display: flex; gap: var(--s-1); }
.nav a { color: var(--ink); text-decoration: none; padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); font-weight: 550; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.header-search { flex: 1; max-width: 360px; margin-left: auto; }
.header-search input { width: 100%; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); min-width: 220px; padding: var(--s-2); z-index: 50; }
.user-menu__panel a, .user-menu__panel button { display: flex; width: 100%; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; min-height: 44px; align-items: center; }
.user-menu__panel a:hover, .user-menu__panel button:hover { background: var(--surface-2); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; border: 1px solid var(--line); }

.bottom-nav { display: none; }
@media (max-width: 759px) {
  .nav, .header-search { display: none; }
  .site-header .container { justify-content: space-between; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface);
    border-top: 1px solid var(--line); padding: var(--s-1) var(--s-2) calc(var(--s-1) + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--fs-xs); color: var(--ink-muted); text-decoration: none; padding: var(--s-1); min-height: 52px; justify-content: center; border-radius: var(--r-sm); }
  .bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 650; }
  .bottom-nav .ico { font-size: 1.25rem; line-height: 1; }
  main { padding-bottom: 96px; }
  body.has-sticky-bar main { padding-bottom: 160px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 var(--fs-sm)/1 var(--font-ui); text-decoration: none;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn--lg { min-height: 56px; padding: 0 var(--s-5); font-size: var(--fs-md); }
.btn--sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-xs); }
.btn--icon { width: 44px; padding: 0; }
.btn--block { width: 100%; }
.icon-btn { background: none; border: 0; color: inherit; cursor: pointer; min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; border-radius: var(--r-pill); font-size: 1.1rem; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s-1); }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: 400 16px/1.4 var(--font-ui);
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); }
.field { margin-bottom: var(--s-4); }
.field__help { color: var(--ink-muted); font-size: var(--fs-xs); margin-top: var(--s-1); }
.field__error, .errorlist { color: var(--danger); font-size: var(--fs-sm); margin: var(--s-1) 0 0; padding: 0; list-style: none; }
.errorlist li::before { content: "⚠ "; }
.check { display: flex; align-items: center; gap: var(--s-2); font-weight: 500; min-height: 44px; cursor: pointer; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-5); box-shadow: var(--shadow-1); }
.form-grid { display: grid; gap: 0 var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: span 2; } }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 var(--s-3); border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-muted); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); }

/* ---------- Messages / toasts ---------- */
.messages { list-style: none; margin: 0 0 var(--s-4); padding: 0; }
.message { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); margin-bottom: var(--s-2); background: var(--surface); border: 1px solid var(--line); }
.message--success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.message--error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.message--warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.toast-region { position: fixed; bottom: var(--s-5); left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: var(--s-2); width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); box-shadow: var(--shadow-2); display: flex; gap: var(--s-3); align-items: center; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 36px; }

/* ---------- Tags / pills ---------- */
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--s-2); border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink); font-size: var(--fs-xs); font-weight: 600; text-decoration: none; border: 1px solid transparent; }
a.tag:hover { border-color: var(--line); color: var(--ink); }
.tag--red { background: #fbe3e0; color: #8a2419; } .tag--amber { background: #fff1d6; color: #6e4300; }
.tag--green { background: #e3f1e3; color: #275a2e; } .tag--blue { background: #e5eef7; color: #264766; }
.tag--plum { background: #f5e4ee; color: #74264f; }
@media (prefers-color-scheme: dark) {
  .tag--red { background: #3d1f1c; color: #ffb4aa; } .tag--amber { background: #3a2c12; color: #ffd891; }
  .tag--green { background: #1b2e1e; color: #a6ddac; } .tag--blue { background: #1c2a38; color: #a9cdf2; }
  .tag--plum { background: #35202b; color: #f2b1d3; }
}
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--s-2); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 650; background: var(--surface-2); color: var(--ink-muted); white-space: nowrap; }
.badge--passive { background: var(--timer-bg); color: var(--timer-ink); }
.badge--periodic { background: var(--tool-bg); color: var(--tool-ink); }
.badge--component { background: var(--sub-bg); color: var(--sub-ink); }
.badge--parallel { background: var(--success-soft); color: var(--success); }

/* ---------- Reference chips ---------- */
.chip {
  display: inline; padding: 1px 7px 2px; margin: 0 1px; border-radius: var(--r-sm); border: 1px solid;
  font: inherit; font-size: 0.97em; line-height: 1.9; white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  text-decoration: none;
}
.chip__glyph { font-size: .8em; margin-right: 4px; opacity: .9; }
.chip__amount { font-weight: 750; font-variant-numeric: tabular-nums; }
.chip__note, .chip__qual { opacity: .85; font-weight: 400; }
.chip--ing { background: var(--ing-bg); color: var(--ing-ink); border-color: var(--ing-line); }
.chip--tool { background: var(--tool-bg); color: var(--tool-ink); border-color: var(--tool-line); }
.chip--sub { background: var(--sub-bg); color: var(--sub-ink); border-color: var(--sub-line); }
a.chip--sub:hover { color: var(--sub-ink); text-decoration: underline; }
.chip--timer { background: var(--timer-bg); color: var(--timer-ink); border-color: var(--timer-line); font-weight: 650; }
button.chip--timer { cursor: pointer; display: inline; }
button.chip--timer:hover { filter: brightness(0.96); }
.chip--missing { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* ---------- Recipe cards ---------- */
.page-head { display: flex; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.card-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 599px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; } }
.recipe-card { position: relative; background: var(--surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-1); border: 1px solid var(--line); display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.recipe-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.recipe-card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.recipe-card__media { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; }
.recipe-card__media img { width: 100%; height: 100%; object-fit: cover; }
.recipe-card__body { padding: var(--s-3) var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); flex: 1; }
.recipe-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.25; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card__title a { color: var(--ink); text-decoration: none; }
.recipe-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.recipe-card__title a:focus-visible { outline: none; }
.recipe-card__ings { font-size: var(--fs-xs); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipe-card__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.recipe-card__meta { margin-top: auto; display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.recipe-card__meta strong { color: var(--ink); font-weight: 650; }
.recipe-card .fav-form { position: absolute; top: var(--s-2); right: var(--s-2); z-index: 2; }
.recipe-card .badge--component { position: absolute; left: var(--s-2); top: var(--s-2); z-index: 2; }
@media (max-width: 599px) {
  .recipe-card__ings, .recipe-card__tags { display: none; }
  .recipe-card__body { padding: var(--s-2) var(--s-3) var(--s-3); }
  .recipe-card__title { font-size: 1rem; }
  .recipe-card__meta { font-size: var(--fs-xs); }
}
.fav-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); cursor: pointer; font-size: 1.25rem; color: var(--ink-muted); display: grid; place-items: center; box-shadow: var(--shadow-1); }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn:hover { background: var(--surface); }

.placeholder-img { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, #f7dcc8, #f1c9a8 40%, #e8b98f); color: rgb(122 58 25 / .55); font: 700 3.5rem/1 var(--font-display); }
.placeholder-img--b { background: linear-gradient(135deg, #dde9d2, #c6dcb5 45%, #a9c99a); color: rgb(45 85 40 / .5); }
.placeholder-img--c { background: linear-gradient(135deg, #f3e2c1, #ead09a 45%, #dfbd73); color: rgb(110 80 20 / .5); }
@media (prefers-color-scheme: dark) {
  .placeholder-img { background: linear-gradient(135deg, #4a3326, #5b3b28); color: rgb(255 210 180 / .45); }
  .placeholder-img--b { background: linear-gradient(135deg, #2c3a28, #3a4d33); color: rgb(200 230 190 / .4); }
  .placeholder-img--c { background: linear-gradient(135deg, #4a3d22, #5c4b28); color: rgb(250 225 170 / .4); }
}

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-4); }
.filter-bar .search-input { flex: 1 1 260px; }
.filter-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4); margin-bottom: var(--s-5); display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 900px) { .filter-panel { grid-template-columns: 1fr 1fr 1.3fr; } }
.filter-panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.filter-panel legend { font-weight: 650; font-size: var(--fs-sm); margin-bottom: var(--s-2); }
.pill-check { display: inline-flex; margin: 0 4px 6px 0; }
.pill-check input { position: absolute; opacity: 0; }
.pill-check span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-sm); font-weight: 550; cursor: pointer; }
.pill-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill-check input:focus-visible + span { outline: 3px solid var(--accent); }
.ing-filter { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.ing-filter__row { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s-2); align-items: center; padding: 2px var(--s-3); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.ing-filter__row:last-child { border-bottom: 0; }
.ing-filter__row label { margin: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; cursor: pointer; }
.results-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-3); color: var(--ink-muted); font-size: var(--fs-sm); }
.htmx-request.results, .htmx-request .results { opacity: .6; transition: opacity .2s; }

.empty { text-align: center; padding: var(--s-7) var(--s-4); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md); }
.empty p { color: var(--ink-muted); }

/* ---------- Recipe detail ---------- */
.detail-hero { display: grid; gap: var(--s-5); grid-template-columns: 1fr; margin-bottom: var(--s-6); }
@media (min-width: 960px) { .detail-hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }
.detail-hero__media { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-2); box-shadow: var(--shadow-1); }
.detail-hero__media img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 599px) { .detail-hero__media { margin: calc(-1 * var(--s-5)) calc(-1 * var(--gutter)) 0; border-radius: 0; aspect-ratio: 16 / 10; } }
.detail-title-row { display: flex; gap: var(--s-3); align-items: flex-start; }
.detail-title-row h1 { flex: 1; margin-bottom: var(--s-2); }
.summary { font-size: var(--fs-md); color: var(--ink-muted); max-width: 60ch; }
.meta-row { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: var(--s-4) 0; }
.meta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2) var(--s-4); min-width: 120px; }
.meta__label { font-size: var(--fs-xs); color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.meta__value { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.meta__hint { font-size: var(--fs-xs); color: var(--ink-muted); }
.servings { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin: var(--s-4) 0; }
.stepper { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); box-shadow: var(--shadow-1); }
.stepper button, .stepper a { width: 48px; height: 48px; border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--ink); border-radius: 50%; display: grid; place-items: center; text-decoration: none; }
.stepper button:hover, .stepper a:hover { background: var(--surface-2); }
.stepper__value { display: flex; align-items: baseline; gap: 6px; padding: 0 var(--s-2); }
.stepper__value input { width: 4.2ch; border: 0; background: transparent; text-align: center; font-size: 1.25rem; font-weight: 750; min-height: 44px; padding: 0; font-variant-numeric: tabular-nums; }
.stepper__value span { font-weight: 600; }
.presets { display: flex; gap: 4px; }
.presets a { min-width: 40px; min-height: 40px; display: grid; place-items: center; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); background: var(--surface); }
.presets a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.hero-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.detail-body { display: grid; gap: var(--s-6); grid-template-columns: 1fr; }
@media (min-width: 960px) { .detail-body { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); } .detail-aside { position: sticky; top: calc(var(--header-h) + var(--s-4)); align-self: start; max-height: calc(100vh - var(--header-h) - var(--s-6)); overflow: auto; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: var(--s-4); }
.panel__footer { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.panel .row + .row { margin-top: var(--s-2); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); }
.panel__head h2 { margin: 0; }
.ing-group + .ing-group { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px dashed var(--line); }
.ing-group__title { font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: baseline; gap: var(--s-2); margin: 0 0 var(--s-2); }
.ing-group__title a { color: var(--sub-ink); }
.ing-list { list-style: none; padding: 0; margin: 0; }
.ing-list li { display: flex; gap: var(--s-2); padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: var(--fs-sm); }
.ing-list li:last-child { border-bottom: 0; }
.tag-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--s-3); }
.tag-list__name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); }
.ing-list .amt { min-width: 5.5em; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--ing-ink); }
.ing-list .opt { color: var(--ink-muted); font-size: var(--fs-xs); }
.tool-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-list li { background: var(--tool-bg); color: var(--tool-ink); border-radius: var(--r-sm); padding: 4px var(--s-2); font-size: var(--fs-sm); font-weight: 600; }
.tool-list .count { font-variant-numeric: tabular-nums; font-weight: 800; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4); display: grid; grid-template-columns: 44px 1fr; gap: var(--s-3); box-shadow: var(--shadow-1); }
.step-card__num { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.step-card__title { font-weight: 700; margin: 0 0 2px; font-size: var(--fs-sm); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .03em; }
.step-card__text .step-text { margin: 0; font-size: var(--fs-md); line-height: 1.75; }
.step-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-2); align-items: center; }
.step-card details { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--ink-muted); }
.step-card summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.used-in { font-size: var(--fs-sm); color: var(--ink-muted); }

.timeline { margin-top: var(--s-5); }
.timeline summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.timeline svg { width: 100%; height: auto; display: block; }
.timeline .lane-label { font: 12px var(--font-ui); fill: var(--ink-muted); }
.timeline .bar--ACTIVE { fill: var(--accent); }
.timeline .bar--PASSIVE { fill: var(--timer-line); }
.timeline .bar--PERIODIC { fill: var(--tool-line); }
.timeline .grid { stroke: var(--line); }
.legend { display: flex; gap: var(--s-3); font-size: var(--fs-xs); color: var(--ink-muted); margin-top: var(--s-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.legend .l-a { background: var(--accent); } .legend .l-p { background: var(--timer-line); } .legend .l-g { background: var(--tool-line); }

.sticky-cook-bar { display: none; }
@media (max-width: 759px) {
  .sticky-cook-bar { display: flex; position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 35; padding: var(--s-2) var(--gutter); gap: var(--s-2); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); align-items: center; }
  .sticky-cook-bar .btn--primary { flex: 1; }
}

/* ---------- Entity pages ---------- */
.entity-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.entity-card { display: flex; gap: var(--s-3); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2); text-decoration: none; color: var(--ink); min-height: 64px; }
.entity-card:hover { box-shadow: var(--shadow-1); color: var(--ink); border-color: var(--ink-muted); }
.entity-card__img { width: 48px; height: 48px; border-radius: var(--r-sm); overflow: hidden; flex: none; background: var(--surface-2); }
.entity-card__img img { width: 100%; height: 100%; object-fit: cover; }
.entity-card__img .placeholder-img { font-size: 1.4rem; }
.entity-card__name { font-weight: 650; }
.entity-card__meta { font-size: var(--fs-xs); color: var(--ink-muted); }
.entity-detail { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 800px) { .entity-detail { grid-template-columns: 280px 1fr; } }
.entity-detail__img { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 1; background: var(--surface-2); }
.entity-detail__img img { width: 100%; height: 100%; object-fit: cover; }
.future-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.future { border: 1px dashed var(--line); border-radius: var(--r-md); padding: var(--s-3); color: var(--ink-muted); font-size: var(--fs-sm); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-1) var(--s-4); margin: 0; }
.dl dt { color: var(--ink-muted); font-size: var(--fs-sm); }
.dl dd { margin: 0; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s-5) var(--gutter); background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 45%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-6) var(--s-5); box-shadow: var(--shadow-2); }
.auth-card .brand { justify-content: center; margin-bottom: var(--s-5); font-size: 1.6rem; }

/* ---------- Shopping ---------- */
.shop-layout { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 900px) { .shop-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.shop-section h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin: var(--s-4) 0 var(--s-2); }
.shop-line { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.shop-line form { margin: 0; }
.check-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 1.1rem; color: transparent; flex: none; }
.check-btn[aria-pressed="true"] { background: var(--success); border-color: var(--success); color: var(--surface); }
.shop-line--checked .shop-line__text { text-decoration: line-through; color: var(--ink-muted); }
.shop-line__text { flex: 1; }
.shop-line__amt { font-weight: 750; font-variant-numeric: tabular-nums; }
.shop-line__src { display: block; font-size: var(--fs-xs); color: var(--ink-muted); }

/* ---------- Editor ---------- */
.editor-top { position: sticky; top: var(--header-h); z-index: 30; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin: calc(-1 * var(--s-5)) 0 var(--s-5); }
.editor-top .container { display: flex; gap: var(--s-3); align-items: center; min-height: 64px; flex-wrap: wrap; padding-top: var(--s-2); padding-bottom: var(--s-2); }
.editor-title { flex: 1 1 280px; font: 600 1.4rem/1.2 var(--font-display) !important; border-color: transparent !important; background: transparent !important; padding-left: 0 !important; }
.editor-title:hover { border-color: var(--line) !important; }
.editor-title:focus-visible { border-color: var(--accent) !important; background: var(--surface) !important; padding-left: var(--s-2) !important; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; padding: 6px var(--s-3); border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-muted); }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
@media (max-width: 599px) {
  .editor-top .container { gap: var(--s-2); min-height: 0; }
  .editor-top .btn { padding-inline: var(--s-3); }
  .editor-title { flex-basis: calc(100% - 60px); }
  .save-state { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; font-size: var(--fs-xs); padding: 6px var(--s-2); }
}
.save-state[data-state="new"] { background: var(--surface-2); color: var(--ink-muted); }
.save-state[data-state="saved"] { background: var(--success-soft); color: var(--success); }
.save-state[data-state="dirty"], .save-state[data-state="draft"] { background: var(--warning-soft); color: var(--warning); }
.save-state[data-state="error"] { background: var(--danger-soft); color: var(--danger); }
.editor-layout { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .editor-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.authoring-note { display: flex; gap: var(--s-2); align-items: center; background: var(--ing-bg); color: var(--ing-ink); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); margin-bottom: var(--s-4); }
.draft-banner { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; background: var(--warning-soft); color: var(--warning); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); }
.step-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
.estep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: var(--s-3) var(--s-4) var(--s-4); transition: box-shadow .2s, border-color .2s; }
.estep:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow-2); }
.estep--flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-2); } 100% { box-shadow: var(--shadow-1); } }
.estep--has-error { border-color: var(--danger); }
.sortable-ghost { opacity: .4; }
.estep__head { display: flex; gap: var(--s-2); align-items: center; }
.estep__handle { cursor: grab; color: var(--ink-muted); font-size: 1.2rem; min-width: 32px; min-height: 44px; display: grid; place-items: center; border: 0; background: none; touch-action: none; }
.estep__num { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.estep__title { flex: 1; min-height: 38px !important; border-color: transparent !important; background: transparent !important; font-weight: 600 !important; }
.estep__title:hover { border-color: var(--line) !important; }
.estep__title:focus-visible { background: var(--surface) !important; border-color: var(--accent) !important; }
.estep__actions { display: flex; gap: 2px; }
.estep__actions .icon-btn { font-size: 1rem; color: var(--ink-muted); }
@media (max-width: 599px) {
  .estep__head { flex-wrap: wrap; row-gap: 0; }
  .estep__actions { margin-left: auto; }
  .estep__title { order: 1; flex-basis: 100%; }
}
.pm-wrap { margin: var(--s-2) 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); padding: var(--s-2) var(--s-3); cursor: text; }
.pm-wrap:focus-within { border-color: var(--accent); background: var(--surface); outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.ProseMirror { outline: none; min-height: 1.9em; font-size: var(--fs-md); line-height: 1.9; white-space: pre-wrap; word-wrap: break-word; }
.ProseMirror p { margin: 0; }
/* Grid stacks the placeholder and the caret's trailing <br> in one cell, so a long placeholder
   wraps inside the box instead of overflowing it (a zero-height float would). */
.ProseMirror p.is-editor-empty:first-child { display: grid; }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--ink-muted); pointer-events: none; grid-area: 1 / 1; line-height: 1.5; padding: .2em 0; }
.ProseMirror p.is-editor-empty:first-child > * { grid-area: 1 / 1; }
.ProseMirror .chip { cursor: pointer; user-select: none; }
.ProseMirror .chip.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 1px; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--ink); animation: pm-blink 1.1s steps(2, start) infinite; }
@keyframes pm-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.insert-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.insert-bar button { min-height: 36px; border-radius: var(--r-pill); border: 1px dashed; background: transparent; font: 600 var(--fs-xs) var(--font-ui); padding: 0 var(--s-3); cursor: pointer; }
.insert-bar .ins-ing { color: var(--ing-ink); border-color: var(--ing-line); }
.insert-bar .ins-tool { color: var(--tool-ink); border-color: var(--tool-line); }
.insert-bar .ins-sub { color: var(--sub-ink); border-color: var(--sub-line); }
.insert-bar .ins-timer { color: var(--timer-ink); border-color: var(--timer-line); }
.insert-bar button:hover { border-style: solid; }
.insert-bar .hint { font-size: var(--fs-xs); color: var(--ink-muted); align-self: center; margin-left: auto; }
.estep__fields { display: grid; gap: var(--s-3); margin-top: var(--s-3); grid-template-columns: 1fr; align-items: end; }
@media (min-width: 700px) { .estep__fields { grid-template-columns: 150px auto 1fr; } }
.estep__fields label { font-size: var(--fs-xs); color: var(--ink-muted); }
.duration-input { display: flex; align-items: center; gap: 6px; }
.duration-input input { width: 90px; }
.deps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; }
.dep-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: var(--r-pill); padding: 0 2px 0 var(--s-3); font-size: var(--fs-sm); font-weight: 600; min-height: 34px; }
.dep-chip button { border: 0; background: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; color: var(--ink-muted); }
.dep-chip button:hover { background: var(--line); }
.deps select { width: auto; min-height: 36px; font-size: var(--fs-sm); padding: 0 var(--s-2); }
.estep__more { margin-top: var(--s-2); }
.estep__more summary { cursor: pointer; font-size: var(--fs-xs); color: var(--ink-muted); min-height: 32px; display: inline-flex; align-items: center; }
.estep__issues { margin: var(--s-2) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.estep__issues li { padding: 4px var(--s-2); border-radius: var(--r-sm); margin-top: 4px; }
.estep__issues .error { background: var(--danger-soft); color: var(--danger); }
.estep__issues .warning { background: var(--warning-soft); color: var(--warning); }
.add-step { width: 100%; margin-top: var(--s-3); border-style: dashed; min-height: 56px; }
.inspector .panel h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin: 0; }
.inspector details.panel > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.inspector details.panel > summary::after { content: "▾"; color: var(--ink-muted); }
.inspector details.panel:not([open]) > summary::after { content: "▸"; }
.inspector details.panel > summary::-webkit-details-marker { display: none; }
.inspector .panel__body { margin-top: var(--s-3); }
.gen-list { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); }
.gen-list li button { all: unset; display: block; width: 100%; padding: 5px var(--s-2); border-radius: var(--r-sm); cursor: pointer; box-sizing: border-box; }
.gen-list li button:hover, .gen-list li button:focus-visible { background: var(--surface-2); }
.gen-list li button:focus-visible { outline: 3px solid var(--accent); }
.gen-group-title { font-size: var(--fs-xs); font-weight: 700; color: var(--sub-ink); margin: var(--s-3) 0 4px; }
.issue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.issue-list li { padding: 6px var(--s-2); border-radius: var(--r-sm); }
.issue-list .error { background: var(--danger-soft); color: var(--danger); }
.issue-list .warning { background: var(--warning-soft); color: var(--warning); }
.issue-list button { all: unset; cursor: pointer; }
.timing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.timing-grid .meta { min-width: 0; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-editor .tag button { border: 0; background: none; cursor: pointer; margin-left: 2px; color: inherit; min-width: 22px; min-height: 22px; }
.tag-editor input { flex: 1; min-width: 120px; }
.image-field img { border-radius: var(--r-md); aspect-ratio: 4/3; object-fit: cover; width: 100%; margin-bottom: var(--s-2); }

/* dialogs */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgb(20 15 10 / .45); }
.dlg { padding: var(--s-5); display: grid; gap: var(--s-4); }
.dlg__head { display: flex; align-items: center; justify-content: space-between; }
.dlg__head h2 { margin: 0; }
.dlg__foot { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
.dlg__foot .left { margin-right: auto; }
.combo { position: relative; }
.combo__list { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 220px; overflow: auto; background: var(--surface); }
.combo__list li { padding: var(--s-2) var(--s-3); border-radius: 6px; cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: var(--s-2); }
.combo__list li[aria-selected="true"], .combo__list li:hover { background: var(--accent-soft); }
.combo__list .create { color: var(--accent); font-weight: 650; }
.picked { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); font-weight: 650; }
.picked button { margin-left: auto; }
.amount-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.slot-options { display: grid; gap: 6px; }
.slot-options label { display: flex; align-items: center; gap: var(--s-2); font-weight: 500; padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; margin: 0; min-height: 44px; }
.slot-options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.slash-menu { position: absolute; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 4px; min-width: 220px; list-style: none; margin: 0; }
.slash-menu li { padding: var(--s-2) var(--s-3); border-radius: 6px; cursor: pointer; display: flex; gap: var(--s-2); align-items: center; min-height: 40px; }
.slash-menu li[aria-selected="true"] { background: var(--accent-soft); }
.slash-menu kbd { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-muted); }

/* ---------- Timer tray (detail page + cook mode) ---------- */
.timer-tray { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 60; display: grid; gap: var(--s-2); width: min(340px, calc(100vw - 32px)); }
@media (max-width: 759px) { .timer-tray { bottom: calc(130px + env(safe-area-inset-bottom)); right: var(--s-3); } }
.timer { background: var(--surface); border: 1px solid var(--timer-line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--s-2) var(--s-3); display: flex; align-items: center; gap: var(--s-2); }
.timer__label { flex: 1; font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer__time { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.3rem; color: var(--timer-ink); }
.timer--done { background: var(--timer-bg); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 0 0 var(--timer-line); } to { box-shadow: 0 0 0 6px transparent; } }

/* ---------- Cook Mode ---------- */
body.cook { --fs-cook: clamp(1.5rem, 4.5vw, 2.25rem); background: var(--bg); }
.cook-top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.cook-top .container { display: flex; align-items: center; gap: var(--s-2); min-height: 60px; }
.cook-top h1 { font-size: 1.15rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wake-indicator { font-size: var(--fs-xs); color: var(--success); }
/* Cook Mode layout: phones/tablets = one column + timer dock at the bottom edge;
   ≥1100px = items | steps | timers. */
.cook-layout { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); padding-top: var(--s-4); padding-bottom: calc(var(--s-8) + var(--dock-h, 0px)); }
.cook-main { min-width: 0; display: grid; gap: var(--s-4); align-content: start; }
.cook-main > .cook-section { margin-top: var(--s-2); }
@media (min-width: 1100px) {
  .cook-layout { grid-template-columns: 300px minmax(0, 1fr) 280px; gap: var(--s-5); padding-bottom: var(--s-8); }
  .cook-aside, .cook-timers { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; }
}
.cook-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2) var(--s-4) var(--s-3); }
.cook-panel > summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: var(--s-2); }
.cook-panel__count { margin-left: auto; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-muted); background: var(--surface-2); padding: 2px var(--s-2); border-radius: var(--r-pill); }
.cook-panel__help { font-size: var(--fs-xs); color: var(--ink-muted); margin: 0 0 var(--s-2); }
.cook-panel__heading { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin: var(--s-3) 0 var(--s-1); }
.cook-items { list-style: none; margin: 0; padding: 0; }
.cook-item-row { display: flex; gap: var(--s-2); align-items: baseline; padding: 6px var(--s-2); margin: 0 calc(-1 * var(--s-2)); border-radius: var(--r-sm); font-size: 1.02rem; transition: background .2s, color .2s; }
.cook-item-row__text { flex: 1; min-width: 0; }
.cook-item-row__tag { flex: none; font-size: var(--fs-xs); font-weight: 700; border-radius: var(--r-pill); padding: 1px var(--s-2); }
.cook-item-row--now { background: var(--accent-soft); }
.cook-item-row__tag--now { background: var(--accent); color: var(--accent-ink); }
.cook-item-row--free .cook-item-row__text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-muted); }
.cook-item-row__tag--free { color: var(--success); background: var(--success-soft); }
.prep-check { display: flex; gap: var(--s-3); align-items: center; min-height: 44px; cursor: pointer; font-weight: 500; margin: 0; }
.prep-check input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); }
.prep-check input:checked + .prep-check__text { text-decoration: line-through; color: var(--ink-muted); }
.cook-items .prep-check { font-size: 1rem; }
/* Schritt 0 */
.current-card__heading { font-family: var(--font-display); font-size: var(--fs-xl); margin: 0 0 var(--s-2); }
.current-card__lead { color: var(--ink-muted); margin: 0 0 var(--s-4); }
.prep-lists { display: grid; gap: var(--s-4); }
@media (min-width: 700px) { .prep-lists { grid-template-columns: 3fr 2fr; } }
.prep-lists h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin: 0 0 var(--s-1); }
.prep-list { list-style: none; margin: 0; padding: 0; font-size: 1.1rem; }
.prep-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
/* Timers: right column on wide screens, dock on the bottom edge otherwise */
.cook-timers h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin: 0 0 var(--s-2); }
.cook-timers .timer-tray { position: static; width: auto; z-index: auto; }
.cook-timers__empty { font-size: var(--fs-sm); color: var(--ink-muted); border: 1px dashed var(--line); border-radius: var(--r-md); padding: var(--s-4); margin: 0; }
.cook-timers.has-timers .cook-timers__empty { display: none; }
@media (min-width: 1100px) {
  .cook-timers .timer { flex-wrap: wrap; padding: var(--s-3); }
  .cook-timers .timer__label { flex-basis: 100%; white-space: normal; order: -1; }
  .cook-timers .timer__time { font-size: 2rem; flex: 1; }
}
@media (max-width: 1099px) {
  .cook-timers { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: var(--s-2) var(--gutter) calc(var(--s-2) + env(safe-area-inset-bottom)); max-height: 45vh; overflow: auto; box-shadow: 0 -6px 20px rgb(0 0 0 / .08); }
  .cook-timers:not(.has-timers) { display: none; }
  .cook-timers h2, .cook-timers__empty { display: none; }
  .cook-timers .timer { box-shadow: none; }
  .cook-timers .timer-tray { gap: var(--s-1); }
}
.parallel-hint { background: var(--success-soft); color: var(--success); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); font-size: 1.1rem; display: grid; gap: 4px; }
.parallel-hint strong { font-weight: 800; }
.parallel-hint button { all: unset; cursor: pointer; text-decoration: underline; font-weight: 700; }
.parallel-hint button:focus-visible { outline: 3px solid var(--accent); }
.current-card { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--s-5); }
.current-card__eyebrow { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: var(--s-2); display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.current-card__component { color: var(--sub-ink); }
.current-card__title { font-weight: 700; color: var(--ink-muted); margin-bottom: var(--s-2); }
.current-card .step-text { font-size: var(--fs-cook); line-height: 1.5; margin: 0 0 var(--s-2); }
.current-card .chip { line-height: 1.7; }
.current-card__notes { color: var(--ink-muted); font-size: 1.05rem; margin-top: var(--s-3); }
.current-card__actions { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.current-card__actions .btn { min-height: 64px; font-size: 1.2rem; border-radius: var(--r-md); }
.current-card--waiting { border-color: var(--line); }
.current-card--done { border-color: var(--success); }
.cook-section { margin-top: var(--s-5); }
.cook-section h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.cook-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.cook-item { display: flex; gap: var(--s-3); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); min-height: 60px; cursor: pointer; width: 100%; text-align: left; font: inherit; color: inherit; }
.cook-item:hover { border-color: var(--ink-muted); }
.cook-item__num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; flex: none; }
.cook-item__body { flex: 1; min-width: 0; }
.cook-item__label { font-weight: 650; font-size: 1.05rem; }
.cook-item__sub { font-size: var(--fs-sm); color: var(--ink-muted); }
.cook-item--component { margin-left: var(--s-5); width: calc(100% - var(--s-5)); border-left: 4px solid var(--sub-line); }
.cook-item--done { opacity: .6; }
.cook-item--done .cook-item__num { background: var(--success); color: var(--surface); }
.cook-item--running { border-color: var(--timer-line); background: var(--timer-bg); }
.cook-item--waiting { opacity: .7; }
.cook-finished { text-align: center; padding: var(--s-7) var(--s-4); }
.cook-finished .big { font-size: 3rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .bottom-nav, .hero-actions, .servings, .sticky-cook-bar, .timer-tray { display: none !important; }
  body { background: #fff; }
  .panel, .step-card { box-shadow: none; }
}

/* utilities / fixes */
.recipe-card__meta { flex-wrap: wrap; row-gap: 0; }
.recipe-card__meta span { white-space: nowrap; }
.input-narrow { width: 5.5em !important; }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
h2.inline { display: inline; }
.cook-section summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

body.cook main { padding-top: 0; }
.cook-item__actions { display: flex; gap: var(--s-2); align-items: center; }
.cook-group-toggle { font-size: var(--fs-xs); }

/* Image picker (static/js/image-picker.js) */
.image-picker { display: grid; gap: var(--s-2); padding: var(--s-3); border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .15s, background .15s; }
.image-picker--drop { border-color: var(--accent); background: var(--accent-soft); }
.image-picker__row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.image-picker__choose { cursor: pointer; }
.image-picker__choose:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.image-picker__link .image-picker__url { flex: 1 1 180px; min-width: 0; }
.image-picker__preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--r-sm); }
.image-picker__status { margin: 0; font-size: var(--fs-sm); }
.image-picker__status:empty { display: none; }
.image-picker__status[data-kind="ok"] { color: var(--success); }
.image-picker__status[data-kind="error"] { color: var(--danger); }
.image-picker[aria-busy="true"] .image-picker__status::before { content: "⏳ "; }

/* Step photos */
.step-photo { margin: var(--s-3) 0 0; }
.step-photo img { width: 100%; max-width: 560px; max-height: 360px; object-fit: cover; border-radius: var(--r-md); display: block; }
.step-photo figcaption { font-size: var(--fs-sm); color: var(--ink-muted); margin-top: var(--s-1); font-style: italic; }
.estep__photo-body { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.estep__photo-preview { width: 100%; max-width: 360px; max-height: 240px; object-fit: cover; border-radius: var(--r-sm); }
body.cook .toast-region { bottom: calc(var(--dock-h, 0px) + var(--s-4)); }
body.cook--prep .cook-aside { display: none; }
@media (min-width: 1100px) { body.cook--prep .cook-main { grid-column: 1 / 3; } }
@media (max-width: 599px) { .hide-sm { display: none; } }
#cook-reset > [aria-hidden] { font-size: 1.35rem; line-height: 1; }
@media (max-width: 799px) {
  /* Without a photo the big placeholder would fill the whole first screen. */
  .entity-detail__img { max-width: 200px; }
  .entity-detail__img:has(.placeholder-img) { display: none; }
}
@media (max-width: 599px) {
  .meta-row { display: grid; grid-template-columns: 1fr 1.3fr 1fr; }
  .meta-row .meta { min-width: 0; padding-inline: 10px; }
  .meta-row .meta__label { letter-spacing: .02em; }
}
