/* static/css/app.css */
@import url('tokens.css');

/* ── Global resets ── */
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--surface);
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* ── Token-driven Bootstrap overrides ── */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ── Workspace grid (animated chat-primary ↔ split) ── */
.workspace {
  display: none;   /* hidden until JS adds .workspace--active */
  grid-template-columns: var(--chat-col) 1px var(--recipe-col);
  height: calc(100vh - 56px);
  overflow: hidden;
  border-top: 1px solid var(--border);
  --chat-col: 100%;
  --recipe-col: 0px;
}
.workspace.workspace--active { display: grid; }

/* Desktop-only state classes: inert on tablet/mobile via the media query below. */
@media (min-width: 1024px) {
  .workspace {
    transition: grid-template-columns 400ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .workspace.workspace--split {
    --chat-col: minmax(380px, 40%);
    --recipe-col: 1fr;
  }
  .workspace.workspace--chat-only,
  .workspace.workspace--collapsed {
    --chat-col: 1fr;
    --recipe-col: 0px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace { transition: none; }
}

.workspace__divider {
  background: var(--border);
  transition: opacity 300ms ease;
}
@media (min-width: 1024px) {
  .workspace.workspace--chat-only .workspace__divider,
  .workspace.workspace--collapsed .workspace__divider { opacity: 0; }
  .workspace.workspace--split .workspace__divider { opacity: 1; }
}

/* ── Show-recipe pill — appears when workspace is collapsed ── */
.show-recipe-pill {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: none;  /* shown only in collapsed state on desktop */
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  z-index: 20;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.show-recipe-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.show-recipe-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (min-width: 1024px) {
  .workspace.workspace--collapsed .show-recipe-pill {
    display: inline-flex;
  }
}

/* ── Chat pane ── */
.chat-pane {
  background: var(--surface-sunken);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-pane__head {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-pane__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.chat-pane__body {
  flex: 1;
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* Chat message column: centered on full-width, naturally left-anchored when pane narrows.
   Scope to assistant-side content only — user bubbles rely on `align-self: flex-end`
   to stay right-anchored, which `margin: auto` would otherwise override. */
.chat-pane__body {
  --chat-content-max: 760px;
}
.chat-pane__body > .bubble:not(.bubble--user),
.chat-pane__body > .message.ai-response,
.chat-pane__body > .regen-offer {
  max-width: var(--chat-content-max);
  margin-left: auto;
  margin-right: auto;
}

.chat-pane__footer {
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 12px 14px;
  box-sizing: border-box;
}

/* ── Floating-card composer ── */
.chat-composer {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-composer textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  font-family: var(--font-ui);
  min-height: calc(2 * 1.5em + 8px);
  max-height: calc(6 * 1.5em + 8px);
  overflow-y: auto;
  padding: 4px 0;
}

.chat-composer textarea::placeholder { color: var(--text-muted, var(--ink-light)); }

.chat-composer__send {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, transform 80ms ease;
}

.chat-composer__send:active { transform: scale(0.92); }

.chat-composer__send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-composer__send--stop { background: #e05252; }

.chat-composer__hint {
  font-size: 11px;
  color: var(--ink-light, var(--border-strong));
  text-align: center;
  padding: 5px 0 0;
}

/* ── Chat bubbles ── */
.bubble {
  max-width: 88%;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  position: relative;
}

.bubble--user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--ink);
}

/* (0,2,0) beats .bubble__ts (0,1,0) — keeps timestamp in normal flow */
.bubble--user .bubble__ts {
  position: static;
  display: block;
  text-align: right;
  margin-top: 6px;
}

.bubble__sender {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bubble--assistant {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  width: 100%;
  padding-left: 44px;
}

.bubble__avatar {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.bubble__phase {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bubble__phase--writing     { color: var(--info); background: var(--info-soft); }
.bubble__phase--structuring { color: var(--warn); background: var(--warn-soft); }
.bubble__phase--ready       { color: var(--success); background: var(--success-soft); }
.bubble__phase--error       { color: var(--error); background: var(--error-soft); }

.bubble__structuring-footer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warn);
  background: var(--warn-soft);
}

.bubble__body--serif {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.65;
}

.bubble__caret {
  display: inline-block;
  width: 1px;
  height: 13px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink { to { opacity: 0; } }

.bubble__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.bubble__footer .bubble__ts {
  position: static;
}

.bubble__copy-btn {
  background: none;
  border: none;
  padding: 2px 3px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-subtle);
  border-radius: 3px;
  opacity: 0.55;
  transition: opacity 0.15s;
  font-size: 11px;
}

.bubble__copy-btn:hover { opacity: 1; color: var(--ink-muted); }

.bubble__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.bubble__action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-ui);
}

.bubble__action:hover { color: var(--ink); border-color: var(--border-strong); }
.bubble__action--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.bubble__action--primary:hover { background: var(--accent-hover); }

.bubble--error-card {
  border: 1px solid var(--error-soft);
  border-left: 3px solid var(--error);
  background: var(--surface-raised);
}

.bubble__ts {
  font-size: 9.5px;
  color: var(--ink-subtle);
  position: absolute;
  right: 10px;
  bottom: 6px;
}

/* ── Three-dot loader ── */
.dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  margin: 0 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%       { opacity: 1;   transform: scale(1.1); }
}

/* Prep Talk — spring entry for chat bubbles */
@keyframes springUp {
  from { opacity: 0; transform: scale(0.82) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* Prep Talk — bouncing typing dots */
@keyframes bounceDot {
  0%, 100% { transform: translateY(0);    opacity: 0.55; }
  50%      { transform: translateY(-5px); opacity: 1;    }
}

/* ── Recipe pane ── */
.recipe-pane {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.recipe-pane__head {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.recipe-pane__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}

.recipe-pane__title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 4px;
  font-weight: 500;
}

.recipe-pane__body {
  flex: 1;
  min-height: 0;
  padding: 18px 28px;
  overflow-y: auto;
  position: relative; /* contains absolutely-positioned loaders (e.g. #recipe-loader) */
}

/* ── Pane loading overlay (sub-recipe drill-down, back-to-main, etc.) ── */
.pane-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 248, 239, 0.7); /* tinted to match --surface */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: all;
}
.pane-loading-overlay__msg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink, #3a2f23);
  background: var(--surface-raised, #fff);
  border: 1px solid var(--border, #e9d7bf);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(58, 47, 35, 0.12);
}

/* Inner slide-in reveal for recipe content — runs on state transition to split. */
@media (min-width: 1024px) {
  .workspace.workspace--chat-only .recipe-pane__body,
  .workspace.workspace--collapsed .recipe-pane__body {
    transform: translateX(40px);
    opacity: 0;
  }
  .workspace.workspace--split .recipe-pane__body {
    transform: translateX(0);
    opacity: 1;
    transition:
      transform 300ms cubic-bezier(0.22, 1, 0.36, 1) 150ms,
      opacity 300ms ease 150ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  .recipe-pane__body {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ── Recipe pane: neutralise legacy style.css white-text rules ──────────────
   style.css (loaded after app.css) has `header { color: white; background: gradient }`
   and `.jumbotron { color: #fff }` that hit <header class="jumbotron recipe-header">
   in recipe_frame.html, rendering all headings invisible against the cream surface.
   The compound selectors here (specificity 0,1,1 / 0,2,0) beat style.css's
   (0,0,1) and (0,1,0) rules regardless of load order.                         ── */
.recipe-pane__body header,
.recipe-pane__body .jumbotron {
  background: var(--surface-raised, #fff) !important;
  color: var(--ink, #3a2f23) !important;
  text-shadow: none !important;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════
   RECIPE PANE REDESIGN — new component classes
   ═══════════════════════════════════════════════════════════ */

/* ── Header: slim to match chat header height ── */
.recipe-pane__head {
  padding: 10px 14px 9px;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.recipe-pane__head-left { display: flex; flex-direction: column; min-width: 0; }
.recipe-pane__head-right { display: flex; gap: 6px; flex-shrink: 0; margin-left: 10px; }
.recipe-pane__title {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Shared pane button tokens ── */
.btn-rp {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-ui);
  line-height: 1.4;
}
.btn-rp--ghost   { background: var(--surface-raised); color: var(--ink-muted); }
.btn-rp--ghost:hover { background: var(--surface-sunken); }
.btn-rp--primary { background: var(--info); color: #fff; border-color: var(--info); }
.btn-rp--primary:hover { opacity: 0.9; }

@keyframes pulse-save {
  0%   { box-shadow: 0 0 0 0   rgba(var(--accent-rgb), 0.55); }
  50%  { box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0); }
  100% { box-shadow: 0 0 0 0   rgba(var(--accent-rgb), 0); }
}

.btn-rp--pulse {
  animation: pulse-save 450ms ease-out 2;
}

.btn-rp--icon {
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Hero card ── */
.recipe-hero {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 10px;
}
.recipe-hero__name {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 8px;
  line-height: 1.3;
}
.recipe-hero__desc {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  margin: 0 0 10px;
  line-height: 1.55;
}
.recipe-hero__pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.recipe-hero__pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  transition: background 0.15s;
}
.recipe-hero__pill:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Section cards ── */
.recipe-section {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
.recipe-section__head {
  padding: 6px 12px 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.recipe-section__body {
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

/* ── Overview stats row ── */
.recipe-overview-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.recipe-stat-item { display: flex; flex-direction: column; gap: 2px; }
.recipe-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.recipe-stat-value { font-size: 14px; color: var(--ink); font-weight: 500; }

/* ── Editable field (shared) ── */
.recipe-field {
  color: var(--ink);
  border-bottom: 1px dashed var(--border);
  outline: none;
  min-width: 60px;
  display: inline-block;
}
.recipe-field:focus { background: var(--surface-sunken); border-radius: 2px; }

/* ── Equipment pill tags ── */
.recipe-eq-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-eq-tag {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.recipe-eq-tag:focus { background: var(--surface-sunken); }

/* ── Prep step circles ── */
.recipe-step { display: flex; gap: 8px; margin-bottom: 10px; }
.recipe-step:last-child { margin-bottom: 0; }
.recipe-step__num {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 2px;
}
.recipe-step__body { flex: 1; min-width: 0; }
.recipe-step__title {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 4px;
}
.recipe-step__instructions { margin: 0; padding-left: 16px; }
.recipe-step__instructions li {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 2px;
}

/* ── Ingredients table ── */
.recipe-ing-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.recipe-ing-table th {
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
.recipe-ing-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface-sunken);
  color: var(--ink);
  vertical-align: middle;
}
.recipe-ing-table tr:last-child td { border-bottom: none; }
/* Sub-recipe row */
.recipe-ing-table tr.ing-row--subrecipe > td { background: var(--surface); }
/* Expand row */
.recipe-ing-table tr.ing-row--expand > td {
  background: var(--surface-sunken);
  padding: 8px 12px;
}
.ing-expand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.ing-expand-field { display: flex; flex-direction: column; gap: 3px; }
.ing-expand-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.ing-expand-value { font-size: 13px; color: var(--ink); }
/* Allergen pills */
.ing-allergen {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--error-soft);
  color: var(--error);
  display: inline-block;
  margin: 1px 1px 0 0;
}
.ing-allergen--none {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink-muted);
}
/* Sub-recipe badge */
.ing-sr-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
}
/* Sub-recipe link */
.ing-sr-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ing-sr-link:hover { text-decoration: underline; }
/* Expand toggle */
.ing-expand-toggle {
  cursor: pointer;
  color: var(--accent);
  font-size: 10px;
  text-align: center;
  user-select: none;
  width: 22px;
}
/* Delete button */
.ing-del-btn {
  font-size: 10px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--error);
  cursor: pointer;
}
.ing-del-btn:hover { background: var(--error-soft); }
/* Row action cell: → and ✕ side by side */
.ing-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
/* Sub-recipe open-page arrow button */
.ing-sr-open-btn {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  line-height: 1.4;
}
.ing-sr-open-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
/* Add row button */
.ing-add-btn {
  width: 100%;
  padding: 5px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  cursor: pointer;
  margin-top: 4px;
}
.ing-add-btn:hover { background: var(--surface-sunken); }
/* Cost summary strip */
.recipe-ing-summary {
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface-raised);
}
.recipe-ing-summary strong { color: var(--ink); }

/* ── Sticky save footer ── */
.recipe-pane__footer {
  position: sticky;
  bottom: 0;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(58,47,35,0.06);
}

.footer-msg {
  font-size: 11px;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-warn {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
}

.btn-save.unsaved::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  display: inline-block;
  margin-left: 8px;
  box-shadow: 0 0 0 2px #fff;
  vertical-align: middle;
}

/* ── Command bar (landing) ── */
.landing-shell {
  max-width: 900px;
  margin: 80px auto 40px;
  padding: 0 20px;
}

.landing-hero h1 {
  font-family: var(--font-serif);
  font-size: 34px;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 6px;
  text-align: center;
}

.landing-hero p {
  color: var(--ink-muted);
  font-size: 15px;
  text-align: center;
  margin-bottom: 22px;
}

/* ── Landing refusal banner (shown above the cmdbar when the model
   emits NO_RECIPE; the user stays on landing to edit and retry) ── */
.landing-refusal {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 16px 16px 18px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.08);
  animation: refusal-slide-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.landing-refusal[hidden] { display: none; }

@keyframes refusal-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.landing-refusal__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.25);
}

.landing-refusal__body {
  flex: 1;
  min-width: 0;
}

.landing-refusal__title {
  font-weight: 600;
  font-size: 14px;
  color: #78350f;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
  font-family: var(--font-ui);
}

.landing-refusal__reason {
  font-size: 13px;
  color: #78350f;
  line-height: 1.5;
  margin-bottom: 8px;
  opacity: 0.88;
}
.landing-refusal__reason:empty { display: none; }

.landing-refusal__hint {
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
  opacity: 0.8;
}
.landing-refusal__hint strong {
  color: #78350f;
  font-weight: 600;
  opacity: 1;
}

.landing-refusal__close {
  border: none;
  background: transparent;
  color: #a16207;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  margin-top: -2px;
  margin-right: -4px;
}
.landing-refusal__close:hover {
  background: rgba(245, 158, 11, 0.14);
  color: #78350f;
}
.landing-refusal__close:active { transform: scale(0.92); }

.cmdbar {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(58,47,35,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

/* Active state — the whole command bar lights up when the textarea (or
   anything inside) gains focus. Creates one clear "this is where you type"
   signal without cluttering the textarea itself with a ring. */
.cmdbar:focus-within {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent),
    0 6px 20px rgba(79, 70, 229, 0.12);
}

/* Legacy row wrapper — retained for any external refs but no longer used. */
.cmdbar__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.cmdbar__textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  padding: 4px 0;
  min-height: 90px;
  line-height: 1.5;
  width: 100%;
}

.cmdbar__textarea::placeholder { color: var(--ink-subtle); }

.cmdbar__hint {
  padding: 0 2px;
  font-size: 12px;
  color: var(--ink-subtle);
  line-height: 1.4;
}

/* Toolbar row below textarea — Customize (left) and Standard + Generate (right). */
.cmdbar__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.cmdbar__spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   Unified pill buttons — ghost (neutral) + primary (accent).
   One visual language across Customize, Standard, and Generate.
═══════════════════════════════════════════════════════════════ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
  border: 1px solid transparent;
  line-height: 1;
}
.pill:active { transform: scale(0.97); }
.pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

/* Ghost — Customize and Standard */
.pill--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-muted);
}
.pill--ghost:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Primary — Generate */
.pill--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}
.pill--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

.pill__icon {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
}
.pill__sparkle {
  font-size: 12px;
  opacity: 0.9;
  margin-left: 1px;
}
.pill__chevron {
  font-size: 9px;
  line-height: 1;
  opacity: 0.6;
  margin-left: 1px;
}

.pill__badge {
  background: var(--accent);
  color: #fff;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  margin-left: 2px;
}
.pill__badge[hidden] { display: none; }

/* ── Model picker (Standard / Extended popover) ── */
.model-picker {
  position: relative;
  display: inline-flex;
}

.model-menu {
  position: absolute;
  bottom: calc(100% + 8px);  /* floats above the pill */
  right: 0;
  width: 300px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 50;
  animation: model-menu-pop 0.16s ease-out;
  transform-origin: bottom right;
}
.model-menu[hidden] { display: none; }

@keyframes model-menu-pop {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.model-menu__item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: background 0.15s ease;
}
.model-menu__item + .model-menu__item { margin-top: 2px; }
.model-menu__item:hover { background: var(--surface); }

.model-menu__item--active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.model-menu__item--active:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.model-menu__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.model-menu__label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: -0.005em;
  flex: 1;
}

.model-menu__check {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.model-menu__item--active .model-menu__check {
  opacity: 1;
  transform: scale(1);
}

.model-menu__desc {
  font-size: 11.5px;
  color: var(--ink-subtle);
  line-height: 1.4;
}

/* Small-screen: anchor menu to the left so it doesn't clip off-viewport */
@media (max-width: 520px) {
  .model-menu {
    right: auto;
    left: 0;
    transform-origin: bottom left;
    width: 260px;
  }
}

/* ── Reasoning effort picker (Auto / Minimal / Low / Medium / High / Extreme) ── */
.effort-picker {
  position: relative;
  display: inline-flex;
  margin-left: 6px;
}

.effort-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--surface-raised, #fff);
  border: 1px solid var(--border, #e9d7bf);
  border-radius: 12px;
  padding: 6px;
  box-shadow:
    0 12px 32px rgba(58, 47, 35, 0.10),
    0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 50;
  animation: model-menu-pop 0.16s ease-out;
  transform-origin: bottom right;
}
.effort-menu[hidden] { display: none; }

.effort-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.effort-menu__item + .effort-menu__item { margin-top: 2px; }
.effort-menu__item:hover { background: var(--surface); }

.effort-menu__item--active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.effort-menu__item--active:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.effort-menu__item--locked,
.effort-menu__item[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.effort-menu__item--locked:hover,
.effort-menu__item[aria-disabled="true"]:hover {
  background: transparent;
}

.effort-menu__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.effort-menu__label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.effort-menu__check {
  font-size: 12px;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.effort-menu__item--active .effort-menu__check {
  opacity: 1;
  transform: scale(1);
}

.effort-menu__desc {
  font-size: 11.5px;
  color: var(--ink-subtle);
  line-height: 1.4;
}

@media (max-width: 520px) {
  .effort-menu {
    right: auto;
    left: 0;
    transform-origin: bottom left;
    width: 240px;
  }
}

/* Legacy — keep for any page still referencing .model-pill. */
.model-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-ui);
}

/* ── Filter chips ── */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-ui);
}

.chip.chip--active {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--ink);
  font-weight: 500;
}

