/* Prepbook — kitchen recipe system */
:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f1ebe1;
  --ink: #1c1917;
  --muted: #6b6258;
  --line: #e3dacd;
  --line-strong: #cfc3b3;
  --accent: #b45309;
  --accent-soft: #fde8c8;
  --accent-ink: #7c2d12;
  --green: #166534;
  --green-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --dark: #1c1917;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 10px 30px rgba(28, 25, 23, .06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.015em; }
h1 { font-size: clamp(2.1rem, 4vw, 3rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
small { font-size: .82rem; }
svg { width: 1.15em; height: 1.15em; flex: none; }

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(28, 25, 23, .97);
  color: #f5f0e8;
  border-bottom: 1px solid #2f2a25;
  backdrop-filter: blur(10px);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff; flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark-large { width: 54px; height: 54px; border-radius: 14px; margin-bottom: 14px; }
.brand-mark-large svg { width: 30px; height: 30px; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.primary-nav { display: flex; align-items: center; gap: 4px; }
.primary-nav a {
  color: #d6cfc5; text-decoration: none; font-weight: 600; font-size: .94rem;
  padding: 9px 13px; border-radius: 9px;
}
.primary-nav a:hover { background: #2c2723; color: #fff; }
.primary-nav a.is-active { background: #332d28; color: #fff; }
.account-menu { margin-left: auto; position: relative; }
.account-menu summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  list-style: none; padding: 5px 8px 5px 5px; border-radius: 10px;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: #2c2723; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 800; font-size: .9rem;
}
.account-text { display: flex; flex-direction: column; line-height: 1.15; }
.account-name { font-weight: 650; font-size: .88rem; }
.account-role { font-size: .72rem; color: #a8a094; }
.chevron { width: 16px; height: 16px; color: #a8a094; }
.account-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.account-panel a, .account-panel .link-button {
  display: block; width: 100%; text-align: left; padding: 9px 11px;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .92rem;
}
.account-panel a:hover, .account-panel .link-button:hover { background: var(--surface-2); }
.account-panel form { margin: 0; }

/* Page frame */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 72px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 24px;
}
.page-head-compact { margin-bottom: 18px; }
.eyebrow {
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: .14em;
  font-size: .74rem; font-weight: 750; color: var(--accent);
}
.lede { color: var(--muted); font-size: 1.02rem; margin: 0; max-width: 60ch; }
.site-foot {
  max-width: 1240px; margin: 0 auto; padding: 20px 24px 36px;
  border-top: 1px solid var(--line); color: var(--muted);
  display: flex; justify-content: space-between; gap: 16px; font-size: .82rem;
}

/* Buttons and chips */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: .94rem; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.button:hover { border-color: var(--muted); background: #fff; }
.button:active { transform: translateY(1px); }
.button svg { width: 17px; height: 17px; }
.button-primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.button-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.button-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--surface-2); color: var(--ink); }
.button-dashed { border-style: dashed; background: transparent; color: var(--muted); width: 100%; }
.button-block { width: 100%; }
.button-small { min-height: 36px; padding: 6px 10px; font-size: .84rem; }
.button[disabled] { opacity: .5; cursor: not-allowed; }
.link-button {
  background: none; border: 0; padding: 0; color: var(--accent-ink);
  font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; font-size: inherit;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted);
  font-size: .76rem; font-weight: 650; white-space: nowrap; text-decoration: none;
}
.chip-warn { background: var(--danger-soft); color: #991b1b; }
.chip-tag { background: #eef2ff; color: #3730a3; }
.chip-tag:hover { background: #e0e7ff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  position: absolute; top: 10px; right: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-archived { background: #e7e5e4; color: #44403c; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 650; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-on { color: var(--green); }
.status-off { color: var(--muted); }
.muted { color: var(--muted); }

/* Messages */
.messages { max-width: 1240px; margin: 16px auto 0; padding: 0 24px; }
.message {
  margin: 0 0 8px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); font-weight: 550;
}
.message-success { background: var(--green-soft); border-color: #bbf7d0; color: #14532d; }
.message-error { background: var(--danger-soft); border-color: #fecaca; color: #7f1d1d; }
.message-info { background: #e0f2fe; border-color: #bae6fd; color: #075985; }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  padding: 14px; margin-bottom: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.search-field { position: relative; flex: 1 1 280px; }
.search-field svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); width: 18px; height: 18px; pointer-events: none;
}
.search-field input {
  width: 100%; min-height: 44px; padding: 10px 12px 10px 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff;
}
.select-field { display: flex; flex-direction: column; gap: 4px; }
.select-field span {
  font-size: .7rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.select-field select {
  min-height: 44px; padding: 8px 32px 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff;
}
.check-field {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: .9rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Recipe grid */
.recipe-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}
.recipe-card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  color: inherit; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.recipe-card:hover {
  transform: translateY(-2px); border-color: var(--line-strong);
  box-shadow: 0 14px 34px rgba(28, 25, 23, .1);
}
.card-media {
  position: relative; aspect-ratio: 3 / 2; background: var(--surface-2);
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.media-glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #b9ac9a; background:
    radial-gradient(circle at 30% 25%, rgba(180, 83, 9, .09), transparent 55%),
    linear-gradient(135deg, #f3ece2, #e9e0d3);
}
.media-glyph svg { width: 64px; height: 64px; }
.card-type {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 9px;
  border-radius: 999px; background: rgba(28, 25, 23, .82); color: #fff;
  font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em;
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.card-kicker {
  margin: 0; font-size: .72rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .1em; color: var(--accent);
}
.recipe-card h2 { font-size: 1.12rem; margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .84rem; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item svg { width: 15px; height: 15px; }
.card-allergens { display: flex; flex-wrap: wrap; gap: 5px; }
.card-foot { margin: auto 0 0; padding-top: 4px; color: var(--muted); font-size: .75rem; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 30px; }
.page-count { color: var(--muted); font-size: .88rem; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 56px 24px; background: var(--surface);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty-state h1, .empty-state h2 { margin: 0; }
.empty-state p { color: var(--muted); max-width: 46ch; margin: 0 0 8px; }
.empty-art { color: #b9ac9a; margin-bottom: 6px; }
.empty-art svg { width: 72px; height: 72px; }

/* Detail */
.breadcrumb { margin-bottom: 18px; }
.breadcrumb a {
  display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
  text-decoration: none; font-weight: 650; font-size: .9rem;
}
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb svg { width: 16px; height: 16px; }
.recipe-head {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 34px; align-items: start; margin-bottom: 30px;
}
.recipe-media {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
}
.recipe-media img { width: 100%; height: 100%; object-fit: cover; }
.recipe-media.is-empty { aspect-ratio: 16 / 7; }
.media-empty-note {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #a1947f;
}
.recipe-intro { padding-top: 4px; }
.kicker-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.kicker-row .badge { position: static; }
.kicker {
  font-size: .74rem; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.recipe-intro h1 { margin-bottom: 10px; }
.recipe-desc { color: var(--muted); font-size: 1.05rem; max-width: 58ch; }
.meta-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0; margin: 20px 0; padding: 12px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.meta-grid div { padding: 0 12px; border-left: 1px solid var(--line); }
.meta-grid div:first-child { padding-left: 0; border-left: 0; }
.meta-grid dt {
  font-size: .68rem; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.meta-grid dd { margin: 2px 0 0; font-weight: 750; font-size: 1rem; }
.allergen-box {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: 0 0 12px; border-radius: var(--radius-sm);
  background: #fff7ed; border: 1px solid #fed7aa;
}
.allergen-label {
  font-size: .7rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #9a3412; padding-top: 2px;
}
.tag-row { margin-bottom: 18px; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.recipe-actions form { margin: 0; }
.updated { color: var(--muted); font-size: .82rem; margin: 0; }

.video-block { margin: 0 0 30px; }
.video-block h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.video-embed {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: #000; border: 1px solid var(--line);
  max-width: 760px;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-note { color: var(--muted); font-size: .82rem; margin: 8px 0 0; }
.video-link {
  display: flex; align-items: center; gap: 14px; max-width: 520px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow);
}
.video-link:hover { border-color: var(--line-strong); }
.video-link strong { display: block; }
.video-link small { color: var(--muted); }
.video-link-icon {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink);
}
.video-link-icon svg { width: 24px; height: 24px; }
.video-link .external { margin-left: auto; width: 16px; height: 16px; color: var(--muted); }

.recipe-columns {
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 30px; align-items: start;
}
.ingredients-panel {
  position: sticky; top: 84px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.scale-control {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface-2); border-radius: 999px; padding: 3px;
}
.scale-control > span { font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0 5px; }
.scale-control a {
  padding: 4px 9px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: .8rem; font-weight: 700;
}
.scale-control a:hover { background: #fff; color: var(--ink); }
.scale-control a.is-active { background: var(--dark); color: #fff; }
.ing-group { margin-bottom: 14px; }
.ing-group h3 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); margin: 0 0 4px;
}
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing label {
  display: flex; align-items: flex-start; gap: 9px; padding: 7px 2px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.ing:last-child label { border-bottom: 0; }
.ing-check { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.ing-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; font-size: .95rem; }
.ing-qty { font-weight: 750; white-space: nowrap; }
.ing-name { }
.ing-note { color: var(--muted); font-size: .86rem; font-style: italic; }
.ing.is-optional .ing-name { color: var(--muted); }
.tag-optional {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 1px 6px;
}
.ing.is-checked { opacity: .55; }
.ing.is-checked .ing-name { text-decoration: line-through; }
.scale-note { color: var(--muted); font-size: .75rem; margin: 12px 0 0; }

.method-panel h2 { margin-bottom: 14px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.step:first-child { padding-top: 0; }
.step-number {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 800; font-size: 1rem;
}
.step-text { margin: 4px 0 0; font-size: 1.04rem; line-height: 1.6; }
.step-timer {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong);
  color: var(--muted); font-size: .78rem; font-weight: 700;
}
.chef-notes {
  margin-top: 26px; padding: 16px 18px; border-radius: var(--radius);
  background: #fffbeb; border: 1px solid #fde68a;
}
.chef-notes h2 { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: #92400e; }
.notes-body p:last-child { margin-bottom: 0; }

/* Cook mode */
.cookmode {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: #14110f; color: #faf7f2; padding: 22px;
}
.cookmode-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cookmode-progress {
  font-size: .8rem; font-weight: 750; letter-spacing: .14em;
  text-transform: uppercase; color: #d6a469;
}
.cookmode .button { background: #251f1a; border-color: #3a312a; color: #faf7f2; }
.cookmode .button-primary { background: var(--accent); border-color: var(--accent); }
.cookmode-main {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 18px; max-width: 1000px; margin: 0 auto; width: 100%;
}
.cookmode-index { font-size: 1rem; font-weight: 800; color: #d6a469; letter-spacing: .1em; }
.cookmode-text {
  font-size: clamp(1.7rem, 3.4vw, 2.9rem); line-height: 1.35; font-weight: 600;
  margin: 0; letter-spacing: -.01em;
}
.cookmode-timer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.timer-display { font-family: var(--mono); font-size: 2rem; font-weight: 700; min-width: 108px; }
.cookmode-nav {
  display: flex; justify-content: space-between; gap: 14px;
  max-width: 1000px; margin: 0 auto; width: 100%;
}
.cookmode-nav .button { min-height: 52px; min-width: 150px; font-size: 1rem; }

/* Forms */
.page-form .page-head { margin-bottom: 20px; }
.recipe-form { display: flex; flex-direction: column; gap: 18px; max-width: 1020px; }
.form-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.form-card > h2 { margin-bottom: 14px; }
.form-card > h2:not(:first-child) { margin-top: 20px; }
.form-card > .field + .field { margin-top: 16px; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 { margin-bottom: 2px; }
.card-head .help { margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label {
  font-size: .82rem; font-weight: 700; color: #44403c;
}
.field-label { display: block; margin-bottom: 5px; }
.input, .field input[type="text"], .field input[type="url"], .field input[type="password"],
.field input[type="number"], .field input[type="search"], .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 84px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); outline: 3px solid rgba(180, 83, 9, .16); outline-offset: 0;
}
.help { color: var(--muted); font-size: .78rem; margin: 0; line-height: 1.45; }
.error { color: var(--danger); font-size: .8rem; font-weight: 600; margin: 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-alert {
  background: var(--danger-soft); border: 1px solid #fecaca; color: #7f1d1d;
  padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
}
.form-alert ul { margin: 0; padding-left: 18px; }
.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.segmented-item { position: relative; cursor: pointer; }
.segmented-item input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-item span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 6px 16px; border-radius: 8px;
  font-size: .9rem; font-weight: 650; color: var(--muted);
}
.segmented-item:hover span { background: #fff; color: var(--ink); }
.segmented-item:has(input:checked) span,
.segmented-item input:checked + span { background: var(--dark); color: #fff; }
.segmented-item:has(input:focus-visible) span { outline: 3px solid var(--accent); }
.check-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: #fff; font-size: .84rem; font-weight: 600;
}
.check-chip input { width: 16px; height: 16px; accent-color: var(--accent); }
.check-chip:has(input:checked) { background: var(--accent-soft); border-color: #f0b775; color: var(--accent-ink); }
.allergen-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

.media-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.image-picker { display: flex; gap: 14px; align-items: flex-start; }
.image-preview { width: 132px; height: 99px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.image-picker-controls { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: .82rem; }
.image-picker-controls a { color: var(--accent-ink); }
.image-picker-controls input[type="file"] { font-size: .78rem; max-width: 100%; }

.formset { display: flex; flex-direction: column; gap: 8px; }
.ing-editor-head, .ing-editor-row {
  display: grid; gap: 7px; align-items: center;
  grid-template-columns: 104px 72px 84px minmax(140px, 1.5fr) minmax(110px, 1fr) auto 82px;
}
.ing-editor-head {
  padding: 0 2px; font-size: .68rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.ing-editor-row, .step-editor-row {
  padding: 7px; border-radius: var(--radius-sm); border: 1px solid transparent;
}
.ing-editor-row:nth-child(odd), .step-editor-row:nth-child(odd) { background: #faf6f0; }
.ing-editor-row .input, .step-editor-row .input { min-height: 40px; padding: 7px 9px; font-size: .9rem; }
.ing-editor-row .input { background: #fff; }
.optional-field { min-height: 40px; font-size: .74rem; gap: 4px; white-space: nowrap; }
.optional-field input { width: 15px; height: 15px; }
input[name$="-DELETE"] { display: none !important; }
.formset-row.is-removed { opacity: .5; background: #f5efe6 !important; }
.formset-row.is-removed .input { text-decoration: line-through; }
.row-remove {
  border: 0; background: transparent; color: var(--muted); font-size: .74rem;
  font-weight: 650; cursor: pointer; padding: 6px 4px; text-decoration: underline;
  text-underline-offset: 2px; white-space: nowrap;
}
.row-remove:hover { color: var(--danger); }
.row-errors { grid-column: 1 / -1; }
.row-errors ul, .errorlist { margin: 2px 0 0; padding-left: 18px; color: var(--danger); font-size: .8rem; }
.step-editor-row {
  display: grid; gap: 8px; align-items: start;
  grid-template-columns: 44px minmax(0, 1fr) 104px 84px;
}
.step-badge {
  font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding-top: 12px;
}
.step-editor-row .textarea { background: #fff; }
.step-editor-row .timer-input { min-height: 40px; }
.step-editor-row .row-errors { grid-column: 1 / -1; }
.form-actions {
  position: sticky; bottom: 16px; z-index: 20;
  display: flex; justify-content: flex-end; gap: 10px;
  width: max-content; max-width: 100%; margin: 4px 0 0 auto; padding: 9px;
  background: rgba(255, 253, 249, .96);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 34px rgba(28, 25, 23, .16);
  backdrop-filter: blur(10px);
}
.form-actions .button { min-height: 44px; }
.button-danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
.button-danger-quiet:hover { background: var(--danger-soft); border-color: #fecaca; color: #7f1d1d; }

/* Team */
.role-guide {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.role-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.role-card h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); margin-bottom: 3px; }
.role-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th, .data-table td {
  text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); background: #faf6f0;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.is-inactive { opacity: .55; }
.member-cell { display: flex; align-items: center; gap: 10px; }
.member-cell span span:not(.avatar) { display: block; }
.member-cell small { display: block; color: var(--muted); }
.member-cell .chip { display: inline-flex; margin-left: 5px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form select {
  min-height: 36px; padding: 5px 26px 5px 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; font-size: .85rem;
}

/* Auth */
.auth-main { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 220px); }
.auth-wrap { width: 100%; display: flex; justify-content: center; }
.auth-card {
  width: min(100%, 430px); margin-inline: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: flex-start;
}
.auth-card-wide { width: min(100%, 640px); }
.auth-card h1 { font-size: 1.9rem; margin-bottom: 4px; }
.auth-card .lede { margin-bottom: 20px; }
.auth-card form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.auth-card .field { width: 100%; }
.auth-help { color: var(--muted); font-size: .84rem; margin: 18px 0 0; }
.auth-card .form-actions { justify-content: flex-end; }

/* Responsive */
@media (max-width: 1024px) {
  .recipe-head { grid-template-columns: 1fr; gap: 20px; }
  .recipe-media { aspect-ratio: 16 / 10; }
  .recipe-columns { grid-template-columns: 1fr; }
  .ingredients-panel { position: static; }
  .field-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ing-editor-head { display: none; }
  .ing-editor-row { grid-template-columns: 1fr 1fr 1fr; }
  .ing-editor-row input[name$="-item"] { grid-column: span 2; }
  .step-editor-row { grid-template-columns: 32px minmax(0, 1fr) 90px; }
  .step-editor-row .row-remove { grid-column: 2 / -1; justify-self: start; }
}
@media (max-width: 760px) {
  .topbar-inner { padding: 8px 14px; gap: 12px; flex-wrap: wrap; }
  .primary-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .primary-nav a { padding: 8px 10px; white-space: nowrap; }
  .account-text { display: none; }
  .page { padding: 22px 14px 56px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .filters { padding: 10px; }
  .search-field { flex-basis: 100%; }
  .select-field { flex: 1 1 130px; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .meta-grid div:nth-child(3) { padding-left: 0; border-left: 0; }
  .meta-grid div:nth-child(3), .meta-grid div:nth-child(4) { border-top: 1px solid var(--line); padding-top: 8px; }
  .field-grid, .field-grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .media-form-grid { grid-template-columns: 1fr; }
  .role-guide { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }
  .ing-editor-row { grid-template-columns: 1fr 1fr; }
  .ing-editor-row input[name$="-item"] { grid-column: span 2; }
  .step-editor-row { grid-template-columns: 1fr 90px; }
  .step-badge { display: none; }
  .step-editor-row .row-remove { grid-column: 1 / -1; }
  .cookmode { padding: 16px; }
  .cookmode-nav .button { min-width: 0; flex: 1; }
  .site-foot { padding: 16px 14px 28px; flex-direction: column; gap: 4px; }
}
@media (max-width: 520px) {
  .recipe-grid { grid-template-columns: 1fr; }
  .image-picker { flex-direction: column; }
  .image-preview { width: 100%; height: 180px; }
  .form-actions { width: 100%; bottom: 8px; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .cookmode-text { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Basic print fallback if a detail page is printed directly */
@media print {
  .topbar, .site-foot, .recipe-actions, .breadcrumb, .cookmode, .messages, .video-block { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .recipe-head, .recipe-columns { grid-template-columns: 1fr; }
  .ingredients-panel { position: static; box-shadow: none; border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
