/* Epulonis - "Kräutergarten" design: herb green on a pale green ground, Nunito throughout,
   neutral charcoal in dark mode (no dark green backgrounds). Fonts are self-hosted. */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/static/fonts/nunito-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/static/fonts/nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(/static/fonts/plus-jakarta-sans-latin.woff2) format('woff2');
}

:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-2: #eef4ec;
  --field: #f4f7f2;
  --text: #1e2b22;
  --muted: #56685b;
  --border: #d5e1d3;
  --border-strong: #bccdba;

  --primary: #2f6b43;
  --primary-hover: #265a38;
  --primary-dark: #23573a;
  --primary-soft: #dcebdd;
  --on-primary: #ffffff;
  --plate-ring: #c9e6cf;
  --bar-b: #7cc995;
  --bar-soon: #e0a526;
  --info: #2d5fa8;

  --ok: #2f6b43;
  --ok-bg: #dcebdd;
  --low: #7a5200;
  --low-bg: #f6dfa4;
  --missing: #a33a2c;
  --missing-bg: #f6d5cf;
  --missing-line: #e9b8af;
  --unknown: #56685b;
  --unknown-bg: #e6ece4;
  --warn-bg: #fbf0d4;
  --warn-text: #6e4a00;

  --tint-0: #dcebdd; --ink-0: #2f6b43;
  --tint-1: #f3e6c4; --ink-1: #7a5a12;
  --tint-2: #f6dcd3; --ink-2: #9a3f2c;
  --tint-3: #e2e7f3; --ink-3: #3a5488;
  --tint-4: #ede3f0; --ink-4: #6b4479;
  --tint-5: #e6efd2; --ink-5: #4f6b1f;

  --backdrop: rgba(20, 30, 22, .45);
  --shadow-sm: 0 1px 2px rgba(30, 43, 34, .06);
  --shadow: 0 1px 2px rgba(30, 43, 34, .05), 0 10px 28px rgba(30, 43, 34, .07);
  --shadow-lg: 0 14px 40px rgba(30, 43, 34, .16);

  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --sans: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --logo: 'Plus Jakarta Sans', var(--sans);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414;
  --surface: #1c1c1c;
  --surface-2: #252525;
  --field: #141414;
  --text: #ececec;
  --muted: #a8a8a8;
  --border: #333333;
  --border-strong: #474747;
  --primary: #7cc995;
  --primary-hover: #95d5a9;
  --primary-dark: #a9ddb9;
  --primary-soft: #1f3a29;
  --on-primary: #141414;
  --plate-ring: #1c1c1c;
  --bar-b: #3e7d53;
  --bar-soon: #ebcb7c;
  --info: #8cb8f0;
  --ok: #7cc995; --ok-bg: #1f3a29;
  --low: #ebcb7c; --low-bg: #3a3016;
  --missing: #f5a99d; --missing-bg: #4a1f1a; --missing-line: #6b2d25;
  --unknown: #a8a8a8; --unknown-bg: #2a2a2a;
  --warn-bg: #2e2814; --warn-text: #ebcb7c;
  --tint-0: #1f3a29; --ink-0: #a9ddb9;
  --tint-1: #3a3016; --ink-1: #ebcb7c;
  --tint-2: #3d241c; --ink-2: #f0a58e;
  --tint-3: #1e2a40; --ink-3: #a9c1ec;
  --tint-4: #33243a; --ink-4: #d6b3e2;
  --tint-5: #2a3318; --ink-5: #c5dd8f;
  --backdrop: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141414;
    --surface: #1c1c1c;
    --surface-2: #252525;
    --field: #141414;
    --text: #ececec;
    --muted: #a8a8a8;
    --border: #333333;
    --border-strong: #474747;
    --primary: #7cc995;
    --primary-hover: #95d5a9;
    --primary-dark: #a9ddb9;
    --primary-soft: #1f3a29;
    --on-primary: #141414;
    --plate-ring: #1c1c1c;
    --bar-b: #3e7d53;
    --bar-soon: #ebcb7c;
    --info: #8cb8f0;
    --ok: #7cc995; --ok-bg: #1f3a29;
    --low: #ebcb7c; --low-bg: #3a3016;
    --missing: #f5a99d; --missing-bg: #4a1f1a; --missing-line: #6b2d25;
    --unknown: #a8a8a8; --unknown-bg: #2a2a2a;
    --warn-bg: #2e2814; --warn-text: #ebcb7c;
    --tint-0: #1f3a29; --ink-0: #a9ddb9;
    --tint-1: #3a3016; --ink-1: #ebcb7c;
    --tint-2: #3d241c; --ink-2: #f0a58e;
    --tint-3: #1e2a40; --ink-3: #a9c1ec;
    --tint-4: #33243a; --ink-4: #d6b3e2;
    --tint-5: #2a3318; --ink-5: #c5dd8f;
    --backdrop: rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--sans); font-weight: 800; line-height: 1.2; color: var(--text); letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin: 0 0 .25em; letter-spacing: -.02em; }