.chip__count {
  background: var(--accent);
  color: #fff;
  border-radius: 9999px;
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 4px;
}

/* Status chips row (Cuisine 2 / Dietary 1 / Allergies 3) — each hidden
   by default, surfaces only when that category has selections.
   Collapses to 0 height when all three are hidden. */
.chips--status { margin-top: 10px; }
.chips--status:empty { display: none; }

/* ── Advanced sheet ── */
.adv-sheet {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-top: 12px;
  display: none;
}

.adv-sheet.adv-sheet--open { display: block; }

.adv-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.adv-sheet__head h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  margin: 0;
  color: var(--ink);
}

.adv-sheet__close {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 16px;
  cursor: pointer;
}

.adv-group { margin-bottom: 18px; }

.adv-group__label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   Pantry Board — bento-grid of category cards inside adv-sheet.
   Replaces the legacy linear form of stacked Select2 dropdowns.
═══════════════════════════════════════════════════════════════ */

.pantry-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pantry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.pantry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  position: relative;
  overflow: hidden;
}

.pantry-card::before {
  /* subtle gradient sheen on hover */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.pantry-card:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.pantry-card:hover::before { opacity: 1; }

.pantry-card--active {
  border-color: rgba(79, 70, 229, 0.55);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.15);
}

.pantry-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.pantry-card__icon {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08));
}

.pantry-card__title {
  flex: 1;
  letter-spacing: -0.005em;
}

.pantry-card__count {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.6);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}
.pantry-card__count.has-count {
  opacity: 1;
  transform: scale(1);
}

.pantry-card__body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.pantry-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
  user-select: none;
}
.pantry-chip:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.4);
  color: #4f46e5;
}
.pantry-chip:active {
  transform: scale(0.96);
}
.pantry-chip--active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: pantry-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pantry-chip--active:hover {
  background: linear-gradient(135deg, #5153e6, #7c3aed);
  color: #fff;
}

/* Allergies: warning-tinted when active */
.pantry-chip--warn.pantry-chip--active {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.pantry-chip--warn.pantry-chip--active:hover {
  background: linear-gradient(135deg, #d97706, #dc2626);
}

@keyframes pantry-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.pantry-hidden-select {
  /* Hidden from view but in the form, so backend still gets values */
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}

/* ── Servings stepper ── */
.pantry-card--compact .pantry-card__body { margin-top: 4px; }

.pantry-card__body--stepper {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 0 2px;
}

.pantry-step {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pantry-step:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}
.pantry-step:active { transform: scale(0.95); }

.pantry-stepper__input {
  border: none;
  text-align: center;
  width: 60px;
  font-size: 26px;
  font-weight: 700;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  padding: 0;
}
.pantry-stepper__input:focus {
  outline: none;
  color: #4f46e5;
}
.pantry-stepper__input::placeholder {
  color: var(--ink-subtle);
  font-weight: 500;
}

/* ── Live summary ribbon ── */
.pantry-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 12px;
  font-size: 13px;
  position: relative;
  overflow: hidden;
}
.pantry-ribbon::after {
  /* shimmer sweep */
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.28),
    transparent
  );
  animation: pantry-shimmer 5s linear infinite;
  pointer-events: none;
}
@keyframes pantry-shimmer {
  0% { left: -100%; }
  60% { left: 100%; }
  100% { left: 100%; }
}