h2 { font-size: 1.375rem; margin: 0 0 .6em; }
h3 { font-size: 1.15rem; margin: 0; }

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.main { flex: 1 0 auto; padding-top: 36px; padding-bottom: 56px; }
.muted { color: var(--muted); }
/* Components set their own display, which would otherwise win over the attribute. */
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.icon { width: 1.2em; height: 1.2em; flex: none; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 16px 24px;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 800; font-size: 1.5rem; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; }
/* The o is a plate seen from above. Its margins are measured so it sits optically centred between l and n. */
.wordmark {
  display: inline-flex; align-items: baseline;
  font-family: var(--logo); font-weight: 800; font-size: 1.75rem; line-height: 1; letter-spacing: -.03em;
  color: var(--text);
}
.wordmark-o { width: .54em; height: .54em; margin: 0 .01em 0 .03em; }
.plate { fill: var(--primary); }
.plate-ring { fill: none; stroke: var(--plate-ring); stroke-width: 2; }

.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.nav-link {
  color: var(--muted); padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: 1rem;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--primary-dark); background: var(--primary-soft); }
.nav-new { margin-left: 8px; }

/* ---------- Search ---------- */
.search { position: relative; flex: 1 1 260px; max-width: 520px; }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--muted); pointer-events: none;
}
/* The type attribute in the selector keeps the generic input rule below from resetting the icon padding. */
.search input[type="search"] {
  width: 100%; padding: 10px 18px 10px 44px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--surface-2); font-size: 1rem; color: var(--text);
}
.search input[type="search"]:focus {
  outline: none; border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  overflow: hidden; z-index: 60; max-height: 70vh; overflow-y: auto;
}
.search-results:empty { display: none; }
.sr-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  cursor: pointer; border-bottom: 1px solid var(--border); color: var(--text);
}
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.active { background: var(--surface-2); text-decoration: none; }
.sr-thumb {
  width: 46px; height: 46px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0;
  background: var(--surface-2);
}
.sr-thumb-fallback {
  width: 46px; height: 46px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 1.25rem;
  background: var(--tint-0); color: var(--ink-0);
}
.sr-text { min-width: 0; }
.sr-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: 16px; color: var(--muted); text-align: center; font-size: .9rem; }

/* ---------- Tints for recipes without a photo ---------- */
.tint-0 { --tint: var(--tint-0); --ink: var(--ink-0); }
.tint-1 { --tint: var(--tint-1); --ink: var(--ink-1); }
.tint-2 { --tint: var(--tint-2); --ink: var(--ink-2); }
.tint-3 { --tint: var(--tint-3); --ink: var(--ink-3); }
.tint-4 { --tint: var(--tint-4); --ink: var(--ink-4); }
.tint-5 { --tint: var(--tint-5); --ink: var(--ink-5); }
.sr-thumb-fallback[class*="tint-"] { background: var(--tint); color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--sans); font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: transform .05s, background .15s, border-color .15s, color .15s;
  white-space: nowrap; text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }
.btn-sm { padding: 7px 14px; font-size: .9rem; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-soft:hover { border-color: var(--primary); }
.btn-danger { background: var(--surface); color: var(--missing); border-color: var(--border); }
.btn-danger:hover { background: var(--missing-bg); border-color: var(--missing-line); }

.icon-btn {
  background: transparent; border: 1px solid transparent; cursor: pointer;
  width: 40px; height: 40px; border-radius: var(--radius-sm); font-size: 1rem; color: var(--muted);
  display: inline-grid; place-items: center; transition: background .15s, color .15s; flex: none;
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--missing-bg); color: var(--missing); }
.icon-btn.is-on { color: var(--primary); }
.icon-btn-gap { width: 40px; height: 40px; flex: none; }

/* ---------- Page head ---------- */
.page-head { margin-bottom: 26px; }
.page-sub { color: var(--muted); margin: 0; }
.breadcrumb { margin: 0 0 18px; }
.breadcrumb a { display: inline-flex; align-items: center; gap: 4px; color: var(--primary-dark); font-weight: 800; }
.breadcrumb .icon { width: 18px; height: 18px; }

/* ---------- Chips / Tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-sm { gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 800;
  background: var(--primary-soft); color: var(--primary-dark); border: 1px solid transparent;
}
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chips-sm .chip { padding: 3px 10px; font-size: .75rem; font-weight: 700; }
.chip-count { font-size: .8em; opacity: .7; font-weight: 600; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-bar .chip {
  padding: 7px 14px; font-size: .9rem; font-weight: 700;
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.filter-bar .chip:hover { border-color: var(--primary); }
.filter-bar .chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.filter-label { align-self: center; font-size: .85rem; font-weight: 700; color: var(--muted); margin-right: 2px; }

/* ---------- Recipe grid / cards ---------- */
.recipe-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.recipe-card {
  display: flex; flex-direction: column;
  transition: transform .14s ease, box-shadow .14s ease;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media {
  position: relative; display: block; aspect-ratio: 5 / 3; overflow: hidden;
  background: var(--tint, var(--surface-2));
}
.card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1;
  transition: transform .3s ease;
}
.recipe-card:hover .card-media img { transform: scale(1.04); }
.card-fallback {
  position: absolute; inset: 0; z-index: 0;
  display: grid; place-items: center;
  font-weight: 800; font-size: 4.5rem; color: var(--ink, var(--muted)); opacity: .85;
}
.card-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: var(--surface); color: var(--text);
  font-size: .75rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 1.25rem; margin: 0; line-height: 1.25; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary-dark); text-decoration: none; }
.card-desc {
  color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: auto; padding-top: 8px;
  color: var(--muted); font-size: .9rem; font-weight: 600;
}
.card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.card-meta .icon { width: 1.05rem; height: 1.05rem; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center; padding: 64px 20px; background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty-state.small { padding: 44px 20px; }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark);
}
.empty-icon .icon { width: 30px; height: 30px; }
.empty-state p { color: var(--muted); max-width: 420px; margin: 6px auto 20px; }

/* ============================================================
   Recipe page
   ============================================================ */
.recipe-hero {
  position: relative; border-radius: 28px; overflow: hidden;
  height: clamp(200px, 28vw, 320px); background: var(--tint, var(--surface-2));
  margin-bottom: 26px;
}
.recipe-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.recipe-hero .card-fallback { font-size: 8rem; }

.recipe-head { margin-bottom: 30px; max-width: 900px; }
.recipe-head h1 { margin-top: 14px; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }
.recipe-head .lead { font-size: 1.125rem; line-height: 1.6; color: var(--muted); max-width: 70ch; margin: 10px 0 0; }

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.badge {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 16px;
}
.badge-ico { display: inline-flex; align-items: center; color: var(--primary); }
.badge-ico .icon { width: 1.35rem; height: 1.35rem; }
.badge-k { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); line-height: 1.3; }
.badge-v { display: block; font-weight: 800; line-height: 1.3; }

.recipe-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.recipe-actions form { margin: 0; }

.recipe-layout {
  display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 28px;
  align-items: start;
}

/* Ingredients */
.ingredients { padding: 24px; position: sticky; top: 92px; border-radius: 24px; }
.ing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ing-head h2 { margin: 0; }