.pantry-ribbon__icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.4));
}

.pantry-ribbon__label {
  color: var(--ink-subtle);
  font-weight: 500;
  flex-shrink: 0;
}

.pantry-ribbon__text {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Responsive: stack cards on small screens */
@media (max-width: 520px) {
  .pantry-grid { grid-template-columns: 1fr; }
  .pantry-card { padding: 11px 13px 13px; }
  .pantry-chip { font-size: 12px; padding: 4.5px 10px; }
}

/* ── Recent recipes row ── */
.recent-row {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.recent-card {
  flex: 1;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s;
}

.recent-card:hover { border-color: var(--border-strong); color: var(--ink); }

.recent-card__label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}

.recent-card__title {
  font-family: var(--font-serif);
  font-size: 14px;
  margin-bottom: 2px;
}

.recent-card__meta { font-size: 10px; color: var(--ink-muted); }

/* ── History button ── */
.history-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(58,47,35,0.08);
  text-decoration: none;
}

/* ── Workspace visibility toggle ── */

/* ── Tool buttons in chat head ── */
.toolbtn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
}

.toolbtn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Responsive ── */

/* Tablet: 768–1023px — two-tab layout */
@media (min-width: 768px) and (max-width: 1023px) {
  .workspace {
    display: block;
  }
  .workspace.workspace--active {
    display: block;
  }
  .workspace__tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
  }
  .workspace__tab {
    padding: 10px 20px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-family: var(--font-ui);
    border-bottom: 2px solid transparent;
  }
  .workspace__tab.tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }
  .workspace__tab .tab-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warn);
    margin-left: 6px;
    vertical-align: middle;
  }
  .workspace__tab.tab--dirty .tab-dot { display: inline-block; }
  .chat-pane { display: none; }
  .chat-pane.pane--active { display: flex; height: calc(100vh - 56px - 44px); }
  .recipe-pane { display: none; }
  .recipe-pane.pane--active { display: flex; height: calc(100vh - 56px - 44px); }
  .workspace__divider { display: none; }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
  .workspace {
    display: block;
  }
  .workspace.workspace--active {
    display: block;
  }
  .workspace__divider, .workspace__tabs { display: none; }
  .chat-pane { height: calc(100vh - 56px); min-height: unset; }
  .recipe-pane { display: none; }

  .recipe-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-raised);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(58,47,35,0.12);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    max-height: 90vh;
    overflow-y: auto;
  }
  .recipe-sheet.sheet--open {
    transform: translateY(50%);
  }
  .recipe-sheet.sheet--fullscreen {
    transform: translateY(0);
  }
  .recipe-sheet__handle {
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 9999px;
    margin: 10px auto 0;
    cursor: grab;
  }
  .recipe-sheet__save-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
  }
}

/* ═══════════════════════════════════════════════════════════
   RECIPE PANE EDITORIAL REDESIGN — rp-* component classes
   ═══════════════════════════════════════════════════════════ */

/* ── Persistent hero bar ── */
.rp-hero {
  background: linear-gradient(135deg, #2e1f10 0%, #5a3010 60%, #7a4020 100%);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.rp-hero__left  { min-width: 0; }
.rp-hero__badge {
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 208, 138, .65);
  font-weight: 600;
  margin-bottom: 3px;
}
.rp-hero__name {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 15px;
  color: #fff;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-hero__stats { display: flex; gap: 18px; flex-shrink: 0; }
.rp-hero__stat  { text-align: center; }
.rp-hero__stat strong {
  display: block;
  font-size: 14px;
  color: #ffd08a;
  font-weight: 700;
  line-height: 1;
}
.rp-hero__stat span {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .5);
  margin-top: 2px;
  display: block;
}

/* Source-link pill — sits on dark hero gradient */
.rp-hero__source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  background: rgba(255, 208, 138, 0.10);
  border: 1px solid rgba(255, 208, 138, 0.30);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: #ffd08a;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.rp-hero__source-link:hover {
  background: rgba(255, 208, 138, 0.20);
  border-color: rgba(255, 208, 138, 0.55);
  color: #ffd08a;
  text-decoration: none;
}