.servings-stepper {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border-radius: 999px; padding: 4px;
}
.step-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface); color: var(--text); font-family: var(--sans); font-size: 1.15rem; font-weight: 800; line-height: 1;
  display: grid; place-items: center;
}
.step-btn:hover { color: var(--primary-dark); }
.servings-field { display: inline-flex; align-items: baseline; gap: 4px; padding: 0 6px; }
#servings-input {
  width: 2.4em; border: none; background: transparent; text-align: center; padding: 0;
  font-size: 1.05rem; font-weight: 800; color: var(--text); font-family: var(--sans);
  -moz-appearance: textfield;
}
#servings-input::-webkit-outer-spin-button,
#servings-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#servings-input:focus { outline: none; box-shadow: none; }
.servings-unit { font-size: .9rem; font-weight: 800; color: var(--text); }

.pantry-hint { font-size: .875rem; color: var(--muted); margin: 0 0 10px; }
.pantry-hint a { font-weight: 800; }

.ingredient-list { list-style: none; margin: 0; padding: 0; }
.ingredient {
  display: grid; grid-template-columns: minmax(4.5em, auto) minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.ing-amount { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; text-align: right; }
.ing-amount .unit { font-weight: 800; }
.ing-name { line-height: 1.35; min-width: 0; }
.ing-note { display: block; font-size: .82rem; color: var(--muted); }

.pantry-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.pantry-pill .pill-ico { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pantry-pill.ok { background: var(--ok-bg); color: var(--ok); }
.pantry-pill.low { background: var(--low-bg); color: var(--low); }
.pantry-pill.missing { background: var(--missing-bg); color: var(--missing); }
.pantry-pill.unknown { background: var(--unknown-bg); color: var(--unknown); }

.consume-btn { width: 100%; margin-top: 14px; }

.pantry-legend {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px;
  font-size: .82rem; font-weight: 700; color: var(--muted);
}
.pantry-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.ok { background: var(--ok); }
.dot.low { background: var(--low); }
.dot.missing { background: var(--missing); }

/* Method */
.method { min-width: 0; }
.method > h2 { font-size: 1.625rem; }
.notes-box {
  display: flex; gap: 14px; background: var(--warn-bg); color: var(--warn-text);
  border-radius: 20px; padding: 18px 20px; margin-bottom: 26px;
}
.notes-box .notes-ico { display: flex; padding-top: 2px; }
.notes-box .notes-ico .icon { width: 22px; height: 22px; }
.notes-box strong { display: block; margin-bottom: 4px; }
.notes-box p { margin: 0; line-height: 1.6; }

.step-list { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.step-list li {
  position: relative; counter-increment: step;
  padding: 0 0 24px 54px; min-height: 36px; line-height: 1.65;
}
.step-list li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  font-weight: 800; font-size: 1rem;
  display: grid; place-items: center;
}
.step-list li::after {
  content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px;
  background: var(--border);
}
.step-list li:last-child { padding-bottom: 0; }
.step-list li:last-child::after { display: none; }
.step-text { display: block; padding-top: 4px; }

/* ============================================================
   Forms
   ============================================================ */
.recipe-form { max-width: 860px; }
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.form-section-title { margin: 0 0 16px; font-size: 1.25rem; }
.form-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.form-section-head .form-section-title { margin: 0; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-weight: 800; font-size: .875rem; margin-bottom: 6px; }
.req { color: var(--primary); }
.hint { font-size: .82rem; font-weight: 600; color: var(--muted); margin: 6px 0 0; }

input:not([type]), input[type="text"], input[type="url"], input[type="number"], input[type="search"],
input[type="password"], input[type="email"], input[type="tel"], input[type="date"], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--field); color: var(--text);
  font-family: var(--sans); font-size: 1rem; font-weight: 600; transition: border-color .15s, box-shadow .15s;
}
input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
::placeholder { color: var(--muted); opacity: .8; font-weight: 600; }

/* Own controls (public/js/controls.js, dialog.js): selects, suggestion lists,
   validation messages and the confirm dialog replace the browser's. */