/* ── Tab bar ── */
.rp-tabs {
  display: flex;
  background: var(--surface-sunken, #faf7f3);
  border-bottom: 1px solid var(--border, #e9ddd0);
  flex-shrink: 0;
}
.rp-tab {
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--ink-muted, #999);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  font-weight: 500;
  font-family: var(--font-ui);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  user-select: none;
}
.rp-tab:hover { color: var(--accent-hover, #6b3e1e); }
.rp-tab--active {
  color: var(--accent, #c17c3a);
  border-bottom-color: var(--accent, #c17c3a);
  font-weight: 600;
}

/* ── Save strip ── */
.rp-save-strip {
  background: #fffaf4;
  border-bottom: 1px solid #f0e8de;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-family: var(--font-ui);
}
.rp-save-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #b07030;
}
.rp-save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8a040;
  flex-shrink: 0;
}
.rp-save-strip--hidden { display: none; }
.rp-save-actions { display: flex; gap: 6px; }

/* ── Scrollable body ── */
.rp-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #e0d0bc) var(--surface-sunken, #faf7f3);
}
.rp-body::-webkit-scrollbar { width: 6px; }
.rp-body::-webkit-scrollbar-track { background: var(--surface-sunken, #faf7f3); }
.rp-body::-webkit-scrollbar-thumb { background: var(--border, #e0d0bc); border-radius: 999px; }

/* ── Tab panels ── */
.rp-panel { display: none; padding: 16px 18px; }
.rp-panel--active { display: block; }

.rp-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent, #c17c3a);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #e9ddd0);
}

/* ── Overview: 2-col field grid ── */
.rp-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.rp-field {
  padding: 7px 0;
  border-bottom: 1px solid var(--border, #f5f0ea);
}
.rp-field--wide { grid-column: span 2; }
.rp-field:last-child { border-bottom: none; }
.rp-field__lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-muted, #b0a090);
  font-weight: 600;
  margin-bottom: 3px;
  font-family: var(--font-ui);
}
.rp-field__val {
  font-size: 13px;
  color: var(--ink, #2c2218);
  border-bottom: 1px dashed transparent;
  display: inline-block;
  transition: border-color .12s;
  cursor: text;
  font-family: var(--font-ui);
  line-height: 1.5;
  min-width: 40px;
}
.rp-field__val:hover,
.rp-field__val:focus { border-bottom-color: var(--accent, #c17c3a); outline: none; }
.rp-field__val--desc { font-style: italic; color: var(--ink-muted, #666); font-size: 12px; }
.rp-field__select {
  font-size: 13px;
  color: var(--ink, #2c2218);
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border, #e0d0bc);
  outline: none;
  padding: 0;
  font-family: var(--font-ui);
  cursor: pointer;
}
.rp-field__select:focus { border-bottom-color: var(--accent, #c17c3a); }

/* ── Equipment tab ── */
.rp-eq-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.rp-eq-tag {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--border, #e0d0bc);
  background: var(--surface-sunken, #faf7f3);
  font-size: 12px;
  color: var(--ink, #5a3a20);
  cursor: text;
  font-family: var(--font-ui);
  transition: border-color .12s, background .12s;
}
.rp-eq-tag:hover,
.rp-eq-tag:focus { background: #f0e4d4; border-color: var(--accent, #c17c3a); outline: none; }

/* ── Prep Steps tab ── */
.rp-step-list { display: flex; flex-direction: column; gap: 16px; }
.rp-step-item { display: flex; gap: 12px; align-items: flex-start; }
.rp-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a3010, #7a4020);
  color: #ffd08a;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-family: var(--font-ui);
}
.rp-step-content { flex: 1; min-width: 0; }
.rp-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #2c2218);
  margin-bottom: 5px;
  cursor: text;
  border-bottom: 1px dashed transparent;
  display: inline-block;
  font-family: var(--font-ui);
}
.rp-step-title:hover,
.rp-step-title:focus { border-bottom-color: var(--accent, #c17c3a); outline: none; }
.rp-step-instructions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  margin: 0;
}
.rp-step-instructions li {
  font-size: 12.5px;
  color: var(--ink-muted, #5a4530);
  line-height: 1.6;
  padding-left: 13px;
  position: relative;
  cursor: text;
  font-family: var(--font-ui);
}
.rp-step-instructions li::before {
  content: '·';
  position: absolute;
  left: 2px;
  color: var(--accent, #c17c3a);
}

/* ── Ingredients tab: modernised table ── */
.rp-ing-table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.rp-ing-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-family: var(--font-ui); }
.rp-ing-table thead th {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted, #b0a090);
  font-weight: 700;
  padding: 0 8px 8px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border, #e9ddd0);
}
.rp-ing-table thead th:first-child { padding-left: 0; }
.rp-ing-table thead th.rp-col-num { text-align: right; }
.rp-ing-table tbody tr { transition: background .1s; }
.rp-ing-table tbody tr:hover { background: var(--surface-sunken, #faf7f3); }
.rp-ing-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border, #f5f0ea);
  color: var(--ink, #2c2218);
  vertical-align: middle;
}
.rp-ing-table tbody td:first-child { padding-left: 0; }
.rp-ing-table tbody td.rp-col-num { text-align: right; color: var(--ink-muted, #888); font-variant-numeric: tabular-nums; }
.rp-ing-table tbody td.rp-col-cost { text-align: right; color: var(--accent, #c17c3a); font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-ing-table tbody td.rp-col-total { text-align: right; font-weight: 700; color: var(--ink, #2c2218); font-variant-numeric: tabular-nums; }
.rp-ing-name { font-weight: 500; }
.rp-ing-summary {
  display: flex;
  gap: 20px;
  padding: 10px 0 0;
  border-top: 1px solid var(--border, #e9ddd0);
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--ink-muted, #888);
  font-family: var(--font-ui);
  flex-wrap: wrap;
}
.rp-ing-summary strong { color: var(--ink, #2c2218); }
.rp-ing-actions { display: flex; gap: 6px; margin-bottom: 12px; }
.rp-add-btn {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px dashed var(--accent, #c17c3a);
  background: transparent;
  color: var(--accent, #c17c3a);
  cursor: pointer;
  font-weight: 500;
  font-family: var(--font-ui);
  transition: background .12s;
}
.rp-add-btn:hover, .rp-add-btn:focus { background: #fdf0e4; }

/* ── Recipe Costing Engine ─────────────────────────────────────── */

.rp-cost-strip {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border, #e0dbd2);
  border-bottom: 1px solid var(--border, #e0dbd2);
  background: #fafaf8;
  margin: 0 0 12px;
}

.rp-cost-cell {
  flex: 1;
  padding: 10px 14px;
  text-align: center;
  border-right: 1px solid var(--border, #e0dbd2);
}
.rp-cost-cell:last-child { border-right: none; }

.rp-cost-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #888;
  margin-bottom: 3px;
}

.rp-cost-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #222;
}

.rp-cost-sub {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* Badge variants */
.rp-cost-badge--green  { color: #2d6a4f; }
.rp-cost-badge--amber  { color: #b45309; }
.rp-cost-badge--red    { color: #dc2626; }
.rp-cost-badge--neutral{ color: #6b7280; }

.rp-cost-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: #aaa;
  background: #fafaf8;
  border-top: 1px solid var(--border, #e0dbd2);
  border-bottom: 1px solid var(--border, #e0dbd2);
  margin: 0 0 12px;
}

/* Costing tab breakdown table */
.rp-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rp-cost-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border, #e0dbd2);
}
.rp-cost-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border, #e0dbd2);
  vertical-align: middle;
}
.rp-cost-match--ok   { color: #2d6a4f; font-size: 12px; }
.rp-cost-match--warn { color: #b45309; font-size: 12px; }
.rp-cost-match--sub  { color: #6b5cff; font-size: 12px; }

.rp-cost-summary-row td {
  font-weight: 700;
  background: #f5f5f0;
  border-top: 2px solid var(--border, #e0dbd2);
}

/* Costing tab label unmatched warning */
.rp-cost-tab-warn { color: #b45309; }

/* Costing tab prominent CTA banner — surfaces unmatched ingredients
   so the matcher is the first thing the user sees, not a footnote. */
.rp-cost-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fff7e6 0%, #fef3e2 100%);
  border: 1px solid #f59e0b;
  border-left: 4px solid #b45309;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 14px;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.08);
}
.rp-cost-cta__body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.rp-cost-cta__icon {
  font-size: 22px;
  line-height: 1;
  color: #b45309;
  flex: 0 0 auto;
}
.rp-cost-cta__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rp-cost-cta__text strong {
  color: #7c2d12;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.rp-cost-cta__text span {
  color: #92400e;
  font-size: 12px;
  line-height: 1.3;
}
.rp-cost-cta__btn {
  flex: 0 0 auto;
  background: #b45309;
  color: #fff;
  border: 1px solid #92400e;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.05s;
  box-shadow: 0 1px 2px rgba(124, 45, 18, 0.2);
}
.rp-cost-cta__btn:hover { background: #92400e; }
.rp-cost-cta__btn:active { transform: translateY(1px); }
.rp-cost-cta__btn:focus-visible {
  outline: 2px solid #b45309;
  outline-offset: 2px;
}

/* ── My Products Only toggle ──────────────────────────────────── */
.pantry-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.pantry-toggle input { display: none; }

.pantry-toggle__track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #d1cfc9;
  border-radius: 10px;
  flex-shrink: 0;
  transition: background .2s;
}
.pantry-toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.pantry-toggle input:checked ~ .pantry-toggle__track {
  background: #2d6a4f;
}
.pantry-toggle input:checked ~ .pantry-toggle__track::after {
  transform: translateX(16px);
}
.pantry-toggle__label {
  font-size: 13px;
  color: #555;
}
.pantry-toggle input:checked ~ .pantry-toggle__label {
  color: #2d6a4f;
  font-weight: 600;
}

/* ── Nutrition panel ─────────────────────────────── */
.rp-nutr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.rp-nutr-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--color-border, #e5ddd3);
  color: var(--color-muted, #9a8c82);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.rp-nutr-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--color-border, #e5ddd3);
  vertical-align: middle;
}
.rp-nutr-summary-row td {
  border-top: 2px solid var(--color-border, #e5ddd3);
  border-bottom: none;
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--color-surface-raised, #fdf8f4);
}

/* ── Inline toggles under the prompt (products / equipment) ── */
.cmdbar__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding: 8px 2px 4px;
  align-items: center;
}
.cmdbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background .15s ease;
}
.cmdbar-toggle:hover {
  background: var(--surface-raised, rgba(0,0,0,0.03));
}
.cmdbar-toggle__icon {
  font-size: 14px;
  line-height: 1;
}
.cmdbar-toggle .pantry-toggle__label {
  font-size: 13px;
  color: var(--ink-subtle, #6b675f);
}

/* ══════════════════════════════════════════════════════════════════
   Chat polish (originally prep-talk) — promoted to global so the
   main recipe chat picks it up too. Layout/positioning still comes
   from the base rules above; this block only refreshes the look.
   ══════════════════════════════════════════════════════════════════ */

/* User bubble: terracotta gradient + rounded tail */
.bubble--user {
  background: linear-gradient(135deg, #c4693a 0%, #d4804f 100%);
  color: #fff;
  border: none;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 12px rgba(196, 105, 58, 0.30);
  animation: springUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Assistant bubble: floating card with left tail */
.bubble--assistant {
  background: #fff;
  border: none;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 2px 10px rgba(58, 47, 35, 0.09);
  animation: springUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}

/* Avatar: gradient circle with shadow (position stays absolute from base rule) */
.bubble__avatar {
  background: linear-gradient(135deg, #c4693a 0%, #8a3d1e 100%);
  box-shadow: 0 3px 10px rgba(196, 105, 58, 0.38);
  border-radius: 50%;
}

/* Sender name: accent colour, no uppercase */
.bubble__sender {
  color: var(--accent);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* Typing dots: bounce instead of pulse */
.dots span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  animation-name: bounceDot;
  animation-duration: 0.9s;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-iteration-count: infinite;
  animation-delay: 0s;
}
.dots span:nth-child(2) { animation-delay: 0.13s; }
.dots span:nth-child(3) { animation-delay: 0.26s; }

/* Status pill: pulsing dot before label */
@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}
.bubble__phase--writing {
  font-size: 10px;
  letter-spacing: 0.07em;
  padding: 3px 10px;
}
.bubble__phase--writing::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  animation: pulseDot 1.2s ease-in-out infinite;
}

/* Composer: rounded with focus ring + gradient send button */
.chat-composer {
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-sunken);
  padding: 8px 8px 8px 14px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.chat-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 105, 58, 0.10);
}
.chat-composer textarea {
  font-family: 'Inter', var(--font-ui);
  font-size: 13px;
}
.chat-composer__send {
  background: linear-gradient(135deg, #c4693a 0%, #d4804f 100%);
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(196, 105, 58, 0.30);
  transition: transform 0.12s, box-shadow 0.12s;
}
.chat-composer__send:hover {
  background: linear-gradient(135deg, #c4693a 0%, #d4804f 100%);
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(196, 105, 58, 0.42);
}
.chat-composer__send:active { transform: scale(0.93); }