select { appearance: none; }
select[data-enhanced], input[data-enhanced] { display: none !important; }
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }
.select {
  display: flex; align-items: center; width: 100%; padding: 11px 14px; cursor: pointer; text-align: left;
  font-family: var(--sans); font-size: 1rem; font-weight: 600; color: var(--text);
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.select::after {
  content: ''; flex: none; width: 7px; height: 7px; margin: -3px 2px 0 12px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select:disabled { opacity: .6; cursor: default; }
/* Every label is stacked in one cell, so the button is as wide as its longest option. */
.select-value { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.select-value > span { grid-area: 1 / 1; visibility: hidden; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-value > .is-on { visibility: visible; }
input.combo {
  padding-right: 34px; background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a988d' stroke-width='1.8'/%3E%3C/svg%3E");
}

.popup {
  inset: auto; margin: 0; padding: 4px 0; overflow: auto; font-size: 1rem; font-weight: 600;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.popup-list { max-height: 320px; max-width: calc(100vw - 16px); }
.popup-list [role="option"] { padding: 8px 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.popup-list [role="option"]:focus, .popup-list .is-active { background: var(--surface-2); }
.popup-list [aria-selected="true"] { font-weight: 800; color: var(--primary-dark); }
.popup-list [aria-disabled="true"] { color: var(--muted); cursor: default; }
.popup-group { padding: 9px 14px 3px; font-size: .8rem; font-weight: 800; color: var(--muted); }
.popup-cal { padding: 12px; width: 284px; border-radius: var(--radius-md); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-title { font-weight: 800; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { font-size: .8rem; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-grid button {
  height: 34px; padding: 0; font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--text); cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 10px;
}
.cal-grid button:hover { background: var(--surface-2); }
.cal-grid button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-grid .is-today { border-color: var(--border-strong); }
.cal-grid .is-selected, .cal-grid .is-selected:hover { background: var(--primary); color: var(--on-primary); }
.datefield { position: relative; display: flex; align-items: center; }
.datefield input { padding-right: 44px; }
.datefield .icon-btn { position: absolute; right: 4px; width: 34px; height: 34px; }

.field-error { margin: 4px 0 0; font-size: .85rem; font-weight: 700; color: var(--missing); }
[aria-invalid="true"] { border-color: var(--missing); }
.select:has(+ select[aria-invalid="true"]) { border-color: var(--missing); }

.ask {
  width: min(420px, calc(100vw - 32px)); padding: 24px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.ask::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.ask h2 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.ask-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.image-upload-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.image-or { color: var(--muted); font-size: .85rem; }
.image-preview { margin-top: 12px; border-radius: var(--radius-sm); overflow: hidden; max-width: 260px; border: 1px solid var(--border); }
.image-preview img { width: 100%; height: 150px; object-fit: cover; }

/* Dynamic rows */
.rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: start; }
.ingredient-row .cell-amount { flex: 0 0 84px; }
.ingredient-row .cell-unit { flex: 0 0 100px; }
.ingredient-row .cell-name { flex: 2 1 130px; }
.ingredient-row .cell-note { flex: 2 1 130px; }
.step-row { align-items: stretch; }
.step-row .step-num {
  flex: 0 0 34px; height: 44px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-sm);
  font-weight: 800;
}
.step-row textarea { flex: 1; }
.row-remove {
  flex: 0 0 44px; height: 44px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.row-remove .icon { width: 16px; height: 16px; }
.row-remove:hover { background: var(--missing-bg); color: var(--missing); border-color: var(--missing-line); }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.form-actions-inline { margin-top: 4px; }

/* ============================================================
   Pantry
   ============================================================ */
/* "Läuft bald ab" as a calendar: overdue, today, then one column per day. */
.expiry-cal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 20px 22px; margin-bottom: 24px; display: flex; flex-direction: column; gap: 14px;
}
.expiry-cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.expiry-cal-head h2 { margin: 0; font-size: 1.25rem; }
.expiry-cal-sub { font-size: .82rem; font-weight: 600; color: var(--muted); }
.expiry-cal-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.expiry-cal-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(108px, 1fr);
}
.cal-col { display: flex; flex-direction: column; gap: 8px; padding: 0 6px 4px; border-left: 1px dashed var(--border); min-width: 0; }
.cal-col:first-child { border-left: 0; padding-left: 0; }
.cal-col:last-child { padding-right: 0; }
.cal-col-head { display: flex; flex-direction: column; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg); }
.cal-col-label { font-size: .82rem; font-weight: 800; }
.cal-col-sub { font-size: .75rem; font-weight: 600; opacity: .8; }
.cal-col.today .cal-col-head { background: var(--primary); color: var(--on-primary); }
.cal-col.expired .cal-col-head { background: var(--missing-bg); color: var(--missing); }
.cal-item {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--low-bg); color: var(--low); overflow-wrap: anywhere;
}
.cal-item strong { font-size: .875rem; font-weight: 800; line-height: 1.3; }
.cal-item span { font-size: .75rem; font-weight: 700; }
.cal-item.expired { background: var(--missing-bg); color: var(--missing); }

.pantry-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
.pantry-layout.readonly { grid-template-columns: minmax(0, 1fr); }
.pantry-form-card { position: sticky; top: 92px; margin: 0; }
.pantry-count { color: var(--muted); font-size: .875rem; font-weight: 700; white-space: nowrap; }
.pantry-error {
  margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--missing-bg); color: var(--missing); font-weight: 700;
}
.hint-info { color: var(--info); font-weight: 700; }

.pantry-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pantry-search { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.pantry-search > .icon { position: absolute; left: 18px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.pantry-search input[type="search"] {
  padding: 10px 46px 10px 46px; border-radius: 999px; background: var(--surface); border-color: var(--border);
}
.pantry-search input::-webkit-search-cancel-button { appearance: none; }
.pantry-search .icon-btn { position: absolute; right: 3px; width: 36px; height: 36px; border-radius: 50%; }
.pantry-nomatch { margin: 0; padding: 24px 0; text-align: center; color: var(--muted); font-weight: 600; }

/* One table: item rows and their batches share the columns. */
.pantry-table {
  --pantry-cols: minmax(0, 1fr) 92px 136px 128px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.readonly .pantry-table { --pantry-cols: minmax(0, 1fr) 92px 136px; }
.readonly .pantry-cols > span:last-child { display: none; }
.pantry-cols, .pantry-item-row, .pantry-batch {
  display: grid; grid-template-columns: var(--pantry-cols); align-items: center; gap: 12px;
}
.pantry-cols {
  padding: 12px 20px; color: var(--muted);
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.pantry-cols-qty { text-align: right; }
.pantry-list { list-style: none; margin: 0; padding: 0; }
.pantry-item { border-top: 1px solid var(--border); }
.pantry-item-row { padding: 8px 20px; min-height: 58px; }
.pantry-item-name { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-weight: 800; }
.pantry-item-title { overflow-wrap: anywhere; line-height: 1.3; }
.pantry-item-qty, .pantry-batch-qty { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pantry-item-bbd { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pantry-batch-bbd { font-weight: 700; font-variant-numeric: tabular-nums; }
.pantry-item-bbd.soon, .pantry-batch-bbd.soon { color: var(--low); }
.pantry-item-bbd.expired, .pantry-batch-bbd.expired { color: var(--missing); }
.pantry-item-bbd.none, .pantry-batch-bbd.none { color: var(--muted); font-weight: 600; }
.pantry-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.pantry-item-actions form { margin: 0; }

.batch-toggle {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--primary-dark); font-family: var(--sans); font-size: .78rem; font-weight: 800;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.batch-toggle:hover { color: var(--primary); }

/* Amount per batch as a split bar; each segment is a button with its own tooltip. */
.qty-bar { display: flex; gap: 3px; width: min(150px, 100%); }
.qty-seg {
  position: relative; flex: 1 1 0; min-width: 10px; height: 18px; padding: 0;
  border: 0; background: none; cursor: pointer;
}
.qty-seg::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 7px; margin-top: -3.5px;
  border-radius: 4px; background: var(--primary);
}
.qty-seg:nth-child(2n)::before { background: var(--bar-b); }
.qty-seg.soon::before { background: var(--bar-soon); }
.qty-seg.expired::before { background: var(--missing); }
.qty-seg:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 4px; }
.qty-seg::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 4px); z-index: 5;
  transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--surface);
  font-size: .8rem; font-weight: 700; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .12s;
}
.qty-seg:first-child::after { left: 0; transform: none; }
.qty-seg:hover::after, .qty-seg:focus-visible::after, .qty-seg.is-tip::after { opacity: 1; }

/* Batches hang off a line, like the steps of a recipe. */
.pantry-batches { list-style: none; margin: 0; padding: 0 0 8px; }
.pantry-batch { position: relative; padding: 0 20px; min-height: 46px; font-size: .95rem; }
.pantry-batch::before {
  content: ''; position: absolute; left: 33px; top: 0; bottom: 0; width: 2px; background: var(--border);
}
.pantry-batch:last-child::before { bottom: 50%; }
.pantry-batch-label { position: relative; display: flex; align-items: center; min-height: 46px; padding-left: 34px; color: var(--muted); font-weight: 700; }
.batch-node {
  position: absolute; left: 8px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--primary-soft); border: 2px solid var(--primary);
}
.pantry-batch .icon-btn { width: 36px; height: 36px; }
.pantry-batch .icon-btn-gap { width: 36px; }

.consume-preview { margin: 0 0 16px; font-size: .875rem; font-weight: 600; color: var(--muted); }
.consume-preview.warn { color: var(--low); }

/* ============================================================
   Modal (subtract from pantry)
   ============================================================ */
dialog.modal {
  border: none; padding: 0; background: transparent; color: var(--text);
  width: calc(100% - 32px); max-width: 560px; border-radius: var(--radius);
}
dialog.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; }
.modal-sub { color: var(--muted); font-size: .9rem; margin: 6px 0 16px; }

.consume-rows {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 52vh; overflow-y: auto; margin-bottom: 14px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.consume-row {
  display: grid; grid-template-columns: 1fr 84px 84px 44px; gap: 8px; align-items: center;
}
.consume-row input { padding: 9px 11px; }
.consume-row .cr-preview {
  grid-column: 1 / -1; font-size: .8rem; font-weight: 600; color: var(--muted); margin: -4px 0 0;
}
.consume-row .cr-preview.warn { color: var(--low); }
.consume-row .cr-batch { grid-column: 1 / -1; }
.consume-add { margin-bottom: 18px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translateX(-50%) translateY(16px);
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  font-size: .9rem; font-weight: 700; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Login
   ============================================================ */
.auth-page { display: flex; justify-content: center; padding: 16px 0 40px; }
.auth-card { width: 100%; max-width: 420px; margin: 0; }
.auth-card h1 { font-size: 1.8rem; }
.sso-btn { display: flex; justify-content: center; width: 100%; margin-top: 18px; }
.auth-divider { text-align: center; color: var(--muted); font-size: .88rem; margin: 16px 0 6px; }
.auth-error {
  background: var(--missing-bg); color: var(--missing); border: 1px solid var(--missing-line);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; font-weight: 700; margin: 14px 0 4px;
}
.flash { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; font-size: .92rem; font-weight: 700; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--missing-bg); color: var(--missing); }

/* ============================================================
   Accounts: avatars, header menu, profile & settings
   ============================================================ */
.avatar {
  display: inline-grid; place-items: center; overflow: hidden; flex-shrink: 0;
  border-radius: 50%; width: 40px; height: 40px; font-size: 1.05rem;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial { user-select: none; }
.avatar-xs { width: 24px; height: 24px; font-size: .72rem; }
.avatar-sm { width: 36px; height: 36px; font-size: .95rem; }
.avatar-md { width: 44px; height: 44px; font-size: 1.15rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2.4rem; }

/* Header avatar menu */
.user-menu { position: relative; flex-shrink: 0; }
.avatar-btn {
  display: inline-grid; place-items: center; padding: 0; cursor: pointer;
  background: transparent; border: 2px solid var(--border); border-radius: 50%;
  transition: border-color .15s;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { border-color: var(--primary); }
.login-btn { flex-shrink: 0; }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 228px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 6px;
}
.user-dropdown[hidden] { display: none; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}
.user-card-text { display: flex; flex-direction: column; min-width: 0; }
.user-card-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-sub { font-size: .82rem; color: var(--muted); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text); font-family: var(--sans); font-size: .95rem; font-weight: 700; text-align: left;
  background: none; border: none;
}
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item .mi-ico { width: 18px; display: inline-grid; place-items: center; color: var(--muted); }
.dropdown-form { margin: 0; }

/* Profile */
.profile-form { max-width: 640px; }
.avatar-edit { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.avatar-edit-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.avatar-edit-actions .hint { margin: 2px 0 0; }

/* Settings */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0; flex-wrap: wrap;
}
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-label { font-weight: 800; }
.user-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--radius-md);
}
.user-row-text { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.user-row-name { font-weight: 800; }
.user-row-sub { font-size: .82rem; color: var(--muted); }
.you-badge {
  font-size: .72rem; background: var(--primary-soft); color: var(--primary-dark);
  padding: 1px 8px; border-radius: 999px; font-weight: 800; margin-left: 4px;
}
.role-badge {
  font-size: .72rem; background: var(--surface); color: var(--muted);
  border: 1px solid var(--border);
  padding: 0 8px; border-radius: 999px; font-weight: 800; margin-left: 4px;
}
.user-row form { margin: 0; }
.subhead { font-size: 1.05rem; margin: 18px 0 10px; }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0; border-top: 1px solid var(--border);
  margin-top: auto; color: var(--muted); font-size: .9rem;
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  padding-top: 20px; padding-bottom: 20px;
}
.footer-inner strong { color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-right { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.switch-btn {
  border: none; background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: .85rem; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.switch-btn:hover { color: var(--text); }
.switch-btn.active { background: var(--primary); color: var(--on-primary); }

.error-detail {
  text-align: left; white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; max-width: 760px; margin: 0 auto 20px; font-size: .82rem; color: var(--muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
  .recipe-layout { grid-template-columns: minmax(0, 1fr); }
  .ingredients { position: static; }
  .pantry-layout { grid-template-columns: minmax(0, 1fr); }
  .pantry-form-card { position: static; }
}

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; }
  .brand { order: 1; }
  .nav { order: 2; margin-left: auto; }
  .user-menu, .login-btn { order: 2; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav-link { padding: 7px 11px; }
  .grid-3 { grid-template-columns: 1fr; }
  .badges { gap: 8px; }
  .ingredient-row { flex-wrap: wrap; }
  .ingredient-row .cell-amount { flex: 1 1 70px; }
  .ingredient-row .cell-unit { flex: 1 1 80px; }
  .ingredient-row .cell-name, .ingredient-row .cell-note { flex: 1 1 100%; }
}

/* Pantry rows on a phone: name on top, amount, date and buttons below. */
@media (max-width: 640px) {
  .pantry-cols { display: none; }
  .pantry-item-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "name name name" "qty bbd actions";
    gap: 4px 12px; padding: 12px 16px;
  }
  .pantry-item-name { grid-area: name; }
  .pantry-item-qty { grid-area: qty; text-align: left; }
  .pantry-item-bbd { grid-area: bbd; }
  .pantry-item-row > .pantry-item-actions { grid-area: actions; }
  .readonly .pantry-item-row { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "name name" "qty bbd"; }
  .pantry-batch { grid-template-columns: 34px auto minmax(0, 1fr) auto; padding: 0 16px; }
  .readonly .pantry-batch { grid-template-columns: 34px auto minmax(0, 1fr); }
  .pantry-batch::before { left: 29px; }
  .pantry-batch-label { padding-left: 0; }
  .batch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .pantry-batch .icon-btn-gap { display: none; }
}

@media (max-width: 480px) {
  .nav-new { display: none; }
  .wordmark { font-size: 1.5rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .consume-row { grid-template-columns: 1fr 1fr 44px; }
  .consume-row .cr-name { grid-column: 1 / -1; }
}
