/* ===================================================================   Nibblr Design System - app.css
   All component classes for the Nibblr web frontend.
   Uses CSS custom properties for theming.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* UX-003 responsive tier boundaries (single source of truth; media queries
     cannot consume custom properties, so keep these numbers in sync by hand):
       desktop  min-width: 1025px  (default, no query)
       tablet   min-width: 768px and max-width: 1024px
       phone    max-width: 767px
     Login card stacking is deliberately pinned at max-width: 1024px. */
  --sidebar-rail-width: 64px;
  --tablet-list-width: 300px;

  /* Brand tokens */

  /* #1065 colour-role contract.
     Three roles per hue, and they are not interchangeable:
       --X       identity. Fills, borders, icons, chart marks. Never a label
                 colour on a tint of itself.
       --X-bg    the tint. An 8-digit hex, so the alpha composites against
                 whatever surface the component lands on.
       --X-text  the label colour used ON --X-bg. Solved to clear 5:1 against
                 --X-bg composited over the DARKEST surface a badge can sit on
                 (--bg-muted, the row-hover fill), which leaves headroom over
                 the 4.5:1 AA floor on parchment.
     The old single-value tokens doubled as both identity and label, which is
     how six of seven source badges shipped below AA. Adding a colour here
     means adding all three. See test/clj/nibblr_api/design_contrast_test.clj,
     which fails the build if any documented pair drops under 4.5:1. */

  /* Accent tokens (mapped to brand gold for backward compat) */

  /* Background tokens */
  /* Referenced by .badge-neutral and several panel rules but never defined,
     so `background: var(--bg-secondary)` resolved to nothing and those
     elements rendered transparent. Pinned to the muted surface (#1065). */

  /* Border tokens */

  /* Text tokens */
  /* Was #8B7060: 4.47:1 on parchment and 3.73:1 on --bg-muted, so ~197
     usages failed AA at rest or on hover. */
  --text-secondary: var(--text-secondary-app, #7A6153);
  /* A thin chevron for selects that hide the native arrow. Chrome pins the
     native arrow near the border whatever the padding, so on a pill it sits
     in the curve. The stroke is --text-secondary; a brand that changes that
     colour overrides --select-caret-brand to match. */
  --select-caret: var(--select-caret-brand, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%237A6153' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"));
  /* Was a second literal #8B7060, i.e. two names for one hex, which is how
     the two drifted apart. Aliased so the tertiary role cannot diverge. */
  --text-tertiary: var(--text-secondary);
  /* #1065 follow-through: --text-muted was documented as "decorative only",
     but the codebase used it as a THIRD TEXT TIER in 162 rules against just
     6 decorative ones, all at 2.42:1. There is no room for a third tier on
     this palette: --text-secondary is already 4.67:1 on --bg-muted, so any
     lighter tone fails AA by construction. The muted text role therefore
     collapses into secondary, and the genuinely decorative uses (dots,
     dividers, hairlines, which carry no information) move to
     --decorative-muted. */
  --text-muted: var(--text-secondary);
  /* Non-text only: never legal as a foreground colour. */
  --text-on-dark-muted: var(--text-on-dark-muted-app, #B8A090);

  /* Status tokens */

  /* Confidence tokens */

  /* Source tokens.
     One entry per data_source value that is actually live in the catalogue.
     Row counts from prod (#1065): cofid 2,332, canadian 1,876, norwegian
     1,531, swedish 1,410, frida 483, composite 424, nibblr 56, user_input
     30, pdf_upload 18, ai_generated 17, image_upload 2.
     `mcw` was renamed to `cofid` (McCance is superseded by CoFID and has
     zero live rows) and `usda` was deleted outright (zero live rows). */
  /* Composite is derived rather than a real source, so it is deliberately
     neutral: it should not read as provenance. */

  /* Info token */

  /* Typography */
  /* Typefaces moved to the brand token stylesheet (BRAND-001 palette
     track). They are brand vocabulary, not layout config: Nibblr is
     Roboto Slab + DM Sans, Canoli is Jost + Figtree. Defining them here
     would win the cascade over the palette, since the palette loads
     FIRST, and every brand would render in Nibblr's faces. */
}

/* Alpine.js cloak - hide elements until Alpine initialises */
[x-cloak] { display: none !important; }

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Script focus targets: a heading, message or fieldset given tabindex="-1" so a swap can move
   focus to it for screen readers. It is not a control, so no ring: Chrome draws its blue default
   on script focus even after a mouse click, once the clicked button has been swapped away.
   Controls keep their ring, including roving-tabindex tabs and options moved to with arrow keys. */
:is(h1, h2, h3, h4, h5, h6, p, div, fieldset, section, article, main)[tabindex="-1"]:not([role="tab"], [role="option"], [role="menuitem"], [role="radio"], [role="gridcell"], [role="treeitem"], [role="button"], [role="link"]):focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   Body Base
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 14px;
}

/* One shared placeholder colour (token), lighter than any filled-in text. */
input::placeholder, textarea::placeholder { color: var(--text-placeholder); opacity: 1; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 20px;
  border-radius: var(--radius-button, 7px);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-primary);
  background: var(--brand-gold);
  color: var(--brand-espresso);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--brand-gold-hover);
}

/* btn-ghost joins this rule. It had no icon sizing, so the first btn-ghost to
   carry a Lucide icon (the UX-006 "Create an editable copy" action) rendered
   the SVG at its natural 24px, making the button 40px tall beside 32px
   siblings and wide enough to wrap the row. Zero risk to existing usage:
   47 btn-ghost instances in the templates, none of them with an icon. */
.btn-primary i, .btn-primary svg,
.btn-ghost i, .btn-ghost svg,
.btn-secondary i, .btn-secondary svg {
  width: 14px;
  height: 14px;
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-button, 8px);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-primary);
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.btn-full-width {
  width: 100%;
  justify-content: center;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 20px;
  border-radius: var(--radius-button, 7px);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-primary);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--text-tertiary);
}

/* PLAT-008 Phase 3.2: SSO buttons (Google, LinkedIn).
   Sized to match the auth-form .btn-primary submit so the OAuth and
   email/password CTAs read as parallel choices. */
.btn-sso {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-sso i, .btn-sso svg, .btn-sso img {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

/* PLAT-008 Phase 3.3: per-provider tint on the icon so the two
   buttons read as parallel choices rather than identical pills.
   The button surface stays neutral (parchment) for legibility. */
.btn-sso--linkedin i, .btn-sso--linkedin svg {
  color: #0A66C2; /* hex-ok: third-party brand mark: LinkedIn blue */
}

.btn-sm {
  padding: 5px 14px;
  font-size: 12px;
}

.btn-teal {
  color: var(--accent-teal-text);
  border-color: var(--accent-teal);
}

.btn-teal:hover {
  background: var(--accent-teal-light);
  border-color: var(--accent-teal-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-button, 7px);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-primary);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-field-sm, 6px);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  height: 100vh;
  /* dvh tracks iPadOS/iOS Safari's dynamic toolbars; vh above is the
     fallback for engines without dvh (UX-003 iPad blank-band fix). */
  height: 100dvh;
  background: var(--bg-primary);
}

.app-main-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100vh;
}

.main-area {
  flex: 1;
  overflow-y: auto;
  /* Containing block for absolutely positioned children (.sr-only), so they
     cannot escape the scroll box and stretch the document. */
  position: relative;
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Action group in a page header / form footer: a horizontal row of controls
   (e.g. "Start with the assistant" + "New Recipe") with a consistent gap. */
.data-tool-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.data-tool-actions form {
  margin: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-card, 12px);
  border: 1px solid var(--border-primary);
  padding: 24px;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: var(--radius-chip-sm, 4px);
  padding: 4px 8px;
}

.badge i,
.badge svg {
  width: 12px;
  height: 12px;
}

.badge-curated {
  background: var(--source-cofid-bg);
  color: var(--source-cofid-text);
}

.badge-uploaded {
  background: var(--accent-orange-light);
  color: var(--accent-orange-text);
}

.badge-draft {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.badge-pass {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.badge-fail {
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
}

/* PLAT-023: recipe tags */
.recipe-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
/* display: contents so the pills and the add-tag input flow as one wrapping
   row; the input follows the last pill instead of dropping to its own line. */
.recipe-tags-pills { display: contents; }
.recipe-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-radius: var(--radius-chip-sm, 4px);
  padding: 4px 8px;
  font-size: 12px;
}
.recipe-tag-status { font-weight: 600; }
.recipe-tag-remove { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; line-height: 1; }
/* The add-tag input reads as an empty chip in the pill row: same height,
   same radius, dashed until it takes focus, then it widens and picks up the
   standard field focus ring. */
.recipe-tags-form { position: relative; flex: 0 1 auto; }
.recipe-tags-input {
  width: 9.5em;
  padding: 3px 8px; /* 1px less than the pill: the border makes up the height */
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-primary);
  background: transparent;
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-chip-sm, 4px);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, width 0.15s ease, background-color 0.15s ease;
}
.recipe-tags-input::placeholder { color: var(--text-placeholder); opacity: 1; }
.recipe-tags-input:hover { border-color: var(--text-secondary); }
.recipe-tags-input:focus {
  width: 14em;
  border-style: solid;
  border-color: var(--accent-teal);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}
.recipe-tag-suggestions {
  position: absolute; left: 0; min-width: 220px; top: calc(100% + 4px); z-index: 20;
  display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border-primary);
  border-radius: var(--radius-chip-sm, 4px);
}
.recipe-tag-suggestions:empty { display: none; }
.recipe-tag-suggestion { text-align: left; border: 0; background: transparent; padding: 6px 10px; cursor: pointer; }
.recipe-tag-suggestion:hover, .recipe-tag-suggestion:focus { background: var(--bg-muted); }
.recipe-tag-suggestion-create { font-weight: 600; }
.recipe-tags-error { flex-basis: 100%; color: var(--status-fail-text); font-size: 12px; margin: 0; }

/* PROD-021 recipe stage: the pill, the change panel and the history.
   Figma: Canoli Web frame 24 (1458:249). An open or live stage shows how far
   along it is as four bars; Parked a pause mark; Abandoned and Discontinued a
   stop mark. No butter: it stays rationed to the one AI action per page. */
/* The version badge and the stage share one line under the title. */
.recipe-meta-row { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.recipe-meta-row .version-badge { margin: 0; }

/* PLAT-024 6.3: "Created by ... · Last edited by ..., HH:MM" under the stage pills. */
.recipe-attribution { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }
/* The stage control's parts join the badge's row: the pill sits beside the
   badge, the Launched line breaks onto its own line, and the panel and
   history anchor to the row (it is position: relative). */
.recipe-meta-row > .recipe-stage { display: contents; }
.recipe-meta-break { flex-basis: 100%; height: 0; }
.recipe-stage { position: relative; }
.recipe-stage-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--bg-muted); color: var(--text-secondary);
}
.stage-pill-development, .stage-pill-scale_up { background: var(--info-bg); color: var(--info-text); }
.stage-pill-launched { background: var(--status-pass-bg); color: var(--status-pass-text); }
.stage-pill-parked { background: var(--status-warning-bg); color: var(--status-warning-text); }
.stage-pill-abandoned, .stage-pill-discontinued { background: var(--bg-muted); color: var(--text-muted); }
.stage-pill-none { background: transparent; border: 1px dashed var(--border-primary); color: var(--text-muted); }
.stage-pill-button, .stage-pill-readonly { cursor: pointer; font-family: inherit; }
.stage-pill-button:focus-visible, .stage-pill-readonly:focus-visible,
.stage-set-button:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
.stage-pill-chevron { font-size: 10px; }
/* Origin (frame 24 H3): a plain stage pill after the stage. A long supplier
   name is cut, not wrapped, so the chip stays one line. */
.origin-chip { max-width: 280px; }
.origin-chip > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.origin-option-label { min-width: 64px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.stage-mark { display: inline-flex; align-items: center; gap: 2px; }
.stage-mark-bar { width: 4px; height: 10px; border-radius: 1px; background: var(--border-primary); }
.stage-mark-bar.is-on { background: currentColor; }
.stage-mark-pause { width: 3px; height: 10px; border-radius: 1px; background: currentColor; }
.stage-mark-stop { width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.recipe-stage-since { font-size: 12px; color: var(--text-muted); }
.recipe-stage-since-launched { color: var(--status-pass-text); font-weight: 600; }
.stage-set-button {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 3px 10px; border-radius: 999px; background: transparent;
  border: 1px dashed var(--border-primary); color: var(--text-secondary);
}
.recipe-stage-line {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0; padding: 6px 12px; border-radius: var(--radius-banner, 10px);
  background: var(--info-bg); color: var(--info-text); font-size: 13px;
}
.recipe-stage-line-link {
  font: inherit; font-weight: 600; color: inherit; text-decoration: underline;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.stage-panel, .stage-history {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 440px; max-width: calc(100vw - 32px);
  background: var(--bg-surface); border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 16px);
  box-shadow: var(--shadow-lifted, 0 8px 24px color-mix(in srgb, var(--text-primary) 14%, transparent));
}
.stage-panel { padding: 16px 20px; }
.stage-panel form { display: flex; flex-direction: column; gap: 12px; }
.stage-panel-head { display: flex; align-items: center; gap: 8px; }
.stage-panel-title { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-right: auto; }
.stage-panel-now { font-size: 12px; color: var(--text-muted); }
.stage-group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-group-label {
  padding: 0; margin-bottom: 2px; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}
.stage-option {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px;
  border-radius: 8px; cursor: pointer;
}
.stage-option.is-picked { background: var(--bg-muted); }
.stage-radio { accent-color: var(--text-primary); margin: 0; }
.stage-option-meaning { font-size: 12px; color: var(--text-muted); }
.stage-panel-divider { height: 1px; background: var(--border-soft, var(--border-primary)); }
.stage-field { display: flex; flex-direction: column; gap: 6px; }
.stage-field-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.stage-field-label.is-error, .stage-field-hint.is-error { color: var(--status-fail-text); }
.stage-input {
  font: inherit; font-size: 13px; color: var(--text-primary);
  padding: 8px 12px; border: 1px solid var(--border-primary);
  border-radius: var(--radius-field, 10px); background: var(--bg-surface);
}
.stage-input:focus { outline: none; border-color: var(--text-primary); }
.stage-textarea { resize: vertical; min-height: 64px; border-radius: var(--radius-field-multiline, 10px); }
.stage-textarea.is-error { border-color: var(--status-fail); }
.stage-field-hint { font-size: 11px; color: var(--text-muted); }
.stage-notice { margin: 0; padding: 10px 12px; border-radius: var(--radius-banner, 10px); font-size: 12px; }
.stage-notice-info { background: var(--info-bg); color: var(--info-text); }
.stage-notice-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.stage-notice-warning strong { display: block; margin-bottom: 2px; }
.stage-notice-error { background: var(--status-fail-bg); color: var(--status-fail-text); }
.stage-panel-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-panel-spacer { flex: 1; }
.stage-panel-actions { display: inline-flex; gap: 8px; }
/* The tasting tick and Save and launch read as one unit, apart from plain Launch. */
.stage-save-launch { display: inline-flex; align-items: center; gap: 10px; }
.stage-tasting-tick { font-size: 13px; }
/* The panel's primary action is ink, not butter: butter stays rationed to
   the one AI action per page (Figma frame 24). Reuses .btn-primary's shape. */
.btn-primary.btn-ink { background: var(--brand-espresso); color: var(--bg-surface); }
.btn-primary.btn-ink:hover { background: var(--text-primary); }
.btn-primary.btn-ink:disabled { opacity: 0.35; cursor: not-allowed; }
.stage-history-link {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.stage-history { width: 600px; }
.stage-history-card { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.stage-history-head { display: flex; align-items: center; }
.stage-history-title { font-weight: 600; font-size: 16px; color: var(--text-primary); margin-right: auto; }
.stage-history-close, .stage-history-correct {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: none; border: 0; cursor: pointer;
}
/* PROD-021b (frame 24 I): the author's "Correct" link, top right of an entry. */
.stage-history-correct { flex: 0 0 auto; align-self: flex-start; padding: 4px 0 0; }
.stage-history-correct:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
.stage-history-why {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 16px;
  border-radius: 12px; background: var(--bg-muted);
}
.stage-history-why-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.stage-history-why-text { margin: 0; font-size: 14px; color: var(--text-primary); }
.stage-history-why-missing { color: var(--text-muted); }
.stage-history-meta { font-size: 11px; color: var(--text-muted); }
.stage-history-meta-sale { color: var(--status-pass-text); font-weight: 600; }
.stage-history-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.stage-history-list { list-style: none; margin: 0; padding: 0; }
.stage-history-entry {
  display: flex; gap: 14px; padding: 12px 0;
  border-top: 1px solid var(--border-soft, var(--border-primary));
}
.stage-history-entry.is-superseded { opacity: 0.55; }
.stage-history-entry.is-superseded .stage-history-reason { text-decoration: line-through; }
.stage-history-date {
  flex: 0 0 84px; font-family: var(--font-mono); font-size: 10px;
  color: var(--text-secondary); padding-top: 4px;
}
.stage-history-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stage-history-move { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-history-arrow { color: var(--text-muted); }
.stage-history-reason { margin: 0; font-size: 13px; color: var(--text-primary); }
@media (max-width: 640px) {
  .stage-panel, .stage-history { position: fixed; left: 16px; right: 16px; top: 72px; width: auto; max-height: calc(100vh - 96px); overflow-y: auto; }
  .stage-history-entry { flex-direction: column; gap: 6px; }
  .stage-history-date { flex-basis: auto; padding-top: 0; }
}

/* UI polish 2026-09-22: recipe card tags, on their own row below .recipe-card-meta. */
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.recipe-tag-sm { font-size: 10px; padding: 1px 6px; line-height: 16px; }

.recipe-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0 8px; }
.recipe-filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-muted); color: var(--text-secondary);
  font-size: 12px; text-decoration: none; border: 1px solid transparent;
}
.recipe-filter-pill:hover { border-color: var(--border-primary); }
.recipe-filter-pill.is-active { background: var(--accent-teal-light); color: var(--accent-teal-text); }
/* PROD-021 step 2: the stage part of the filter bar (Figma frame 24 D). */
.recipe-filter-divider { width: 1px; height: 20px; background: var(--border-primary); }
.recipe-filter-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.recipe-filter-pill.is-group { background: var(--brand-espresso); color: var(--bg-surface); }
.stage-pill-chosen { text-decoration: none; border-color: var(--text-primary); }
.stage-pill-chosen:hover { opacity: 0.85; }
.recipe-filter-pill-status.is-active { background: var(--accent-orange-light); color: var(--accent-orange-text); }
.recipe-filter-count { font-family: var(--font-mono); font-size: 10px; opacity: 0.8; }
/* Clear filters is a quiet action in the same pill row: pill height and
   radius, no fill, no underline; a border appears on hover so it reads as
   a control without competing with the active filters. */
.recipe-filter-clear {
  display: inline-flex; align-items: center;
  padding: 4px 10px; margin-left: 2px; border-radius: 999px;
  color: var(--text-secondary); font-size: 12px; text-decoration: none;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.recipe-filter-clear:hover { border-color: var(--border-primary); color: var(--text-primary); }
/* UX-011 (Figma frame 25): the pager under each recipes-home grid. Buttons
   reuse .recipe-filter-pill and the label .mono-small; this only lays them
   out: centred under the grid, spread edge to edge on a phone (frame 25 D). */
.recipe-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
@media (max-width: 767px) { .recipe-pager { justify-content: space-between; } }
.recipe-filter-clear:focus-visible { outline: none; border-color: var(--accent-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent); }

.badge-near {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

/* Declared twice, and the second block won with an undefined
   --bg-secondary, so this rendered as unstyled text on whatever was behind
   it. Now one rule, on a defined surface, with a label colour that passes
   (#1065). Also the fallback badge for unrecognised sources (#1066), so it
   has to stay readable. */
.badge-neutral {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.badge-cofid {
  background: var(--source-cofid-bg);
  color: var(--source-cofid-text);
}

.badge-canadian {
  background: var(--source-canadian-bg);
  color: var(--source-canadian-text);
}

.badge-frida {
  background: var(--source-frida-bg);
  color: var(--source-frida-text);
}

.badge-composite {
  background: var(--source-composite-bg);
  color: var(--source-composite-text);
}

.badge-pro {
  background: var(--source-pro-bg);
  color: var(--source-pro-text);
}

.badge-user {
  background: var(--source-user-bg);
  color: var(--source-user-text);
}

.badge-ai {
  background: var(--source-ai-bg);
  color: var(--source-ai-text);
}

.badge-swedish {
  background: var(--source-swedish-bg);
  color: var(--source-swedish-text);
}

.badge-norwegian {
  background: var(--source-norwegian-bg);
  color: var(--source-norwegian-text);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
}

/* DATA-012 M2: process pill rendered alongside source / category badges
   on ingredient cards across Library, My Ingredients, recipe picker, and
   the ingredient info modal. The classifier groups buckets A-E; v1 uses
   one neutral-blue tone for all groups (group-coded variants below can
   be added later if the picker UX benefits from finer discrimination). */
.badge-process {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-process-a { background: var(--status-pass-bg); color: var(--status-pass-text); }
.badge-process-b { background: var(--accent-teal-light); color: var(--accent-teal-text); }
.badge-process-c { background: var(--info-bg); color: var(--info-text); }
.badge-process-d { background: var(--bg-muted); color: var(--text-secondary); }
.badge-process-e { background: var(--source-pro-bg); color: var(--source-pro-text); }

/* PLAT-011: "Coming soon" marker rendered by partials/feature-marker.html.
   Used on marketing pricing cards (PLAT-008) next to feature rows whose
   plans.feature_set.<slug>.coming_soon flag is true. Warm parchment tone,
   muted text, small dot pip to read as a forthcoming label rather than a
   live status badge. Inherits .badge sizing/typography. */
.badge.coming-soon {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.2px;
  font-style: italic;
}

.badge.coming-soon::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--decorative-muted);
  margin-right: 2px;
}

/* --------------------------------------------------------------------------
   Confidence Badges (dot + label)
   -------------------------------------------------------------------------- */
.conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-chip-sm, 4px);
}

.conf-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.conf-badge-high {
  background: var(--status-pass-bg);
  color: var(--confidence-high-text);
}

.conf-badge-high::before {
  background: var(--confidence-high);
}

.conf-badge-medium {
  background: var(--status-warning-bg);
  color: var(--confidence-medium-text);
}

.conf-badge-medium::before {
  background: var(--confidence-medium);
}

.conf-badge-low {
  background: var(--status-fail-bg);
  color: var(--confidence-low-text);
}

.conf-badge-low::before {
  background: var(--confidence-low);
}

/* --------------------------------------------------------------------------
   Section Labels
   -------------------------------------------------------------------------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* PROD-011: subtle Nutri-Score algorithm-version label under the panel title. */
.nutriscore-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* PROD-011: subtle Nutri-Score algorithm-version subtitle, stacked directly
   under the NUTRI-SCORE title (one line, not a separate column). */
.nutriscore-version {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  opacity: 0.8;
  white-space: nowrap;
}

/* PROD-025: the front-of-pack card (Figma frame 42). Every tab has one height,
   so the cards below do not move when the tab changes. */
.card.fop-card,
.recipe-builder-sidebar .card.fop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px;
}
@media (min-width: 768px) and (max-width: 1024px) {
  .recipe-builder-sidebar .card.fop-card {
    padding: 14px 16px;
  }
  /* The narrow sidebar: smaller circles keep the copy to one tab height. */
  .fop-card .fad-body {
    gap: 8px;
  }
  .fop-card .fad-portions {
    gap: 3px;
  }
  .fop-card .fad-portion {
    width: 16px;
    height: 16px;
  }
}
.fop-tabs {
  display: flex;
  width: 100%;
}
.fop-tabs .status-toggle-option {
  flex: 1;
  padding: 5px 0;
  font-size: 10px;
}
.fop-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 86px;
}
.fop-panel[hidden] {
  display: none;
}
.fop-body {
  display: flex;
  align-items: center;
  min-height: 66px;
}
.fop-message {
  justify-content: center;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-label);
}
.fop-meta,
.fop-card .nutriscore-version {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  line-height: 12px;
  letter-spacing: 0.36px;
  text-transform: uppercase;
  color: var(--text-label);
  opacity: 1;
}
/* The 16px "?" must not make this tab taller than the others. */
.fop-meta {
  display: flex;
  align-items: center;
  height: 12px;
}
.fop-card .nutriscore-body {
  flex-direction: column-reverse;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  min-height: 86px;
  padding: 0;
}
/* The tab names the label, so its text goes; the "?" help link inside it stays,
   beside the version line. .help-hint sets its own font size. */
.fop-card .nutriscore-heading {
  flex-direction: row;
  align-items: center;
  gap: 2px;
  /* The 16px "?" must not make this tab taller than the others. */
  height: 12px;
}
.fop-card .nutriscore-heading .section-label {
  order: 2;
  font-size: 0;
  letter-spacing: 0;
}
.fop-card .nutriscore-img {
  width: 168px;
  margin: 2px auto;
}
.fop-card .nutriscore-na {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
}
.fad-body {
  gap: 12px;
}
.fad-portions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
.fad-portion {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  background: var(--bg-muted);
}
.fad-portion-on {
  border-color: var(--status-pass);
  background: var(--status-pass);
}
/* Portions past OHID's limit of 2 that the IGD guide would count: shown,
   but faded, so the card stays at 2. */
.fad-portion-extra {
  background: var(--status-pass);
  opacity: 0.35;
}
.fad-copy {
  min-width: 0;
}
.fad-headline {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
.fad-detail {
  margin: 2px 0 0;
  font-family: var(--font-primary);
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-secondary);
}
/* PROD-025 "How we counted": a text link at the right of the meta row. It
   takes the row's mono caps, so it stays 12px high like the row. */
.fad-working-link {
  margin-left: auto;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--link-on-surface);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  cursor: pointer;
}
.fad-working-link:hover,
.fad-working-link:focus-visible {
  color: var(--link-on-surface-hover);
}
.fad-working-row {
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border-divider);
}
.fad-working-row .nut-row-value {
  white-space: nowrap;
  text-align: right;
}
.fad-working-sum,
.fad-working-portions {
  display: block;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
}
.fad-working-row .nut-row-value.fad-working-over {
  color: var(--status-fail-text);
}
.fad-working-note,
.fad-working-total {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.fad-working-total {
  font-weight: 600;
  color: var(--text-primary);
}
/* The "?" beside "Canoli never shows more than 2 portions.": a details
   element styled as the help hint, opening a small panel below it. */
/* Not display:contents on the details: that breaks its built-in hiding. The
   panel floats under the line, across the note's width. */
.fad-why {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}
.fad-why-details > summary {
  list-style: none;
  cursor: pointer;
}
.fad-why-details > summary::-webkit-details-marker {
  display: none;
}
.fad-why-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-muted);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Input Groups & Fields
   -------------------------------------------------------------------------- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-field {
  padding: 10px 14px;
  border-radius: var(--radius-field, 8px);
  border: 1px solid var(--border-primary);
  font-size: 14px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* On the add-ingredient cards a field takes the card's width under its label:
   a product page link or an ingredient name does not fit 170px. */
.upload-card .input-field {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 8px;
}

/* .input-field is a pill on Canoli, which suits one-line inputs. A textarea
   wearing the same class needs the multi-line corner instead. */
textarea.input-field {
  border-radius: var(--radius-field-multiline, 8px);
}

.input-field:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}

.input-field::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

.input-help {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.settings-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-teal);
  margin: 0;
}

/* COMP-011 Increment 0b: settings-page radio group (health claims markets).
   Same visual language as .settings-checkbox above, but block-laid-out
   since these labels run to a full sentence and stack rather than sit
   inline. */
.settings-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-radio + .settings-radio {
  margin-top: 10px;
}

.settings-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent-teal);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width, 220px);
  min-width: var(--sidebar-width, 220px);
    background: var(--bg-sidebar);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  /* BRAND-001 palette track: Canoli's rail is a floating rounded card
     inset from the page edge; Nibblr's tokens are 0/0 so it stays flush
     and full-bleed exactly as before. */
  border-radius: var(--radius-sidebar, 0);
  margin: var(--sidebar-inset, 0px);
  height: calc(100vh - (2 * var(--sidebar-inset, 0px)));
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* The nav scrolls inside this box. The footer (.sidebar-bottom) sits
     below it in normal flow, so a long admin list scrolls above the
     footer instead of sliding under it. */
  padding-bottom: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--nav-gap, 2px);
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  /* doubled (was 8px) to give the Version line more breathing room below
     the stacked legal links. */
  gap: 16px;
  /* In normal flow, not absolute: .sidebar-top has flex: 1, so on short
     navs the footer still sits at the foot of the sidebar; on long navs the
     nav scrolls and the footer stays clickable and un-overlapped. */
  flex-shrink: 0;
  padding-top: 16px;
}

.sidebar-divider {
  height: 1px;
  background: var(--bg-sidebar-hover);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
}

.user-name {
  color: var(--text-on-dark);
  font-size: 13px;
  font-weight: 500;
}

.sidebar-logo {
  padding: 0 16px;
  line-height: 0;
}

/* Square mark only appears on the collapsed tablet rail (UX-003). */
.sidebar-logo-mark {
  display: none;
}

.sidebar-divider-spaced {
  height: 1px;
  background: var(--bg-sidebar-hover);
  margin: 12px 0;
}

.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 12px;
  border: none;
  background: none;
  cursor: pointer;
  margin-top: 4px;
}
.sidebar-section-toggle:hover { opacity: 0.8; }

.sidebar-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-on-dark-muted);
  opacity: 0.5;
}

.sidebar-section-caret {
  width: 14px;
  height: 14px;
  color: var(--text-on-dark-muted);
  opacity: 0.4;
  transition: transform 0.2s ease;
}
.sidebar-section-caret.rotate-180 {
  transform: rotate(180deg);
}

.sidebar-legal-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  font-size: 11px;
  /* left pad matches .nav-item's 16px so the links line up with the nav
     labels above; top pad unchanged. */
  padding: 12px 0 0 16px;
}

/* Muted by COLOUR, never by opacity. These used --text-on-dark-muted at
   0.5 and 0.4 opacity, which blends the text back into the sidebar: 3.3:1
   for the links and 2.58:1 for the version label, against the 4.5:1 floor.
   --text-on-dark-subtle is the on-dark text rung that
   on-dark-text-tokens-clear-aa-on-the-dark-surfaces proves readable on
   --bg-sidebar for every brand. --text-on-dark-muted is not a text colour
   on Canoli: its palette entry says non-text only. */
.sidebar-legal-link {
  color: var(--text-on-dark-subtle);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-legal-link:hover {
  color: var(--text-on-dark);
}

/* Version and the system status line: information, not navigation. The top
   border is the divider that sets them apart from the legal links, and the
   block is centred so neither line reads as one more link. */
.sidebar-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-sidebar-hover);
}

.sidebar-version {
  font-size: 11px;
  color: var(--text-on-dark-subtle);
  text-align: center;
}

/* The status line (partials/system-status.html). Same size and colour as
   Version; the dot carries the state's colour and the label says it. */
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 16px;
  color: var(--text-on-dark-subtle);
  text-decoration: none;
  transition: color 0.15s;
}

.system-status:hover {
  color: var(--text-on-dark);
}

.system-status__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.system-status--up .system-status__dot { background: var(--system-status-up); }
.system-status--issues .system-status__dot { background: var(--system-status-issues); }
.system-status--maintenance .system-status__dot { background: var(--system-status-maintenance); }
.system-status--outage .system-status__dot { background: var(--system-status-outage); }

.sidebar-logout-btn {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--nav-item-gap, 10px);
  padding: 10px 16px;
  border-radius: var(--radius-nav-item, 6px);
  font-size: 14px;
  color: var(--text-on-dark-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-on-dark);
}

/* Keeps the IDENTITY gold, not the -text variant: .nav-item only ever
   renders inside the dark sidebar (partials/sidebar.html), so the gold tint
   composites over --bg-sidebar and gold reads at 6.71:1 there. The darkened
   label colour is for gold tints on LIGHT surfaces and would drop this to
   2.17:1. */
.nav-item.active {
  /* BRAND-001 palette track: Nibblr keeps its gold tint + identity-gold
     label (see the dark-context exemption in the contrast lint); Canoli
     is a solid butter pill with slab ink. */
  background: var(--nav-active-fill);
  color: var(--nav-active-label);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Ingredient Table (grid layout)
   -------------------------------------------------------------------------- */
.ing-table {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-table, 8px);
  overflow: hidden;
}

.ing-table-header {
  display: grid;
  grid-template-columns: 32px 1fr 80px 56px 60px 80px 40px;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-primary);
}

.ing-table-header > * {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.ing-header-right { text-align: right; }

/* When a recipe has no ingredients yet, hide the table chrome so the page
   reads as "unfinished" rather than "done but empty", and show the
   first-ingredient CTA instead. CSS auto-flips the moment a row is added. */
.ing-table:not(:has(.ing-row)) > .ing-table-header,
.ing-table:not(:has(.ing-row)) > .ing-table-footer {
  display: none;
}
.ing-table:has(.ing-row) > .first-ingredient-cta {
  display: none;
}

.first-ingredient-cta {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 24px;
  background: var(--bg-surface);
  border: 2px dashed var(--border-primary);
  border-radius: 8px;
  margin: 8px;
}
.first-ingredient-cta-arrow {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--accent-teal);
}
.first-ingredient-cta-body { flex: 1; min-width: 0; }
.first-ingredient-cta-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.first-ingredient-cta-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.quick-add-bar-prompt .quick-add-input {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px var(--accent-teal-light);
}

/* --------------------------------------------------------------------------
   Nutrition Rows
   -------------------------------------------------------------------------- */
.nut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.nut-row-label {
  color: var(--text-primary);
  font-weight: 500;
}

.nut-row-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.nut-row-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0 3px 16px;
  font-size: 12px;
}

.nut-row-sub .nut-row-label {
  color: var(--text-tertiary);
}

.nut-row-sub .nut-row-value {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Flash Messages
   -------------------------------------------------------------------------- */
.flash-message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 16px 24px 0;
  border-radius: 8px;
  font-size: 14px;
}

.flash-message i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

.flash-close i {
  width: 16px;
  height: 16px;
}

.flash-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.flash-toast {
  background: var(--bg-surface, var(--bg-surface));
  color: var(--text-primary, var(--text-primary));
  border: 1px solid var(--status-pass, var(--status-pass));
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--text-primary) 12%, transparent);
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 250ms ease, transform 250ms ease;
}

.flash-toast-error {
  border-color: var(--status-fail, var(--status-fail));
}

.flash-toast-info {
  border-color: var(--accent-teal, var(--brand-gold));
}

.flash-toast-success {
  border-color: var(--status-pass, var(--status-pass));
}

/* Copy Ingredients: a declaration warning shown after the copy. */
.flash-toast-warning {
  border-color: var(--status-warning);
}

.flash-toast-out {
  opacity: 0;
  transform: translateX(20px);
}

.flash-success {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
  border: 1px solid var(--status-pass);
}

.flash-error {
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  border: 1px solid var(--status-fail);
}

.flash-info {
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
}

.flash-warning {
  background: var(--status-warning-bg, var(--status-warning-bg));
  color: var(--status-warn, var(--status-warning-text));
  border: 1px solid var(--status-warn, var(--status-warning-text));
}

.invite-branch-d-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.invite-branch-d-actions .btn-secondary {
  text-align: center;
}

/* --------------------------------------------------------------------------
   Locked-mode banner (PLAT-008 audit C8)
   Persistent top-of-page banner shown when an org is in read-only mode
   ('trial_expired_locked' or 'canceled'). Higher visual urgency than the
   verification or trial-prompt banners: this is a billing block, not a nudge.
   -------------------------------------------------------------------------- */
.locked-mode-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--status-fail-bg, var(--status-fail-bg));
  color: var(--text-primary);
  border-bottom: 1px solid var(--status-fail, var(--status-fail));
  font-size: 14px;
}

.locked-mode-banner__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}

.locked-mode-banner i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--status-fail, var(--status-fail));
}

.locked-mode-banner__copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.locked-mode-banner__title {
  margin: 0;
  font-weight: 600;
  color: var(--status-fail, var(--status-fail));
}

.locked-mode-banner__subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.locked-mode-banner__cta {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Rebrand notice (BRAND-001)
   --------------------------------------------------------------------------
   The once-only "<former> is now <name>" strip. Figma: Canoli Web page,
   "Rebrand notice / desktop" and "/ mobile". It sits INSIDE the content
   column on the muted surface, not on butter: butter is rationed to the
   one AI action per page. The dot is the rail's "changed" marker. */
.rebrand-notice {
  margin: 24px 24px 0;
}
.rebrand-notice__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px 10px 16px;
  background: var(--bg-muted);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-primary);
}
.rebrand-notice__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-gold);
}
.rebrand-notice__copy {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
}
.rebrand-notice__title {
  font-weight: 600;
}
.rebrand-notice__link {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 44px target (WCAG 2.5.8) around a 16px glyph. */
.rebrand-notice__dismiss {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -8px 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.rebrand-notice__dismiss i {
  width: 16px;
  height: 16px;
}
.rebrand-notice__dismiss:hover { background: var(--bg-secondary); }
.rebrand-notice__dismiss:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
/* --------------------------------------------------------------------------
   Add-payment-method banner (PR #1627)
   --------------------------------------------------------------------------
   Figma: Canoli Web, "18 Add payment method" (1286:21). Same shape as the
   rebrand notice above: a rounded card inside the content column, not a
   full-bleed bar. Trial sits on the info tint; past due (a payment has
   already failed) takes the warning palette. */
.payment-method-banner {
  margin: 24px 24px 0;
}
.payment-method-banner__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  background: var(--info-bg);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-primary);
}
.payment-method-banner--past-due .payment-method-banner__inner {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}
.payment-method-banner__message {
  flex: 1;
  margin: 0;
}
.payment-method-banner__cta {
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .payment-method-banner { margin: 12px 12px 0; }
  .payment-method-banner__inner { padding-top: 12px; padding-bottom: 12px; }
  .rebrand-notice { margin: 12px 12px 0; }
  .rebrand-notice__inner { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
  .rebrand-notice__dot { margin-top: 6px; }
  .rebrand-notice__copy { flex-direction: column; align-items: flex-start; gap: 2px; }
  .rebrand-notice__dismiss { margin-top: -10px; }
}

.verification-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--status-warning-bg, var(--status-warning-bg));
  color: var(--status-warn, var(--status-warning-text));
  border-bottom: 1px solid var(--border-primary);
  font-size: 14px;
}

.verification-banner i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.verification-banner-text {
  flex: 1;
}

.verification-banner-actions {
  margin: 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.verification-banner-sep {
  opacity: 0.6;
}

.verification-banner .btn-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.verification-banner .btn-link:hover {
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Trial collaboration prompt (PLAT-008 Phase 9.1)
   Day 7 / Day 14 in-product banner. Engagement-only, no billing copy.
   Distinct visual from .verification-banner (informational, not warning).
   -------------------------------------------------------------------------- */
.trial-prompt {
  background: var(--info-bg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
  padding: 10px 24px;
  font-size: 14px;
}

.trial-prompt__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

.trial-prompt__message {
  flex: 1;
  margin: 0;
}

.trial-prompt__cta {
  flex-shrink: 0;
}

.trial-prompt__close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.trial-prompt__close:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.trial-prompt__close i {
  width: 18px;
  height: 18px;
}

.page-container-narrow {
  max-width: 560px;
}

/* Subtle back link used on /billing/upgrade under the "Talk to us"
   card. Matches the warm body type (DM Sans, --text-secondary), no
   default purple anchor styling. */
.upgrade-back-link {
  margin-top: 16px;
}
.upgrade-back-link .back-link {
  color: var(--text-secondary, var(--text-secondary));
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
.upgrade-back-link .back-link:hover,
.upgrade-back-link .back-link:focus-visible {
  color: var(--text-primary, var(--text-primary));
  border-bottom-color: var(--text-primary, var(--text-primary));
}

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

.btn-third {
  min-width: 33%;
  justify-content: center;
}

.members-grid {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: 32px;
}

.members-col {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.members-list {
  display: flex;
  flex-direction: column;
}

.members-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-primary);
}

.members-row:last-child {
  border-bottom: none;
}

.members-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.members-name {
  font-weight: 500;
  color: var(--text-primary);
}

.members-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.members-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.members-role {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  white-space: nowrap;
}

.members-role-owner {
  background: var(--accent-teal-bg, var(--gold-tint));
  color: var(--accent-teal-text);
}

.members-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.input-field-sm {
  padding: 4px 8px;
  font-size: 13px;
  min-width: 100px;
}

.danger-zone {
  border-color: var(--status-fail);
}

.danger-zone .section-label {
  color: var(--status-fail-hover);
}

/* --------------------------------------------------------------------------
   Mobile Header
   -------------------------------------------------------------------------- */
.mobile-header {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  flex-shrink: 0;
}

.mobile-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-left .back-arrow {
  color: var(--text-secondary);
  cursor: pointer;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  text-decoration: none;
}

.mobile-header-logo {
  display: block;
  height: 22px;
  width: auto;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Phone header: logo home link, burger, drawer (layouts/app.html)
   Replaces the old bottom tab bar. The header slides away on scroll down
   and returns on scroll up (appMobileNav in app.js); the drawer carries
   the sidebar's own links and footer on the sidebar's dark ground.
   -------------------------------------------------------------------------- */

/* The x-data wrapper must not become a box: the header has to stay a
   direct flex child of .app-main-column to stick. */
.mobile-nav-scope {
  display: contents;
}

.mobile-header {
  transition: transform 0.25s ease;
}

.mobile-header--hidden {
  transform: translateY(-100%);
}

.mobile-header-home {
  display: inline-flex;
  line-height: 0;
}

/* 44px hit area (WCAG 2.5.5), bars drawn at 22px. */
.mobile-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-field-sm, 6px);
  cursor: pointer;
  color: var(--text-primary);
  /* GROW-005: anchors .burger-dot. */
  position: relative;
}

.mobile-burger-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* Burger becomes an X while the drawer is open, so it is obvious the same
   control closes it. Bars are 2px with a 6px gap: each outer bar travels
   8px to meet the middle one, which fades. */
.mobile-burger[aria-expanded="true"] .mobile-burger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-burger[aria-expanded="true"] .mobile-burger-bar:nth-child(2) {
  opacity: 0;
}

.mobile-burger[aria-expanded="true"] .mobile-burger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.mobile-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-sidebar);
  max-height: calc(100vh - var(--app-header-h, 61px));
  max-height: calc(100dvh - var(--app-header-h, 61px));
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 18px 32px color-mix(in srgb, var(--text-primary) 35%, transparent);
}

.mobile-drawer .nav-item {
  padding: 12px 16px;
  font-size: 16px;
}

.mobile-drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-sidebar-hover);
}

.mobile-drawer-footer .sidebar-legal-links {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
}

/* Same backdrop as the tablet rail's .sidebar-scrim, under the header
   (z-index 100) so the header and its drawer stay on top. */
.mobile-drawer-scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--text-primary) 35%, transparent);
  z-index: 99;
}

/* Scroll lock while the drawer is open (set only by setOpen). */
body.mobile-menu-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  .mobile-drawer-scrim {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-header,
  .mobile-burger-bar {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Login / Auth Pages
   -------------------------------------------------------------------------- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  /* Brand-scoped: see --auth-screen-bg in the token files. Was --bg-muted,
     which on Canoli is a warm beige and read as the wrong brand next to a
     marketing page whose light sections are all shell. */
  background: var(--auth-screen-bg);
}

.login-card {
  display: flex;
  width: 900px;
  min-height: 560px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
}

.brand-side {
  width: 400px;
  min-width: 400px;
  background: var(--brand-espresso);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-side-logo {
  line-height: 0;
}

.brand-side-tagline {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 8px;
  max-width: 280px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.brand-feature i {
  color: rgba(255, 255, 255, 0.67);
  width: 18px;
  height: 18px;
}

.form-side {
  flex: 1;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.form-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
}

.form-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.divider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.divider-row .line {
  flex: 1;
  height: 1px;
  background: var(--border-primary);
}

.divider-row span {
  font-size: 12px;
  color: var(--text-muted);
}

.login-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Was --info, which is a real token but the wrong one: semantic/info is for
   informational status, not for links, and being the only cool value on this
   surface it read as borrowed. --link-on-surface is the link colour the
   policy pages already use, so links now match across the whole public
   surface. 5.81:1 on white. */
.login-link a {
  color: var(--link-on-surface);
  font-weight: 600;
  text-decoration: none;
}

.login-link a:hover {
  color: var(--link-on-surface-hover);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   User Avatar
   -------------------------------------------------------------------------- */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-cocoa);
  color: var(--text-on-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state p {
  margin-top: 12px;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   HTMX Loading Indicator
   -------------------------------------------------------------------------- */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   General Utilities
   -------------------------------------------------------------------------- */
.u-hidden { display: none; }

/* --------------------------------------------------------------------------
   Responsive Utilities
   -------------------------------------------------------------------------- */
.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

/* The sidebar carries .desktop-only too. Without this, the rule above
   (later in the file, same specificity) turns the sidebar into a block,
   the flex column never applies, and the footer spills out below the
   100vh box onto the page background. */
.sidebar.desktop-only {
  display: flex;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoint (phone, UX-003 tier: max-width 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Two classes so this outranks .sidebar.desktop-only above. */
  .sidebar.desktop-only {
    display: none;
  }

  .mobile-header {
    display: block;
  }

  /* The DOCUMENT scrolls on phone, not .main-area. With .main-area as the
     scroller inside a fixed 100dvh box, the header could never scroll
     away and iOS Safari never shrank its own toolbars either: two bars of
     permanent chrome on the smallest screen. overflow-x: clip keeps the
     old sideways containment without making .main-area a scroll
     container again (clip, unlike hidden/auto, does not). */
  .app-layout,
  .app-main-column {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .main-area {
    overflow: visible;
    overflow-x: clip;
  }

  /* Sticky bands sit under the phone header while it is shown and slide
     up to the top edge when it hides. */
  .locked-mode-banner {
    top: var(--app-header-offset, 0px);
    transition: top 0.25s ease;
  }

  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }

  /* Smaller titles on mobile */
  .page-title {
    font-size: 20px;
  }

  .page-container {
    padding: 20px 16px;
  }

  .ing-table {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Login card stacking, deliberately pinned at 1024px (UX-003): portrait
   iPads keep the stacked auth card; the tablet tier does not apply here.
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .login-card {
    flex-direction: column;
    width: 100%;
    min-height: auto;
    border-radius: 0;
    border: none;
  }

  .brand-side {
    width: 100%;
    min-width: 0;
    padding: 32px 24px;
  }

  .form-side {
    width: 100%;
    padding: 32px 24px;
  }

  /* Two children under space-between sit far apart on the tall desktop
     column and collapse against each other once the panel is a short
     horizontal band. The gap is a floor, so it changes nothing on desktop. */
  .brand-side {
    gap: 24px;
  }
}

/* --------------------------------------------------------------------------
   Auth card on tablets
   --------------------------------------------------------------------------
   The stacking above is deliberate and stays (UX-003 pins it at 1024px so
   portrait iPads keep the stacked card). What does not belong on a 820px
   screen is the rest of that block's phone treatment: full bleed to both
   edges, no radius, no border. At phone widths an edge-to-edge card is
   correct because there is no room for a margin; at 820 it just looks like a
   phone page enlarged, and the form fields stretch to 780px, which is an
   absurd measure for an email address.

   So the card comes back as a card: centred, bounded, and given its corners
   and border back.
   -------------------------------------------------------------------------- */
@media (min-width: 701px) and (max-width: 1024px) {
  .login-screen {
    padding: 48px 32px;
    align-items: center;
  }

  .login-card {
    width: 100%;
    max-width: 560px;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
  }

  .brand-side {
    padding: 36px 40px;
    gap: 28px;
  }

  .form-side {
    padding: 40px;
  }
}

/* --------------------------------------------------------------------------
   Tablet tier (UX-003): collapsed icon rail.
   The sidebar becomes a fixed 64px icon-only rail; the full labelled sidebar
   expands as an overlay (.rail-open via Alpine, or hover/focus under the
   fine-pointer gate below) without reflowing the work area.
   Z-order: scrim 1190, expanded rail 1200; above the version-history drawer
   (950) and the draft-conflict modal (1000), below flash toasts (9999).

   Every "collapsed" rule below is gated `:not(.rail-open):not(:hover):not
   (:focus-within)`, not just `:not(.rail-open)`. The fine-pointer hover
   expansion further down widens the rail with a `:hover`/`:focus-within`
   selector rather than the Alpine class, and the collapsed rules used to
   only stand down for `.rail-open`; on a mouse, hovering widened the rail
   to 260px while every row stayed clamped to the 44px centred icon column,
   which is what forced two-word labels ("My Ingredients", "Failed logins")
   into a cramped, wrapped, centred stack. Reported 2026-09-11.
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-layout {
    padding-left: calc(var(--sidebar-rail-width) + 2 * var(--sidebar-inset, 0px)); /* IMPORT-001 switch-on pack A1:
       the rail sits --sidebar-inset in from the edge (Canoli tokens) and the page keeps the same gap after it, so the
       rail never covers the page's box (0 under brands with no inset) */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    /* Anchor to both edges instead of height:100vh - on iPadOS Safari, vh
       tracks the largest viewport (toolbars hidden), so a vh-sized rail
       leaves a blank band when the toolbars are visible. Edge anchoring
       always spans the real visual viewport. */
    bottom: 0;
    height: auto;
    width: var(--sidebar-rail-width);
    min-width: 0;
    padding: 24px 10px;
    overflow: hidden;
    transition: width 0.2s ease;
    z-index: 1200;
  }

  .sidebar.rail-open {
    width: 260px;
    padding: 24px 16px;
  }

  .sidebar-logo {
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Collapsed rail shows the square mark; the wordmark returns on expand. */
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-logo-full {
    display: none;
  }

  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-logo-mark {
    display: block;
  }

  .nav-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Collapsed rail: icons only. Labels, role-gated sections, legal links and
     the version and status block live in the expanded overlay. */
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .nav-item span,
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-section,
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-legal-links,
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-meta {
    display: none;
  }

  /* BRAND-001: the collapsed rail is 64px wide and carries NO labels, so
     the icon is the only thing telling you what a row is. The dot marker
     is a full-width-rail affordance and would leave four identical dots
     here. Icons back on, dots off, for the collapsed state only. */
  .sidebar--marker-dot:not(.rail-open):not(:hover):not(:focus-within) .nav-item > i,
  .sidebar--marker-dot:not(.rail-open):not(:hover):not(:focus-within) .nav-item > svg,
  .sidebar--marker-dot:not(.rail-open):not(:hover):not(:focus-within) .nav-item > .nav-icon {
    display: block;
  }

  .sidebar--marker-dot:not(.rail-open):not(:hover):not(:focus-within) .nav-item::before {
    display: none;
  }

  /* Centre the icon in the rail and stop the active pill stretching the
     full 64px: with radius 999 a full-width row renders as a large disc
     rather than a control. */
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .nav-item {
    justify-content: center;
    padding: 10px 0;
    margin: 0 auto;
    width: 44px;
  }

  /* The brand mark sits on the SAME 44px centre line as the nav rows.
     .sidebar-logo carries `padding: 0 16px` for the expanded rail, which
     inside a 64px rail leaves 12px of usable width and pushes the mark
     off that line: every icon below it is centred and the logo alone is
     not. Matching the column here is what squares the top of the rail. */
  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-logo {
    justify-content: center;
    padding: 0;
    width: 44px;
    margin: 0 auto;
  }

  .sidebar:not(.rail-open):not(:hover):not(:focus-within) .sidebar-logo-mark {
    width: 28px;
    height: 28px;
  }

  /* Scrim under the expanded rail; Alpine toggles visibility. */
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--text-primary) 35%, transparent); /* --brand-espresso at low opacity */
    z-index: 1190;
  }
}

/* Fine-pointer hover/keyboard expansion, gated so iPadOS synthetic hover
   never expands the rail on touch (UX-003). The delay stops a cursor
   crossing the rail from flashing the overlay open. */
@media (min-width: 768px) and (max-width: 1024px) and (hover: hover) and (pointer: fine) {
  .sidebar:hover,
  .sidebar:focus-within {
    width: 260px;
    padding: 24px 16px;
    transition-delay: 250ms;
  }

  .sidebar:hover .nav-item span,
  .sidebar:focus-within .nav-item span {
    display: inline;
  }

  .sidebar:hover .sidebar-section,
  .sidebar:focus-within .sidebar-section,
  .sidebar:hover .sidebar-legal-links,
  .sidebar:focus-within .sidebar-legal-links {
    display: block;
  }

  .sidebar:hover .sidebar-meta,
  .sidebar:focus-within .sidebar-meta {
    display: flex;
  }

  .sidebar:hover .sidebar-logo-full,
  .sidebar:focus-within .sidebar-logo-full {
    display: block;
  }

  .sidebar:hover .sidebar-logo-mark,
  .sidebar:focus-within .sidebar-logo-mark {
    display: none;
  }
}

/* Outside the tablet tier the scrim never renders, whatever Alpine thinks. */
@media (max-width: 767px), (min-width: 1025px) {
  .sidebar-scrim {
    display: none !important;
  }
}

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

/* --------------------------------------------------------------------------
   Page Container
   -------------------------------------------------------------------------- */
.page-container {
  padding: 32px;
  max-width: 1200px;
}

/* --------------------------------------------------------------------------
   Form Header
   -------------------------------------------------------------------------- */
.form-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   Signup plan summary (shown on /start so the visitor sees what plan they
   are committing to before submit; their first sight of the tier was
   previously the Stripe Checkout page).
   -------------------------------------------------------------------------- */
.signup-plan-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  margin-bottom: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-divider);
  border-radius: 12px;
}

.signup-plan-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signup-plan-summary__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.signup-plan-summary__change {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.signup-plan-summary__change:hover {
  color: var(--text-primary);
}

.signup-plan-summary__name {
  font-family: var(--font-display, 'Roboto Slab', serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.signup-plan-summary__cadence {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0;
}

.signup-plan-summary__meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* What actually leaves the account, and what annual saves. Quieter than the
   per-month figure above it: that line is the headline, this is the detail
   that stops it being read as a monthly charge. */
.signup-plan-summary__billing {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 4px;
}

.signup-plan-summary__hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-divider);
  font-size: 12px;
  color: var(--text-secondary);
}

.signup-plan-summary__hint i,
.signup-plan-summary__hint svg {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}

.signup-plan-summary__hint a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Recipe Grid & Cards
   -------------------------------------------------------------------------- */
/* PROD-022 PH3: 248px, not 320px, so a wide screen shows four cards a row. */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 16px;
}

/* The photo runs edge to edge at the top, so the padding moves to the body. */
.recipe-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.recipe-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

/* PROD-022 PH3 (Adam, 28 Sep): one line with an ellipsis, not two. */
.recipe-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -4px;
}

.recipe-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* COMP-015: the unconfirmed chip sits on its own line above the meta row so
   it never squeezes the HFSS badge or the count. */
.recipe-card-allergen-row { display: flex; }

.recipe-card-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.recipe-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* PROD-022 PH3: the thumb (thumb rendition, 4:3 centre crop) or a quiet
   placeholder, with the version badge and stage pill on solid backgrounds
   so any photo stays readable. */
.recipe-card-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg-muted); }
.recipe-card-thumb-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.recipe-card-thumb-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--text-muted); }
.recipe-card-thumb-empty svg, .recipe-card-thumb-empty i { width: 28px; height: 28px; stroke-width: 1.5; }
.recipe-card-thumb-version { position: absolute; top: 10px; left: 10px; }
.recipe-card-thumb-stage { position: absolute; top: 10px; right: 10px; }
.recipe-card-thumb .version-badge { background: var(--brand-gold); }
.recipe-card-thumb .version-badge-draft { background: var(--bg-surface); color: var(--text-secondary); }
.recipe-card-thumb .stage-pill { background: var(--bg-surface); color: var(--text-primary); border-color: transparent; }
.recipe-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; min-width: 0; padding: 14px 16px 16px; }
.recipe-card-updated { font-size: 12px; color: var(--text-muted); }
.recipe-card-narrow { display: none; }
/* PROD-022 PH9: photos off (a personal preference) gives the pre-2b card:
   the badge row under the name, then the tags. It wraps, since four cards
   a row are narrower than the old 320px minimum. */
.recipe-card-no-photo .recipe-card-meta { flex-wrap: wrap; row-gap: 6px; }
/* Same order numbers as the phone rules below, so neither overrides the
   other (this pair is more specific and would win on a phone too). */
.recipe-card-no-photo .recipe-card-allergen-row, .recipe-card-no-photo .recipe-card-meta { order: 1; }
.recipe-card-no-photo .recipe-card-tags { order: 2; }
.recipe-card-no-photo .recipe-card-footer { order: 3; }

/* Phone: each card is a row, a square thumb with the version badge and the
   stage beside the name; the count joins the update time. */
@media (max-width: 767px) {
  .recipe-grid { grid-template-columns: 1fr; gap: 8px; }
  .recipe-card { flex-direction: row; align-items: flex-start; }
  .recipe-card-thumb { flex: none; width: 88px; aspect-ratio: 1; margin: 12px 0 12px 12px; border-radius: 10px; overflow: hidden; }
  .recipe-card-thumb-version { top: 6px; left: 6px; }
  .recipe-card-thumb-empty { padding-top: 18px; }
  .recipe-card-thumb-empty svg, .recipe-card-thumb-empty i { width: 22px; height: 22px; }
  .recipe-card-body { gap: 6px; padding: 12px; }
  .recipe-card-title { font-size: 15px; }
  .recipe-card-desc { display: none; }
  .recipe-card-allergen-row { order: 1; }
  .recipe-card-meta { order: 1; flex-wrap: wrap; gap: 6px; }
  .recipe-card-tags { order: 2; }
  .recipe-card-footer { order: 3; margin-top: 0; }
  .recipe-card-wide { display: none; }
  .recipe-card-narrow { display: inline; }
}

.mono-small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Empty State Extensions
   -------------------------------------------------------------------------- */
.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 8px;
  max-width: 360px;
}

.empty-state-small {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   UX-009 Part A: request a missing ingredient (library empty state, picker
   empty line, and the shared status pill). The library block sits inside
   .empty-state-small (spec 4.2); the picker line sits inside
   .quick-add-empty (spec 4.5).
   -------------------------------------------------------------------------- */
.request-ingredient {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.request-ingredient-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-primary);
  margin: 0;
}

.request-ingredient-headline i {
  width: 16px;
  height: 16px;
  color: var(--status-pass);
}

.request-ingredient-hints {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.request-ingredient-hints a {
  /* Same treatment as .request-ingredient-own: the accent tone on paper
     is not readable for inline text (Adam, 2026-09-16, second pass). */
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.request-ingredient-hints a:hover {
  text-decoration-thickness: 2px;
}

.request-ingredient-note {
  font-size: 12px;
  color: var(--text-tertiary);
  max-width: 320px;
  margin: 0;
}

.request-ingredient-own {
  font-size: 12px;
  /* Body ink, underlined. The accent tone on the paper background fell
     below readable contrast for a small text link (Adam, 2026-09-16). */
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.request-ingredient-own:hover {
  text-decoration-thickness: 2px;
}

.request-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.request-status-pill a {
  color: inherit;
  text-decoration: underline;
}

.request-status-requested {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.request-status-in_progress {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.request-status-added {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.request-status-declined {
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
}

.quick-add-request {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-add-request-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-button, 6px);
  border: 1px solid var(--border-primary);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}

.quick-add-request-btn:hover {
  background: var(--bg-muted);
}

.quick-add-sep {
  color: var(--decorative-muted, var(--text-tertiary));
}

/* The one-line Request offer beside near-match rows (library above the list,
   picker under the rows). Pairs with .quick-add-request for the flex row. */
.request-ingredient-inline {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Recipe Builder (two-column layout)
   -------------------------------------------------------------------------- */
.recipe-builder {
  display: flex;
  gap: 0;
  height: 100%;
}

.recipe-builder-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.recipe-builder-sidebar {
  width: 360px;
  border-left: 1px solid var(--border-primary);
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recipe-header-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.formulation-inputs {
  /* Figma 01b (Adam, 2026-10-07): the fields sit in groups (.fi-cluster) that
     wrap as wholes, never split, so a drink fits one line where 01a's
     four-column grid of boxes took two. Every value carries 6px of padding
     for its focus box; the row pulls left by the same 6px so the text lines
     up with the header above. */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 20px;
  margin-top: 12px;
  margin-left: -6px;
}
/* A validation message for a field in the row: its own full-width line, and
   no space at all while it is empty. */
.serving-row-error { flex-basis: 100%; padding-left: 6px; }
.serving-row-error:empty { display: none; }

/* Recipe Total Weight stat (issue #131 follow-up).
   Read-only sibling of the editable TYPE / SERVING / YIELD inputs in
   .formulation-inputs. Same label rhythm as the other fields; value
   is mono to mirror the serving-field input text. */
.serving-stat {
  /* Inherits .serving-size-input layout (flex, gap, align-items:center). */
  gap: 8px;
}
.serving-stat-value {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
/* Total weight: raw -> cooked, shown only while the yield is not 100%. The
   arrow is Lucide arrow-right at text size (a text arrow's head was too
   small, Adam 2026-10-07). */
.serving-stat-cooked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.fi-arrow {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.status-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.serving-size-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
.serving-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.label-tooltip {
  display: inline-flex;
  align-items: center;
  cursor: help;
  vertical-align: middle;
  opacity: 0.5;
}
.label-tooltip:hover { opacity: 1; }
.label-tooltip svg { width: 12px; height: 12px; }
.serving-field {
  width: 56px;
  padding: 5px 6px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  text-align: right;
  background: var(--bg-surface);
  color: var(--text-primary);
  -moz-appearance: textfield;
}
.serving-field::-webkit-inner-spin-button,
.serving-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.serving-field:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}
.serving-field::placeholder {
  color: var(--text-placeholder);
  /* An empty box must look empty: the placeholder colour is the body text
     colour, and a customer read the example "400" as a saved pack size. */
  opacity: 1;
}

/* The formulation row, to the Figma frame "01b Recipe header: servings row
   on one line, click to edit" (Adam, 2026-10-07). Every group stacks its
   LABEL ABOVE its VALUE. Typed values are real inputs that look like text
   at rest (a dotted line marks each one) and show their box on focus; the
   box takes the same space as the text, so the row never moves. Type and
   Dilution open a small menu. Nothing reacts to hover: the hover swap was
   dropped on 2026-10-02. */
.fi-cluster {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}
.fi-cluster-drink,
.fi-cluster-dilution,
.fi-cluster-food,
.fi-cluster-weight { gap: 8px; }
.formulation-inputs .fi-group {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  justify-content: flex-start;
}
.formulation-inputs .serving-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  cursor: default;
  padding-left: 6px;
}
/* x and = between Serving size, Per pack and Pack, on the value line. */
.fi-op {
  align-self: flex-end;
  height: 32px;
  line-height: 32px;
  padding: 0 2px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-secondary);
}
.fi-rest {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 32px;
  padding: 0 6px;
  white-space: nowrap;
}
.fi-value,
.fi-pack {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 32px;
  color: var(--text-primary);
}
/* Worked out, never typed (Pack, Total weight): the secondary colour and no
   dotted line. */
.fi-pack { color: var(--text-secondary); }
.fi-unit {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}
.fi-empty { color: var(--text-tertiary); }

/* A value you can change: the input (or menu button) and its unit in one
   box. At rest the box is invisible and a dotted line sits under the
   content; on focus (or while its menu is open) the box shows. */
.fi-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  background-image: linear-gradient(to right, var(--text-secondary) 50%, transparent 0);
  background-size: 4px 1px;
  background-repeat: repeat-x;
  background-position: left bottom 5px;
  background-origin: content-box;
  background-clip: content-box;
  white-space: nowrap;
  cursor: text;
}
.fi-box:not(.fi-menu-trigger):focus-within,
.fi-menu-trigger[aria-expanded="true"],
.fi-menu-trigger:focus-visible,
.recipe-header-main > .recipe-title-edit:focus {
  background-color: var(--bg-surface);
  background-image: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 35%, transparent);
  outline: none;
}
.formulation-inputs .fi-input {
  width: auto;
  min-width: 1ch;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  field-sizing: content;
}
.formulation-inputs .fi-input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}
.formulation-inputs .fi-input::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}
/* Browsers without field-sizing get a fixed width per value. */
@supports not (field-sizing: content) {
  .formulation-inputs .fi-w-3 { width: 3ch; }
  .formulation-inputs .fi-w-4 { width: 4ch; }
  .formulation-inputs .fi-w-5 { width: 5.5ch; }
}
/* The unit (g, ml, %, g/ml) prints beside the value inside the box. An empty
   value at rest is a dash alone, never "- %"; the unit comes back on focus. */
.serving-field-suffix {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-secondary);
  pointer-events: none;
}
.fi-input:placeholder-shown:not(:focus) + .serving-field-suffix { display: none; }
.fi-check-wrap {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 6px;
}

/* Type and Dilution: a value picked from a small menu (the recipe menu's
   dropdown), opened by click like the stage control. */
.fi-menu { position: relative; }
.fi-menu-trigger {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.fi-menu-trigger .fi-value { line-height: 30px; }
.fi-chevron {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
/* Scoped to the row so it wins over .recipe-menu-dropdown, which comes later
   in this file and opens to the right. */
.formulation-inputs .fi-menu-dropdown {
  left: 0;
  right: auto;
  min-width: 160px;
}
.formulation-inputs .fi-menu-dropdown[hidden] { display: none; }
.formulation-inputs .fi-menu-dropdown-wide { min-width: 280px; }
/* Set by fiPlaceMenu (app.js) when a left-anchored menu would cross the
   row's right edge. */
.formulation-inputs .fi-menu-dropdown-end {
  left: auto;
  right: 0;
}
.formulation-inputs .fi-menu-dropdown { max-width: calc(100vw - 32px); }
.fi-menu-dropdown .recipe-menu-item { font-size: 14px; }
.fi-menu-dropdown .recipe-menu-item.active {
  font-weight: 600;
  background: var(--bg-muted);
}
.fi-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  visibility: hidden;
}
.recipe-menu-item.active .fi-check { visibility: visible; }
.fi-menu-water { cursor: text; }
.formulation-inputs .fi-menu-input {
  width: 72px;
  height: 28px;
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.fi-menu-unit {
  font-size: 13px;
  color: var(--text-secondary);
}
/* METH-004 item 7: the cooking-liquid checkbox sits in the same row as the
   serving fields; sized to the label's cap height so the row stays in rhythm. */
.serving-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent-teal);
  cursor: pointer;
}

.recipe-menu {
  position: relative;
}

.recipe-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 50;
  padding: 4px;
}

.recipe-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease;
}

.recipe-menu-item:hover {
  background: var(--bg-muted);
}

.recipe-menu-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.recipe-menu-item-danger {
  color: var(--status-fail);
}

.recipe-menu-item-danger:hover {
  background: var(--status-fail-bg);
}

.recipe-menu-divider {
  height: 1px;
  background: var(--border-divider);
  margin: 4px 0;
}

/* Unselectable section heading inside the recipe dropdown (mirrors
   .section-label; "Exports" group, Adam 2026-08-25). */
.recipe-menu-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 6px 12px 2px 16px;
  user-select: none;
  cursor: default;
}

.recipe-menu-confirm {
  padding: 8px 12px;
}

.recipe-menu-confirm p {
  font-size: 13px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.recipe-menu-confirm p small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.recipe-menu-reason-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.recipe-menu-reason-input:focus {
  outline: none;
  border-color: var(--accent-teal);
}

/* PROD-021 4.4: "Abandon instead" in the delete confirmation. */
.recipe-menu-confirm-alt { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft, var(--border-primary)); }
.recipe-menu-confirm-alt p { margin: 0 0 6px; font-size: 12px; color: var(--text-secondary); }
.recipe-menu-confirm-link {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text-primary);
  text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer;
}
.recipe-menu-confirm-buttons {
  display: flex;
  gap: 8px;
}

/* PROD-023 8: the delete confirm's draft variants (title, body, and the
   Discard / Upgrade buttons sized to the menu like Delete and Cancel). */
.recipe-menu-confirm .recipe-menu-confirm-title { font-weight: 600; margin-bottom: 4px; }
.recipe-menu-confirm .recipe-menu-confirm-note { font-size: 12px; color: var(--text-secondary); }
.recipe-menu-confirm-buttons .btn-danger,
.recipe-menu-confirm-buttons .btn-secondary {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  text-decoration: none;
}
.recipe-menu-confirm-buttons .btn-danger { flex: 0 0 auto; white-space: nowrap; }

.btn-confirm-delete {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 500;
  color: var(--text-on-dark);
  background: var(--status-fail);
  border: none;
  border-radius: var(--radius-button, 6px);
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.btn-confirm-delete:hover {
  opacity: 0.9;
}

.btn-confirm-cancel {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-button, 6px);
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-confirm-cancel:hover {
  background: var(--bg-muted);
}

.recipe-menu-form {
  display: contents;
}

.recipe-builder-sidebar .card {
  padding: 0;
}

.recipe-builder-sidebar .card:hover {
  box-shadow: none;
}

.recipe-builder-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  /* The formulation row is a full-width third child under the title and
     the actions (Adam on dev, 2026-09-18: inside the title column it wrapped
     with room to spare). */
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.recipe-builder-header > .formulation-inputs { flex-basis: 100%; }

/* Title column flex-grows but is allowed to shrink so the header action
   cluster can never get pushed off screen. */
.recipe-builder-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.recipe-builder-header .page-title {
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* The actions share the TITLE's row, not the whole text column's (Figma
   554:20). The column dissolves into the header's flex row: the title and
   the actions are the only items that sit side by side, and every other
   line (fork note, stage, tags, description) takes a full row below. So a
   long description no longer drops the actions under itself and leaves a
   void; only a title too long to share its row pushes them down. */
.recipe-builder-header { row-gap: 0; }
.recipe-builder-header > .recipe-header-main { display: contents; }
.recipe-header-main > * { flex-basis: 100%; min-width: 0; order: 2; }
.recipe-header-main > .fork-attribution { order: 0; }
.recipe-header-main > .page-title { flex: 0 1 auto; order: 1; }
/* The editable name. Focus empties "Untitled Recipe", and an empty title used to shrink to nothing, so a click looked
   like it deleted the name and left nowhere to type. It keeps a minimum width, shows the placeholder while empty, and
   wears the formulation inputs' halo on focus (the .fi-box focus rule above). The border and padding are always there
   and the negative margin cancels them, so the text does not move when the halo appears. */
.recipe-header-main > .recipe-title-edit {
  min-width: 8ch;
  margin-inline: -9px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: text;
}
.recipe-header-main > .recipe-title-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--text-placeholder);
  pointer-events: none;
}
/* Space under the actions only shows when they wrap below a long title:
   on the title's row they plus 8px are still shorter than the title. */
.recipe-builder-header > .recipe-header-actions { order: 1; margin-bottom: 8px; }
.recipe-builder-header > .formulation-inputs { order: 3; margin-top: 16px; }

.recipe-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-toggle {
  display: inline-flex;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-toggle, 7px);
  overflow: hidden;
  flex-shrink: 0;
}

.status-toggle-option {
  padding: 5px 14px;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.status-toggle-option:not(:last-child) {
  border-right: 1px solid var(--border-primary);
}

.status-toggle-option.active {
  background: var(--brand-espresso);
  color: var(--text-on-dark);
  font-weight: 600;
  cursor: default;
}

.recipe-builder-actions {
  display: flex;
  gap: 8px;
}

.recipe-desc {
  max-width: 600px;
}

.recipe-add-ingredient {
  margin-top: 16px;
}

.recipe-batch-label,
.recipe-notes-label {
  margin-top: 32px;
}

/* Batch Calculator */
.batch-calc-header {
  margin-top: 12px;
  margin-bottom: 12px;
}

.batch-calc-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

.batch-calc-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.batch-calc-active {
  border-color: var(--border-primary);
  background: var(--bg-muted);
}

.batch-scratch-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.batch-calc-error {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--status-fail);
}

.batch-calc-or {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

.batch-size-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.batch-size-input {
  width: 100px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 14px;
}

#batch-target-weight {
  width: 120px;
}

.batch-inv-table {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  overflow: hidden;
}

.batch-inv-header {
  display: grid;
  grid-template-columns: 1fr 50px 100px 100px;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.batch-inv-right {
  text-align: right;
}

.batch-inv-row {
  display: grid;
  grid-template-columns: 1fr 50px 100px 100px;
  gap: 8px;
  padding: 8px 12px;
  align-items: center;
  border-bottom: 1px solid var(--border-divider);
  background: var(--bg-surface);
}

.batch-inv-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-inv-pct {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.batch-inv-qty {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.batch-inv-cost {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.batch-inv-footer {
  display: grid;
  grid-template-columns: 1fr 50px 100px 100px;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-top: 1px solid var(--border-primary);
}

.batch-inv-footer-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.batch-inv-footer .batch-inv-qty,
.batch-inv-footer .batch-inv-cost {
  font-weight: 600;
}

.batch-cogs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--accent-teal-light);
  border-radius: 8px;
}

.batch-cogs-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.batch-cogs-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-teal-text);
}

.batch-summary {
  margin-top: 8px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  overflow: hidden;
}

.batch-summary-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-divider);
}

.batch-summary-row:last-child { border-bottom: none; }

.batch-summary-highlight {
  background: var(--accent-teal-light);
}

.batch-summary-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.batch-summary-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  min-width: 80px;
}

.batch-actions {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 0;
}

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-divider);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-family: var(--font-primary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
}

.tab-active {
  color: var(--accent-teal-text);
  font-weight: 600;
  border-bottom-color: var(--accent-teal);
}

.tab-inactive {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Drag Handle
   -------------------------------------------------------------------------- */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
}

.drag-handle:active {
  cursor: grabbing;
}

/* --------------------------------------------------------------------------
   Export Page
   -------------------------------------------------------------------------- */
.export-actions {
  display: flex;
  gap: 8px;
}

.export-preview {
  padding: 32px;
  margin-top: 24px;
}

.export-label-content {
  margin-top: 16px;
}

.export-pdf-draft-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   Ingredient Library (two-panel)
   -------------------------------------------------------------------------- */
.ingredient-library-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 32px 40px;
  gap: 20px;
}

.ingredient-library-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Title block and the Add button share one row (compact header). The
   header-main tracks the list panel's width so the button right-aligns
   with the search input (panel width minus the search bar's 16px right
   inset); the pinned ingredient name owns the header's right edge over
   the detail column. The button centres on the title line, not the
   title + count block. */
.ingredient-library-header-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 380px; /* track .ingredient-list-panel */
  flex-shrink: 0;
  padding-right: 16px; /* mirror .search-bar right inset */
}

.ingredient-library-header-main .btn-primary {
  margin-top: 2px; /* optically centre on the title line */
}

.ingredient-library-header-main > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Pinned ingredient name: lives in the non-scrolling header band, aligned to
   the right over the detail panel, so the user always knows which ingredient
   they are editing even when the panel is scrolled down to costing/provenance. */
.ingredient-pinned-name {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-left: auto;
  max-width: 55%;
  text-align: right;
}
/* The class sets display:flex, which would otherwise beat the [hidden]
   attribute's display:none (equal specificity, class wins by order). This guard
   lets JS toggle visibility via the hidden attribute. */
.ingredient-pinned-name[hidden] { display: none; }
.ingredient-pinned-value {
  max-width: 100%;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Phone only (UX-003): was max-width 900px from the single-breakpoint era,
   which bled into the tablet tier and hid the pinned name on portrait iPads
   even though the two-pane detail scroll works there. */
/* Phone (UX-003 follow-up): the compact title row and the pinned name apply
   on mobile too. The page (not the panel) scrolls on phone, so the header
   band sticks to the top of the .main-area scroll; the pinned name takes a
   second row inside it when revealed. */
@media (max-width: 767px) {
  .ingredient-library-header {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    position: sticky;
    /* Under the phone header while it is shown (appMobileNav). */
    top: var(--app-header-offset, 0px);
    transition: top 0.25s ease;
    z-index: 10;
    background: var(--bg-primary);
    padding-bottom: 8px;
  }

  /* List panel is full-width on phone; header-main follows it. */
  .ingredient-library-header-main {
    width: 100%;
  }

  .ingredient-pinned-name {
    align-self: flex-end;
  }
}

.ingredient-library {
  display: flex;
  gap: var(--library-gap, 0);
  flex: 1;
  height: 100%;
  min-height: 0;
}

.ingredient-list-panel {
  width: 380px;
  /* Lifted card under a brand that asks for one; a plain bordered
     column otherwise. --radius-list-card and --shadow-lifted are
     Canoli-only, so the default brand keeps its divider rule. */
  padding: var(--list-panel-pad, 0);
  border-right: var(--list-panel-border, 1px solid var(--border-primary));
  border-radius: var(--radius-list-card, 0);
  box-shadow: var(--shadow-lifted, none);
  background: var(--list-panel-bg, transparent);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ingredient-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px 16px;
}

.ingredient-detail-panel {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.ingredient-library-wrapper .ingredient-detail-panel {
  padding: 0 0 0 24px;
}

/* Hidden on desktop, shown on mobile via media query */
.ingredient-detail-back {
  display: none;
}

.search-bar {
  /* Left flush with the title + count; right inset to 16px so the search
     box shares its right edge with the result rows below it. */
  padding: 0 16px 16px 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding-left: 36px !important;
}

.spinner-icon {
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   My Ingredients
   -------------------------------------------------------------------------- */
.generate-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.generate-form .input-field {
  width: 240px;
}

.ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredient-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
}

.ingredient-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ingredient-card-name {
  font-size: 15px;
  font-weight: 500;
}

.page-header-actions {
  display: flex;
  gap: 8px;
}

.upload-review-card {
  padding: 24px;
  margin-top: 16px;
}

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.settings-toggle input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 18px;
  height: 18px;
}

.settings-save {
  align-self: flex-start;
}

.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}

.settings-link:hover {
  color: var(--link-on-surface-hover);
}

.settings-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.claim-watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}

.settings-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-account-email {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-account-role {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.settings-account-org {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.source-trust-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 16px;
}

.settings-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-toggle-name {
  font-size: 14px;
  color: var(--text-primary);
}

.settings-toggle-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Settings Shell (unified sub-nav + content layout used across all
   /settings/* pages). Three columns visually: app sidebar (outside this
   file's concern) | parchment sub-nav rail | content area.
   -------------------------------------------------------------------------- */
.settings-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  /* Fill the parent scroll container (.main-area) exactly, not the
     viewport. The viewport approach was wrong because banners above
     .main-area (verification, locked-mode, trial-prompt) eat vertical
     space, leaving .main-area shorter than 100vh, and a 100vh sub-nav
     would extend past the visible area and bury Sign out below the
     fold. height:100% follows the actual available height. */
  height: 100%;
  background: var(--bg-primary);
}

@media (max-width: 860px) {
  /* One column: the sub-nav stacks above the content, so the shell grows with both and the
     page scrolls as one. Pegged to height:100% here, from 768 to 860 px (.main-area is still the
     fixed-height scroll box there) the 800px sub-nav took the whole box and squeezed the content
     into a thin strip that scrolled on its own. */
  .settings-shell {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.settings-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 24px 16px 16px;
  border-right: 1px solid var(--border-divider);
  background: var(--bg-primary);
  /* Sticky to the parent scroll container (.main-area) so Sign out
     (pinned at the bottom of the flex column via
     .settings-subnav-filler) stays on-screen even when
     /settings/members or /settings/organisation content runs long.
     Height is 100% (fills the grid row, which now matches .main-area
     because .settings-shell uses height:100%), NOT 100vh, because
     the verification / locked-mode / trial-prompt banners above
     .main-area would otherwise push Sign out below the fold. */
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 100%;
  overflow-y: auto;
}

@media (max-width: 860px) {
  /* Compact menu in one column: a single row of pills that scrolls sideways and sticks to the
     top of the page scroll, instead of the full 800px list above every page. The title, group
     labels and filler drop out; the page has its own heading. app.js scrolls the
     current page's pill into view. */
  .settings-subnav {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border-divider);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }
  /* Scoped under .settings-subnav: the base rules for these classes come later in the file. */
  .settings-subnav .settings-subnav-title,
  .settings-subnav .settings-subnav-group-label,
  .settings-subnav .settings-subnav-filler {
    display: none;
  }
  .settings-subnav .settings-subnav-group {
    display: contents;
  }
  .settings-subnav .settings-subnav-item,
  .settings-subnav .settings-subnav-signout {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
    border: 1px solid var(--border-divider);
    border-radius: 999px;
  }
  .settings-subnav .settings-subnav-item.is-active {
    border-color: var(--text-primary);
  }
  .settings-subnav .settings-subnav-signout-form {
    flex: 0 0 auto;
  }
  .settings-subnav .settings-subnav-signout {
    width: auto;
  }
}

.settings-subnav-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 12px 20px;
}

.settings-subnav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.settings-subnav-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 8px 12px 6px;
}

.settings-subnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 120ms, color 120ms;
}

.settings-subnav-item:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.settings-subnav-item.is-active {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* A locked subnav item still links to the upgrade page, so it is an active
   control and its label must be readable. The global `.locked` treatment
   fades the whole element to 0.55, which took this grey label to 3.19:1.
   The padlock that `.locked::after` draws already says it is locked, so the
   label keeps full strength here, on hover too. */
.settings-subnav-item.locked,
.settings-subnav-item[data-locked-control="true"],
.settings-subnav-item.locked:hover,
.settings-subnav-item[data-locked-control="true"]:hover {
  opacity: 1;
}

.settings-subnav-item i,
.settings-subnav-item svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.settings-subnav-filler {
  flex: 1 1 auto;
  min-height: 24px;
}

.settings-subnav-signout-form {
  margin: 0;
}

.settings-subnav-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.settings-subnav-signout:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.settings-subnav-signout i,
.settings-subnav-signout svg {
  width: 16px;
  height: 16px;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 48px 56px;
  max-width: 880px;
  /* Scroll content independently of the sub-nav rail so long pages
     (e.g. /settings/members) don't push the rail taller than the
     scroll container. Without this the grid row would grow to fit
     the content, undoing the sub-nav's height:100% pegging. */
  min-height: 0;
  overflow-y: auto;
}

/* Pin every direct child to its natural height so the flex column
   does not squash tall cards to fit the viewport. Issue with the
   billing page (.plan-card) surfaced after PR #316 added the same
   rule to .settings-card only; this is the broader, future-proof
   form so any new card variant under .settings-content is covered
   automatically. The cards have overflow:hidden for rounded
   corners, which combined with squashing previously clipped the
   bottom rows; .settings-content's own overflow-y:auto becomes the
   scroll container, which is the intended architecture. */
.settings-content > * {
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .settings-content {
    padding: 32px 20px;
    /* The page scrolls, not the content box (see .settings-shell above). */
    overflow-y: visible;
  }
}

.settings-page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.settings-page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* Shared card styling for the unified settings area. The legacy
   .settings-card class further up the stylesheet is kept untouched for
   non-settings pages that still reference it, so the variant below uses
   the same class name with additional descendants to progressively
   enhance the look. */
.settings-shell .settings-card {
  padding: 0;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 12px);
  /* overflow:hidden keeps inner backgrounds (table head fill, footer
     action strip) inside the 12px rounded corners. Without flex-shrink:0
     the surrounding .settings-content flex column will squash tall cards
     to fit the viewport, clipping the bottom rows because overflow is
     hidden. We want the cards at their natural height; .settings-content
     itself has overflow-y:auto and is the scroll container. */
  overflow: hidden;
  flex-shrink: 0;
}

.settings-card-form {
  display: flex;
  flex-direction: column;
}

/* A card that is one line and one button: Sign out everywhere (PLAT-029 I2). */
.settings-shell .settings-card.settings-card-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 12px;
}

.settings-card-row-text {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-card-row-text .settings-card-title {
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: normal;
}

.settings-card-row-text .settings-card-sub {
  color: var(--text-deep);
  line-height: normal;
}

.settings-card-row .btn-secondary {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  line-height: normal;
  white-space: nowrap;
}

.settings-card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.settings-card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.settings-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card-body-table {
  padding: 0;
}

.settings-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-divider);
}

/* Autosave banner used on Preferences */
.settings-autosave-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
  border: 1px solid var(--status-pass);
  border-radius: var(--radius-banner, 8px);
  font-size: 13px;
}

.settings-autosave-banner i,
.settings-autosave-banner svg {
  width: 16px;
  height: 16px;
}

/* Email row with inline verified/unverified badge (Profile) */
.settings-email-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-email-row .input-field {
  flex: 1 1 auto;
}

.settings-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.settings-email-badge-verified {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.settings-email-badge-unverified {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.settings-email-badge i,
.settings-email-badge svg {
  width: 12px;
  height: 12px;
}

.settings-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--link-on-surface);
  font-size: 12px;
  text-decoration: none;
  margin-top: 4px;
  align-self: flex-start;
}

.settings-inline-link:hover {
  text-decoration: underline;
}

.settings-inline-link i,
.settings-inline-link svg {
  width: 12px;
  height: 12px;
}

/* URL slug row (Organisation details) */
.settings-slug-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-slug-input {
  background: var(--bg-muted);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.settings-slug-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.settings-slug-note i,
.settings-slug-note svg {
  width: 12px;
  height: 12px;
}

/* Website URL reachability field (Organisation details) */
.settings-url-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.settings-url-spinner {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  color: var(--text-tertiary);
}

.settings-url-spinner.htmx-request {
  display: inline-flex;
  animation: spin 0.9s linear infinite;
}

.settings-url-spinner i,
.settings-url-spinner svg {
  width: 14px;
  height: 14px;
}

.settings-url-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  width: fit-content;
}

.settings-url-badge i,
.settings-url-badge svg {
  width: 12px;
  height: 12px;
}

.settings-url-badge-ok {
  color: var(--status-pass, var(--status-pass));
}

.settings-url-badge-warn {
  color: var(--status-warn, var(--status-fail));
}

.settings-url-field-unreachable .input-field,
.settings-url-field-invalid .input-field,
.settings-url-field-blocked .input-field {
  border-color: var(--status-warn, var(--status-fail));
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Trusted sources table (Preferences) */
.settings-sources-table,
.settings-members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.settings-sources-table thead,
.settings-members-table thead {
  background: var(--bg-muted);
}

.settings-sources-table th,
.settings-members-table th {
  text-align: left;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.settings-sources-table td,
.settings-members-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--border-divider);
  vertical-align: middle;
}

.settings-sources-th-check,
.settings-sources-td-check {
  width: 40px;
  padding-right: 0 !important;
}

.settings-sources-th-count,
.settings-sources-td-count {
  width: 140px;
  text-align: right;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.settings-sources-td-label {
  color: var(--text-primary);
  font-weight: 500;
}

.settings-sources-check input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Claim watchlist (Preferences) */
.settings-claim-watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
}

.settings-claim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

/* PROD-022 PH9: one tick with its hint underneath (Recipe list card). */
.settings-tick-group { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.settings-tick-hint { margin: 0 0 0 26px; font-size: 13px; color: var(--text-secondary); }

.settings-claim-toggle input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 16px;
  height: 16px;
}

/* Invite form (Members) */
.settings-invite-form {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 12px;
  align-items: end;
  padding: 24px;
  border-top: 1px solid var(--border-divider);
}

@media (max-width: 720px) {
  .settings-invite-form {
    grid-template-columns: 1fr;
  }
}

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

/* Members table (Members) */
.settings-members-th-actions {
  width: 120px;
}

.settings-members-td-name {
  color: var(--text-primary);
}

.settings-members-name-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-members-name {
  font-weight: 500;
  color: var(--text-primary);
}

.settings-members-email {
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-invite-expired {
  font-size: 12px;
  color: var(--status-warning-text);
}

.settings-members-you {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 12px;
}

.settings-members-td-role {
  width: 180px;
}

.settings-members-td-actions {
  text-align: right;
}

.settings-members-td-actions form + form {
  margin-left: 8px;
}

.settings-members-remove {
  color: var(--status-fail);
}

.settings-members-remove:hover {
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
}

/* Role badges (Members) */
.settings-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-primary);
}

.settings-role-badge-owner {
  background: var(--accent-teal-light);
  color: var(--accent-teal-text);
}

.settings-role-badge-admin {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.settings-role-badge-member {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.settings-role-badge i,
.settings-role-badge svg {
  width: 12px;
  height: 12px;
}

/* Billing empty state */
.settings-billing-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 40px;
  background: var(--bg-surface);
  border: 2px dashed var(--border-primary);
  border-radius: 12px;
  text-align: center;
}

.settings-billing-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-teal-light);
  color: var(--accent-teal-text);
}

.settings-billing-empty-icon i,
.settings-billing-empty-icon svg {
  width: 26px;
  height: 26px;
}

.settings-billing-empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.settings-billing-empty-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0;
}

/* Danger card (red variant of settings-card) */
.danger-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--status-fail);
  border-radius: 12px;
  overflow: hidden;
}

.danger-card + .danger-card {
  margin-top: 24px;
}

.danger-card-head {
  display: flex;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--status-fail-bg);
  background: var(--status-fail-bg);
}

.danger-card-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--status-fail);
}

.danger-card-icon i,
.danger-card-icon svg {
  width: 18px;
  height: 18px;
}

.danger-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.danger-card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.danger-card-body {
  padding: 24px;
}

.danger-card-actions {
  display: flex;
  justify-content: flex-end;
}

.danger-card-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.danger-card-hint a {
  color: var(--link-on-surface);
  text-decoration: none;
}

.danger-card-hint a:hover {
  text-decoration: underline;
}

.danger-card-hint i,
.danger-card-hint svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.settings-confirm-input {
  font-family: var(--font-mono);
}

/* Hide the legacy /settings .main-area padding on the settings shell
   pages, the shell manages its own padding. The layout gives us a
   nested .main-area containing .settings-shell, so zero-pad here. */
.main-area:has(.settings-shell) {
  padding: 0;
}

/* --------------------------------------------------------------------------
   Admin Tables
   -------------------------------------------------------------------------- */
.admin-table-card {
  padding: 0;
  overflow: hidden;
  margin-top: 24px;
}

/* The title of an admin card (Blog, Dragnet, Help Centre, What's New). It
   had no rule, so in a table card, which has no padding, it sat on the
   card's border (Adam, 2026-10-13). */
.card-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Inside a .card-header bar (Dragnet), the bar sets the spacing. */
.card-header > .card-title {
  margin: 0;
}

.admin-table-card > .card-title {
  margin: 0;
  /* 24px sides: the same inset as a padded .card, so titles line up. */
  padding: 20px 24px 16px;
}

/* A plain block, not .empty-state's flex column: these are one sentence
   with inline <strong>, which a column would split onto separate lines. */
.admin-table-card > .empty-state {
  display: block;
  margin: 0;
  padding: 32px 24px;
}

.table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead {
  background: var(--bg-muted);
}

.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-divider);
}

/* PDF link in the invoices table. Browser default <a> is bright blue
   which clashes with the warm parchment palette; we render dark text
   with a gold underline accent and an arrow that nudges right on hover.
   The `a.` qualifier raises specificity to 0,1,1 so it ties with the
   user agent `a:-webkit-any-link` rule (author origin still wins on
   tie). Same styling shape as `.faq-teaser__link` on the marketing FAQ. */
a.invoices-table__pdf-link,
.invoices-table__pdf-link {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--brand-gold);
  text-decoration-thickness: 1.5px;
  white-space: nowrap;
  transition: text-decoration-color 0.15s ease;
}

.invoices-table__pdf-link:hover {
  text-decoration-color: var(--text-primary);
}

.invoices-table__pdf-link-arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.18s ease;
}

.invoices-table__pdf-link:hover .invoices-table__pdf-link-arrow {
  transform: translateX(3px);
}

.admin-select {
  padding: 6px var(--select-pad-right, 10px) 6px 10px;
  font-size: 13px;
  width: auto;
}

/* UX-009 Part A: the ingredient-request row's inline save form (status
   select + ingredient id + note + button), same flex-row shape as
   .members-actions above. */
.admin-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
}

.admin-action-btn {
  padding: 4px 12px;
  font-size: 13px;
}

/* Inline-edit inputs inside admin tables (e.g. /admin/plans). */
.admin-input {
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
  min-width: 0;
}

.admin-input-narrow {
  width: 90px;
}

.admin-feature-set {
  margin: 8px 0 0 0;
  padding: 8px 10px;
  background: var(--color-bg-elevated, var(--bg-panel));
  border-radius: 4px;
  font-size: 11px;
  max-height: 240px;
  overflow: auto;
}

/* --------------------------------------------------------------------------
   Review Queue
   -------------------------------------------------------------------------- */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.review-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
}

.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.review-card-description {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-card-category { margin-top: 4px; }

.review-card-meta {
  display: flex;
  gap: 16px;
}

.review-detail-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.review-detail-card {
  padding: 24px;
  margin-top: 16px;
}

/* --------------------------------------------------------------------------
   Responsive: Recipe Builder & Ingredient Library
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* ---- Recipe builder ---- */
  .recipe-builder {
    flex-direction: column;
    height: auto;
  }

  /* The builder header is a title column + actions cluster on one flex row;
     below desktop the actions (~330px) crush the title column to nothing and
     the non-wrapping formulation row (TYPE/SERVING/YIELD/WEIGHT, ~630px)
     pokes into .main-area's overflow, making the whole page swipe sideways.
     Stack the header and let the chips wrap instead. */
  .recipe-builder-header {
    flex-wrap: wrap;
  }

  .recipe-builder-header > div:first-child {
    flex-basis: 100%;
  }

  .formulation-inputs {
    column-gap: 16px;
  }

  .recipe-builder-main {
    padding: 20px 16px;
    overflow-y: visible;
  }

  .recipe-builder-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-primary);
    padding: 16px;
  }

  /* Horizontal scroll for ingredient table on mobile */
  .ing-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* UX-003 fix (pre-existing): without min-width on .ing-table itself its
     base overflow:hidden clipped the 580px rows and the wrapper never
     scrolled, so the unit/source/delete columns were unreachable on phones. */
  .ing-table-scroll .ing-table {
    min-width: 580px;
  }

  .ing-table-scroll .ing-table-header,
  .ing-table-scroll .ing-row,
  .ing-table-scroll .ing-table-footer {
    min-width: 580px;
  }

  /* ---- Ingredient library/my ingredients: show/hide panels ---- */
  .ingredient-library-wrapper {
    padding: 20px 16px;
  }

  .ingredient-library {
    flex-direction: column;
  }

  .ingredient-list-panel {
    width: 100%;
    border-right: none;
    max-height: none;
  }

  .ingredient-detail-panel {
    border-top: none;
  }

  /* On mobile, hide detail panel by default, show list */
  .ingredient-library .ingredient-detail-panel {
    display: none;
  }

  /* When detail is active (ingredient selected), hide list, show detail */
  .ingredient-library.detail-active .ingredient-list-panel {
    display: none;
  }

  .ingredient-library.detail-active .ingredient-detail-panel {
    display: block;
    padding: 0;
  }

  /* Mobile back button for ingredient detail */
  .ingredient-detail-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 0 0 16px;
    font-family: var(--font-primary);
  }

  .ingredient-detail-back:hover {
    color: var(--text-primary);
  }

  .ingredient-detail-back i,
  .ingredient-detail-back svg {
    width: 16px;
    height: 16px;
  }
}

/* --------------------------------------------------------------------------
   Tablet tier (UX-003): recipe builder + ingredient library stay two-pane.
   Only deltas from desktop; .detail-active is deliberately inert here and
   .ingredient-detail-back keeps its base display:none.
   Width budget at 820px: 820 - 64 rail - 280 sidebar - 40 padding = 436px
   main pane, so the ing-table scroll wrapper engages below ~1000px and the
   full column set fits only near 1024px. Accepted in the spec.
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
  /* ---- Recipe builder ---- */
  .recipe-builder-main {
    padding: 20px;
  }

  .recipe-builder-sidebar {
    width: 280px;
    min-width: 280px;
    padding: 16px;
  }

  /* Same header stacking as phone: the 436px tablet main pane cannot hold
     the title column, actions cluster, and the ~630px formulation row. */
  .recipe-builder-header {
    flex-wrap: wrap;
  }

  .recipe-builder-header > div:first-child {
    flex-basis: 100%;
  }


  .ing-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* min-width must sit on .ing-table itself: its base overflow:hidden (for
     the border-radius) would otherwise clip the 580px rows internally and
     the scroll wrapper would never overflow, leaving row tails unreachable. */
  .ing-table-scroll .ing-table {
    min-width: 580px;
  }

  .ing-table-scroll .ing-table-header,
  .ing-table-scroll .ing-row,
  .ing-table-scroll .ing-table-footer {
    min-width: 580px;
  }

  /* Touch targets from row height, not column width (UX-003 criterion 16). */
  .ing-row {
    min-height: 44px;
  }

  .drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 44px;
    /* A swipe starting on the handle drags the row instead of scrolling. */
    touch-action: none;
  }

  .ing-amount-input,
  .ing-unit-select {
    min-height: 44px;
    padding: 8px;
    /* Keep the focused row visible above the iPad software keyboard. */
    scroll-margin-bottom: 320px;
  }

  .ing-delete-btn,
  .btn-confirm-yes,
  .btn-confirm-no {
    min-width: 40px;
    min-height: 44px;
  }

  .ing-row-actions {
    padding-left: 24px;
  }

  /* ---- Ingredient library / My Ingredients ---- */
  .ingredient-library-wrapper {
    padding: 20px;
  }

  /* Header-main tracks the narrower tablet list panel; the title steps
     down so title + Add still fit the 300px column on one line. */
  .ingredient-library-header-main {
    width: var(--tablet-list-width);
  }

  .ingredient-library-header .page-title {
    font-size: 22px;
  }

  .ingredient-list-panel {
    width: var(--tablet-list-width);
    min-width: var(--tablet-list-width);
  }

  .ingredient-result-row {
    min-height: 44px;
  }

  /* Sidebar card headers (NUTRITION label + per-100g/per-serving toggle)
     need ~260px on one line; at the 280px sidebar the toggle wraps under
     the label instead of poking past the card edge. */
  .recipe-builder-sidebar .card-header {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .recipe-builder-sidebar .micro-header-left {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  /* The micro-columns 720px viewport query never fires at tablet, but the
     detail pane (~380px) and builder sidebar (280px) are far narrower than
     the viewport; stack vitamins/minerals to stop column collisions. */
  .ingredient-detail-panel .micro-columns,
  .recipe-builder-sidebar .micro-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* --------------------------------------------------------------------------
   Fragment-specific Styles
   -------------------------------------------------------------------------- */

/* Ingredient status filter */
.ingredient-status-filter { margin-top: 8px; }
.ingredient-category-filter { width: 100%; margin-top: 8px; }
.ingredient-category-filter .filter-select { width: 100%; }
.filter-select { font-family: var(--font-primary); font-size: 13px; color: var(--text-primary); background: var(--bg-surface, var(--bg-surface)); border: 1px solid var(--border-primary); border-radius: var(--radius-field, 8px); padding: 8px var(--select-pad-right, 12px) 8px 12px; cursor: pointer; }
.filter-select:focus { outline: none; border-color: var(--accent-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent); }

/* Ingredient search results */
.ingredient-results-list { display: flex; flex-direction: column; }
.ingredient-result-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; cursor: pointer; border-radius: var(--radius-card, 8px); transition: background 0.1s; }
.ingredient-result-row:hover, .ingredient-result-row-active { background: var(--bg-muted); }
/* Selected row: a warm gold tint so the active ingredient reads clearly in the
   list (stronger than the neutral hover state). */
.ingredient-result-row.is-active,
.ingredient-result-row.is-active:hover { background: color-mix(in srgb, var(--brand-gold) 12%, transparent); }
.ingredient-result-info { display: flex; align-items: center; gap: 8px; }
.ingredient-result-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ingredient-result-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ingredient-result-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.ingredient-result-category { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; }
.ingredient-result-description { font-size: 12px; color: var(--text-secondary); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ingredient-heart-icon { width: 14px; height: 14px; color: var(--status-fail); fill: var(--status-fail); }
.badge-source-curated { background: color-mix(in srgb, var(--source-user) 9%, transparent); color: var(--source-user-text); font-size: 10px; font-weight: 500; }
.badge-source-uploaded { background: color-mix(in srgb, var(--source-user) 9%, transparent); color: var(--source-user-text); font-size: 10px; font-weight: 600; }
/* My Ingredients "Requested" filter rows (Figma 1741:795): a request that
   is not yet an ingredient opens nothing, so it does not look clickable. */
.request-result-row { cursor: default; }
.ingredient-result-row .badge[class*="request-status-"] { font-size: 10px; font-weight: 600; }
.my-ingredients-requests-link { background: none; border: none; padding: 0; font: inherit; color: var(--link-on-surface); text-decoration: underline; cursor: pointer; }

/* Infinite scroll sentinel */
.ingredient-scroll-sentinel { display: flex; justify-content: center; padding: 12px 0; }
.scroll-loading { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }

/* Ingredient detail panel content.
   26px between blocks, matching the Figma frame's gap (node 33:2). */
.ingredient-detail { display: flex; flex-direction: column; gap: 26px; }

/* --------------------------------------------------------------------------
   UX-006 Figma parity (node 53:2): ONE card, then flat sections.

   The panel used to wrap every block in a bordered, filled card. Six stacked
   cards give six things the same visual weight, so nothing reads as more
   important than anything else and the eye has no route through the page. The
   design has exactly one card, Per 100g, and states everything below it as a
   flat section under a serif heading with a quiet right-aligned qualifier.
   Hierarchy comes from the headings and from whitespace, not from chrome.

   Structural note for anyone editing the fragments: several of these sections
   are ALSO hx-swap outerHTML targets (#ingredient-allergens-card, #costing,
   #provenance-card). The fragment is both the inline include and the swap
   response, so the wrapper markup below has to stay identical in every
   template that can render one of those ids, or the card style flips the
   moment an editor opens. -------------------------------------------------- */
.ingredient-section {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.ingredient-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
}
.ingredient-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0;
  text-transform: none;
}
/* Title plus whatever sits WITH the title rather than opposite it: the edit
   pencil, the cost freshness dot, the pairing beta chip. The right-hand slot
   belongs to the scope qualifier alone, so anything that qualifies the title
   itself has to travel with it. */
.ingredient-section-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
/* The qualifier, not a heading: it says which scope or caveat the section is
   speaking under ("your organisation", "3 recipes", "flavour network, not a
   recommendation"). Quiet on purpose; it must never compete with the title. */
.ingredient-section-meta {
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}

/* Section bodies were written when each of these was a card, so they carry a
   card's own horizontal inset (14-20px) on top of the panel's. Inside a flat
   section that inset is doubled and the body no longer lines up with the
   heading above it, which is the "nothing lines up" complaint in a new place.
   The panel already supplies the 10px inset via .ingredient-detail-aligned,
   so the body contributes none.

   Scoped to .ingredient-section rather than edited at source: .allergen-body
   and .used-in-recipe-row are also rendered by the recipe ingredient-info
   modal, which is still a card and still wants its own padding. */
.ingredient-section .allergen-body { padding: 4px 0 0; }
.ingredient-section .used-in-recipe-row { padding: 9px 0; border-bottom-color: var(--border-divider); }
.ingredient-section .used-in-recipe-row:last-child { border-bottom: 1px solid var(--border-divider); }
.ingredient-section .used-in-recipes-empty { padding: 4px 0 0; text-align: left; }
.ingredient-section .pairing-list { padding: 4px 0 0; }
/* Already separated from the title by the title-group's 8px gap. */
.ingredient-section .pairing-beta { margin-left: 0; }

/* UX-006 section 3.6: one shared inset so every section heading and every
   list row sits on the same vertical.

   The panel's cards inset their own content by 20px (see
   .ingredient-nut-card-header padding below), while the sections that are not
   cards (the source pill, the action row, the copy hatch, used-in-recipes,
   pairings, also-appears-under) sit flush at 0. That 20px discrepancy is the
   "nothing lines up" problem in the spec.

   Scoped to a NEW wrapper class and applied only to non-card children.
   Deliberately NOT applied to .nut-row, .section-label or .micro-row: those
   are shared with the recipe ingredient-info modal, the recipe nutrition and
   claims panels, the settings and admin modals (section-label alone is used by
   26 templates) and the PDF spec export, so insetting them would leak this
   change across surfaces nobody would think to check. */
.ingredient-detail-aligned { --ingredient-panel-inset: 10px; }
.ingredient-detail-aligned > *:not(.card) {
  padding-inline: var(--ingredient-panel-inset);
}
.ingredient-detail-header { display: flex; flex-direction: column; gap: 8px; }
.ingredient-detail-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ingredient-detail-header-top > div:first-child { flex: 1 1 60%; min-width: 200px; }
.ingredient-detail-name { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.ingredient-detail-description { font-size: 14px; color: var(--text-secondary); margin: 2px 0 0; line-height: 1.4; }
.ingredient-detail-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.ingredient-edit-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
}
.ingredient-detail-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 1; }
.ingredient-detail-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ingredient-detail-badges .badge i { width: 12px; height: 12px; }
.ingredient-detail-actions { display: flex; gap: 8px; }
.ingredient-detail-footer { display: flex; gap: 6px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-light, var(--border-divider)); }
.ingredient-id-badge { font-family: var(--font-mono); font-size: 10px; color: var(--source-user-text); background: color-mix(in srgb, var(--source-user) 6%, transparent); padding: 2px 6px; border-radius: 3px; }

/* Source pill */
.ingredient-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-muted);
  border-radius: var(--radius-source-badge, 6px);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  width: fit-content;
}

.ingredient-source-pill i { width: 14px; height: 14px; }

/* COMP-007a P4c: copy-to-my-ingredients hatch. A quiet card-adjacent box
   between the action-button row and the nutrition card - reuses the same
   surface/border/muted tokens as .ingredient-source-pill and .card rather
   than introducing new colours. */
/* UX-006 section 3.4: demoted from a bordered panel to a plain footnote.
   Once the button label says what the action does ("Create an editable copy"),
   the paragraph underneath is a detail rather than the whole meaning, and a
   bordered box around it claimed more of the reader's attention than it earns. */
.ingredient-detail-copy-hatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.ingredient-detail-copy-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.ingredient-detail-copy-success {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--status-pass);
  margin: 0;
}

.ingredient-detail-copy-success i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ingredient-detail-copy-success a {
  color: var(--status-pass);
  font-weight: 600;
  text-decoration: underline;
}

.ingredient-detail-copy-done {
  background: var(--status-pass-bg);
  border-color: var(--status-pass);
}

/* Ingredient nutrition card */
.ingredient-nut-card { padding: 0; }

/* Per 100g is now the ONLY card, so this rule has exactly one caller
   (detail-panel.html). It was mono/uppercase/letterspaced at 11px, the same
   treatment as MACRONUTRIENTS and MICRONUTRIENTS inside it, which put the
   card's own title on a level with its sub-headings. The design gives the
   card title the same serif 16px as every section heading on the page, and
   keeps the mono treatment for the sub-headings alone. */
.ingredient-nut-card-header {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-divider);
}

/* UX-006 section 3.2: the header's three ranked lines.
   Line 1 carries the name and the one signed trust claim; line 2 is quiet
   metadata at Body/Small. Colours reuse the existing AA-checked tokens rather
   than introducing new values, so the contrast lint keeps passing. */
.ingredient-detail-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ingredient-detail-meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.ingredient-detail-meta-item {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* UX-006 section 3.3: sub-sections inside the single per-100g card, and the
   footer that holds density and the footnotes. Density is g/ml, not a per-100g
   value, so it sits outside both sub-sections and the card header's statement
   stays true of everything above it. */
.nut-subsection + .nut-subsection { border-top: 1px solid var(--border-divider); }
.nut-subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-secondary);
  padding: 12px 20px 4px;
}
.nut-card-qualifier {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-secondary);
}
.nut-card-footer { border-top: 1px solid var(--border-divider); }

/* A dash is indistinguishable from a zero at a glance, and for a nutrient the
   difference between "measured and absent" and "nobody measured it" is the
   difference between a claim you can make and one you cannot. Set quieter than
   a real value so a column of them does not shout. */
.micro-value-unmeasured {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary);
}

.ingredient-nut-card .nut-table { padding: 4px 18px 12px; }
/* The footnotes are siblings of .nut-table, not children, so they missed the
   20px inset above and sat flush against the card's left edge while every row
   beside them was indented. Same 20px, same reason as the card-body rule
   further down: inside .ingredient-nut-card, content lines up with the
   nutrient rows. Scoped to this card because .nut-footnote is also used by
   review/nutrition-table.html, which sits in a differently padded container. */
.ingredient-nut-card .nut-footnote {
  padding-left: 18px;
  padding-right: 18px;
}
/* The footnotes are the LAST thing in the footer, and .nut-footnote's base
   rule pads top-only (6px 0 0), so the final line sat flush on the card's
   bottom edge. Padding the container once rather than each footnote: several
   can stack, and a per-footnote bottom pad would open gaps between them. */
.ingredient-nut-card .nut-card-footer { padding-bottom: 12px; }

/* Same bug, same card family: .cost-card-body carries the 20px inset, so the
   read-only view is indented and the edit form, which is a SIBLING of that
   body rather than a child, is not. Opening "Set a price" therefore threw the
   whole form flush left.

   Direct-child combinator on purpose. provenance-card.html nests its
   .inline-edit-form inside .cost-card-body, so it already inherits the inset;
   a descendant selector here would pad those forms twice. */
.ingredient-nut-card > .inline-edit-form,
.ingredient-section > .inline-edit-form { padding: 0 0 16px; }

/* Allergen body */
.allergen-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
}

.allergen-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-chip-sm, 4px);
}

.allergen-confirmed {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

/* Favourite button */
.favourite-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-button, 7px);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-primary);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.favourite-btn:hover { background: var(--bg-muted); }
.favourite-icon { width: 16px; height: 16px; color: var(--text-muted); }
.favourite-active { color: var(--status-pass); fill: var(--status-pass); }
.favourite-btn:has(.favourite-active) {
  /* Active/saved is an ACCENT state, not a pass verdict. Green is the
     compliance colour and this button makes no compliance claim; the
     design system scopes the highlight accent to active states. The
     default brand keeps its green through both fallbacks.

     The border and the LABEL take different tokens on purpose: this is the
     three-role contract. The accent identity colour is butter, which is
     1.38:1 on a white card and unreadable as text, so the label takes the
     accent's -text variant. Note the contrast lint cannot catch this class:
     the rule sets no background, so there is no pair for it to measure. */
  border-color: var(--state-active-accent, var(--status-pass));
  color: var(--state-active-accent-text, var(--status-pass));
}
/* Org uploads are in My Ingredients permanently, so the panel states the fact
   instead of rendering a toggle that cannot change it. It keeps .favourite-btn
   so it holds its place in the action row, and drops the affordances that
   would promise an action: no pointer, no hover shift. */
.favourite-btn-static { cursor: default; }
.favourite-btn-static:hover { background: var(--bg-surface); }

/* Tags and nutrition table */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dietary-tags { padding-bottom: 24px; }
.nut-table { display: flex; flex-direction: column; }
.nut-label { color: var(--text-primary); font-weight: 500; }
.nut-value { font-family: var(--font-mono); font-weight: 500; color: var(--text-primary); }
.nut-value-muted { color: var(--text-muted); font-style: italic; font-weight: 400; }
.nut-method-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 1px 4px;
  border-radius: var(--radius-chip-sm, 3px);
  vertical-align: middle;
  margin-left: 2px;
}
/* Specs first: the energy row of a sheet that did not print its energy. The tag sits with the label (a gap between them),
   the value stays at the right, and the Annex XIV words take their own line, so nothing crowds. */
.nut-row--worked-out { flex-wrap: wrap; column-gap: var(--space-md, 16px); row-gap: var(--space-xs, 4px); }
.nut-method-badge--worked-out { margin-left: var(--space-sm, 8px); }
.nut-row-note { flex: 1 1 100%; font-size: 12px; color: var(--text-label); }
/* COMP-008: the label-convention default is a guess we have marked, not a
   measured method; dashed so it reads as provisional next to a measured AOAC. */
.nut-method-badge-assumed {
  border: 1px dashed var(--text-muted);
  background: transparent;
  color: var(--text-muted);
  cursor: help;
}

/* COMP-008 Phase 2: the estimated mark for basis-unestablished fibre.
   Visually distinct from the assumed badge (dashed) and from a measured
   badge (solid): dotted border, warning tint. */
.nut-method-badge-estimated {
  border: 1px dotted var(--status-warning);
  background: transparent;
  color: var(--status-warning);
  cursor: help;
}

/* PLAT-020: subtle "regulated" tag beside the settings rows whose absence
   the spec PDF marks with a withheld stub. Mirrors the estimated badge
   above (dotted, warning tint) so the two marks read as one family. */
.settings-regulated-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border-radius: var(--radius-chip-sm, 3px);
  vertical-align: middle;
  margin-left: 6px;
  border: 1px dotted var(--status-warning);
  color: var(--status-warning);
  background: transparent;
  cursor: help;
}

/* Card header/body (sidebar card structure) */
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* PROD-019: with three basis options (100g / 100ml / serving) the toggle no
   longer fits beside the label, so it drops to its own full-width line. */
.card-header-stacked {
  flex-wrap: wrap;
  row-gap: 10px;
}
.card-header-stacked .status-toggle {
  display: flex;
  width: 100%;
}
.card-header-stacked .status-toggle-option {
  flex: 1 1 0;
  padding-left: 8px;
  padding-right: 8px;
}

.card-body {
  padding: 12px 20px;
}

/* --------------------------------------------------------------------------
   Nutri-Score panel (recipe builder sidebar). Renders the official A-E badge
   strip artwork (one image per grade, ns-{a..e}.png), scaled to sit alongside
   the panel label.

   The graded artwork (484x178) carries the enlarged rounded badge for the
   awarded grade, which overhangs the strip top and bottom; the not-assessable
   artwork (484x118) is the bare strip.

   Size on WIDTH, not height. Both files are 484px wide and the strip spans that
   full width in each, so a shared width renders the strip identically in both
   states with no per-state rule. Sizing on height instead would make the graded
   image the wider of the two (its extra pixels are vertical overhang), which
   eats the space the NUTRI-SCORE label needs.

   140px is a budget, not a round number. The sidebar is 360px, less 24px
   padding each side and 20px card padding each side leaves 272px of row, less
   the 16px flex gap. "NUTRI-SCORE" needs 94.6px on one line at the mono size
   and letter-spacing below, so the image can have at most ~150px before the
   label wraps to two lines. 140px leaves ~10px of headroom for font fallback
   and rounding; do not push it back toward 150px, that is the cliff edge.

   The nowrap on the heading is the structural guard: if this budget is ever
   wrong (different font loads, copy changes), the label holds its line and the
   layout stays readable rather than silently regressing to a wrapped title.
   -------------------------------------------------------------------------- */
.nutriscore-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}
.nutriscore-heading {
  white-space: nowrap;
}
.nutriscore-img {
  display: block;
  width: 140px;
  height: auto;
  flex-shrink: 0;
}
.nutriscore-na {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}
/* PROD-019: scoring caveat sits BELOW the flex row, never inside the 140px
   image budget above. Two classes so it outranks .nut-footnote's padding,
   which is declared later and would otherwise pin it to the card edges. */
.nut-footnote.nutriscore-caveat {
  padding: 0 20px 14px;
  margin-top: -8px;
}

.nut-yield-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding: 4px 8px;
  margin-bottom: 4px;
  background: var(--bg-muted);
  border-radius: 4px;
}
.nut-subheader {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: right;
  padding: 4px 0 2px;
}

.nut-basis-note {
  font-style: italic;
  opacity: 0.75;
}
.nut-footnote {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 0 0;
  line-height: 1.4;
}

/* --- Retail reference panel --- */
.retail-reference-section {
  margin-top: 0;
  padding: 16px 32px;
}

/* Collapsible panel (mirrors agent-review-panel) */
.retail-ref-panel { margin: 0; }

.retail-ref-panel > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  list-style: none;
  user-select: none;
}

.retail-ref-panel > summary::-webkit-details-marker { display: none; }

.retail-ref-panel > summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--decorative-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.retail-ref-panel[open] > summary::before {
  transform: rotate(90deg);
}

.retail-ref-panel > summary .nut-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.retail-ref-match-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.retail-ref-body { padding: 8px 0 0 13px; /* align with shopping-bag icon */ }

/* Uniform icon size for section headings (bot, shopping-bag, etc.) */
.nut-heading i[data-lucide] {
  width: 16px;
  height: 16px;
}

.retail-ref-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.retail-ref-table-wrap { overflow-x: auto; }

.retail-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.retail-ref-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.retail-ref-table th:first-child { text-align: left; }

.retail-ref-table td {
  padding: 6px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-primary);
}

.retail-nutrient-label {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}

.retail-current-value { color: var(--text-primary); }
.retail-value-missing { color: var(--text-muted); }

.retail-median-value {
  font-weight: 600;
  color: var(--accent-teal-text);
}

.retail-product-value { color: var(--text-muted); }

.retail-product-th {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
}
.retail-product-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-primary);
  text-underline-offset: 2px;
}
.retail-product-link:hover {
  color: var(--link-on-surface-hover);
  text-decoration-color: var(--accent-teal);
}

.retail-region-badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: var(--radius-chip-sm, 3px);
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

.retail-region-uk { background: var(--bg-muted); color: var(--text-primary); }
.retail-region-eu { background: var(--bg-muted); color: var(--text-secondary); }
.retail-region-row { background: var(--bg-muted); color: var(--text-secondary); }

.retail-row-highlighted { background: color-mix(in srgb, var(--brand-gold) 6%, transparent); }

.retail-ref-footer {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 0 0;
  line-height: 1.4;
}

/* OPS-006: retry search row + alias capture affordances */
.retail-ref-retry {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bg-muted);
  background: var(--bg-surface);
  flex-wrap: wrap;
}

.retail-ref-retry-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.retail-ref-retry-input {
  flex: 1 1 240px;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
}

.retail-ref-retry-toggle {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.retail-ref-retry-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-muted);
}

.retail-ref-flash {
  padding: 0.5rem 0.75rem;
  color: var(--status-pass);
  font-size: 0.85rem;
}

.retail-ref-match-count-empty {
  color: var(--text-secondary);
  font-style: italic;
}

.retail-ref-auto-widened {
  color: var(--text-secondary);
  font-style: italic;
}

.retail-ref-empty {
  padding: 0.75rem 0.75rem 0.25rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Nutrition dividers */
.nut-divider {
  height: 1px;
  background: var(--border-divider);
  margin: 4px 0;
}

.nut-value.bold {
  font-weight: 600;
}

/* Per-ingredient breakdown */
.ing-breakdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
}

.ing-breakdown-chevron {
  width: 14px;
  height: 14px;
  /* A flex item shrinks below its width when the sibling label is wide:
     the HEALTH CLAIMS header (two badges plus a register label) squeezed
     its chevron to about 10px on a narrow sidebar while ALL CLAIMS kept
     14px (Adam, dev, 2026-09-16). Never shrink. */
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.ing-breakdown-chevron-open {
  transform: rotate(180deg);
}

.ing-breakdown {
  display: flex;
  flex-direction: column;
}

.macro-group {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-divider);
}

.macro-group:last-child {
  border-bottom: none;
}

.macro-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.macro-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.macro-contrib {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 11px;
  color: var(--text-secondary);
}

.macro-contrib-name {
  font-weight: 400;
}

.macro-contrib-vals {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

/* #1119: absolute grams (or kcal) shown before the % so number-oriented
   users can scan the contribution directly. Muted vs the percent. */
.macro-contrib-grams {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-tertiary);
}

.macro-contrib-pct {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ===== My Ingredients ===== */

/* My Ingredients filters */
.my-ingredients-filters { display: flex; gap: 16px; padding: 0 20px; }
.filter-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px;
                   font-family: var(--font-primary); color: var(--text-secondary); cursor: pointer; }
.filter-checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--text-primary); }

/* Two-column bottom section */

/* Cost source badge */
.badge-cost-source { background: var(--bg-muted); color: var(--text-secondary); }

/* Costing card body */
.cost-card-body { padding: 4px 0 0; display: flex; flex-direction: column; gap: 12px; }
.cost-price-row { display: flex; align-items: baseline; gap: 4px; }
.cost-price-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
/* SUPPLY-004: the shelf-life card's stated value. Deliberately NOT
   .cost-price-value: that is a 24px display-serif headline sized for a short
   price, and a shelf life is a sentence ("6 weeks · best before · chilled"),
   which at that scale dominated the whole panel. Body font, one step up from
   default, because it is this card's primary content rather than a labelled
   sub-field like provenance-card's value. */
.shelf-life-value { font-size: 15px; font-weight: 500; color: var(--text-primary); }
/* SUPPLY-004 form layout (design review 2026-08-05). The first pass gave each
   of five short controls its own full-width row, so the form ran ~840px tall
   while using about a third of the panel width, and both text placeholders
   truncated mid-word. Row 1 now carries duration + date type + storage state,
   the same three things, in the same order, that the saved card renders as
   "24 months · best before · chilled".

   flex-wrap, not a fixed grid: at narrow widths the three fields wrap to two
   lines rather than squashing three selects into an unreadable row. The
   200px basis is the point where a select still shows "Best before" whole. */
.shelf-life-row { display: flex; gap: 16px; flex-wrap: wrap; }
.shelf-life-field { display: flex; flex-direction: column; min-width: 0; }
/* max-width matters as much as the basis. Without it, a field that wraps onto
   a line of its own grows to the full panel width, so on a mid-width panel
   "Storage state" became a 476px select sitting under two 200px ones. The cap
   keeps a wrapped field the same size as its unwrapped siblings. */
.shelf-life-row > .shelf-life-field { flex: 1 1 200px; max-width: 300px; }
.shelf-life-row > .shelf-life-field-duration { flex: 1 1 220px; max-width: 300px; }
.shelf-life-duration-inputs { display: flex; gap: 8px; min-width: 0; }
.shelf-life-duration-inputs .shelf-life-num { flex: 0 1 84px; min-width: 0; }
.shelf-life-duration-inputs .input-field + .input-field { flex: 1 1 auto; min-width: 0; }
/* Clear is destructive, so it goes to the far edge rather than sitting a few
   pixels from Cancel. margin-left:auto keeps it right-aligned without needing
   a spacer element. */
.shelf-life-actions { display: flex; align-items: center; gap: 12px; }
.shelf-life-actions .shelf-life-clear { margin-left: auto; }
.cost-price-unit { font-size: 14px; color: var(--text-secondary); }
.cost-supplier-row { display: flex; justify-content: space-between; align-items: center; }
.cost-supplier { font-size: 13px; color: var(--text-secondary); }
.cost-date { font-size: 12px; color: var(--text-muted); }
/* UX-006 Figma parity (node 33:173): the price state and its action share one
   row. The button used to be the last child of a flex COLUMN, and a column
   stretches its children, so "Set a price" spanned the full panel width and
   read as the section's primary call to action rather than a quiet way to
   edit one field. */
.cost-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
/* The reveal buttons sit on their state's row now, so the stacked-button
   top margin would push them off centre. Scoped to the row so the provenance
   card's own reveal buttons, which are still stacked, keep theirs. */
.cost-state-row .inline-edit-open { margin-top: 0; }

/* Freshness indicator */
/* Cost freshness badge (inline in header, not a bar) */
.cost-freshness-badge { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; }
.cost-freshness-dot { width: 6px; height: 6px; border-radius: 50%; }
.cost-freshness-current .cost-freshness-dot { background: var(--status-pass); }
.cost-freshness-current { color: var(--status-pass); }
.cost-freshness-aging .cost-freshness-dot { background: var(--status-warning); }
.cost-freshness-aging { color: var(--status-warning); }
.cost-freshness-stale .cost-freshness-dot { background: var(--status-fail); }
.cost-freshness-stale { color: var(--status-fail); }

/* uPlot price history chart */
.cost-chart-section { display: flex; flex-direction: column; gap: 6px; }
.cost-chart-label { font-family: var(--font-primary); font-size: 11px; color: var(--text-muted); }
.cost-chart-wrap { position: relative; }
.cost-uplot { border-radius: 6px; overflow: hidden; }
.cost-chart-tooltip {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--text-secondary); text-align: center; padding: 4px 0;
  opacity: 0; transition: opacity 0.15s; min-height: 20px;
}

/* Cost update form */
.cost-update-section { border-top: 1px solid var(--border-primary); padding-top: 12px; }
.cost-update-label { font-size: 13px; font-weight: 500; margin-bottom: 8px; display: block; }
/* UX-006: .cost-update-form removed. It was declared TWICE, and the second
   declaration sat AFTER .inline-edit-form's display:none at equal specificity,
   so display:flex won on source order and the "form on demand" disclosure was
   permanently open: every card showed its empty edit form alongside the new
   state text, which is the exact defect spec 3.5 exists to remove. The class
   was used by only these two templates, so both declarations are now dead and
   both are gone. Row layout comes from .cost-update-inputs below. */
.cost-update-inputs { display: flex; gap: 8px; align-items: center; width: 100%; }
.cost-input-prefix, .cost-input-suffix { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.cost-input { width: 80px; font-family: var(--font-mono); }
.cost-supplier-input { flex: 1; min-width: 0; }
.cost-save-btn { white-space: nowrap; }

/* SUPPLY-005: supplier fields on the cost forms. Tokens only. */
.cost-supplier-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.cost-moq { display: inline-flex; gap: 4px; }
.cost-moq .input-field:first-child { width: 6em; }
.cost-supplier-meta { color: var(--text-muted); margin: 2px 0 0; }

/* DATA-025: provenance card. Sits below the two-column section, so it needs the
   same 20px inter-card gap the columns use. The two sections stack
   label-over-form; the organic-cert row has three inputs plus Save, so its input
   row wraps rather than chopping the button off the card edge. */
#provenance-card { margin-top: 20px; }
.provenance-section { display: flex; flex-direction: column; gap: 6px; }
.provenance-section + .provenance-section { margin-top: 14px; }
.provenance-section .cost-update-label { display: block; }
.provenance-section .cost-update-inputs { flex-wrap: wrap; }
.provenance-section .cost-update-inputs .input-field { flex: 1 1 150px; min-width: 0; }
.provenance-section .cost-update-inputs .cost-save-btn { flex: 0 0 auto; }
.provenance-history { margin-top: 12px; }
.provenance-history-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.provenance-history-item { display: flex; gap: 8px; align-items: center; }
/* DATA-025: certifications list - one clean row per certification. Scheme name
   on top, certifier / reference / expiry as a muted line beneath, and a ghost
   icon remove control on the right. Hairline divider between rows; no pills,
   no logos (we never render a licensed certification mark off declared data). */
.cert-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.cert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border-divider);
}
.cert-row:first-child { border-top: none; }
.cert-row-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cert-row-name { font-weight: 500; font-size: 13px; color: var(--text-primary); }
.cert-row-meta { font-size: 12px; color: var(--text-secondary, var(--text-secondary)); }
.cert-row-remove-form { flex: 0 0 auto; margin: 0; }
.cert-row-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.cert-row-remove:hover { background: var(--bg-muted); color: var(--status-fail-text); }
.cert-row-remove svg,
.cert-row-remove i { width: 16px; height: 16px; }
.provenance-cert-add-form { margin-top: 4px; }
/* DATA-025: recipe ingredient-info modal - costing + provenance sections.
   Each section is read-only with a small edit icon linking to the editable
   My Ingredients page (named anchor). */
.modal-info-section { margin-top: 20px; }
.modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal-section-head .section-label { margin: 0; }
.modal-section-edit {
  display: inline-flex;
  align-items: center;
  color: var(--text-tertiary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 4px;
  margin: -4px;
  cursor: pointer;
}
.modal-section-edit:hover { color: var(--link-on-surface-hover); }
.modal-section-edit svg,
.modal-section-edit i { width: 14px; height: 14px; }
.modal-cost-price { font-weight: 600; color: var(--text-primary); }

/* In-situ edit toggle for the ingredient modal COSTING / PROVENANCE sections.
   A visually-hidden checkbox holds the editing state; CSS sibling selectors
   swap the read-only view (.modal-ro) for the inline form (.modal-edit-form).
   Survives hx-swap (a fresh fragment arrives unchecked) with no JS binding,
   mirroring the ingredient-row delete-confirm pattern. */
.modal-edit-toggle, .inline-edit-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
/* An absolutely-positioned element without a positioned ancestor is laid out
   against the INITIAL containing block, which means it escapes any scrolling
   container it happens to sit inside. overflow:auto does not contain it;
   only position (or transform/filter/contain) does.

   These toggles sit deep inside .ingredient-detail-panel, which scrolls
   internally. With no positioned parent they resolved against the page, so
   the toggle furthest down the panel's 2200px of content pushed the DOCUMENT's
   scroll height to 2200 while the body stayed at viewport height. The result
   was a page that scrolled roughly 1600px past its own content into an empty
   void, with nothing visible in it, because the only thing down there was a
   1x1 transparent checkbox.

   :has() rather than a list of parent classes on purpose. The bug is a
   property of the toggle, not of the three containers that currently hold
   one, so the fix belongs with the toggle and should cover the fourth
   container nobody has written yet. Position must stay absolute: these live
   in flex columns, and putting them back in flow would add a row plus the
   container's gap. */
*:has(> .modal-edit-toggle),
*:has(> .inline-edit-toggle) { position: relative; }
.modal-edit-form, .inline-edit-form { display: none; flex-direction: column; gap: 8px; margin-top: 8px; }
.modal-edit-toggle:checked ~ .modal-ro,
.inline-edit-toggle:checked ~ .inline-edit-ro { display: none; }
.modal-edit-toggle:checked ~ .modal-edit-form,
.inline-edit-toggle:checked ~ .inline-edit-form { display: flex; }
/* Hide the pencil while editing so the inline form owns the section. */
.modal-edit-toggle:checked ~ .modal-section-head .modal-edit-open { visibility: hidden; }
.modal-edit-row, .inline-edit-row { display: flex; align-items: center; gap: 6px; }
.modal-edit-row .cost-input { width: 6.5rem; }
.modal-edit-label, .inline-edit-label { font-size: 0.8rem; color: var(--text-secondary); }
.modal-edit-actions, .inline-edit-actions { display: flex; align-items: center; gap: 8px; }

/* UX-006 section 3.5. The ingredient cards adopt the SAME click-to-edit
   mechanism the recipe modal already uses, rather than inventing a third
   pattern: a visually-hidden checkbox plus sibling selectors, framework-free,
   which survives an hx-swap outerHTML with no re-init (a fresh render arrives
   unchecked, i.e. back to read-only, which is the correct close-after-save).
   The selectors above are shared rather than duplicated; only the class names
   differ, because "modal-" would be a lie on the ingredient panel.

   Note this hides only the FORM, never the state. The price, the source badge,
   the system median and the price-history chart stay rendered, which is both
   what "state first, form on demand" means and the reason the uPlot chart has
   no zero-width problem here. */
.inline-edit-state-empty { color: var(--text-secondary); font-size: 13px; margin: 0; }
.cost-waterfall-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 6px 0 0;
  line-height: 1.45;
}
.inline-edit-open { margin-top: 10px; }
.cert-empty-state { color: var(--text-secondary); font-size: 13px; }

.modal-provenance-manage-link { display: inline-block; margin-top: 4px; font-size: 0.8rem; color: var(--link-on-surface); text-decoration: none; }
.modal-provenance-manage-link:hover { text-decoration: underline; }
.spec-error-msg { color: var(--status-fail); font-size: 0.8rem; }
/* DATA-025: small sub-heading inside a nut-table (e.g. "Certifications" under
   the country-of-origin row in the provenance section). */
.nut-subhead {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary, var(--text-secondary));
}

/* System median */
.cost-median-row { display: flex; justify-content: space-between; font-size: 12px;
                   color: var(--text-secondary); }

/* Used in Recipes card */
.used-in-recipes-body { display: flex; flex-direction: column; }
.used-in-recipe-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px;
                      border-bottom: 1px solid var(--border-primary); text-decoration: none;
                      color: inherit; cursor: pointer; }
.used-in-recipe-row:last-child { border-bottom: none; }
.used-in-recipe-row:hover { background: var(--bg-muted); }
.used-in-recipe-icon { width: 14px; height: 14px; color: var(--text-secondary); flex-shrink: 0; }
.used-in-recipe-info { display: flex; flex-direction: column; gap: 2px; }
.used-in-recipe-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.used-in-recipe-amount { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }
.used-in-recipes-empty { padding: 16px; text-align: center; }

/* Responsive: stack columns when detail panel gets narrow */
@media (max-width: 1400px) {
}

/* --------------------------------------------------------------------------
   Claims Panel
   -------------------------------------------------------------------------- */
.claims-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* #1120: wrap the summary pills onto multiple lines instead of a horizontal
   scroll (David found the horizontal scroll awkward). */
.claims-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* #1120: met/not-met filter on the expanded ALL CLAIMS list. Alpine sets
   claims-filter-<mode> on the container; rows carry data-status. "Met" = a
   qualifying (pass) claim; "not-met" = everything else (near/fail/na). Empty
   category headers are hidden with :has() so a filtered category disappears. */
.claims-filter-bar {
  margin-bottom: 10px;
}

/* Equal thirds, not text-width thirds.
   .claims-detail is a column flexbox, so its default align-items: stretch
   pulls this inline-flex bar to the full panel width. The options kept their
   content width, which left every pixel of slack inside the LAST cell. It
   read as a badly sized third pill rather than as trailing space, because
   that button's background is the same surface colour as the bar.
   `flex: 1 1 0` distributes from a zero basis, so the three are equal
   regardless of label length ("All" against "Not met"). Scoped to this bar:
   the recipe page's search toggle shares .picker-mode-option and is meant
   to hug. */
.claims-filter-bar .picker-mode-option {
  flex: 1 1 0;
  text-align: center;
}

.claims-filter-met .claims-row:not([data-status="pass"]) {
  display: none;
}

.claims-filter-not-met .claims-row[data-status="pass"] {
  display: none;
}

.claims-filter-met .claims-category:not(:has(.claims-row[data-status="pass"])) {
  display: none;
}

.claims-filter-not-met .claims-category:not(:has(.claims-row:not([data-status="pass"]))) {
  display: none;
}

.claim-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-chip-sm, 4px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.claim-pill i,
.claim-pill svg {
  width: 12px;
  height: 12px;
}

.claim-pill-pass {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.claim-pill-near {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.claims-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

.claims-category {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.claims-category-label {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.claims-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.claims-row-label {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.claims-row .badge {
  font-size: 9px;
  padding: 2px 6px;
  gap: 2px;
}

.claims-row .badge i,
.claims-row .badge svg {
  width: 10px;
  height: 10px;
}

.claims-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.claims-row-proximity {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* COMP-011 Increment 0: health claims sub-section, nested inside the same
   .claims-body as ALL CLAIMS above and sharing its toggle/badge classes. */
.claims-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.claims-register-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.health-claim-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}

.health-claim-row + .health-claim-row {
  border-top: 1px solid var(--border-primary);
}

.health-claim-text {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.health-claim-unlock {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin: 0;
}

.health-claim-conditions {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
}

/* COMP-011 Increment 0b: dual-market mark on an eligible/manual health
   claim row, same mono treatment as .claims-register-label above. */
.health-claim-markets {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Same full-border tinted-fill treatment as .origin-advisory. */
.claims-advisory {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-banner, 8px);
  background: var(--status-warning-bg);
  font-size: 12px;
  color: var(--text-primary);
}

.claims-advisory i,
.claims-advisory svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--status-warning);
}

/* COMP-011 Increment 1: micronutrient data-gap lines (D5/D6/D7/D8), shown
   before the eligible list. .claims-pending is the beverage-gate line,
   .claims-data-gap the fixable-by-customer gaps (unknown ingredients,
   not-assessable nutrients, uncooked-basis warning, retention cautions),
   .claims-note the permanent no-source-data line. */
.claims-pending,
.claims-data-gap,
.claims-note {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 6px 0;
}

.claims-data-gap i,
.claims-data-gap svg {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  color: var(--status-warning);
}

/* COMP-011 Increment 1 IA (2026-09-16): the health claims card answers
   "what do I do next". Fix rows carry one action each; eligible claims sit
   under the nutrient that unlocks them; the facts live in a modal. */
.claims-fix-list,
.claims-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px 0;
}

.claims-fix-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-banner, 8px);
  background: var(--status-warning-bg);
}

.claims-fix-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--status-warning-text);
}

.claims-fix-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.claims-fix-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-primary);
}

.claims-fix-detail {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.claims-fix-action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--status-warning-text);
  cursor: pointer;
}

.claims-fix-action svg {
  width: 12px;
  height: 12px;
}

.claims-group {
  padding: 6px 0;
}

.claims-group + .claims-group {
  border-top: 1px solid var(--border-primary);
}

.claims-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.claims-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.claims-group-nutrient {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* COMP-018: the High in line, between the pills and ALL CLAIMS. */
.claims-high-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.claims-high-in-line {
  display: flex;
  flex: 0 0 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}

.claims-high-in-line .help-hint {
  flex-shrink: 0;
}

.claims-high-in-label {
  font-weight: 600;
}

.claims-high-in .claims-near-miss-text {
  flex: 0 0 100%;
}

.claims-gate-text {
  margin: 0 0 4px 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.claims-near-miss-text {
  margin: 0 0 4px 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--status-warning-text);
}

.claims-group-claims {
  padding-left: 4px;
}

.claims-details-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
}

.claims-details-body p,
.claims-details-notes {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

.claims-details-notes {
  padding-left: 18px;
  margin: 8px 0;
}

/* HFSS body */
.hfss-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hfss-body .divider-h {
  margin: 6px 0;
}

.hfss-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hfss-score-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.hfss-label {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.hfss-point-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

/* NPM score value */
.score-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

/* Sub-section label */
.section-label-sm {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* Horizontal divider */
.divider-h {
  height: 1px;
  background: var(--border-divider);
}

/* Formula/threshold */
.hfss-calc {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hfss-calc .formula {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.hfss-calc .threshold {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* NPM dual-score UI */
.hfss-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.hfss-header .section-label {
  white-space: nowrap;
}

.hfss-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.hfss-badges .badge {
  white-space: nowrap;
}

.hfss-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-divider);
}

.hfss-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.hfss-tab:hover {
  color: var(--text-primary);
}

.hfss-tab-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-teal);
}

.hfss-divergence {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 6px 8px;
  background: var(--status-warning-bg);
  border-radius: 4px;
  color: var(--status-warning-text);
}

.hfss-incomplete-msg {
  padding: 4px 0;
}

.hfss-caveat {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 0;
}

/* Disclaimer */
.disclaimer {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* METH-002 G6 / METH-009 3.4: the standing caveat, on screen.

   Emitted by partials/standing-caveat.html, which every fragment or page
   showing a DERIVED recipe value includes (ruling A73 draws that boundary at
   recipe values, not stored ingredient composition).

   DO NOT HIDE THIS and do not collapse it behind a disclosure. display:none,
   visibility:hidden, a zero height or a clip would each leave a caveat we are
   required to show in the markup and out of the reader's sight, which is the
   failure G6 exists to prevent. Quiet is fine; absent is not. */
.standing-caveat {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

/* RAG colours */
.text-teal { color: var(--accent-teal-text); }
.text-orange { color: var(--accent-orange); }
.text-red { color: var(--status-fail); }
.text-pass { color: var(--status-pass); }
.text-fail { color: var(--status-fail); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.icon-xs { width: 14px; height: 14px; }

/* Cost data */
.cost-list { display: flex; flex-direction: column; gap: 4px; }
.cost-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.cost-supplier { font-size: 14px; }
.cost-average { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-divider); font-weight: 600; }
.cost-summary { display: flex; flex-direction: column; gap: 12px; }

/* Recipe ingredient rows */
.ing-row { display: grid; grid-template-columns: 32px 1fr 80px 56px 60px 80px 40px; gap: 8px; padding: 8px 12px; align-items: center; border-bottom: 1px solid var(--border-divider); background: var(--bg-surface); }
.ing-row:hover { background: var(--bg-muted); }
.drag-handle i { width: 16px; height: 16px; }
.ing-row-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.ing-row-name { flex-wrap: wrap; }
/* Lune & Wild feedback 2026-10-07: the catalogue name under an organisation
   label name (recipe row, inspector header). Secondary, never the headline. */
.ing-name-catalogue { margin: 0; font-size: 11px; font-weight: 400; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* In the row the catalogue name always takes its own line under the printed
   name, whatever the name's length; the allergen dot and chips stay on the
   first line beside the name (order), and a gap warning comes last. */
.ing-row-name > .ing-name-catalogue { flex-basis: 100%; order: 1; }
.ing-row-name > .ing-row-gap { order: 2; }
.ing-row-gap { flex-basis: 100%; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; font-weight: 500; color: var(--status-warning); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.ing-row-gap-icon { width: 12px; height: 12px; flex-shrink: 0; }
.swap-list-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.swap-dismiss-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); background: none; border: none; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-field-sm, 4px); }
.swap-dismiss-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.ing-amount-input { width: 100%; padding: 4px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 4px); font-family: var(--font-mono); font-size: 13px; text-align: right; }
.ing-amount-input:focus { border-color: var(--accent-teal); outline: none; }
.ing-amount-input::-webkit-inner-spin-button,
.ing-amount-input::-webkit-outer-spin-button { -webkit-appearance: inner-spin-button; opacity: 1; height: 100%; cursor: pointer; }
.ing-unit-select { width: 100%; padding: 4px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 4px); font-size: 13px; background: var(--bg-surface); }
/* PROD-007 Stage B: per-line cooking-method picker + quiet resolution chip. */
.ing-row-method { display: inline-block; margin-top: 4px; }
.ing-method-select { max-width: 180px; padding: 2px 6px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 4px); font-size: 12px; background: var(--bg-surface); color: var(--text-secondary); }
/* PROD-007 Stage B: the per-line NRF (nutrient retention factor) chip. One
   fixed "NRF" label; colour carries the outcome: green = displayed nutrition
   reflects cooking retention (a measured cooked variant or calculated factors),
   amber = retention could not be modelled so raw values are shown. The hover
   title (retention_hint) gives the specific reason. */
.ing-retention-chip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: var(--radius-chip-sm, 10px); font-size: 11px; font-weight: 600; letter-spacing: 0.3px; text-transform: none; vertical-align: middle; }
.ing-retention-measured { background: var(--status-pass-bg); color: var(--status-pass-text); }
.ing-retention-calculated { background: var(--status-pass-bg); color: var(--status-pass-text); }
.ing-retention-caution { background: var(--warn-subtle, var(--status-warning-bg)); color: var(--accent-orange-text); }
/* EXPORT-003: per-line QUID (FIR Art 22) declare toggle. A visually hidden but
   keyboard-operable checkbox drives a pill label (via <label for>); no Alpine,
   so it survives the row's hx-swap-oob re-renders (same rationale as the delete
   confirm). When on, the pill fills and reveals the mix-bowl percent chip
   client-side ("QUID 12.4%"); the percent itself re-renders from weight_percent. */
.ing-row-quid { display: inline-flex; align-items: center; margin-left: 6px; margin-top: 4px; vertical-align: middle; }
.ing-quid-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.ing-quid-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 1px 6px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip-sm, 10px); font-size: 11px; font-weight: 600; letter-spacing: 0.3px; color: var(--text-secondary); background: var(--bg-surface); user-select: none; }
.ing-quid-label:hover { border-color: var(--accent-teal); color: var(--text-secondary); }
/* Gold is a light fill and takes the espresso label (7.79:1); white on
   gold is 2.08:1 (#1065). */
.ing-quid-toggle:checked + .ing-quid-label { background: var(--accent-teal); border-color: var(--accent-teal); color: var(--brand-espresso); }
.ing-quid-toggle:focus-visible + .ing-quid-label { outline: 2px solid var(--accent-teal); outline-offset: 1px; }
.ing-quid-pct { display: none; font-variant-numeric: tabular-nums; }
.ing-quid-toggle:checked + .ing-quid-label .ing-quid-pct { display: inline; }
/* EXPORT-005 Stage 1: per-line FIC declaration-name override + its adjacent
   422 error slot. Reuses the .ing-amount-input tokens (border/radius/font
   size) rather than inventing new ones. */
.ing-declaration-name { display: block; width: 100%; margin-top: 4px; padding: 4px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 4px); font-size: 12px; background: var(--bg-surface); }
.ing-declaration-name:focus { border-color: var(--accent-teal); outline: none; }
.ing-declaration-name-error { display: block; font-size: 11px; color: var(--status-fail); margin-top: 2px; }
.ing-declaration-name-error:empty { display: none; }
/* #599: read-only recipe view renders row values as static text (no edit controls) */
.ing-amount-ro { display: inline-block; width: 100%; padding: 4px 8px; font-family: var(--font-mono); font-size: 13px; text-align: right; color: var(--text-primary); }
.ing-unit-ro { display: inline-block; padding: 4px 8px; font-size: 13px; color: var(--text-muted); }
.step-instruction-ro { flex: 1; min-width: 0; margin: 0; font-family: var(--font-primary); font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.step-note-ro { display: flex; gap: 6px; align-items: flex-start; }
.step-note-ro .step-note-text { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.step-ing-method-ro { font-size: 12px; color: var(--text-muted); }
.ing-row-actions { padding-left: 16px; position: relative; }
/* CSS-only two-step remove confirm: a hidden per-row checkbox holds the
   "confirming" state and sibling selectors toggle the trash icon vs the
   confirm controls. No Alpine binding to drop when the recipe builder
   re-renders rows via hx-swap-oob (which previously left the x-cloak'd
   confirm permanently hidden and the trash icon inert). */
.ing-delete-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.ing-delete-btn { display: inline-flex; align-items: center; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: var(--radius-field-sm, 4px); }
.ing-delete-btn:hover { color: var(--status-fail-text); background: var(--status-fail-bg); }
.ing-delete-btn i, .ing-delete-btn svg { width: 14px; height: 14px; }

.ing-delete-confirm { display: none; gap: 2px; }
.ing-delete-toggle:checked ~ .ing-delete-btn { display: none; }
.ing-delete-toggle:checked ~ .ing-delete-confirm { display: inline-flex; }
.btn-confirm-yes, .btn-confirm-no { display: inline-flex; align-items: center; background: none; border: none; cursor: pointer; padding: 4px; border-radius: var(--radius-field-sm, 4px); }
.btn-confirm-yes { color: var(--status-fail); }
.btn-confirm-yes:hover { background: var(--status-fail-bg); }
.btn-confirm-no { color: var(--text-muted); }
.btn-confirm-no:hover { background: var(--bg-muted); }
/* Explicit focus ring so keyboard users see the control even if a global
   reset suppresses the default button outline. */
.ing-delete-btn:focus-visible,
.btn-confirm-yes:focus-visible,
.btn-confirm-no:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 1px; }
.btn-confirm-yes i, .btn-confirm-yes svg,
.btn-confirm-no i, .btn-confirm-no svg { width: 14px; height: 14px; }

/* PROD-008: sub-recipe line-item rows */
.ing-row-name-sub { display: flex; align-items: center; gap: 6px; }
.ing-sub-icon { width: 14px; height: 14px; color: var(--text-secondary); flex-shrink: 0; }
.ing-sub-icon[data-lucide] { width: 14px; height: 14px; }
.ing-sub-link { font-style: italic; color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-primary); text-underline-offset: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ing-sub-link:hover { color: var(--link-on-surface-hover); text-decoration-color: var(--accent-teal); }
.ing-row-amount { position: relative; }
/* Absolutely positioned beneath the amount input so it adds no row height.
   Sub-recipe rows then stay the same height as ingredient rows (which have no
   hint), keeping the amount / unit / % columns vertically aligned. */
.ing-finished-weight-hint { position: absolute; top: 100%; right: 0; font-size: 10px; line-height: 1.1; color: var(--text-muted); text-align: right; cursor: help; white-space: nowrap; pointer-events: none; }

/* Sub-recipe ingredient-table row: subtle left accent + muted fill so a
   composed component reads as visually distinct from a plain ingredient. */
/* Faint gold wash (paired with the gold left accent) marks a sub-recipe row.
   Deliberately NOT --bg-muted: that is the totals/header fill and reusing it
   made sub-recipe rows read as a totals row. */
.ing-row-sub { background: var(--accent-teal-light); border-left: 3px solid var(--accent-teal); }

/* Sub-recipe row in the quick-add picker dropdown: matching gold wash + left
   accent so the picker mirrors the in-table distinction. */
.quick-add-row-sub { background: var(--accent-teal-light); border-left: 3px solid var(--accent-teal); }

/* Inner error banner injected on a rejected sub-recipe add (cycle / depth /
   ineligible / volume-unit). The outer slot owns the live region; this is just
   the styled message users read. */
.sub-recipe-picker-error-banner {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--status-fail-text);
  background: var(--status-fail-bg);
  border-left: 3px solid var(--status-fail);
  border-radius: 4px;
}

/* Loading indicator */
.loading-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--text-muted); font-size: 14px; }

/* Review detail */
.review-decision-label { margin-top: 24px; }
.review-actions { display: flex; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------------------
   Recipe Notes
   -------------------------------------------------------------------------- */
.recipe-notes {
  width: 100%;
  min-height: 120px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card-sm, 8px);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.recipe-notes:focus {
  outline: none;
  border-color: var(--accent-teal);
}

.recipe-notes::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Recipe notes: single WYSIWYG panel (toolbar + contenteditable). Markdown
   is serialised under the hood by notes-editor.js; users never see it.
   -------------------------------------------------------------------------- */
.recipe-notes-editor {
  margin-top: 12px;
}

.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-primary);
  border-bottom: none;
  border-radius: var(--radius-card-sm, 8px) var(--radius-card-sm, 8px) 0 0;
  background: var(--bg-muted);
}

.notes-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  cursor: pointer;
}

.notes-tool:hover {
  background: var(--bg-surface);
  border-color: var(--border-primary);
}

.notes-tool i {
  width: 16px;
  height: 16px;
}

.notes-tool-italic em {
  font-style: italic;
}

.notes-tool-h {
  font-weight: 700;
  font-size: 13px;
}

.notes-tool-divider {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: var(--border-divider);
}

.notes-tool.is-active {
  background: var(--bg-surface);
  border-color: var(--accent-teal);
  color: var(--text-primary);
}

/* The contenteditable panel sits flush under the toolbar with only its
   bottom corners rounded. */
.recipe-notes-editor .recipe-notes {
  margin-top: 0;
  border-radius: 0 0 var(--radius-card-sm, 8px) var(--radius-card-sm, 8px);
}

.recipe-notes-rte {
  cursor: text;
  overflow-wrap: anywhere;
}

/* Placeholder for the empty editor (contenteditable has no native one). */
.recipe-notes-rte:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* Rendered notes-markdown output (editor surface + read-only view) */
.recipe-notes-rendered {
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 13px;
  line-height: 1.6;
}

.recipe-notes-rendered p {
  margin: 0 0 8px 0;
}

.recipe-notes-rendered p:last-child {
  margin-bottom: 0;
}

.recipe-notes-rendered ul,
.recipe-notes-rendered ol {
  margin: 0 0 8px 0;
  padding-left: 20px;
}

.recipe-notes-rendered h3 {
  margin: 0 0 6px 0;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.recipe-notes-rendered strong {
  font-weight: 600;
}

.recipe-notes-rendered em {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Quick-Add Ingredient Search
   -------------------------------------------------------------------------- */
.quick-add-bar {
  position: relative;
  margin-top: 12px;
  margin-bottom: 16px;
}

.quick-add-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.quick-add-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.quick-add-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-field, 8px);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}

.quick-add-input:focus {
  outline: none;
  border-color: var(--accent-teal);
}

.quick-add-input::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

.quick-add-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 50;
}

.quick-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.quick-add-row:hover,
.quick-add-row-active {
  background: var(--bg-muted);
}

.quick-add-name {
  font-size: 13px;
  color: var(--text-primary);
}

.quick-add-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.quick-add-category {
  font-size: 11px;
  color: var(--text-muted);
}

.quick-add-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.quick-search-more {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-top: 1px solid var(--border-divider);
  text-align: center;
}

.quick-search-more a {
  color: var(--link-on-surface);
  text-decoration: none;
}

.quick-search-more a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   PROD-008 Sub-recipes: picker mode toggle + sub-recipe row treatment
   -------------------------------------------------------------------------- */
/* Segmented control above the picker search input. Mirrors .status-toggle. */
.picker-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-toggle, 7px);
  overflow: hidden;
  margin-bottom: 8px;
}

.picker-mode-option {
  padding: 5px 14px;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.picker-mode-option:not(:last-child) {
  border-right: 1px solid var(--border-primary);
}

.picker-mode-option.active {
  background: var(--brand-espresso);
  color: var(--text-on-dark);
  font-weight: 600;
  cursor: default;
}

/* Sub-recipe rows in the picker dropdown */
.quick-add-name-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

.quick-add-sub-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.quick-add-sub-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-add-sub-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.quick-add-yield-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Picker error slot (cycle / depth / ineligible) */
.sub-recipe-picker-error {
  font-size: 12px;
  color: var(--status-fail);
  margin-bottom: 8px;
}

.sub-recipe-picker-error:empty {
  display: none;
}

/* Used-in-recipes wrapper under Notes */
.recipe-used-in-wrap:empty {
  display: none;
}

.recipe-used-in-wrap {
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   Ingredient Info Button
   -------------------------------------------------------------------------- */
.ing-row-name {
  cursor: pointer;
}

/* Hover uses the accent's TEXT rung, not the accent itself.
   --accent-teal is a fill colour: a saffron on Nibblr, butter on Canoli.
   As a foreground it measured 1.39:1 on Canoli and 2.08:1 on Nibblr against
   a plain row, so the hovered name was unreadable in both brands. On an
   inspected row it is worse still, because --accent-teal-light tints the
   ground with the same hue the text is trying to be: 1.32:1 on Canoli.
   That is the state Adam caught, but selection only made it visible; the
   hover was already failing on every row.
   --accent-teal-text exists in both palettes for exactly this and lands at
   7.95:1 / 6.75:1 plain, 7.56:1 / 6.07:1 on the selected tint. */
.ing-row-name:hover .ing-name-text {
  color: var(--accent-teal-text);
}

.ing-row-name:hover .ing-info-icon,
.ing-row-name:hover .ing-info-icon[data-lucide] {
  color: var(--accent-teal-text);
}

.ing-info-icon,
.ing-info-icon[data-lucide] {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Ingredient Cost Column + Footer
   -------------------------------------------------------------------------- */
.ing-row-cost { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.ing-cost-value { color: var(--text-primary); font-weight: 500; }
.ing-cost-unknown, .ing-total-cost.ing-cost-unknown { color: var(--text-muted); font-weight: 600; cursor: help; }
.ing-cost-community { color: var(--status-warning); cursor: help; }

.ing-row-percent { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.ing-percent-value { color: var(--text-secondary); font-weight: 500; }
.ing-percent-unknown { color: var(--text-muted); font-weight: 600; cursor: help; }

.ing-table-footer {
  display: grid;
  grid-template-columns: 32px 1fr 80px 56px 60px 80px 40px;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-top: 1px solid var(--border-primary);
}
.ing-footer-label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-primary); align-self: center; }
.ing-total-weight { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; color: var(--text-primary); white-space: nowrap; align-self: center; }
.ing-finished-weight { font-size: 11px; font-weight: 400; color: var(--text-tertiary); }
.ing-total-cost { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; color: var(--text-primary); white-space: nowrap; align-self: center; }

/* COST-003: Other costs block under the ingredient table. Tokens only. */
/* UI polish 2026-09-22: COSTS heading moved above the card, like METHOD and
   RECIPE SPEC NOTES; .cost-lines-head has no rule of its own now, it just
   inherits .section-label-row's spacing. .cost-lines-card carries the
   border/panel styling that used to live on .cost-lines. */
.cost-lines { margin-top: 32px; }
.cost-lines-card { container-type: inline-size; border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-surface); overflow: hidden; }
.cost-lines-error { padding: 0 12px; }
.cost-lines-error:empty { display: none; }
.cost-line-row { display: grid; grid-template-columns: 1fr 120px 160px 170px 40px; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-divider); }
.cost-line-add { background: var(--bg-muted); }
.cost-line-add-actions { display: inline-flex; gap: 6px; }
.cost-line-label-input, .cost-line-amount-input, .cost-line-basis-select { font: inherit; padding: 4px 6px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 4px); background: var(--bg-surface); color: var(--text-primary); width: 100%; }
.cost-line-amount { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); }
.cost-line-currency { color: var(--text-muted); }
.cost-lines-empty { padding: 12px 12px 16px; color: var(--text-secondary); font-size: 13px; }
.cost-lines-empty p { margin: 0 0 12px; }
.cost-lines-cap { padding: 8px 12px; margin: 0; color: var(--text-muted); font-size: 12px; }
.cost-lines-totals { border-top: 1px solid var(--border-primary); }
.cost-lines-total-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 8px 12px; border-bottom: 1px solid var(--border-divider); }
.cost-lines-total-row:last-child { border-bottom: none; }
.cost-lines-total-highlight { background: var(--accent-teal-light); }
.cost-lines-total-label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-primary); }
.cost-lines-total-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-primary); text-align: right; min-width: 80px; }
.cost-lines-rrp { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 8px 12px; }
.cost-lines-rrp-input { width: 110px; text-align: right; }
.cost-lines-rrp-help { padding: 0 12px 10px; margin: 0; color: var(--text-muted); font-size: 12px; }
.cost-lines-margin-hint { padding-top: 4px; }
.cost-lines-subhead { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 10px 12px 4px; }
.cost-lines-subhead .cost-lines-sublabel { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }
.cost-lines-note { padding: 0 12px 8px; margin: 0; font-size: 12px; color: var(--text-muted); }
/* The sub-line under the Ingredients row reads as part of the row: the row gives up
   its hairline and the note carries it instead. :has() is already relied on
   in this file (settings-card-body). */
.cost-lines-total-row:has(+ .cost-lines-sub-note) { border-bottom: 0; }
.cost-lines-sub-note { padding-bottom: 8px; border-bottom: 1px solid var(--border-divider); }
/* COST-003 4.10: a cost line's share of one pack, right-aligned at the end of
   its row ("= £5.00 a pack"); the same muted mono voice as the foot line and
   the "= 50 kg" beside Packs per batch. */
.cost-line-share { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-align: right; }
/* Packs per batch: a PLAIN row (surface background, no tint: a pink row reads
   as an error). Help text under the label, the number input, then the
   batch's mass. */
.cost-lines-packs-per-batch { display: grid; grid-template-columns: 1fr auto 120px; gap: 16px; align-items: center; padding: 8px 12px; background: var(--bg-surface); border-bottom: 1px solid var(--border-divider); }
.cost-lines-packs-per-batch .cost-lines-rrp-help { padding: 2px 0 0; }
.cost-lines-packs-per-batch .cost-lines-rrp-input { width: 90px; }
/* The no-pack and no-mass hint stands where the per-pack rows would. */
.cost-lines-hint { padding-top: 10px; }
/* "A batch of 10 packs: costs ..." under the margin rows. */
.cost-lines-batch-foot { padding: 8px 12px 10px; margin: 0; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.cost-lines-group { border-top: 1px solid var(--border-primary); }
/* Narrow CARD (not viewport: on a desktop page the card is only about 590px
   wide, so a viewport query never fires there). .cost-lines-card is the size
   container. The five-column cost line row would squeeze its label to nothing
   (and clip its share and delete columns inside the overflow:hidden card), so
   at 640px or less it becomes two rows: label, amount and delete on the
   first; basis and the share text on the second. The Add form's actions take
   their own full-width row. The Packs per batch row stacks its help text over
   the input and the batch mass. */
@container (max-width: 640px) {
  .cost-line-row { grid-template-columns: 1fr 120px 40px; }
  .cost-line-row .cost-line-label-input, .cost-line-row .cost-line-label { grid-column: 1; grid-row: 1; }
  .cost-line-row .cost-line-amount { grid-column: 2; grid-row: 1; }
  .cost-line-row .ing-delete-btn { grid-column: 3; grid-row: 1; }
  .cost-line-row .cost-line-basis-select, .cost-line-row .cost-line-basis { grid-column: 1; grid-row: 2; }
  .cost-line-row .cost-line-share { grid-column: 2 / 4; grid-row: 2; }
  .cost-line-row .cost-line-add-actions { grid-column: 1 / -1; }
  .cost-lines-packs-per-batch { grid-template-columns: auto 1fr; }
  .cost-lines-packs-per-batch .cost-lines-ppb-text { grid-column: 1 / -1; }
  .cost-lines-packs-per-batch .cost-line-share { text-align: left; }
}

/* --------------------------------------------------------------------------
   Modal Cost Section
   -------------------------------------------------------------------------- */
.modal-cost-display { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; }
.cost-price-row { display: flex; align-items: baseline; gap: 8px; }
.modal-cost-display .cost-freshness-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; align-self: center; }
.cost-price-large { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--text-primary); }
.cost-per-unit { font-family: var(--font-mono); font-size: 13px; color: var(--text-tertiary); }
.cost-source-badge { font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: 0.5px; padding: 2px 6px; border-radius: var(--radius-source-badge, 4px); color: var(--text-tertiary); background: var(--bg-muted); }
.modal-cost-display .cost-supplier-row { font-family: var(--font-primary); font-size: 12px; color: var(--text-tertiary); }
.cost-no-data { color: var(--text-muted); font-style: italic; font-size: 14px; margin: 0; }
.modal-section-divider { height: 1px; background: var(--border-divider); margin: 8px 0; }
.cost-form-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cost-currency { font-family: var(--font-mono); font-size: 14px; color: var(--text-tertiary); }
.cost-input { width: 80px; padding: 6px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 6px); font-family: var(--font-mono); font-size: 13px; background: var(--bg-primary); }
.cost-input:focus { border-color: var(--accent-teal); outline: none; }
.cost-supplier-input { flex: 1; padding: 6px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-field-sm, 6px); font-size: 13px; background: var(--bg-primary); }
.cost-supplier-input:focus { border-color: var(--accent-teal); outline: none; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border-primary);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-divider);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-divider);
  background: var(--bg-muted);
}

.modal-edit-link:hover {
  color: var(--text-primary);
  border-color: var(--border-primary);
}

.modal-edit-link i {
  width: 12px;
  height: 12px;
}

.modal-body {
  padding: 16px 20px;
}

.modal-body .section-label {
  margin-top: 16px;
}

.modal-body .section-label:first-child {
  margin-top: 0;
}

/* ---------------------------------------------------------------------------
   SUPPLY-005 B: the spec-export pre-flight's Include sourcing checkbox
   --------------------------------------------------------------------------- */

.spec-export-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 12px;
}

.spec-export-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-teal);
  margin: 0;
}

.spec-export-option-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* ---------------------------------------------------------------------------
   PLAT-008 change-plan modal: tier + cadence picker
   --------------------------------------------------------------------------- */

.plan-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.plan-picker--cadence {
  flex-direction: row;
  flex-wrap: wrap;
}

.plan-picker--cadence .plan-picker__option {
  flex: 1 1 220px;
}

/* Specificity bump (.modal-body .plan-picker .plan-picker__option, 0/3/0)
   so cached/older `.input-group label` rules from elsewhere can't win
   when the modal renders inside an .input-group wrapper. */
.modal-body .plan-picker label.plan-picker__option,
.plan-picker__option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-soft, var(--border-divider));
  border-radius: 10px;
  background: var(--bg-surface, var(--bg-surface));
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.plan-picker__option:hover {
  border-color: var(--border-strong, var(--border-primary));
  background: var(--bg-page, var(--brand-parchment));
}

.plan-picker__option:has(input[type="radio"]:checked) {
  border-color: var(--brand-gold, var(--brand-gold));
  background: var(--bg-surface, var(--bg-surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 18%, transparent);
}

.plan-picker__option input[type="radio"] {
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--brand-gold, var(--brand-gold));
}

.plan-picker__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary, var(--text-primary));
}

.plan-picker__label strong {
  font-weight: 600;
  font-size: 15px;
}

.plan-picker__best-for {
  color: var(--text-secondary, var(--text-secondary));
  font-size: 13px;
}

/* Reset link modal */
.reset-link-user-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.reset-link-display {
  display: flex;
  gap: 8px;
  align-items: center;
}

.reset-link-display .input-field {
  flex: 1;
  font-size: 12px;
}

.reset-link-expiry {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.admin-actions {
  display: flex;
  gap: 4px;
}

/* AI Nutrition Lookup - two-column review layout */
.review-columns {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.review-nutrition-card {
  flex: 0 0 33%;
  padding: 24px;
}

.review-ai-panel {
  flex: 1 1 0%;
  min-width: 0;
  padding: 24px;
}

.review-ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.review-ai-panel-header .section-label {
  margin: 0;
}

.review-decision-card {
  padding: 24px;
  margin-top: 16px;
}

.review-decision-fields {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.review-decision-fields .input-group {
  flex: 0 0 200px;
}

.review-notes-group {
  flex: 1 1 0% !important;
}

.ai-lookup-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--text-muted);
}

.ai-lookup-empty p {
  text-align: center;
  font-size: 13px;
  max-width: 240px;
}

.ai-lookup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--text-secondary);
}

.spinner-lg {
  width: 32px;
  height: 32px;
}

.ai-lookup-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--status-fail);
}

.ai-lookup-table-wrap {
  overflow-x: auto;
}

.ai-lookup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ai-lookup-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-divider);
  text-align: right;
}

.ai-lookup-table thead th:first-child {
  text-align: left;
}

.ai-lookup-nutrient-col {
  text-align: left;
  min-width: 100px;
}

.ai-lookup-source-col {
  text-align: right;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-lookup-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-divider);
}

.ai-lookup-nutrient-label {
  color: var(--text-primary);
  font-weight: 500;
}

.ai-lookup-value {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.ai-lookup-value-present {
  color: var(--text-primary);
  font-weight: 500;
}

.ai-lookup-conf {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

.ai-lookup-conf-high {
  background: var(--confidence-high);
}

.ai-lookup-conf-medium {
  background: var(--confidence-medium);
}

.ai-lookup-conf-low {
  background: var(--confidence-low);
}

.ai-lookup-notes {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0 0;
  padding-left: 20px;
}

.ai-lookup-notes li {
  margin-bottom: 4px;
}

.ai-lookup-table tfoot td {
  padding: 8px 12px;
  text-align: right;
}

.ai-lookup-table tfoot td:first-child {
  text-align: left;
}

.ai-lookup-data-quality {
  margin-bottom: 12px;
}

.ai-lookup-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.ai-lookup-variance-col {
  text-align: center;
  width: 50px;
}

.ai-lookup-variance {
  text-align: center;
}

/* --------------------------------------------------------------------------
   Method Steps
   -------------------------------------------------------------------------- */
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* More than one action on the right of a section label (Copy Ingredients
   beside Batch Calculator, Figma 1733:738). */
.section-label-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--link-on-surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-field-sm, 4px);
}

.btn-text:hover {
  background: var(--accent-teal-light);
}

.btn-text i, .btn-text svg {
  width: 14px;
  height: 14px;
}

.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: var(--radius-field-sm, 4px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm:hover {
  color: var(--text-secondary);
  background: var(--bg-muted);
}

.btn-icon-sm i, .btn-icon-sm svg {
  width: 14px;
  height: 14px;
}

.ing-table + .section-label-row,
.ing-table-scroll + .section-label-row {
  margin-top: 40px;
}

/* Method card container */
.method-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card-sm, 8px);
  overflow: hidden;
}

.method-card .method-empty {
  padding: 24px 16px;
  margin: 0;
}

.step-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-divider);
}

.step-row:last-child {
  border-bottom: none;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: var(--bg-muted);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.step-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.5;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-drag-handle:hover {
  opacity: 1;
}

.step-drag-handle:active {
  cursor: grabbing;
}

.step-drag-handle i, .step-drag-handle svg {
  width: 14px;
  height: 14px;
}

.step-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-note-toggle.step-note-active {
  color: var(--accent-teal-text);
}

.step-instruction {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-primary);
  resize: none;
  overflow: hidden;
  padding: 0;
  line-height: 1.4;
}

.step-instruction:focus {
  outline: none;
}

.step-instruction::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

/* Step note with lightbulb icon */
.step-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0 0 46px;
}

.step-note-icon {
  width: 12px;
  height: 12px;
  min-width: 12px;
  color: var(--accent-teal);
  margin-top: 8px;
}

.step-note-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  resize: none;
  overflow: hidden;
  padding: 6px 0;
  line-height: 1.4;
  min-height: 32px;
}

.step-note-input:focus {
  outline: none;
}

.step-note-input::placeholder {
  color: var(--text-placeholder);
  font-style: italic;
  opacity: 1;
}

/* Ingredient tags - indented to align with instruction text */
.step-ingredients {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0 0 46px;
}

.step-ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.step-ing-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-muted);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
}

.step-ing-name {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
}

.step-ing-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.step-ing-method {
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.step-ing-method:focus {
  outline: 1px solid var(--accent-teal);
  border-radius: 2px;
}

.step-ing-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.step-ing-remove:hover {
  color: var(--status-fail);
}

.step-ing-remove i, .step-ing-remove svg {
  width: 10px;
  height: 10px;
}

.step-add-ingredient-select {
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 0;
  cursor: pointer;
}

.step-add-ingredient-select:focus {
  outline: none;
  color: var(--text-secondary);
}

.method-empty {
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Batch Modal (show/hide overrides)
   -------------------------------------------------------------------------- */
.batch-modal-hidden {
  display: none;
}

.batch-modal-hidden.modal-visible {
  display: flex;
}

.batch-modal {
  max-width: 600px;
}

/* --------------------------------------------------------------------------
   Free Sugar Classification
   -------------------------------------------------------------------------- */
.free-sugar-stats {
  margin-bottom: 1.5rem;
}

.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 8px);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.filter-bar {
  margin-bottom: 1rem;
}

.filter-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  margin-bottom: 0;
}

/* Filter-bar selects draw the --select-caret chevron, set in from the right
   edge so it clears the pill's curve. */
.filter-form select.input-field {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 12px 8px;
}

.bulk-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-muted);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.col-checkbox {
  width: 40px;
  text-align: center;
}

.free-sugar-select {
  width: auto;
  min-width: 130px;
}

.text-success {
  color: var(--status-pass);
}

.badge-success {
  background: var(--status-pass);
  color: white;
}

.badge-warning {
  background: var(--status-warning);
  color: white;
}

/* --------------------------------------------------------------------------
   Allergen Display
   -------------------------------------------------------------------------- */
.allergen-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allergen-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-chip-sm, 4px);
  font-size: 12px;
  font-weight: 500;
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  white-space: nowrap;
}

.allergen-badge-may-contain {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-chip-sm, 4px);
  font-size: 12px;
  font-weight: 500;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  white-space: nowrap;
}

.allergen-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border-radius: var(--radius-banner, 6px);
  font-size: 13px;
}

/* In-text links inside a notice take the notice's own tone, underlined,
   rather than the browser's default blue. */
.allergen-warning a {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
}

.icon-sm,
.icon-sm[data-lucide] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.allergen-clear {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  color: var(--status-pass);
  font-size: 13px;
}

.allergen-may-contain-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 10px;
  margin-bottom: 4px;
}

.allergen-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 4px;
  flex-shrink: 0;
}

.allergen-dot-contains { background: var(--status-fail); }
.allergen-dot-unknown { background: var(--status-warning); }
.allergen-dot-may-contain { background: var(--status-warning); }

/* An org's own precautionary may-contain note reuses the may-contain dot's
   warning-orange fill, but must not read as identical to a catalogue-wide
   allergen declaration. The badge that used to carry the same dashed
   distinction was dropped (Adam, 30 July: the read view no longer says whose
   precaution it is). This dot survives because it is a bare marker in a dense
   recipe row, not a labelled chip, and it is the only thing distinguishing an
   org note there. box-sizing: border-box (global
   reset) means the dashed border clips the fill inward via background-clip
   rather than growing the dot's footprint, so no layout/overflow risk in the
   ing-row-name flex row. */
.allergen-dot-org-overlay {
  border: 1px dashed var(--status-warning);
  background-clip: padding-box;
}

/* #1100: "Confirm no allergens" cereal-exclusion-override interstitial.
   Swaps into #allergen-panel in place of the normal chip grid; a card (not
   the inline .allergen-warning flex row above) since it carries several
   paragraphs plus a Cancel/Confirm-anyway action row. */
.no-allergens-warning-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--status-warning);
  background: var(--status-warning-bg);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

.no-allergens-warning-lead {
  margin: 0;
}

.no-allergens-warning-body {
  margin: 0;
}

.no-allergens-warning-blast {
  margin: 0;
}

.no-allergens-warning-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Confidence border variants on allergen tags */
.allergen-tag.allergen-verified { border: 1.5px solid var(--status-pass); }
.allergen-tag.allergen-inferred { border: 1.5px dashed var(--status-warning); }
.allergen-tag.allergen-ai_generated { border: 1.5px dotted var(--source-ai); }
.allergen-tag.allergen-unclassified { border: 1.5px solid var(--border-primary); }
.allergen-tag.allergen-may-contain { border: 1.5px dashed var(--status-warning); }

.allergen-class {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* --------------------------------------------------------------------------
   UX-006 allergen grouping (proposal A, Adam 30 July).

   The card used to lay every allergen out in one wrapped row and rely on the
   badge tint alone to separate contains from may-contain. Two tints, no
   legend, and the distinction that carries the legal weight was the one thing
   the card never said out loud.

   Each group now names itself, in the same mono treatment the panel already
   uses for MACRONUTRIENTS and MICRONUTRIENTS, so the tints become
   reinforcement rather than the sole carrier. Deliberately reusing that
   existing treatment instead of inventing a third label style.
   -------------------------------------------------------------------------- */
.ingredient-section .allergen-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.allergen-group {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 7px 0;
}
.allergen-group-label {
  flex: 0 0 104px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.2px;
  line-height: 20px;
  color: var(--text-secondary);
}
.allergen-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
/* Badges sit on a 20px label line, so give them the height to match rather
   than letting the two columns drift apart. */
.allergen-group-items > span {
  padding-top: 3px;
  padding-bottom: 3px;
}

/* The two empty states. Outlined rather than tinted: neither is a
   declaration, so neither should borrow a status colour. */
.allergen-state-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-chip-sm, 6px);
  font-size: 12px;
  color: var(--text-secondary);
}
/* COMP-015: the list-row marker is the same outlined chip, tighter for a card. */
.allergen-unconfirmed-chip {
  align-self: auto;
  padding: 2px 8px;
  font-size: 11px;
  white-space: nowrap;
}
.allergen-state-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 17px;
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  /* The fixed label column costs too much width on a phone; stack instead of
     letting the badges compress into a one-word-per-line column. */
  .allergen-group { flex-direction: column; gap: 6px; }
  .allergen-group-label { flex: none; }
}

.allergen-unclassified-note {
  color: var(--text-muted);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   COMP-007: tri-state allergen editor. Extends the allergen-badge / warm
   parchment + gold accent design system rather than introducing new
   colours. Each row's presence choice is the import's chip chooser
   (.import-add-choice / .import-add-option, Figma I4 v2 modal C), built
   by fragments/allergens/presence-choice.html.
   -------------------------------------------------------------------------- */
.allergen-edit-form { padding: 14px 20px; }

.allergen-editor-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.allergen-none-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1.5px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-muted);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.allergen-none-row input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.allergen-none-row-active {
  border-color: var(--accent-teal);
  background: var(--accent-teal-light);
}

.allergen-edit-list {
  display: flex;
  flex-direction: column;
}

.allergen-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-divider);
  flex-wrap: wrap;
}

.allergen-edit-row:last-child { border-bottom: none; }

/* not-present-spec.md R7 (Figma N4): a row left blank on a part-answered save, marked by allergen-unset.js until it is answered */
.allergen-edit-row.allergen-edit-row--unset {
  background: var(--status-fail-bg);
}

.allergen-edit-row--unset .allergen-edit-name {
  color: var(--status-fail-text);
}

/* R3: what the sheet or page said of this allergen, in the placeholder colour so it never looks like an answer */
.allergen-edit-hint {
  font-size: 11px;
  line-height: 15px;
  color: var(--text-placeholder);
}

/* the import rows keep their name column when the name and hint stack */
.import-add-allergen > .allergen-edit-label {
  flex: 1 1 10rem;
  min-width: 0;
}

/* inside that column the name is a plain line again: its row-level flex basis (10rem) would otherwise become the column's
   height, making every Add allergens and U3 row about 192 px tall. The import own dialog's names, outside a label, keep it. */
.allergen-edit-label > .import-add-name {
  flex: none;
}

/* R4: the one bulk setter ("None of the 14" / "Set the rest as Not present") and the N4 notice under it */
.allergen-set-rest {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 12px;
}

.allergen-set-rest .allergen-unset-notice {
  margin-bottom: 0;
}

.allergen-edit-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Name plus its small "not yet confirmed" line, stacked so the radios stay
   on the row. */
.allergen-edit-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.allergen-edit-sublabel {
  font-size: 11px;
  line-height: 15px;
  color: var(--text-secondary);
}

.allergen-editor-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
}

.allergen-editor-conflict {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  font-size: 13px;
}

.allergen-editor-conflict i { flex-shrink: 0; margin-top: 1px; width: 16px; height: 16px; }

.allergen-editor-error {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  font-size: 13px;
}

.modal-allergen-status {
  font-size: 13px;
  font-style: italic;
  margin: 4px 0 0 0;
}

/* --------------------------------------------------------------------------
   COMP-007a: org may-contain overlay editor + read-only overlay badge.
   Reuses the same warm parchment + gold + --status-warning tokens as the
   COMP-007 allergen editor above (its chip chooser) rather than introducing new colours -
   this is a sibling control on the same card, not a new design language.
   -------------------------------------------------------------------------- */
.allergen-overlay-body { padding: 14px 20px; }

.allergen-overlay-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

.allergen-overlay-list {
  display: flex;
  flex-direction: column;
}

.allergen-overlay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-divider);
  cursor: pointer;
}

.allergen-overlay-row:last-child { border-bottom: none; }

.allergen-overlay-row-catalogue { cursor: default; }

.allergen-overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.allergen-overlay-checkbox {
  accent-color: var(--status-warning);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.allergen-overlay-label { font-size: 12px; }

.allergen-badge-catalogue {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   COMP-014 PR C: recipe may-contain statement (Figma frame 28)
   Panel notice tones, the panel's edit controls, and the editor modal.
   Existing tokens only; the warning tone is the base .allergen-warning.
   -------------------------------------------------------------------------- */
.allergen-notice-pass {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.allergen-notice-info {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* COMP-014 / COMP-005 P5 slice: a contains detected only by keyword or AI.
   Same colours as a declaration, dashed and labelled, so it never reads as
   one. */
.allergen-badge-unverified {
  background: transparent;
  border: 1px dashed var(--status-fail-text);
}

.allergen-badge-note {
  color: var(--status-fail-text);
  white-space: nowrap;
}

/* The review status (states B to D): one quiet line, not a notice box. */
.allergen-review-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.allergen-review-line.allergen-review-pass { color: var(--status-pass-text); }
.allergen-review-line.allergen-review-warning { color: var(--status-warning-text); }
/* "No cross-contact review yet" is the state that most needs attention. */
.allergen-review-line.allergen-review-info { color: var(--text-primary); font-weight: 500; }

.allergen-pending-note { color: var(--status-warning-text); }

/* UX-012 6.2: allergen pills are buttons; tapping one reveals its sources. */
.allergen-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allergen-pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  row-gap: 6px;
}

.allergen-pill-row-label {
  min-width: 84px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.allergen-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 2px 8px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-chip-sm, 4px);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: inherit;
}

/* Only the Step A pills are buttons; the stepper's static pills are spans. */
button.allergen-pill {
  cursor: pointer;
}

.allergen-pill:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}

/* A selected not-confirmed chip stays dashed: the dash is the untapped cue
   that it prints as not confirmed, so Show all sources never removes it.
   No selected rule may change its border-style. */
.allergen-badge-unverified.allergen-pill { border: 1px dashed var(--status-fail-text); }
.allergen-badge-may-contain-unverified.allergen-pill { border: 1px dashed var(--status-warning-text); }

.allergen-pill.allergen-pill-selected {
  border-width: 1px;
  border-color: currentColor;
  font-weight: 600;
}

/* The chevron marks the open chip only. */
.allergen-pill .allergen-pill-chevron { display: none; }

.allergen-pill.allergen-pill-selected .allergen-pill-chevron { display: inline-flex; }

.allergen-show-all { align-self: flex-start; }

.allergen-src-box {
  padding: 8px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-banner, 6px);
  font-size: 13px;
  color: var(--text-secondary);
}

.allergen-src-box[hidden] { display: none; }

.allergen-src-title {
  font-weight: 500;
  color: var(--text-primary);
}

.allergen-src-from {
  font-size: 12px;
  color: var(--text-muted);
}

.allergen-src-tag { white-space: nowrap; }

.allergen-src-list {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.may-contain-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* M6: mobile is read-only. */
@media (max-width: 640px) {
  .may-contain-edit { display: none; }
}

/* UX-012: the panel's one status line, its toggle and the task list. */
.allergen-status {
  align-items: flex-start;
}

.allergen-status > .icon-sm {
  margin-top: 2px;
}

.allergen-status .allergen-status-body {
  flex: 1;
  min-width: 0;
}

/* The button sits on its own row under the text, aligned with the text
   (the icon is the only thing to its left). */
.allergen-status-action {
  margin-top: 6px;
}

.allergen-status-detail {
  margin: 2px 0 0;
  font-size: 12px;
}

.allergen-empty-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.allergen-task-items {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.allergen-task {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-divider);
}

.allergen-task:last-child { border-bottom: 0; }

.allergen-task-name {
  font-weight: 500;
  color: var(--text-primary);
}

.allergen-task-note {
  font-size: 12px;
  color: var(--text-secondary);
}

.allergen-task-action { margin-left: auto; }

.allergen-task-list[hidden] { display: none; }

/* Phone width and read-only: the list is shown open, with no button. */
@media (max-width: 640px) {
  .allergen-check-toggle { display: none; }
  .allergen-task-list[hidden] { display: block; }
}

/* UX-012 Step B1: the guided allergen check. The shell, header, close button,
   body, scrim and bottom sheet are the UX-007 inspector's (.ingredient-
   inspector*, see "Recipe ingredient inspector"); these are the step's own
   parts. */
/* UX-012 D9: the export page's allergen notice sits above the preview. */
.export-allergen-notice {
  margin-bottom: 16px;
}

.allergen-check-recipe {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.allergen-check-body {
  padding: 16px 24px 24px;
  gap: 12px;
}

.allergen-check-progress {
  display: flex;
  gap: 6px;
}

.allergen-check-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-divider);
}

.allergen-check-segment-on {
  background: var(--text-primary);
}

.allergen-check-stepno {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.allergen-check-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.allergen-check-subject {
  margin: 4px 0 0;
  font-family: var(--font-display, "Roboto Slab", serif);
  font-size: 18px;
  color: var(--text-primary);
}

.allergen-check-headline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.allergen-check-reason,
.allergen-check-note,
.allergen-check-choice-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.allergen-check-question {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.allergen-check-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.allergen-check-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.allergen-check-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.allergen-check-choice:has(input:checked),
.allergen-check-option:has(> .allergen-check-choice input:checked) {
  background: var(--bg-muted);
}

/* A choice that owns a block (the group step): the tint wraps the choice and
   its block, and the block carries no tint of its own. */
.allergen-check-option {
  border-radius: 8px;
}

.allergen-check-option > .allergen-check-choice {
  background: none;
}

.allergen-check-option-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px 12px 34px;
}

.allergen-check-option-body[hidden] {
  display: none;
}

/* The brand radio and checkbox colour, as .stage-radio (not the browser blue). */
.allergen-check-choice input,
.allergen-check-option-body input,
.allergen-check-editor input {
  flex-shrink: 0;
  accent-color: var(--text-primary);
}

.allergen-check-choice-note {
  padding: 0 12px 0 34px;
}

.allergen-check-editor {
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-muted);
}

.allergen-check-editor[hidden] {
  display: none;
}

.allergen-check-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.allergen-check-primary {
  margin-left: auto;
}

.allergen-check-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.allergen-check-reload {
  margin-left: auto;
}

.allergen-check-copied {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-primary);
}

.allergen-check-done,
.allergen-check-skipped,
.allergen-check-waiting {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.allergen-check-done li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.allergen-check-waiting-title {
  margin: 12px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.allergen-check-waiting-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: 13px;
}

/* UX-012 B2 (Figma B1e 1830:2025): the item's fixes, side by side on their
   own row under its name. */
.allergen-check-waiting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-basis: 100%;
  margin-top: 6px;
}

.allergen-check-waiting-actions form {
  margin: 0;
}

.may-contain-editor .modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.may-contain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 0;
  margin: 0;
  padding: 0;
}

.may-contain-chips legend {
  margin-bottom: 8px;
}

.may-contain-chip {
  position: relative;
  cursor: pointer;
}

.may-contain-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.may-contain-chip span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-chip-sm, 6px);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.may-contain-chip input:checked + span {
  background: var(--status-warning-bg);
  border-color: var(--status-warning);
  color: var(--status-warning-text);
}

.may-contain-chip input:focus-visible + span {
  outline: 2px solid var(--status-warning);
  outline-offset: 2px;
}

.may-contain-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-card-sm, 12px);
  background: var(--bg-muted);
}

.may-contain-detail[hidden] { display: none; }

.may-contain-detail-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.may-contain-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.may-contain-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.may-contain-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.may-contain-field-wide { flex: 1; min-width: 220px; }

.may-contain-assess {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.may-contain-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Beats .modal-footer's flex-end: "No statement needed" sits apart, on the left. */
.may-contain-editor .may-contain-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.may-contain-actions {
  display: flex;
  gap: 8px;
}

.may-contain-footer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The org's own overlay badge on the read-only card (allergen-section.html)
   reuses .allergen-badge-may-contain's colours but adds a dashed border and
   a small "your org" tag so it reads as the viewer's org's own precautionary
   note, not a catalogue-wide declaration. */


/* Data Tools (admin) */
.data-tool-card {
  padding: 1.5rem;
}

.data-tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.data-tool-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem 0;
}

.data-tool-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
  max-width: 480px;
}

.data-tool-stats {
  margin-bottom: 1rem;
}

.data-tool-stats-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
}

.data-tool-spinner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.data-tool-batch-input {
  width: 80px;
  display: inline-block;
  margin-right: 8px;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes panel-flash {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-gold) 30%, transparent); }
  50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-gold) 0%, transparent); }
}
.panel-flash { animation: panel-flash 0.6s ease-out; }

.inference-result {
  border-top: 1px solid var(--border-primary);
  padding-top: 1rem;
  margin-top: 1rem;
}

.inference-result-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--status-pass);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
}

.stat-card-pass { border-color: var(--status-pass); }
.stat-card-warn { border-color: var(--status-warning); }

.inference-allergens {
  margin-top: 1rem;
}

.inference-allergens-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.inference-allergen-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.inference-running { color: var(--text-secondary); }
.inference-error { color: var(--status-fail); }
.inference-error-msg { color: var(--status-fail); font-size: 0.875rem; }

/* AI-007a live authoring feed: the agent's real actions, streamed */
.assistant-feed-steps {
  list-style: none;
  margin: 0 0 0.75rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.assistant-feed-step {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-primary, inherit);
  animation: assistant-feed-in 0.25s ease-out;
}

.assistant-feed-icon {
  color: var(--status-pass);
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
}

.assistant-feed-detail { color: var(--text-secondary); }
.assistant-feed-tail { font-size: 0.8125rem; }

/* AI-007a in-situ ticker: one step at a time on a single row (replaces the
   growing checklist). app.js#assistantFeedTicker drives the text + counter. */
.assistant-feed-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  min-height: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-primary, inherit);
}
.assistant-feed-count {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.assistant-stop-btn {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-field-sm, 6px);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.assistant-stop-btn:hover {
  border-color: var(--status-fail);
  color: var(--status-fail);
}

@keyframes assistant-feed-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Respect reduced-motion: no slide-in, and freeze the spinner */
@media (prefers-reduced-motion: reduce) {
  .assistant-feed-step { animation: none; }
  .assistant-feed .spin { animation: none; }
}

/* ─── Reformulate (AI-007) review card ─── */

.reformulate-summary {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

.reformulate-diff { margin: 0 0 1rem 0; }

.reformulate-diff-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.reformulate-diff-line {
  font-family: var(--font-mono, monospace);
  font-size: 0.8125rem;
  margin: 0.125rem 0;
}

.reformulate-diff-add { color: var(--status-pass); }
.reformulate-diff-remove { color: var(--status-fail); }
.reformulate-diff-change { color: var(--text-secondary); }

/* Allergen change is a food-safety signal: an addition is a prominent amber
   warning a food business MUST see before adopting; a removal is neutral. */
.reformulate-allergen-add,
.reformulate-allergen-caveat {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--status-warning-text);
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning);
  border-radius: 4px;
  padding: 0.375rem 0.5rem;
  margin: 0.5rem 0;
}

.reformulate-allergen-add i,
.reformulate-allergen-caveat i {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.reformulate-allergen-remove {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0.25rem 0;
}

.reformulate-claim-gain { font-size: 0.8125rem; color: var(--status-pass); margin: 0.25rem 0; }
.reformulate-claim-loss { font-size: 0.8125rem; color: var(--status-fail); margin: 0.25rem 0; }
/* COMP-008 AC13: a version frozen before its claims were; no gain or loss is claimed. */
.reformulate-claim-unknown { font-size: 0.8125rem; color: var(--text-muted); margin: 0.25rem 0; }

/* Method change is a food-safety signal: the agent's method tools can remove or
   weaken a step (e.g. a safe cooking temperature) that the rest of the card does
   not show. A prominent amber block with a FULL border (no side-stripe accent)
   makes the change, and the resulting method, visible before Adopt. */
.reformulate-method-change {
  color: var(--status-warning-text);
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning);
  border-radius: 4px;
  padding: 0.5rem 0.625rem;
  margin: 0.5rem 0;
}

.reformulate-method-change-heading {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 0.375rem 0;
}

.reformulate-method-change-heading i {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.reformulate-method-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.reformulate-method-list li { margin: 0.125rem 0; }

/* ─── Roadmap page ─── */

.rm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.rm-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.rm-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
}

.rm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.rm-legend-sep {
  width: 1px;
  height: 16px;
  background: var(--border-primary);
}

.rm-legend-pill {
  font-size: 0.5625rem;
  padding: 0.15rem 0.375rem;
}

.rm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rm-dot-done { background: var(--status-pass); }
.rm-dot-acceptance { background: var(--info); }
.rm-dot-in-progress { background: var(--status-warning); }
.rm-dot-partial { background: var(--status-warning); }
.rm-dot-planned { background: var(--decorative-muted); }
.rm-dot-blocked { background: var(--decorative-muted); }
.rm-dot-superseded { background: var(--decorative-muted); opacity: 0.4; }

/* Status filter toggles. Each legend entry is a button; an "off" entry is
   dimmed and struck through, and .rm-filter-scope carries one
   rm-filter-hide-<status> class per hidden status (set by roadmapFilters()
   in app.js). Cards are hidden by their own rm-card-<status> class, so a
   card re-rendered by HTMX picks the filter straight back up. */
.rm-legend-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.12s ease;
}

.rm-legend-toggle:hover {
  color: var(--text-primary);
}

.rm-legend-toggle:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.rm-legend-off {
  opacity: 0.4;
  text-decoration: line-through;
}

.rm-legend-hidden {
  color: var(--text-muted);
}

.rm-legend-reset {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--info);
  cursor: pointer;
  text-decoration: underline;
}

.rm-filter-hide-done .rm-board-card.rm-card-done,
.rm-filter-hide-acceptance .rm-board-card.rm-card-acceptance,
.rm-filter-hide-in-progress .rm-board-card.rm-card-in-progress,
.rm-filter-hide-partial .rm-board-card.rm-card-partial,
.rm-filter-hide-planned .rm-board-card.rm-card-planned,
.rm-filter-hide-blocked .rm-board-card.rm-card-blocked,
.rm-filter-hide-superseded .rm-board-card.rm-card-superseded {
  display: none;
}

/* "N hidden" footer on any card list with filtered-out cards, so a column
   that looks empty is visibly a filtered column, not a lost one. The count
   is stamped as data-rm-hidden by roadmapFilters().recount(). */
.rm-board-col-cards[data-rm-hidden]:not([data-rm-hidden="0"])::after,
.rm-backlog-col-cards[data-rm-hidden]:not([data-rm-hidden="0"])::after {
  content: attr(data-rm-hidden) " hidden";
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
}

.rm-phases {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rm-phase-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rm-phase-done { border-color: var(--status-pass); }
.rm-phase-in-progress { border-color: var(--status-warning); }
.rm-phase-planned { border-color: var(--border-primary); }

.rm-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rm-phase-title-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.rm-phase-name {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rm-phase-period {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rm-status-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  white-space: nowrap;
}

.rm-badge-done {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.rm-badge-in-progress {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.rm-badge-planned {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.rm-badge-acceptance {
  background: var(--info-bg);
  color: var(--info-text);
}

.rm-phase-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

.rm-group-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.rm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.rm-pill {
  font-family: var(--font-primary);
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-chip, 6px);
  white-space: nowrap;
  cursor: default;
}

.rm-pill-done {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.rm-pill-in-progress {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.rm-pill-partial {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.rm-pill-alpha {
  background: var(--accent-teal-bg, color-mix(in srgb, var(--brand-gold) 15%, transparent));
  color: var(--brand-espresso);
  border: 1px solid var(--accent-teal);
}

.rm-pill-planned {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-primary);
}

.rm-pill-blocked {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-primary);
}

.rm-pill-acceptance {
  background: var(--info-bg);
  color: var(--info-text);
}

.rm-pill-superseded {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-primary);
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.rm-pill-spec {
  border-style: dashed;
}

.rm-pill-spec.rm-pill-done {
  border: 1px dashed var(--status-pass);
}

.rm-pill-spec.rm-pill-acceptance {
  border: 1px dashed var(--info);
}

.rm-pill-spec.rm-pill-in-progress {
  border: 1px dashed var(--status-warning);
}

.rm-pill-spec.rm-pill-planned {
  border-style: dashed;
}

.rm-pill-spec.rm-pill-partial {
  border: 1px dashed var(--status-warning);
}

.rm-pill-spec.rm-pill-superseded {
  border: 1px dashed var(--border-primary);
}

.rm-pill-spec.rm-pill-alpha {
  border: 1px dashed var(--accent-teal);
}

a.rm-pill {
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

a.rm-pill:hover {
  opacity: 0.75;
}

.rm-spec-ref {
  opacity: 0.6;
  font-size: 0.5625rem;
}

/* Workstreams section */

.rm-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 2rem 0 1.5rem;
}

.rm-ws-header {
  margin-bottom: 1rem;
}

.rm-ws-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.rm-ws-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0;
}

.rm-ws-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.rm-ws-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.rm-ws-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rm-ws-domain {
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rm-ws-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* v1 forward roadmap: side-by-side surface columns */
/* The board container keeps a quiet parchment edge rather than inheriting the
   amber phase-status border: at 2px amber it framed the whole kanban and
   competed with the status colour of the cards inside it. Archived phase cards
   below still use their status border. */
.rm-v1-card {
  border-width: 1px;
  border-color: var(--border-primary);
}

.rm-v1-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.rm-v1-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.rm-pills-col {
  flex-direction: column;
  align-items: stretch;
}

.rm-pills-col .rm-pill {
  width: 100%;
  white-space: normal;
}

@media (max-width: 900px) {
  .rm-v1-columns { grid-template-columns: 1fr; }
}

/* PLAT-019: editable roadmap board (drag-and-drop columns + cards) */
/* Roadmap page uses the full available width so all four surface columns
   sit on one row (App must not wrap to a second row). */
.page-container-wide {
  max-width: 1680px;
}

.rm-board-columns {
  display: grid;
  /* PLAT-019 fast-follow: columns are now addable/deletable, so the fixed
     4-up grid becomes auto-fit. At the page's max-width this still lays
     the original four columns out identically to the old repeat(4, 1fr). */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 1200px) {
  .rm-board-columns { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .rm-board-columns { grid-template-columns: 1fr; }
}

.rm-board-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.rm-board-col-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.25rem;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.rm-board-col-cards:empty {
  border: 1px dashed var(--border-primary);
}

/* PLAT-019 fast-follow: column header actions (rename / move / delete). */
.rm-col-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  min-height: 1.25rem;
}

.rm-col-label-wrap,
.rm-col-rename-wrap {
  flex: 1;
  min-width: 0;
}

.rm-col-label-wrap .rm-group-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact single-line text input, shared by the column rename field and
   the "Add column" label field. */
.rm-inline-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-primary, var(--bg-primary));
}

.rm-inline-input:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}

.rm-col-menu {
  position: relative;
  flex-shrink: 0;
}

.rm-col-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-field-sm, 4px);
  transition: background 0.12s ease, color 0.12s ease;
}

.rm-col-menu-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.rm-col-menu-btn i {
  width: 12px;
  height: 12px;
}

.rm-col-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 50;
  padding: 4px;
}

.rm-col-menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.rm-col-menu-item:hover {
  background: var(--bg-muted);
}

.rm-col-menu-item-danger {
  color: var(--status-fail);
}

.rm-col-menu-item-danger:hover {
  background: var(--status-fail-bg);
}

.rm-col-error {
  flex-basis: 100%;
  font-size: 0.6875rem;
  color: var(--status-fail);
  margin: 0;
}

/* "Add card" / "Add column" dashed controls, matching the empty-column
   dashed placeholder above. */
.rm-add-card-btn,
.rm-add-column-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.rm-add-card-btn:hover,
.rm-add-column-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
  background: var(--bg-muted);
}

.rm-add-card-btn i,
.rm-add-column-btn i {
  width: 13px;
  height: 13px;
}

.rm-add-column-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.rm-add-column-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 8px;
}

.rm-card-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 8px;
}

/* Shared field styling for the add-card, edit-card and add-column forms. */
.rm-form-error {
  font-size: 11px;
  color: var(--status-fail);
  margin: 0 0 6px;
}

.rm-form-input,
.rm-form-select {
  display: block;
  width: 100%;
  padding: 6px var(--select-pad-right, 8px) 6px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-primary, var(--bg-primary));
}

.rm-form-input:focus,
.rm-form-select:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}

.rm-form-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.rm-form-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-primary);
  border-radius: var(--radius-button, 6px);
  border: 1px solid var(--border-primary);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease;
}

.rm-form-btn:hover {
  background: var(--bg-muted);
}

.rm-form-btn-primary {
  background: var(--brand-gold);
  border-color: var(--brand-gold);
  color: var(--brand-espresso);
}

.rm-form-btn-primary:hover {
  background: var(--brand-gold-hover);
  border-color: var(--brand-gold-hover);
}

.rm-form-btn-danger {
  color: var(--status-fail);
  border-color: color-mix(in srgb, var(--status-fail) 30%, transparent);
}

.rm-form-btn-danger:hover {
  background: var(--status-fail-bg);
}

/* Compact single-row card. Status is conveyed by the card's tint + text
   colour (brandbook Semantic Colours), so there is no separate status label.
   The name is the click target that opens the status menu; the ref links to
   the spec doc; drag stays on the handle. Single line keeps every card the
   same height; long names truncate with an ellipsis. */
.rm-board-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  min-height: 2.25rem;
  color: var(--text-secondary);
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}

.rm-board-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rm-board-card-dragging {
  opacity: 0.35;
  border: 2px dashed var(--border-divider);
}

.rm-drag-handle {
  cursor: grab;
  color: inherit;
  opacity: 0.7;
  flex-shrink: 0;
  display: inline-flex;
}

.rm-drag-handle:active {
  cursor: grabbing;
}

.rm-drag-handle i {
  width: 13px;
  height: 13px;
}

/* Name wrapper anchors the status dropdown and takes the free space so the
   ref sits hard-right. */
.rm-card-name-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* The name doubles as the status control (click opens the status menu). */
.rm-board-card-name {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-board-card-name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Ref = link to the spec doc. */
.rm-board-card-ref {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
  opacity: 0.85;
  text-decoration: none;
}

a.rm-board-card-ref:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 1;
}

.rm-board-card-spec-pill {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.3rem;
  border: 1px dashed currentColor;
  border-radius: var(--radius-chip, 4px);
  opacity: 0.65;
}

/* PLAT-019 fast-follow: pencil edit affordance, visible on card hover
   (or while its form is open, so it doesn't vanish mid-edit). */
.rm-card-edit-wrap {
  position: relative;
  flex-shrink: 0;
}

.rm-card-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  opacity: 0;
  cursor: pointer;
  border-radius: var(--radius-field-sm, 4px);
  pointer-events: none;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.rm-board-card:hover .rm-card-edit-btn,
.rm-card-edit-open .rm-card-edit-btn,
.rm-card-edit-btn:focus-visible {
  opacity: 0.75;
  pointer-events: auto;
}

.rm-card-edit-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

.rm-card-edit-btn i {
  width: 12px;
  height: 12px;
}

.rm-card-form-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 60;
  padding: 10px;
  /* Card rows sit in a normal-weight, non-mono context; the form fields
     should read like a plain form regardless of the card's status colour. */
  color: var(--text-primary);
}

/* Status tints + text colour, from the brandbook Semantic Colours. */
.rm-card-done {
  background: color-mix(in srgb, var(--status-pass) 8%, transparent);
  border-color: color-mix(in srgb, var(--status-pass) 22%, transparent);
  color: var(--status-pass-text);
}
.rm-card-acceptance {
  background: color-mix(in srgb, var(--info) 8%, transparent);
  border-color: color-mix(in srgb, var(--info) 22%, transparent);
  color: var(--info-text);
}
.rm-card-in-progress,
.rm-card-partial {
  background: color-mix(in srgb, var(--status-warning) 8%, transparent);
  border-color: color-mix(in srgb, var(--status-warning) 22%, transparent);
  color: var(--status-warning-text);
}
.rm-card-blocked {
  background: color-mix(in srgb, var(--status-fail) 8%, transparent);
  border-color: color-mix(in srgb, var(--status-fail) 22%, transparent);
  color: var(--status-fail-text);
}
.rm-card-planned {
  background: var(--bg-surface);
  border-color: var(--border-primary);
  color: var(--text-secondary);
}
.rm-card-superseded {
  background: var(--bg-muted);
  border-color: var(--border-divider);
  color: var(--text-secondary);
}

/* Status menu, opened by clicking the card name; anchored under the name. */
.rm-status-menu-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 50;
  padding: 4px;
}

.rm-status-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.rm-status-menu-item:hover {
  background: var(--bg-muted);
}

.rm-status-menu-item-active {
  font-weight: 700;
}

/* PLAT-021: the roadmap backlog. Parked cards, grouped by the column they
   came from, below the board. Deliberately reuses .rm-board-columns,
   .rm-board-col and the card styles so the backlog reads as the board's
   sibling; only the container chrome is new. */
/* Shared chrome for the roadmap board's two collapsible sections: the
   PLAT-021 backlog and the PLAT-019 completed-phases archive. The first cut
   of this defined the backlog's summary, caret and open-state rules
   property-for-property identical to the archive's, under a second set of
   class names, while the comment above claimed it reused existing styles.
   One definition now serves both, and each section keeps only what actually
   differs from the other. */
.rm-collapsible {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-divider);
  padding-top: 0.5rem;
}

.rm-collapsible-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.5rem 0;
  user-select: none;
}

.rm-collapsible-summary::-webkit-details-marker { display: none; }

.rm-collapsible-caret {
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.rm-collapsible[open] > .rm-collapsible-summary .rm-collapsible-caret {
  transform: rotate(90deg);
}

.rm-backlog-body {
  margin-top: 0.5rem;
}

/* Parked-card lists mirror .rm-board-col-cards but are a separate class so
   initRoadmapBoard()'s selector cannot pick them up and put them in the
   board's Sortable group (which would allow a cross-section drag). */
.rm-backlog-col-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.25rem;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.rm-backlog-col-cards:empty {
  border: 1px dashed var(--border-primary);
}

/* Parked work is context, not the headline: mute it until hovered. */
.rm-backlog-col .rm-board-card {
  opacity: 0.82;
}

.rm-backlog-col .rm-board-card:hover {
  opacity: 1;
}

/* The placement action in the card menu, separated from the status list. */
.rm-status-menu-sep {
  height: 1px;
  margin: 0.25rem 0;
  background: var(--border-divider);
}

.rm-status-menu-item-placement {
  color: var(--text-muted);
}

.rm-status-menu-item-placement i {
  width: 0.875rem;
  height: 0.875rem;
}

/* Collapsible archive sections (native <details>, collapsed on load) */
/* The archive's chrome now comes from .rm-collapsible above (PLAT-021).
   Only its body spacing differs from the backlog's. */
.rm-archive-body {
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   Upload Components (AI-002)
   -------------------------------------------------------------------------- */

/* Upload tabs */
.upload-tabs { max-width: 720px; }
.upload-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-primary);
  margin-bottom: 1.5rem;
}
.upload-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.upload-tab-btn:hover { color: var(--text-primary); }
.upload-tab-btn.active {
  color: var(--accent-teal-text);
  border-bottom-color: var(--brand-gold);
}
.upload-tab-btn i { width: 16px; height: 16px; }

/* Upload card */
.upload-card { padding: 1.5rem; margin-bottom: 1rem; }
.upload-submit-btn {
  margin-top: 1rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.upload-submit-btn span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.upload-submit-btn i, .upload-submit-btn [data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Input hint */
.input-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Callout */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-card, 8px);
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0.75rem 0;
}
.callout i, .callout [data-lucide] { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.callout-warning {
  background: var(--status-warning-bg);
  color: var(--text-primary);
  border: 1px solid var(--status-warning);
}
.callout-warning i, .callout-warning [data-lucide] { color: var(--status-warning); }
/* PLAT-020 settings page: a .callout-when-off inside an .input-group only
   shows while that group's checkbox is unchecked (ruling 2026-08-27: the
   allergen withheld warning appears once, and only when switched off). */
.input-group:has(.settings-checkbox input:checked) .callout-when-off { display: none; }
/* PLAT-020 dependent toggle (2026-09-04): a row whose registry entry carries
   :requires greys out and stops taking clicks while its parent box is
   unchecked. Presentation only: the server clamps the stored value. CSS
   cannot read data-requires, so the parent is named here; data-requires is a
   marker for tests and any future generic JS, not live wiring. A child left
   ticked when its parent is unticked stays ticked in the DOM and is clamped
   to false on save.

   Final review, 2026-09-04 (medium finding 5): pointer-events must sit on
   the .settings-checkbox LABEL, not the bare input - the input is nested
   inside the label (see export.html), so a click on the label's own text
   still reached and toggled the input when the rule only named it. Mouse
   clicks anywhere in the row's control are now inert while greyed; the
   server clamp remains the actual enforcement regardless of DOM state, so a
   keyboard Tab+Space activation still cannot persist a true value while the
   parent is off - only mouse affordance changes here.

   Adding a second `:requires` key needs a second pair of rules keyed the
   same way (or the generic `data-requires`-reading JS this comment used to
   gesture at, not yet written): CSS cannot read the attribute, so nothing
   catches a mismatched key at build time. */
.settings-card-body:has(input[name="cost-summary"]:not(:checked)) .settings-dependent-row[data-requires="cost-summary"] { opacity: 0.45; }
.settings-card-body:has(input[name="cost-summary"]:not(:checked)) .settings-dependent-row[data-requires="cost-summary"] .settings-checkbox { pointer-events: none; }
.settings-card-body:has(input[name="additional-costs"]:not(:checked)) .settings-dependent-row[data-requires="additional-costs"] { opacity: 0.45; }
.settings-card-body:has(input[name="additional-costs"]:not(:checked)) .settings-dependent-row[data-requires="additional-costs"] .settings-checkbox { pointer-events: none; }
.settings-dependent-row { padding-left: 24px; }
.callout-info {
  background: var(--accent-teal-light);
  color: var(--text-primary);
  border: 1px solid var(--accent-teal);
}
.callout-info i, .callout-info [data-lucide] { color: var(--accent-teal); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-dropzone, 12px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  background: var(--bg-surface);
}
.dropzone:hover { border-color: var(--brand-clay); }
.dropzone-active {
  border-color: var(--brand-gold);
  background: var(--accent-teal-light);
}
.dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.dropzone-icon { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 0.5rem; }
.dropzone-title { font-weight: 600; color: var(--text-primary); font-size: 1rem; }
.dropzone-subtitle { color: var(--text-secondary); font-size: 0.875rem; }
.dropzone-hint { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.5rem; }
.dropzone-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}
.dropzone-file-icon { width: 32px; height: 32px; color: var(--brand-gold); flex-shrink: 0; }
.dropzone-file-info { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.dropzone-file-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropzone-file-size { color: var(--text-muted); font-size: 0.8rem; }

/* Upload error (inline) */
.upload-error {
  color: var(--status-fail-text);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--status-fail-bg);
  border-radius: 6px;
}

/* Upload review card */
.upload-review-card { padding: 1.5rem; margin-top: 1rem; }
.upload-review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.upload-review-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--text-primary); }
.upload-review-source {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.upload-review-source i { width: 14px; height: 14px; }
.upload-review-name-row { margin-bottom: 1rem; }
.upload-review-section { margin-top: 1rem; }
.upload-review-section-title { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* Nutrition review table */
.nutrition-review-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}
.nutrition-review-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border-primary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.nutrition-review-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-divider);
  color: var(--text-primary);
}
.nutrition-review-table tr:last-child td { border-bottom: none; }

/* Compact input for review table */
.input-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  max-width: 100px;
}

/* Nutrition grid (manual entry) */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.nutrition-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nutrition-input-group label { font-size: 0.8rem; }
.nutrition-input-group .input-field { width: 100%; min-width: 0; }

/* DATA-024: Advanced-nutrition (vitamins + minerals) entry grid. A plain
   nutrition-grid-3 goes ragged here because the longer micronutrient labels
   wrap to different heights and the inputs stop aligning. This reserves a
   uniform two-line label box so every input lines up into a clean matrix. */
.micro-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem 1.1rem;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
}
.micro-entry-grid .nutrition-input-group {
  display: flex;
  flex-direction: column;
}
.micro-entry-grid label {
  min-height: 2.3em;          /* reserve up to two lines so inputs align */
  line-height: 1.15;
  margin-bottom: 0.25rem;
}
.micro-entry-grid .input-field { width: 100%; }
@media (max-width: 767px) {
  .micro-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .micro-entry-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .micro-entry-grid label { min-height: 0; }
}

/* Manual entry form */
.manual-name-field { width: 100%; }
.manual-form-section {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-divider);
}
.manual-form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
}
.manual-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}
.manual-section-header i,
.manual-section-header [data-lucide] {
  width: 14px;
  height: 14px;
}

/* Confidence badges */
.confidence-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-chip-sm, 10px);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}
.confidence-extracted { background: var(--status-pass-bg); color: var(--status-pass-text); }
.confidence-inferred { background: var(--status-warning-bg); color: var(--status-warning-text); }
.confidence-estimated { background: var(--status-fail-bg); color: var(--status-fail-text); }
/* #2175 PR 3b (IMPORT-001 Figma 2114:3413, frame 45): a figure a sums finding concerns, beside its source badge. */
.confidence-check { background: var(--status-fail-bg); color: var(--status-fail-text); }
/* DATA-049 PR 3: a value the sheet does not print. */
.confidence-missing { background: transparent; border: 1px dashed var(--border-divider); color: var(--text-secondary); }
.review-not-on-sheet { color: var(--text-secondary); font-style: italic; }
/* A badge holding words ("Not on the sheet"), not a one-word code: keep sentence case. */
.confidence-badge-label { text-transform: none; }

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-chip-sm, 10px);
  font-size: 0.75rem;
  font-weight: 500;
}
.tag-allergen { background: var(--status-fail-bg); color: var(--status-fail-text); }
.tag-dietary { background: var(--status-pass-bg); color: var(--status-pass-text); }

/* Upload allergen groups (contains vs may-contain) */
.upload-allergen-groups { display: flex; flex-direction: column; gap: 0.75rem; }
.upload-allergen-group { display: flex; align-items: flex-start; gap: 0.75rem; }
.upload-allergen-group-label {
  flex-shrink: 0;
  width: 90px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0;
}
.upload-allergen-group-label.label-contains { color: var(--status-fail); }
.upload-allergen-group-label.label-may-contain { color: var(--status-warning); }

/* Upload review actions */
.upload-review-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-divider);
}

/* #2175 PR 3b (Figma frame 45): the single upload review's "This sheet needs" card sits at the top of the review card, and the
   figures tick box under the table. Both slots are empty when there is nothing to show, so they take no room then. */
.upload-review-needs .import-sheet-needs { padding: 0; margin: 0 0 var(--space-4, 1rem); }
.upload-review-figures-match .data-warnings { margin: var(--space-4, 1rem) 0 0; }
/* The save's look findings are one warning bar: its lines read left to right in the centred success card. */
.upload-success-content .callout .data-warnings-list { text-align: left; }

/* Upload success */
.upload-success-card { padding: 2rem; text-align: center; margin-top: 1rem; }
.upload-success-content { margin-bottom: 1.5rem; }
.upload-success-icon { margin-bottom: 0.75rem; }
.upload-success-icon i { width: 48px; height: 48px; color: var(--status-pass); }
/* #883: the create succeeded but the allergen declaration did not. The glyph
   and title already say so, but colour is the most pre-attentive channel on
   the card, and a 48px alert-triangle left in --status-pass still scans as
   "pass". Reuses the same warning token as .callout-warning below. */
.upload-success-icon--warning i { color: var(--status-warning); }
.upload-success-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--text-primary); }
.upload-success-name { font-weight: 600; color: var(--text-primary); margin-top: 0.25rem; }
.upload-success-meta { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }
.upload-success-actions { display: flex; justify-content: center; gap: 0.75rem; }

/* Upload error card */
.upload-error-card { padding: 2rem; text-align: center; margin-top: 1rem; }
.upload-error-content { margin-bottom: 1rem; }
.upload-error-icon { width: 48px; height: 48px; color: var(--status-fail); margin-bottom: 0.5rem; }
.upload-error-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-primary); }
.upload-error-message { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Button small variant */
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* Upload responsive */
@media (max-width: 767px) {
  .upload-tab-nav { overflow-x: auto; }
  .upload-tab-btn { font-size: 0.8rem; padding: 0.6rem 0.75rem; white-space: nowrap; }
  .nutrition-grid { grid-template-columns: minmax(0, 1fr); }
  .nutrition-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-review-header { flex-direction: column; gap: 0.5rem; }
  .upload-review-actions { flex-direction: column; }
  .upload-success-actions { flex-direction: column; }
}

/* ============================================================
   CRM Module Styles
   ============================================================ */

/* --- CRM Layout --- */
.crm-page {
  padding: 32px;
}

.crm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--brand-gold);
}

.crm-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--brand-espresso);
}

.crm-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.crm-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-divider, var(--border-divider));
  border-radius: var(--radius-toggle, 6px);
  overflow: hidden;
}

.crm-view-toggle button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, var(--text-secondary));
  transition: all 0.15s;
}

.crm-view-toggle button.active {
  background: var(--text-primary, var(--brand-espresso));
  color: var(--text-on-dark);
}

/* --- Kanban Board --- */
.kanban-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
}

.kanban-column {
  min-width: 210px;
  max-width: 240px;
  flex: 1;
  background: var(--bg-secondary, var(--bg-panel));
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
  margin-bottom: 8px;
}

.kanban-column-header .stage-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.kanban-column-header .count-badge {
  background: var(--border-divider, var(--border-divider));
  color: var(--text-secondary, var(--text-secondary));
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-chip, 10px);
}

.kanban-column-header .stage-acv {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--status-pass);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 40px;
}

/* --- Kanban Card --- */
.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-divider, var(--border-divider));
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kanban-card.dragging {
  opacity: 0.35;
  border: 2px dashed var(--border-divider, var(--border-divider));
}

.kanban-column.drag-over {
  outline: 2px dashed var(--brand-gold);
  outline-offset: -2px;
  background: var(--accent-teal-light);
}

.kanban-card .card-company {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
  color: var(--text-primary, var(--brand-espresso));
}

.kanban-card .card-contact {
  font-size: 0.75rem;
  color: var(--text-secondary, var(--text-secondary));
  margin-bottom: 6px;
}

.kanban-card .card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.kanban-card .card-acv {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--status-pass);
}

/* --- CRM Badges --- */
.crm-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-persona-P1 { background: var(--status-pass-bg); color: var(--status-pass-text); }
.badge-persona-P2 { background: var(--info-bg); color: var(--info-text); }
.badge-persona-P3 { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-persona-P4 { background: var(--badge-lilac-bg); color: var(--badge-lilac-text); }

.badge-priority-High { background: var(--status-fail-bg); color: var(--status-fail-text); }
.badge-priority-Medium { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-priority-Low { background: var(--border-divider); color: var(--text-secondary); }

/* Off-system Tailwind-ish literals that predate the token set. Kept on their
   own palette (these read as calendar urgency, not Nibblr status), but
   darkened to clear AA on their own fills: 3.95:1 and 2.86:1 before. */
.badge-overdue { background: var(--status-fail-bg); color: var(--status-fail-text); font-weight: 700; }
.badge-due-soon { background: var(--status-warning-bg); color: var(--status-warning-text); }

/* Stage color classes */
.sc-0 { color: var(--crm-score-0); }
.sc-1 { color: var(--crm-score-1); }
.sc-2 { color: var(--crm-score-2); }
.sc-3 { color: var(--crm-score-3); }
.sc-4 { color: var(--crm-score-4); }
.sc-5 { color: var(--crm-score-5); }
.sc-6 { color: var(--crm-score-6); }
.sc-7 { color: var(--crm-score-7); }
.sc-8 { color: var(--crm-score-8); }
.sc-9 { color: var(--crm-score-9); }

.bg-sc-0 { background: var(--crm-score-0); }
.bg-sc-1 { background: var(--crm-score-1); }
.bg-sc-2 { background: var(--crm-score-2); }
.bg-sc-3 { background: var(--crm-score-3); }
.bg-sc-4 { background: var(--crm-score-4); }
.bg-sc-5 { background: var(--crm-score-5); }
.bg-sc-6 { background: var(--crm-score-6); }
.bg-sc-7 { background: var(--crm-score-7); }
.bg-sc-8 { background: var(--crm-score-8); }
.bg-sc-9 { background: var(--crm-score-9); }

/* --- CRM Table --- */
.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.crm-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, var(--text-secondary));
  border-bottom: 2px solid var(--border-divider, var(--border-divider));
  white-space: nowrap;
}

.crm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
  vertical-align: middle;
}

.crm-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.crm-table tbody tr:hover {
  background: var(--bg-secondary, var(--bg-panel));
}

.crm-table .company-cell strong {
  display: block;
  font-weight: 600;
}

.crm-table .company-cell span {
  font-size: 0.75rem;
  color: var(--text-secondary, var(--text-secondary));
}

.crm-table .acv-cell {
  font-weight: 700;
  color: var(--status-pass);
}

/* --- CRM Filters --- */
.crm-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.crm-filters .filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-filters select,
.crm-filters input[type="search"] {
  padding: 6px var(--select-pad-right, 10px) 6px 10px;
  border: 1px solid var(--border-divider, var(--border-divider));
  border-radius: var(--radius-field, 6px);
  font-size: 0.85rem;
  background: var(--bg-surface);
  color: var(--text-primary, var(--brand-espresso));
}

.crm-filters input[type="search"] {
  min-width: 200px;
}

.crm-count {
  font-size: 0.8rem;
  color: var(--text-secondary, var(--text-secondary));
  margin-left: auto;
}

/* --- CRM Dashboard --- */
.crm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.crm-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-divider, var(--border-divider));
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
}

.crm-stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-cocoa);
  margin-bottom: 4px;
}

.crm-stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
}

.crm-stat-card .stat-value.blue { color: var(--brand-espresso); }
.crm-stat-card .stat-value.green { color: var(--status-pass); }
.crm-stat-card .stat-value.orange { color: var(--brand-terracotta); }

.crm-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.crm-dashboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-divider, var(--border-divider));
  border-radius: 10px;
  padding: 16px 18px;
}

.crm-dashboard-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
  color: var(--brand-cocoa);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- CSS-Only Bar Chart --- */
.crm-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crm-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-bar-label {
  font-size: 0.75rem;
  min-width: 120px;
  text-align: right;
  color: var(--text-secondary, var(--text-secondary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-bar-track {
  flex: 1;
  height: 18px;
  background: var(--bg-secondary, var(--bg-panel));
  border-radius: 4px;
  overflow: hidden;
}

.crm-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
  min-width: 2px;
}

.crm-bar-value {
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 24px;
  color: var(--text-secondary, var(--text-secondary));
}

/* --- Priority Focus List --- */
.crm-priority-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crm-priority-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
}

.crm-priority-item:last-child {
  border-bottom: none;
}

.crm-priority-item .company {
  font-weight: 700;
  font-size: 0.85rem;
}

.crm-priority-item .contact-info {
  font-size: 0.75rem;
  color: var(--text-secondary, var(--text-secondary));
}

.crm-priority-item .next-action {
  font-size: 0.8rem;
  color: var(--text-primary, var(--brand-espresso));
  margin-top: 2px;
}

/* --- Activity List --- */
.crm-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crm-activity-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
  font-size: 0.8rem;
}

.crm-activity-item:last-child {
  border-bottom: none;
}

.crm-activity-item .activity-header {
  font-weight: 600;
}

.crm-activity-item .activity-notes {
  color: var(--text-secondary, var(--text-secondary));
  font-size: 0.75rem;
}

.crm-activity-item .activity-date {
  font-size: 0.7rem;
  color: var(--text-muted, var(--decorative-muted));
}

/* --- CRM Report --- */
.crm-report {
  max-width: 800px;
  margin: 0 auto;
}

.crm-report-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-divider, var(--border-divider));
}

.crm-report-header h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--brand-espresso);
}

.crm-report-header .report-dates {
  font-size: 0.85rem;
  color: var(--text-secondary, var(--text-secondary));
}

.crm-report-section {
  margin-bottom: 20px;
}

.crm-report-section h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--brand-gold);
  color: var(--brand-cocoa);
}

.crm-report-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

/* --- CRM Modal Extensions --- */
.crm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.crm-form-grid .full-width {
  grid-column: 1 / -1;
}

.crm-form-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
}

.crm-form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.crm-form-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 10px 0;
  color: var(--text-secondary, var(--text-secondary));
}

.crm-persona-hint {
  font-size: 0.75rem;
  color: var(--text-secondary, var(--text-secondary));
  padding: 4px 8px;
  background: var(--bg-secondary, var(--bg-panel));
  border-radius: 4px;
  margin-top: 4px;
}

/* --- CRM Modal Extensions --- */
.modal-lg { max-width: 680px; }

.crm-modal-footer {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border-divider, var(--border-divider));
  gap: 8px;
}

.crm-modal-footer-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.crm-delete-btn { color: var(--status-fail); }
.crm-delete-btn:hover { color: var(--status-fail-text); background: var(--status-fail-bg); }

.crm-badge-acv { background: var(--status-pass-bg); color: var(--status-pass-text); font-weight: 700; }

.crm-detail-subtitle { font-size: 0.85rem; color: var(--text-secondary, var(--text-secondary)); }

.crm-detail-notes { margin-bottom: 12px; }
.crm-detail-notes-body { font-size: 0.85rem; }

.crm-detail-tags { margin-bottom: 16px; }

.crm-stage-selector { margin-bottom: 16px; }

.crm-touchpoint-section {
  border-top: 1px solid var(--border-divider, var(--border-divider));
  padding-top: 12px;
  margin-top: 12px;
}

.crm-touchpoint-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.crm-touchpoint-section-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.crm-touchpoint-empty { font-size: 0.85rem; color: var(--text-secondary, var(--text-secondary)); }

/* --- CRM Detail View --- */
.crm-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.crm-detail-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.crm-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.crm-detail-field {
  font-size: 0.8rem;
}

.crm-detail-field .field-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary, var(--text-secondary));
  margin-bottom: 2px;
}

.crm-detail-box {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  background: var(--bg-secondary, var(--bg-panel));
}

.crm-detail-box.next-action {
  border: 1px solid var(--status-pass);
}

.crm-detail-box.blocker {
  border: 1px solid var(--status-fail);
}

/* --- Touchpoint Log --- */
.crm-touchpoint-log {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crm-touchpoint-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
  font-size: 0.8rem;
}

.crm-touchpoint-item:last-child {
  border-bottom: none;
}

.crm-touchpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crm-touchpoint-header .tp-info {
  font-weight: 600;
}

.crm-touchpoint-header .tp-delete {
  font-size: 0.7rem;
  color: var(--status-fail);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
}

.crm-touchpoint-notes {
  color: var(--text-secondary, var(--text-secondary));
  margin-top: 2px;
}

/* --- Pipeline Overview Table (Dashboard) --- */
.crm-pipeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.crm-pipeline-table th {
  text-align: left;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary, var(--text-secondary));
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
}

.crm-pipeline-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-divider, var(--border-divider));
}

.crm-pipeline-table .acv-total {
  font-weight: 700;
  color: var(--status-pass-text);
  background: var(--status-pass-bg);
}

/* --- ACV Forecast Card --- */
.crm-acv-banner {
  /* Off-system green darkened so the white label clears AA: was #16a34a
     at 3.30:1 (#1065). */
  background: var(--status-pass);
  color: var(--text-on-dark);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 12px;
}

.crm-acv-banner .acv-amount {
  font-size: 1.4rem;
  font-weight: 800;
}

.crm-acv-banner .acv-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  opacity: 0.9;
}

.crm-acv-breakdown {
  font-size: 0.8rem;
}

.crm-acv-breakdown .acv-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

/* --- Tags --- */
.crm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.crm-tag {
  background: var(--bg-secondary, var(--bg-panel));
  border: 1px solid var(--border-divider, var(--border-divider));
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  color: var(--text-secondary, var(--text-secondary));
}

/* --- Print Styles for Report --- */
@media print {
  .sidebar, .mobile-header, .crm-report-actions {
    display: none !important;
  }
  .app-main-column {
    margin-left: 0 !important;
  }
  .crm-report {
    max-width: 100%;
  }
}

/* --- Responsive --- */
@media (max-width: 767px) {
  .crm-page {
    padding: 16px;
  }
  .crm-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .kanban-board {
    flex-direction: column;
  }
  .kanban-column {
    min-width: 100%;
    max-width: 100%;
  }
  .crm-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .crm-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .crm-form-grid {
    grid-template-columns: 1fr;
  }
  .crm-detail-grid {
    grid-template-columns: 1fr;
  }
  .crm-filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Privacy page ── */

.privacy-content {
  max-width: 720px;
  margin-top: 24px;
}

.privacy-card {
  padding: 32px;
  line-height: 1.7;
  color: var(--text-primary);
}

.privacy-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.privacy-card h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 16px;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.privacy-card p {
  font-size: 0.875rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.privacy-card a,
.privacy-card .privacy-optout__button {
  color: var(--link-on-surface);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.privacy-card a:hover,
.privacy-card .privacy-optout__button:hover {
  opacity: 0.8;
}

/* "Stop counting my visits" on the privacy page (js/visit-counting-optout.js):
   a button, because it acts rather than navigates, styled as the links
   around it. */
.privacy-optout__button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* Ingredient detail action button row */
.ingredient-detail-btn-row {
  display: flex;
  gap: 10px;   /* Figma 33:148: 10px between the three actions */
  margin: 8px 0;
}
/* UX-006 section 3.4: sized to content, left-aligned. These were half-width
   halves that stretched to fill the panel, which gave two actions the visual
   weight of the evidence above them. Content-sized and wrapping also means the
   row survives its own permutations (spec open question 6): the three actions
   are independently gated, so one-button and two-button cases exist, and
   neither now stretches to fill the row. */
.ingredient-detail-aligned .ingredient-detail-btn-row { flex-wrap: wrap; justify-content: flex-start; }
.ingredient-detail-btn-half {
  flex: 0 0 auto;
  position: relative;
}
/* UX-006 3.4: three actions on ONE line at panel width.
   The three labels the spec specifies ("Add to recipe", "Save to My
   Ingredients", "Create an editable copy") come to 537px of button plus 16px
   of gap in a 576px row. That fits by 23px, which is inside the margin that
   font rendering moves, so the third action wrapped to a second line and read
   as a separate call to action, which is what it looked like before it was
   moved into the row at all.
   Reclaiming 6px per side per button buys 36px and takes the row to 517px,
   comfortably clear. The labels stay as specced; the padding is the thing
   that was arbitrary. Below the panel breakpoint the row still wraps, which
   is correct: three buttons genuinely do not fit on a phone. */
/* 14px, not the Figma's 16px, and the reason is a width difference not a
   disagreement. The design panel is 760px wide, 676px of content; the built
   panel is 576px. The three specced labels plus the design's 16px insets and
   10px gaps come to 540px, which wraps in 576. At 14px they come to 528px and
   fit with 48px clear. The labels and the one-row layout are the design intent
   worth holding; 2px of inset is not. Widening the panel to 760 is a separate
   change, and the honest place to reconcile this. */
.ingredient-detail-btn-row .btn-primary,
.ingredient-detail-btn-row .btn-secondary,
.ingredient-detail-btn-row .btn-ghost,
.ingredient-detail-btn-row .favourite-btn {
  padding-left: 14px;
  padding-right: 14px;
}
/* Equal height across the three. btn-primary carries `border: none` while
   btn-secondary carries a 1px border, so with content-box sizing the primary
   sat 2px shorter than its two neighbours: 30px against 32px. The Figma action
   row has them the same height. A transparent border rather than a height,
   because it keeps the box model identical instead of papering over it, and it
   is scoped to this row so no other primary button on the site moves. */
.ingredient-detail-btn-row .btn-primary,
.ingredient-detail-btn-row .btn-ghost {
  border: 1px solid transparent;
}
/* UX-006 3.4: match btn-primary / btn-secondary exactly. This carried
   padding 8px 12px and font-size 13px, which made it 35px tall beside two
   32px siblings, so "three, sized to content" read as three slightly
   different buttons. */
.ingredient-detail-btn-half .favourite-btn {
  justify-content: center;
  padding: 7px 20px;
  font-size: 12px;
  box-sizing: border-box;
}
/* The copy hatch is the third action. It stays one element because
   #copy-to-my-ingredients-slot is an hx-swap outerHTML target that replaces
   the form AND its footnote with copy-success.html, so splitting the button
   away from the paragraph would break that swap. Its button is content-sized
   to match the other two. */
.ingredient-detail-aligned .ingredient-detail-copy-hatch > form { display: inline-flex; }

/* Add to Recipe dropdown */
.add-to-recipe-action {
  position: relative;
}
.add-to-recipe-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 260px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 4px;
}
.add-to-recipe-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
}
.add-to-recipe-option:hover {
  background: var(--bg-muted);
}
.add-to-recipe-name {
  font-weight: 500;
}
.add-to-recipe-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.add-to-recipe-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- PROD-005: Versioning & Collaboration ---------- */

.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-chip, 12px);
  background: var(--bg-muted);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.version-badge-inline {
  margin-left: 8px;
  vertical-align: middle;
}

/* DRAFT state: soft amber/gold pill, signals auto-saved working copy. */
.version-badge-draft {
  background: color-mix(in srgb, var(--brand-gold) 18%, transparent);
  color: var(--accent-teal-text);
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-chip, 12px);
  background: color-mix(in srgb, var(--brand-gold) 15%, transparent);
  color: var(--accent-teal-text);
  font-family: var(--font-primary, "DM Sans", sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  vertical-align: middle;
}

.draft-badge i {
  width: 12px;
  height: 12px;
}

.draft-badge-sm {
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 10px;
}

.version-entry-live {
  border-color: var(--accent-teal, var(--brand-gold));
  background: var(--bg-surface, var(--bg-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}

.btn-primary-emphasis {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 25%, transparent);
  animation: draft-pulse 2s ease-in-out infinite;
}

@keyframes draft-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 25%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-gold) 15%, transparent); }
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--status-fail);
  border-radius: var(--radius-button, 8px);
  background: var(--status-fail);
  color: var(--bg-surface);
  font-family: var(--font-primary, "DM Sans", sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-danger:hover {
  background: var(--status-fail-hover);
  border-color: var(--status-fail-hover);
}

.btn-danger i, .btn-danger svg {
  width: 14px;
  height: 14px;
}

.draft-conflict-modal {
  max-width: 480px;
}

.draft-conflict-modal-overlay {
  /* Must sit above .version-history-panel (z-index 950) so users can
     interact with the modal when triggered from inside the panel. */
  z-index: 1000;
}

.draft-conflict-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.version-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* PLAT-024 PR C1: edit-lease presence line. The dot is the mint affirmation
   tone, not --status-pass (reserved for a regulatory pass). */
.edit-presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-right: 12px;
}

.edit-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint-plate, #6FDFB8); /* hex-ok: fallback, --mint-plate lives only in tokens-canoli.css */
}

.flash-toast-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  margin-left: 12px;
  cursor: pointer;
  font-size: inherit;
  line-height: 1;
}

@media (max-width: 640px) {
  .edit-presence {
    flex-basis: 100%;
    margin-right: 0;
  }
}

.version-controls .btn-secondary,
.version-controls .btn-primary {
  white-space: nowrap;
  flex-shrink: 0;
}

.version-controls .btn-icon[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Phase 7: read-only variant of the header version controls. The History
   button is the only child (no Save Version), so the cluster sits flush
   without the Save Version primary CTA. */
.version-controls-readonly {
  margin-right: 8px;
}

/* Phase 7: per-version fork buttons inside the history panel. Visually
   distinct from Restore so a teammate can tell at a glance which entries
   have a fork action. */
.version-actions .btn-fork-version {
  color: var(--link-on-surface);
}

.version-actions .btn-fork-version:hover {
  color: var(--text-primary, var(--text-primary));
}

.version-history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-surface, var(--bg-surface));
  border-left: 1px solid var(--border-default, var(--border-divider));
  box-shadow: -8px 0 24px color-mix(in srgb, var(--text-primary) 8%, transparent);
  z-index: 950;
  display: flex;
  flex-direction: column;
}

.version-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default, var(--border-divider));
}

.version-history-title {
  margin: 0;
  font-family: var(--font-display, "Roboto Slab", serif);
  font-size: 18px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.version-history-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-entry {
  padding: 16px;
  border: 1px solid var(--border-default, var(--border-divider));
  border-radius: 10px;
  background: var(--bg-primary, var(--bg-primary));
}

.version-entry-current {
  border-color: var(--status-pass, var(--status-pass));
  background: var(--bg-surface, var(--bg-surface));
}

.version-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.version-meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.version-summary {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.version-summary-pending {
  color: var(--text-muted);
  font-style: italic;
}

.version-notes {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-muted);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.version-notes i,
.version-notes svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.version-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.version-meta-item {
  font-family: var(--font-mono);
}

.version-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-default, var(--border-divider));
}

.version-actions .btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.version-save-modal {
  max-width: 480px;
}

/* IMPORT-001 PR 3a: Save version refused for unconfirmed allergens (the modal's slot and the shared fragment) */
.version-save-error:empty { display: none; }
.version-save-error { margin: 0 0 12px; }
.unconfirmed-allergens, .unsaved-sub-recipes {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  font-size: 14px;
}
.unconfirmed-allergens-words { margin: 0 0 6px; }
.unconfirmed-allergens-list { margin: 0; padding-left: 18px; }
.unconfirmed-allergens-list a, .unsaved-sub-recipes a { color: inherit; text-decoration: underline; }
/* PR 3c: one line per sub-recipe to save */
.unsaved-sub-recipes-line { margin: 0; }

.modal-overlay.is-hidden {
  display: none !important;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-default, var(--border-divider));
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  height: 36px;
  padding: 0 20px;
  line-height: 1;
}

.read-only-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--status-warning-bg);
  border-bottom: 1px solid var(--status-warning);
  color: var(--status-warning-text);
  font-size: 13px;
}

.read-only-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.read-only-banner-content i,
.read-only-banner-content svg {
  width: 16px;
  height: 16px;
}

.read-only-banner-text {
  font-weight: 500;
}

.read-only-banner-actions {
  display: flex;
  gap: 8px;
}

.recipe-notes-readonly {
  /* Holds server-rendered notes HTML (see .recipe-notes-rendered), not raw
     text, so no white-space: pre-wrap - that would turn the newlines between
     block tags into spurious blank lines. */
  padding: 12px 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-card-sm, 8px);
  color: var(--text-secondary);
  font-size: 13px;
  min-height: 48px;
}

.fork-attribution {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 10px;
  background: var(--bg-muted);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.fork-attribution i,
.fork-attribution svg {
  width: 12px;
  height: 12px;
}

.fork-attribution a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

.fork-attribution a:hover {
  text-decoration: underline;
}

.fork-attribution--inactive {
  color: var(--text-muted);
  font-style: italic;
}

.team-recipes-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-default, var(--border-divider));
}

.team-recipe-card {
  border-style: dashed;
}

.recipe-card-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.recipe-card-author i,
.recipe-card-author svg {
  width: 12px;
  height: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default, var(--border-divider));
  border-radius: var(--radius-field-multiline, 8px);
  font-family: var(--font-primary, "DM Sans", sans-serif);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary, var(--bg-primary));
  resize: vertical;
}

/* Single-line text input, matched to .form-textarea (the recipe name field on
   the assistant forms). Without this the .form-input class is unstyled. */
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default, var(--border-divider));
  border-radius: var(--radius-field, 8px);
  font-family: var(--font-primary, "DM Sans", sans-serif);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary, var(--bg-primary));
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-gold) 15%, transparent);
}

.form-input::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

/* --------------------------------------------------------------------------
   Branded Error Pages (403, 404, 500, etc.)
   -------------------------------------------------------------------------- */
.error-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-muted);
}

.error-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.error-brand {
  background: var(--brand-espresso);
  padding: 24px 32px;
  display: flex;
  align-items: center;
}

.error-brand-logo {
  line-height: 0;
  display: inline-block;
}

.error-body {
  padding: 40px 32px 32px;
  text-align: center;
}

.error-code {
  font-family: var(--font-display, "Roboto Slab", serif);
  font-size: 72px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent-teal-text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.error-title {
  font-family: var(--font-display, "Roboto Slab", serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.error-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 400px;
  margin: 0 auto 28px;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.error-actions .btn-primary,
.error-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.error-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border-primary);
  background: var(--bg-muted);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.error-footer a {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-primary);
}

.error-footer a:hover {
  color: var(--link-on-surface-hover);
}

/* --------------------------------------------------------------------------
   Admin analytics dashboard
   -------------------------------------------------------------------------- */
.admin-analytics .kpi-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.admin-analytics .kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 20px;
}

.admin-analytics .kpi-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-analytics .kpi-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 8px;
}

.admin-analytics .kpi-target {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.admin-analytics .funnel-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.admin-analytics .section-title {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.admin-analytics .funnel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-analytics .funnel-stage {
  flex: 1;
  text-align: center;
  min-width: 120px;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
}

.admin-analytics .funnel-stage-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-analytics .funnel-stage-value {
  font-family: var(--font-primary);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 4px;
}

.admin-analytics .funnel-arrow {
  color: var(--status-pass);
  font-size: 20px;
}

@media (max-width: 900px) {
  .admin-analytics .kpi-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .admin-analytics .kpi-cards { grid-template-columns: 1fr; }
}

/* Analytics -- cohort table and charts */
.admin-analytics .cohort-section {
  background: var(--bg-surface);
  border: 1px solid var(--bg-muted);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.admin-analytics .cohort-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-analytics .cohort-table th,
.admin-analytics .cohort-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bg-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}
.admin-analytics .cohort-table th {
  font-family: var(--font-primary);
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.7;
}
.admin-analytics .cohort-table td.num,
.admin-analytics .cohort-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.admin-analytics .cohort-empty,
.admin-analytics .chart-empty {
  color: var(--text-primary);
  opacity: 0.6;
  font-style: italic;
}

.admin-analytics .timeseries-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.admin-analytics .chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-muted);
  border-radius: 8px;
  padding: 20px;
}
.admin-analytics .chart-container {
  width: 100%;
  /* uPlot puts the canvas at the configured 240px and renders the legend
     row beneath it. Letting the container grow naturally (min-height
     instead of fixed height) keeps the legend inside the card. */
  min-height: 240px;
}

@media (max-width: 900px) {
  .admin-analytics .timeseries-section { grid-template-columns: 1fr; }
}

/* Analytics, quality row (ingredient metrics + reviewer velocity, side by side) */
.admin-analytics .analytics-quality-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-analytics .ingredient-metrics-card,
.admin-analytics .reviewer-velocity-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-muted);
  border-radius: 8px;
  padding: 20px;
}

.admin-analytics .section-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.admin-analytics .ingredient-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.admin-analytics .ingredient-metric {
  background: var(--bg-primary);
  border-radius: 6px;
  padding: 14px 16px;
}
.admin-analytics .ingredient-metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 500;
}
.admin-analytics .ingredient-metric-value {
  font-family: var(--font-display), serif;
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 4px;
}
.admin-analytics .ingredient-metric-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Scope legend beneath the data-quality grid: explains what the denominator
   (system-catalogue base) counts, and what each metric means. */
.admin-analytics .ingredient-metrics-legend {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-muted);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.admin-analytics .ingredient-metrics-legend p {
  margin: 0 0 6px;
}
.admin-analytics .ingredient-metrics-legend p:last-child {
  margin-bottom: 0;
}
.admin-analytics .ingredient-metrics-legend .legend-term {
  color: var(--text-primary);
  font-weight: 500;
}

.admin-analytics .reviewer-velocity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-analytics .reviewer-velocity-table th,
.admin-analytics .reviewer-velocity-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--bg-muted);
  text-align: left;
}
.admin-analytics .reviewer-velocity-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 500;
}
.admin-analytics .reviewer-velocity-table .vel-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.admin-analytics .reviewer-velocity-table tfoot .vel-totals td {
  font-weight: 500;
  color: var(--text-primary);
  border-top: 2px solid var(--bg-muted);
  border-bottom: none;
  padding-top: 12px;
}

@media (max-width: 900px) {
  .admin-analytics .analytics-quality-row { grid-template-columns: 1fr; }
  .admin-analytics .ingredient-metrics-grid { grid-template-columns: 1fr 1fr; }
}

/* Analytics, trialists table (the internal-accounts card shares its surface) */
.admin-analytics .trialists-section,
.admin-analytics .internal-accounts-section {
  background: var(--bg-surface);
  border: 1px solid var(--bg-muted);
  border-radius: 8px;
  padding: 20px;
}
.admin-analytics .trialists-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-analytics .trialists-table th,
.admin-analytics .trialists-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bg-muted);
  font-size: 13px;
  font-family: var(--font-primary);
}
.admin-analytics .trialists-table th {
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.7;
}
.admin-analytics .trialists-table th.num,
.admin-analytics .trialists-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.admin-analytics .trialists-empty {
  color: var(--text-primary);
  opacity: 0.6;
  font-style: italic;
}
.admin-analytics .status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-analytics .status-active {
  background: color-mix(in srgb, var(--status-pass) 15%, transparent);
  color: var(--status-pass-text);
}
.admin-analytics .status-churning {
  background: color-mix(in srgb, var(--brand-gold) 15%, transparent);
  color: var(--accent-teal-text);
}
.admin-analytics .status-dormant {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* Analytics, internal accounts: whose numbers the page shows (scope line
   under the subtitle) and the bulk-mark card at the foot of the page.
   Figma: Canoli Web, frame 1384:21. */
.admin-analytics .analytics-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 8px 0 24px;
  font-size: 13px;
  color: var(--text-secondary);
}
.admin-analytics .analytics-scope-link {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: underline;
}
.admin-analytics .internal-accounts-section {
  margin-top: 24px;
}
/* --radius-field is a pill on Canoli, which suits one-line inputs; a
   four-row paste box needs a small corner. */
.admin-analytics .internal-accounts-form .form-textarea {
  border-radius: var(--radius-field-sm, 6px);
}
.admin-analytics .internal-accounts-actions {
  margin-top: 12px;
}
.admin-analytics .internal-accounts-result p {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.admin-analytics .internal-accounts-result .internal-accounts-marked {
  font-weight: 600;
  color: var(--status-pass-text);
}
.admin-analytics .internal-accounts-result .internal-accounts-error {
  color: var(--status-fail-text);
}
.admin-analytics .internal-accounts-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}


/* Analytics - metric help trigger and modals */
.metric-help-trigger {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.metric-help-trigger:hover {
  opacity: 1;
  color: var(--text-primary);
}
/* Lucide replaces <i> with <svg> at runtime; size both selectors. */
.metric-help-trigger svg,
.metric-help-trigger i {
  width: 12px !important;
  height: 12px !important;
}

/* The hidden attribute must beat .modal-overlay's display:flex */
.metric-help-modal[hidden] {
  display: none;
}

.metric-help-content {
  max-width: 420px;
}
.metric-help-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0 0 12px;
}
.metric-help-details {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.metric-help-details li {
  margin-bottom: 6px;
}
.metric-help-details li:last-child {
  margin-bottom: 0;
}

/* ---------- Micronutrients panel (recipe + ingredient) ---------- */
.micro-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 24px;
  margin-top: 4px;
}
.micro-columns > .micro-section,
.micro-columns > .micro-section + .micro-section {
  margin-top: 0;
  min-width: 0;
}
.micro-columns > .micro-section > .micro-section-title:first-child {
  margin-top: 0;
}
@media (max-width: 720px) {
  .micro-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
.micro-section {
  margin-top: 8px;
}
.micro-section + .micro-section {
  margin-top: 16px;
}
.micro-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.micro-table {
  display: flex;
  flex-direction: column;
}
.micro-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-divider);
  font-size: 12px;
}
.micro-row:last-child {
  border-bottom: none;
}
.micro-row-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding-bottom: 4px;
}
.micro-row .micro-label {
  color: var(--text-primary);
  font-weight: 500;
}
.micro-row .micro-value {
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: right;
  min-width: 70px;
}
.micro-row .micro-pct {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-align: right;
  min-width: 48px;
}
/* Names the ingredients that left a nutrient blank. A SIBLING of .micro-row,
   never a child: the row's three spans are the label / value / %NRV contract
   that both a reader and the meth010b rendered-output assertions parse, and a
   note nested in the label span lands inside the value text. The class must
   also not begin with "micro-row", because those assertions match
   `micro-row[^"]*` and would count this line as a nutrient row. */
.micro-missing-line {
  margin: 0 0 6px 0;
  padding-left: 2px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-secondary);
}
/* PLAT-027: an "at least" floor for an unknown nutrient, for orgs that opted
   in. Quieter than a real figure (secondary colour, italic) so a minimum never
   reads as the total; the >= and the missing line beneath carry the meaning.
   The class must not begin with "micro-row" (see .micro-missing-line). */
.micro-value-floor {
  font-style: italic;
  color: var(--text-secondary);
}
.micro-footnote {
  margin-top: 12px;
  font-size: 10px;
  color: var(--text-secondary);
  font-style: italic;
}
.ing-micronutrients {
  margin-top: 16px;
}

/* Recipe panel: collapsible header is the entire card-header row */
.micro-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.micro-collapse-toggle:hover .ing-breakdown-chevron {
  color: var(--text-primary);
}

/* Per 100g/Per Serving toggle on its own row, right-aligned */
.micro-mode-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

/* Ingredient detail card body: pad to match .nut-table inside .ingredient-nut-card */
.ingredient-nut-card .ing-micronutrients-body {
  padding: 8px 20px 12px;
}

/* Modal: tighten the section-label spacing above the micronutrients block */
.modal-body .ing-micronutrients-body {
  margin-top: -4px;
}

/* Coverage badge ("21 / 24 nutrients") on the micronutrients panel headers.
   Reuses the warm-theme tokens; band-state classes shade lightly without
   inventing new colours. */
.micro-coverage-badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.micro-coverage-high {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}
.micro-coverage-mid {
  background: var(--accent-teal-light);
  color: var(--accent-teal-text);
}
.micro-coverage-low {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* Recipe panel: keep the section-label and badge together on the left, with
   the chevron pinned to the right by the parent flex container. */
.micro-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* PLAT-027: a second badge ("16 as a minimum") wraps under the first in
     the narrow builder rail rather than being clipped. One badge never
     needs to wrap, so the default header is unchanged. Wrapping needs a
     bounded width: flex 1 1 auto + min-width 0 lets the toggle (a flex row
     with the chevron) constrain this group instead of it growing to its
     content; left-aligned content looks the same when it fits. */
  flex-wrap: wrap;
  row-gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
/* PLAT-027: the count of rows showing an "at least" floor. Dashed, so it
   reads as a softer statement than the solid count of real figures. */
.micro-coverage-floor {
  background: transparent;
  border: 1px dashed var(--border-primary);
  font-style: italic;
}

/* Ingredient detail card and modal: section-label rows that include a badge
   become flex containers so the badge sits to the right of the label text. */
.ingredient-nut-card-header-with-badge,
.section-label-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Welcome page (PLAT-008 Phase 4.1)

   Post-Checkout celebration. Reuses .btn-primary / .btn-ghost from the
   shared button stack above and the parchment surface tokens. Single
   centred card; works on mobile by collapsing the CTA row to a column.
   -------------------------------------------------------------------------- */
.welcome-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  background: var(--bg-primary);
  min-height: 100%;
}

/* UX-014: one white card; a waving hand centred above a big greeting
   (Figma "Canoli Web · Not live" frame 47, option C2). */
.welcome-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 20px;
  padding: 36px 44px 40px;
}

.welcome-hand {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.welcome-headline {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.15;
}

.welcome-lede {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.55;
}

/* The plan, billing and trial end on one quiet line, dot-separated. Every part
   carries its own leading dot and the parts sit 24px left of the line, which
   clips: so a part that wraps to a new line never starts with a dot. */
.welcome-plan-line {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-teal-text);
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-divider);
}
/* On the signed-out welcome page the auth layout's .form-side already spaces
   its children with a 24px flex gap, so the hand and the plan line drop their
   own bottom margins there. */
.form-side > .welcome-hand,
.form-side > .welcome-plan-line {
  margin-bottom: 0;
}

.welcome-plan-parts {
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  margin-left: -24px;
}
.welcome-plan-parts > span::before {
  content: "\00B7";
  display: inline-block;
  width: 24px;
  text-align: center;
}

/* EXPORT-006 1b: "Where do you sell?" as a plain section of the welcome
   card; "Let's get cooking" below it is the page's one button. */
.welcome-sells-in { margin: 0 0 28px; }
.welcome-section-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.welcome-section-lede { margin: 0 0 12px; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.welcome-sells-in-options { display: flex; flex-direction: column; gap: 8px; }

.welcome-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.welcome-footer-note {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}

.welcome-footer-note a {
  color: var(--text-primary);
  text-decoration: underline;
}

@media (max-width: 540px) {
  .welcome-card {
    padding: 28px 22px;
  }
  .welcome-headline {
    font-size: 28px;
  }
  .welcome-hand {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }
  .welcome-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
}


/* ==========================================================================
   PLAT-008 Settings -> Billing
   --------------------------------------------------------------------------
   .billing-banner   trial / past-due notice strip at the top of the page.
                     Three modifiers map to subscription state:
                       --trial-active   amber, "X days remaining"
                       --trial-expired  red, "trial ended, reactivate"
                       --past-due       amber, "payment retrying"
   .plan-card        always-visible card showing the org's current plan,
                     status pill, cadence, and (Phase 5.4) period info.
   ========================================================================== */
.billing-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  margin-bottom: 20px;
}

.billing-banner__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-surface);
}

.billing-banner__icon i,
.billing-banner__icon svg {
  width: 18px;
  height: 18px;
}

.billing-banner__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.billing-banner__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.billing-banner__subline {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.billing-banner__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Trialing, amber/gold tone using the existing warning token. */
.billing-banner--trial-active {
  background: var(--status-warning-bg);
  border-color: var(--status-warning);
}

.billing-banner--trial-active .billing-banner__icon {
  color: var(--status-warning);
}

/* Past due, same amber tone as trialing but a different copy slot. */
.billing-banner--past-due {
  background: var(--status-warning-bg);
  border-color: var(--status-warning);
}

.billing-banner--past-due .billing-banner__icon {
  color: var(--status-warning);
}

/* Trial expired & locked, red. Mirrors the .danger-card aesthetic. */
.billing-banner--trial-expired {
  background: var(--status-fail-bg);
  border-color: var(--status-fail);
}

.billing-banner--trial-expired .billing-banner__icon {
  color: var(--status-fail);
}

@media (max-width: 720px) {
  .billing-banner {
    flex-direction: column;
  }
  .billing-banner__actions {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Plan card
   --------------------------------------------------------------------------
   Reuses the .settings-card visual rhythm but with its own DOM so the
   layout (heading + status pill on the right, definition-list of details,
   button row in the footer) is independent of the form-style cards on
   other settings pages.
   -------------------------------------------------------------------------- */
.plan-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  overflow: hidden;
}

.plan-card__head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-divider);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.plan-card__sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.plan-card__status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-secondary);
  text-transform: capitalize;
}

.plan-card__status--trialing,
.plan-card__status--past_due {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.plan-card__status--active {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.plan-card__status--canceled,
.plan-card__status--trial_expired_locked {
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
}

.plan-card__details {
  padding: 8px 24px;
  margin: 0;
}

.plan-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-divider);
}

.plan-card__row:last-child {
  border-bottom: none;
}

.plan-card__label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.plan-card__value {
  font-size: 14px;
  color: var(--text-primary);
  margin: 0;
  font-weight: 500;
}

.plan-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-divider);
}

.plan-card__actions button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* PLAT-008 audit C2 - /billing/select-plan reactivation landing.
   The page reuses the marketing pricing-card / pricing-toggle classes
   (loaded via marketing.css from inside the page template). The
   select-plan-page namespace below covers only the page-level layout
   (header, grid spacing, error swap target, footer). */

.select-plan-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.select-plan-page__header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.select-plan-page__title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.select-plan-page__subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}

.select-plan-page__subtitle a {
  color: var(--link-on-surface);
  text-decoration: underline;
}

.select-plan-grid {
  /* Two cards (Starter + Growth) side by side, capped to a comfortable
     reading width so they don't stretch into giant slabs on widescreens.
     The marketing surface uses 4 columns; this grid is intentionally
     narrower because Scale + Enterprise are filtered out as sales-led. */
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-lg, 24px);
  align-items: stretch;
  max-width: 880px;
  margin: 0 auto;
}

@media (max-width: 760px) {
  .select-plan-grid { grid-template-columns: 1fr; }
}

.select-plan-page__empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 32px 16px;
}

.select-plan-page__error {
  /* HTMX swap target for inline Stripe / validation errors. Stays
     visually quiet when empty. */
  min-height: 0;
}

.select-plan-page__error:empty {
  display: none;
}

.select-plan-page__footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.select-plan-page__footer a {
  color: var(--link-on-surface);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .select-plan-page {
    padding: 20px 16px 48px;
    gap: 24px;
  }

  .select-plan-page__title {
    font-size: 26px;
  }
}

/* PLAT-011 feature-gate locked controls. Buttons and cards still occupy
   the same slot in the layout but read as inactive, with a tooltip-style
   data-tip explaining why they are locked. The locked element still
   responds to clicks (it links to /billing/upgrade) so the user can act
   on the locked affordance.

   Issue #122: `[data-locked-control="true"]` is the canonical, Alpine-safe
   marker. The legacy `.locked` class selector is kept alongside so existing
   templates (and any element that uses an Alpine `:class` binding to flip
   `locked` on/off) get the same visual treatment. Keep the two selectors
   in lockstep. */
.locked,
[data-locked-control="true"] {
  opacity: 0.55;
  position: relative;
  cursor: pointer;
}
.locked::after,
[data-locked-control="true"]::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='11' width='18' height='11' rx='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: -2px;
}
.locked:hover,
[data-locked-control="true"]:hover {
  opacity: 0.8;
}
.locked[data-tip]:hover::before,
.locked[data-tip]:focus-visible::before,
[data-locked-control="true"][data-tip]:hover::before,
[data-locked-control="true"][data-tip]:focus-visible::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--coffee-bean, var(--brand-espresso));
  color: var(--text-on-dark);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  width: max-content;
  z-index: 1000;
  pointer-events: none;
}
/* Status badges carrying a data-tip get the same tooltip treatment as
   locked controls. Kept as its own selector block rather than widening
   the .locked list, so the two families cannot cascade into each other.
   tabindex="0" on the badge makes the focus-visible branch reachable by
   keyboard; an aria-label carries the same copy for screen readers. */
.status-badge[data-tip] {
  position: relative;
  cursor: help;
}
.status-badge[data-tip]:hover::before,
.status-badge[data-tip]:focus-visible::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--coffee-bean, var(--brand-espresso));
  color: var(--text-on-dark);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  max-width: 280px;
  white-space: normal;
  width: max-content;
  z-index: 1000;
  pointer-events: none;
}

/* The placeholder div used by some locked variants (e.g. batch-scaling
   modal else-branch) is intentionally hidden and must not display the
   lock-icon decoration. `[hidden]` shouldn't render at all per spec, but
   ::after on a hidden parent can still leak in some browsers. */
.locked[hidden]::after,
[data-locked-control="true"][hidden]::after {
  content: none;
}


/* --------------------------------------------------------------------------
   PLAT-009: Organisation dashboard (Variant B, 2026-05-14)
   Three metric cards rendered directly on the parchment background.
   Each card has four zones top-to-bottom: header (icon + small mono
   label + period), hero (Roboto Slab numeral + label group), middle
   (stacked progress bar + dot legend, or a 2x2 stat grid for activity),
   and footer (top divider, icon + bold number + caption).
   -------------------------------------------------------------------------- */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 32px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 12px);
}

.metric-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-card__title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metric-card__title-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-teal);
  flex-shrink: 0;
}

.metric-card__title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.metric-card__period {
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.metric-card__empty {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 24px 0;
  text-align: center;
  margin: 0;
}

.metric-card__hero {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.metric-card__hero-num {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
}

.metric-card__hero-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}

.metric-card__hero-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-card__hero-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.metric-card__bar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-card__bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.metric-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  background: var(--bg-muted);
}

.metric-bar__seg {
  flex: var(--seg-grow, 0) 0 0;
  height: 100%;
  min-width: 0;
}

.metric-bar__seg--pass     { background: var(--status-pass); }
.metric-bar__seg--warn     { background: var(--status-warning); }
.metric-bar__seg--fail     { background: var(--status-fail); }
.metric-bar__seg--unscored { background: var(--bg-muted); }

.metric-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.metric-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.metric-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.metric-legend__dot--pass     { background: var(--status-pass); }
.metric-legend__dot--warn     { background: var(--status-warning); }
.metric-legend__dot--fail     { background: var(--status-fail); }
.metric-legend__dot--unscored {
  background: var(--bg-muted);
  border: 1px solid var(--border-primary);
}

.metric-legend__text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-legend__text--muted {
  color: var(--text-muted);
}

.metric-card__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-divider);
}

.metric-card__footer-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.metric-card__footer-icon--pass   { color: var(--status-pass); }
.metric-card__footer-icon--fail   { color: var(--status-fail); }
.metric-card__footer-icon--accent { color: var(--accent-teal); }
.metric-card__footer-icon--muted  { color: var(--text-secondary); }

.metric-card__footer-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-card__footer-text {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Status badge: hero-row chip for the compliance-health panel. */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-chip-sm, 10px);
  font-size: 11px;
  font-weight: 600;
}

.status-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge--pass    { background: var(--status-pass-bg);    color: var(--status-pass-text); }
.status-badge--warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.status-badge--fail    { background: var(--status-fail-bg);    color: var(--status-fail-text); }

/* Dragnet admin (DATA-048): feed last_outcome and run result values. */
.status-badge--ok,
.status-badge--not_modified,
.status-badge--empty     { background: var(--status-pass-bg);    color: var(--status-pass-text); }
.status-badge--partial,
.status-badge--blocked,
.status-badge--not_a_feed { background: var(--status-warning-bg); color: var(--status-warning-text); }
.status-badge--failed,
.status-badge--dead,
.status-badge--error     { background: var(--status-fail-bg);    color: var(--status-fail-text); }
.status-badge--none      { background: var(--bg-muted);          color: var(--text-secondary); }

/* Activity panel 2x2 stat grid. */

.metric-card__stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card__stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-card__stat-row {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
}

.metric-card__stat-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
}

.metric-card__stat-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  padding-bottom: 4px;
}

/* Trend chip on activity stats. Hidden naturally by the template when
   the previous-period count is zero (no denominator). */

.trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.trend-chip__icon {
  width: 10px;
  height: 10px;
}

.trend-chip__text {
  font-size: 10px;
  font-weight: 600;
}

.trend-chip--up   { background: var(--status-pass-bg); color: var(--status-pass-text); }
.trend-chip--down { background: var(--status-fail-bg); color: var(--status-fail-text); }

/* Tablet (UX-003): keep all three dashboard cards on one row. The 1100px
   2-up rule near .metrics-grid was tuned for the 260px desktop sidebar;
   with the 64px rail the content area fits 3-up at reduced density. Placed
   after the full metric component section so it wins the cascade. */
@media (min-width: 768px) and (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .metric-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .metric-card__hero {
    gap: 8px;
  }

  .metric-card__hero-num {
    font-size: 34px;
  }

  .metric-card__hero-label-group {
    padding-bottom: 3px;
  }

  .metric-card__hero-label {
    font-size: 12px;
  }

  .metric-card__hero-sub {
    font-size: 11px;
  }

  .metric-legend {
    gap: 6px 10px;
  }

  .metric-legend__text {
    font-size: 11px;
  }

  .metric-card__stat-grid {
    gap: 10px;
  }

  .metric-card__stat-num {
    font-size: 24px;
  }

  .metric-card__footer-num,
  .metric-card__footer-text {
    font-size: 12px;
  }
}

/* UX-011 3.6: /recipes renders the three panels as shells that their
   fragments fill on load (Figma Canoli Web frame 25, section C1). The
   shell keeps the LOADED panel's height at each breakpoint, measured on
   the seeded org, so the filter bar and grids below never move when the
   panels arrive. It stays on after the swap, so a shorter loaded state
   (an empty panel) does not shrink the row either. Placed after the
   tablet block above so its breakpoints win the cascade. */
.metric-card--deferred {
  min-height: 340px;
}

@media (max-width: 1100px) {
  .metric-card--deferred {
    min-height: 368px;
  }
}

/* 721-767px is two columns with the compliance panel in the first row, and
   the loaded compliance panel is 6px taller there. */
@media (min-width: 721px) and (max-width: 767px) {
  .metric-card--deferred {
    min-height: 374px;
  }
}

@media (max-width: 720px) {
  .metric-card--deferred.metric-card--coverage   { min-height: 273px; }
  .metric-card--deferred.metric-card--compliance { min-height: 374px; }
  .metric-card--deferred.metric-card--activity   { min-height: 257px; }
}

.metric-skeleton {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.metric-skeleton__bar {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: var(--bg-muted);
}

.metric-skeleton__bar--title      { width: min(90px, 40%); }
.metric-skeleton__bar--hero       { width: min(160px, 70%); height: 28px; border-radius: 6px; }
.metric-skeleton__bar--line       { width: min(200px, 90%); }
.metric-skeleton__bar--line-short { width: min(130px, 60%); }

/* /admin/orgs index and detail-page Checkout-link tool */

.admin-search-form {
  display: flex;
  gap: 8px;
  margin: 16px 0 24px;
  max-width: 600px;
}

.admin-search-form .input-field { flex: 1; }

.admin-empty-state {
  padding: 32px 16px;
  text-align: center;
}

.checkout-link-result {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}

.checkout-link-headline {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  font-weight: 500;
}

.checkout-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkout-link-display {
  flex: 1;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  padding: 8px 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
}

.copy-link-button { white-space: nowrap; }

.checkout-link-meta {
  margin: 12px 0 0 0;
  font-size: 12px;
}

/* Admin section card spacing: the show.html page stacks multiple forms
   inside a single .card.admin-section. Without internal spacing the
   forms, dividers, and muted helper text feel crammed against each
   other (issue raised 2026-05-18). Give the section a bit of breathing
   room around its title and between sub-forms. */
.admin-section {
  padding: 24px;
}

/* Stack-spacing between sibling admin-section cards on /admin/orgs/:id
   (Subscription actions + Members). Matches metrics-grid's 24px rhythm. */
.admin-section + .admin-section {
  margin-top: 24px;
}

/* Warning variant used by the /admin/orgs/:id "Metrics unavailable" notice
   when org-dashboard-context catches an exception. Tints the card so the
   admin can tell a broken render apart from an empty-org case, without
   shouting. */
.admin-section--warning {
  border: 1px solid var(--status-warning);
  background: var(--status-warning-bg);
}

.admin-section h3 {
  margin: 0 0 16px 0;
}

/* A refused Members-row action lands above the table (#admin-user-row-error);
   flash-message's page-level side margins would indent it inside the card. */
.admin-section .flash-message {
  margin: 0 0 16px;
}

.admin-form {
  margin: 16px 0;
}

.admin-form label {
  display: block;
  margin-bottom: 8px;
}

.admin-form .input-field,
.admin-form button {
  margin-right: 8px;
}

.admin-form .muted {
  margin-top: 8px;
  display: block;
}

.admin-section hr.divider {
  border: 0;
  border-top: 1px solid var(--border-divider);
  margin: 24px 0;
}

/* Admin-table links use the design-system pattern (text-primary +
   brand-gold underline accent on hover) instead of the user-agent blue.
   Mirrors the .invoices-table__pdf-link rule. The `admin-table` scope
   keeps this from blanket-restyling anchors elsewhere. */
.admin-table a {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--brand-gold);
  text-decoration-thickness: 1.5px;
  transition: text-decoration-color 0.15s ease;
}

.admin-table a:hover {
  text-decoration-color: var(--text-primary);
}

/* =============================================================
   GROW-002: blog sync status fragment (rendered into /admin/blog
   and /admin/data-tools after POST /admin/blog/sync). Pinned to
   the existing --status-fail / --status-pass tokens so the warning
   matches the rest of the admin chrome.
   ============================================================= */

.blog-sync-status {
  margin-top: var(--space-md, 16px);
}

.blog-sync-status__summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.blog-sync-status--ok .blog-sync-status__summary {
  color: var(--status-pass, var(--status-pass));
}

.blog-sync-status--failed .blog-sync-status__summary {
  color: var(--status-fail, var(--status-fail));
  font-weight: 600;
}

.blog-sync-warning {
  margin-top: 12px;
  padding: 14px 18px;
  background: var(--status-fail-bg, var(--status-fail-soft));
  border: 1px solid var(--status-fail, var(--status-fail));
  border-radius: 8px;
  color: var(--text-primary);
}

.blog-sync-warning__title {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--status-fail, var(--status-fail));
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-sync-warning__icon {
  width: 18px;
  height: 18px;
}

.blog-sync-warning__list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.blog-sync-warning__item + .blog-sync-warning__item {
  margin-top: 8px;
}

.blog-sync-warning__page-title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.blog-sync-warning__message {
  display: block;
  color: var(--status-fail, var(--status-fail));
}

/* =============================================================
   GROW-002: HTMX in-button spinner. Both Sync-from-Notion buttons
   (/admin/blog and /admin/data-tools) use the .btn-idle / .btn-busy
   morph so the click feedback is co-located with the click target
   instead of in a sibling label. HTMX adds the .htmx-request class
   to the issuing element for the duration of the in-flight request.
   ============================================================= */

.btn-idle { display: inline-flex; align-items: center; gap: 6px; }
.btn-busy { display: none; }

.htmx-request .btn-idle { display: none; }
.htmx-request .btn-busy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The loader-circle SVG lucide renders inside .btn-busy spins for as
   long as the request is in flight. Kept on .btn-busy so it doesn't
   accidentally apply to play/rss icons that happen to share the SVG
   tag elsewhere on the page. */
.btn-busy svg {
  animation: nibblr-btn-spin 1s linear infinite;
  transform-origin: center;
}

@keyframes nibblr-btn-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Reduce visual jitter for users who've requested reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .btn-busy svg { animation: none; }
}

/* Abandoned-Checkout callout on /admin/orgs index. Distinguishes a
   needs-action list from the regular org table below. Uses the warning
   token (amber) rather than fail (red) because the org isn't broken,
   just stalled mid-onboarding. */
.admin-callout {
  padding: 20px 24px;
  margin-bottom: 24px;
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning);
}

.admin-callout__title {
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--text-primary);
}

.admin-callout__title i[data-lucide] {
  width: 18px;
  height: 18px;
  color: var(--status-warning);
}

.admin-callout__lede {
  margin: 0 0 16px 0;
  color: var(--text-secondary, var(--text-secondary));
}

/* EXPORT-002: recipe documents panel */
/* Documents section: matches METHOD / RECIPE SPEC NOTES layout. The label
   sits in a section-label-row above the card (not inside a card-header), and
   the card mirrors .method-card's border/surface so all three main-column
   sections read as one family. */
.recipe-documents-label { margin-top: 32px; }
.documents-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card-sm, 8px);
  overflow: hidden;
}
.documents-list { list-style: none; margin: 0; padding: 0; }
.documents-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-divider); }
.documents-name { flex: 1; color: var(--text-primary); text-decoration: none; }
.documents-name:hover { text-decoration: underline; }
.documents-meta { color: var(--text-tertiary); font-size: 12px; }
.documents-dropzone { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 16px; border: 1px dashed var(--border-primary); border-radius: var(--radius-dropzone, 8px); color: var(--text-tertiary); cursor: pointer; }
.documents-dropzone input[type=file] { display: none; }
.documents-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.documents-files-label { margin: 16px 0 4px; }

/* PROD-022 1b: Photos strip (Figma PH4) */
.photo-strip-section { margin-bottom: 16px; }
.photo-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.photo-strip-label { font-size: 11px; letter-spacing: 0.08em; color: var(--text-tertiary); }
.photo-privacy, .photo-lightbox-privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); }
.photo-privacy .icon-sm { color: var(--status-pass-text); }
.photo-upload-summary { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius-card-sm, 8px); background: var(--bg-muted); font-size: 13px; }
.photo-upload-summary[hidden] { display: none; }
.photo-summary-dismiss { margin-left: auto; background: none; border: 0; color: var(--text-tertiary); font-size: 12px; cursor: pointer; }
.photo-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.photo-tile { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-card-sm, 8px); overflow: hidden; background: var(--bg-muted); }
.photo-tile-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.photo-tile-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-tile-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: var(--radius-chip-sm, 999px); font-size: 11px; font-weight: 600; background: var(--status-pass); color: var(--text-on-dark); }
.photo-tile-pending .photo-tile-img { opacity: 0.35; }
.photo-tile-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius-card-sm, 8px); background: var(--bg-surface); font-size: 11px; font-weight: 600; }
.photo-tile-bar { width: 90px; height: 4px; border-radius: 999px; background: var(--border-divider); overflow: hidden; }
.photo-tile-bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--text-primary); animation: photo-tile-bar 1.2s ease-in-out infinite; }
@keyframes photo-tile-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.photo-tile-refused { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--status-fail-bg); border: 1px solid var(--status-fail); overflow: auto; }
.photo-tile-refused-name { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--status-fail-text); overflow-wrap: anywhere; }
.photo-tile-refused-msg { font-size: 11px; font-weight: 600; color: var(--status-fail-text); line-height: 1.3; }
.photo-tile-refused.is-busy { background: var(--status-warning-bg); border-color: var(--status-warning); }
.photo-tile-refused.is-busy .photo-tile-refused-name, .photo-tile-refused.is-busy .photo-tile-refused-msg { color: var(--status-warning-text); }
.photo-tile-refused-actions { display: flex; gap: 10px; margin-top: auto; }
.photo-tile-refused-actions button { background: none; border: 0; padding: 0; font-size: 11px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.photo-tile-add { background: var(--bg-surface); border: 1.5px dashed var(--border-primary); }
.photo-tile-add.is-dragover, .documents-card.is-dragover { border-color: var(--text-primary); background: var(--bg-muted); }
.photo-add-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; cursor: pointer; text-align: center; padding: 8px; }
/* The input stays focusable (.visually-hidden, not display:none) so the
   Add photos tile is reachable by keyboard; the tile shows the focus. */
.photo-tile-add:focus-within { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.photo-add-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--bg-muted); }
.photo-add-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.photo-add-hint { font-size: 10px; color: var(--text-tertiary); }

/* PROD-022 1b: photo lightbox (Figma PH5, Phase 1 elements) */
.photo-lightbox { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: var(--bg-sidebar); color: var(--text-on-dark); }
.photo-lightbox[hidden] { display: none; }
body.photo-lightbox-open { overflow: hidden; }
.photo-lightbox-bar, .photo-lightbox-foot { width: min(1000px, 100%); display: flex; align-items: center; gap: 12px; }
.photo-lightbox-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.photo-lightbox-count { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-on-dark-subtle); }
.photo-lightbox-close { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--text-on-dark-subtle); background: none; color: var(--text-on-dark); cursor: pointer; }
.photo-lightbox-stage { width: min(1000px, 100%); display: flex; align-items: center; gap: 12px; min-height: 0; flex: 1; }
.photo-lightbox-img { flex: 1; min-width: 0; max-height: calc(100vh - 220px); object-fit: contain; border-radius: var(--radius-card, 12px); }
.photo-lightbox-arrow { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--bg-surface); color: var(--text-primary); cursor: pointer; }
.photo-lightbox-arrow[disabled] { opacity: 0.3; cursor: default; }
.photo-lightbox-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-on-dark-subtle); }
.photo-lightbox-meta .photo-lightbox-privacy { color: var(--text-on-dark-subtle); }
.photo-lightbox-actions { position: relative; margin-left: auto; display: flex; align-items: center; gap: 10px; }
.photo-lightbox-download { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.photo-lightbox-remove { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 0; background: var(--bg-surface); color: var(--status-fail-text); font-weight: 600; cursor: pointer; }
.photo-lightbox-confirm { position: absolute; right: 0; bottom: calc(100% + 12px); width: 300px; padding: 16px; border-radius: var(--radius-card, 12px); background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-lifted, 0 8px 24px rgba(0, 0, 0, 0.18)); }
.photo-lightbox-confirm[hidden] { display: none; }
.photo-lightbox-confirm-title { margin: 0 0 12px; font-weight: 600; }
.photo-lightbox-confirm-actions { display: flex; gap: 8px; }
@media (max-width: 767px) {
  .photo-lightbox { padding: 12px; }
  .photo-lightbox-foot { flex-direction: column; align-items: stretch; }
  .photo-lightbox-actions { margin-left: 0; flex-wrap: wrap; }
  .photo-lightbox-arrow { width: 36px; height: 36px; }
}

/* PROD-022 2a: product photo marks in the strip and lightbox */
.photo-tile-marker, .photo-tile-used { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-chip-sm, 999px); font-size: 10px; font-weight: 600; }
.photo-tile-marker { background: var(--brand-gold); color: var(--text-primary); }
.photo-tile-used { background: var(--text-primary); color: var(--text-on-dark); }
.photo-lightbox-meta-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.photo-lightbox-used { padding: 2px 8px; border-radius: 999px; background: var(--brand-gold); color: var(--text-primary); font-size: 11px; font-weight: 600; }
.photo-lightbox-used[hidden], .photo-lightbox-use[hidden], .photo-lightbox-is-product[hidden], .photo-lightbox-remove[hidden], .photo-lightbox-remove-note[hidden], .photo-lightbox-confirm-body[hidden] { display: none; }
.photo-lightbox-use { display: inline-flex; align-items: center; gap: 6px; }
.photo-lightbox-is-product { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--text-on-dark-subtle); font-weight: 600; opacity: 0.8; }
.photo-lightbox-remove-note { max-width: 220px; font-size: 11px; color: var(--text-on-dark-subtle); }
.photo-lightbox-confirm-body { margin: 0 0 12px; font-size: 13px; color: var(--text-tertiary); line-height: 1.45; }

/* PROD-022 PH5/PH6: Erase photo everywhere. The link sits under Remove's
   question (or alone where there is no Remove); the confirmation is a
   dialog on <body> above the lightbox (z 120). */
.photo-lightbox-erase { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-divider); }
.photo-lightbox-erase[hidden], .photo-lightbox-erase-alt[hidden] { display: none; }
.photo-lightbox-erase-link, .photo-lightbox-erase-alt { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--status-fail-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.photo-lightbox-erase-alt { color: var(--text-on-dark); font-weight: 500; }
.photo-lightbox-erase-who { margin: 4px 0 0; font-size: 11px; color: var(--text-tertiary); }
.photo-erase { position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg-sidebar) 70%, transparent); }
.photo-erase-card { width: min(544px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px 32px; border-radius: 20px; background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-lifted, 0 8px 24px color-mix(in srgb, var(--text-primary) 14%, transparent)); }
.photo-erase-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 999px; background: var(--status-fail-bg); color: var(--status-fail-text); }
.photo-erase-title { margin: 16px 0; font-family: var(--font-display); font-size: 24px; }
.photo-erase-photo { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 12px; background: var(--bg-muted); }
.photo-erase-thumb { flex: none; width: 96px; height: 72px; object-fit: cover; border-radius: 8px; }
.photo-erase-about { min-width: 0; }
.photo-erase-name { margin: 0; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.photo-erase-added { margin: 2px 0 6px; font-size: 11px; color: var(--text-tertiary); }
.photo-erase-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-erase-chip { padding: 2px 10px; border-radius: 999px; background: var(--bg-surface); font-size: 10px; font-weight: 600; }
.photo-erase-facts { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.45; }
.photo-erase-facts li { display: flex; gap: 10px; align-items: flex-start; }
.photo-erase-facts li i, .photo-erase-facts li svg { flex: none; margin-top: 2px; }
.photo-erase-tick { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border-divider); border-radius: 12px; font-size: 13px; cursor: pointer; }
.photo-erase-foot { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.photo-erase-who { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-tertiary); }
.photo-erase-foot .btn-danger[disabled] { opacity: 0.45; cursor: not-allowed; }

/* PROD-022 PH10: the crop dialog. The stage clips the display rendition;
   the frame is a fixed 4:3 box whose outside is dimmed by a spread shadow.
   photos.js sets the photo's size and position and the frame's box. */
.photo-crop-icon { background: var(--bg-muted); color: var(--text-primary); }
.photo-crop-stage { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 12px; background: var(--bg-sidebar); touch-action: none; cursor: grab; user-select: none; }
.photo-crop-stage:active { cursor: grabbing; }
.photo-crop-stage:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
.photo-crop-img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.photo-crop-frame { position: absolute; top: 0; left: 0; box-sizing: border-box; border: 2px solid var(--bg-surface); box-shadow: 0 0 0 9999px color-mix(in srgb, var(--bg-sidebar) 55%, transparent); pointer-events: none; }
.photo-crop-zoom { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; font-weight: 500; }
.photo-crop-zoom input { flex: 1; accent-color: var(--brand-gold); }
.photo-crop-note { margin: 10px 0 0; font-size: 13px; color: var(--text-secondary); }
.photo-crop-error:empty { display: none; }
.photo-crop-card .photo-erase-foot { justify-content: flex-end; }
@media (max-width: 767px) {
  .photo-erase-card { padding: 20px; }
  .photo-erase-foot { flex-wrap: wrap; }
  .photo-erase-who { flex-basis: 100%; }
}

/* PROD-022 2a: the header product photo (Figma PH1). The title row is
   unchanged; the photo sits beside the stage, tags and description and
   scales with the main column: 26%, between 96 and 200 px, always 4:3. */
.recipe-header-body { display: flex; align-items: flex-start; gap: 20px; }
.recipe-header-details { flex: 1; min-width: 0; }
.recipe-photo { position: relative; flex: none; width: clamp(96px, 26%, 200px); container-type: inline-size; }
.recipe-photo.has-photo { aspect-ratio: 4 / 3; }
.recipe-photo-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-card-sm, 8px); }
.recipe-photo.is-empty { display: flex; flex-direction: column; gap: 6px; }
.recipe-photo-empty { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 4 / 3; padding: 8px; border: 1.5px dashed var(--border-primary); border-radius: var(--radius-card-sm, 8px); background: var(--bg-surface); text-align: center; cursor: pointer; }
.recipe-photo-empty:focus-within, .recipe-photo-choose:focus-within { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.recipe-photo-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; background: var(--bg-muted); }
.recipe-photo-empty-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.recipe-photo-empty-hint { font-size: 11px; color: var(--text-tertiary); }
.recipe-photo-short { display: none; }
@container (max-width: 149px) {
  .recipe-photo-long, .recipe-photo-empty-hint { display: none; }
  .recipe-photo-short { display: inline; }
  .recipe-photo-empty-icon { width: 28px; height: 28px; }
}
.recipe-photo.has-error .recipe-photo-empty { border-style: solid; border-color: var(--status-fail); background: var(--status-fail-bg); justify-content: flex-start; align-items: stretch; text-align: left; }
.recipe-photo-error { display: flex; gap: 6px; font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--status-fail-text); overflow: auto; }
.recipe-photo-error-note { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 8px; border-radius: var(--radius-field-sm, 6px); background: var(--status-fail-bg); color: var(--status-fail-text); font-size: 11px; font-weight: 600; }
.recipe-photo.is-dragover .recipe-photo-empty { border-color: var(--text-primary); background: var(--bg-muted); }
.recipe-photo.is-processing .recipe-photo-img, .recipe-photo.is-processing .recipe-photo-empty { opacity: 0.35; }
.recipe-photo-preview { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; opacity: 0.35; border-radius: var(--radius-card-sm, 8px); }
.recipe-photo-processing { position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.recipe-photo-processing span { padding: 4px 10px; border-radius: 999px; background: var(--bg-surface); font-size: 11px; font-weight: 600; }
.recipe-photo-menu { position: absolute; top: 8px; right: 8px; }
.recipe-photo-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--bg-surface); font-size: 12px; font-weight: 600; list-style: none; cursor: pointer; opacity: 0; transition: opacity 0.15s ease; }
.recipe-photo-chip::-webkit-details-marker { display: none; }
.recipe-photo:hover .recipe-photo-chip, .recipe-photo-menu[open] .recipe-photo-chip, .recipe-photo-chip:focus-visible { opacity: 1; }
@media (hover: none) { .recipe-photo-chip { opacity: 1; } }
.recipe-photo-menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 250px; padding: 12px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border-primary); border-radius: var(--radius-card, 12px); background: var(--bg-surface); box-shadow: var(--shadow-lifted, 0 8px 24px rgba(0, 0, 0, 0.18)); }
.recipe-photo-replace { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border-divider); }
.recipe-photo-menu-title { margin: 0; font-weight: 600; font-size: 14px; }
.recipe-photo-menu-note { margin: 0; font-size: 12px; color: var(--text-tertiary); }
.recipe-photo-tick { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.recipe-photo-choose { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.recipe-photo-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius-field-sm, 6px); background: none; font: inherit; font-size: 13px; color: var(--text-primary); text-decoration: none; text-align: left; cursor: pointer; }
.recipe-photo-menu-item:hover { background: var(--bg-muted); }
.recipe-photo-menu-item.is-danger { color: var(--status-fail-text); }
@media (max-width: 767px) {
  /* Phones: the photo becomes a full-width 16:9 banner above the title. */
  .recipe-header-body { display: contents; }
  .recipe-header-body > .recipe-photo { order: 0; flex-basis: 100%; width: 100%; }
  .recipe-header-body > .recipe-photo.has-photo { aspect-ratio: 16 / 9; }
  .recipe-header-body > .recipe-photo.is-empty .recipe-photo-empty { aspect-ratio: auto; min-height: 88px; }
  .recipe-header-details { order: 2; flex-basis: 100%; }
}

/* AI-003 MIGHT PAIR WITH panel */
.pairing-panel { margin-top: 16px; }
.pairing-list { list-style: none; margin: 0; padding: 14px 20px; }
.pairing-item { padding: 6px 0; border-bottom: 1px solid var(--border-divider); }
.pairing-item:last-child { border-bottom: none; }
.pairing-link { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-decoration: none; color: inherit; }
.pairing-link:hover .pairing-name { text-decoration: underline; }
.pairing-name { flex: 1; color: var(--text-primary); font-weight: 500; }
.pairing-score { color: var(--text-tertiary); font-size: 12px; font-variant-numeric: tabular-nums; }
.pairing-beta { display: inline-block; margin-left: 10px; padding: 1px 8px; border-radius: 999px; font-size: 0.65em; font-weight: 600; letter-spacing: 0.04em; text-transform: lowercase; background: var(--border-primary); color: var(--brand-espresso); vertical-align: middle; }

/* --- DATA-014 Phase 0.7e: fibre methodology footnote --- */
/* Used on the nutrition card, ingredient detail panel, ingredient info
   modal and recipe spec PDF when at least one displayed row carries
   fibre_basis = nsp_converted_v1. Inherits .nut-footnote sizing/colour
   and adds an inline Methodology link target. */
.methodology-footnote { margin-top: 8px; }
.methodology-footnote-link {
  margin-left: 6px;
  color: var(--text-tertiary);
  text-decoration: underline;
  white-space: nowrap;
}
.methodology-footnote-link:hover { color: var(--text-primary); }
ul.method-citations { padding-left: 1.25rem; }
ul.method-citations li { margin: 4px 0; }

/* === AI-001a: goal-based ingredient swap skateboard === */
/* Sits inline next to the ingredient name, in place of the old info icon. */
.ing-swap-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.ing-swap-btn:hover { color: var(--accent-orange); }
.ing-swap-btn i, .ing-swap-btn svg { width: 14px; height: 14px; }

.swap-modal { max-width: 560px; }
.swap-goal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.swap-goal-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-primary);
  user-select: none;
}
.swap-goal-chip input { position: absolute; opacity: 0; pointer-events: none; }
.swap-goal-chip:has(input:checked) {
  border-color: var(--accent-orange);
  background: var(--accent-orange-light);
  color: var(--status-warning-text);
  font-weight: 500;
}

.swap-hint { font-size: 0.78rem; color: var(--text-secondary); margin: 4px 0 8px; }
.swap-allergen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px 10px;
  margin-bottom: 14px;
}
.swap-allergen-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
}

.swap-actions { display: flex; align-items: stretch; gap: 12px; }
.swap-find-btn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.swap-find-btn i, .swap-find-btn svg { width: 15px; height: 15px; }

/* Swap loader: a marquee of cooking verbs scrolling across the action bar
   while the AI thinks, filling the space next to the Find swaps button. */
.swap-spinner.htmx-indicator { display: none; }
/* min-width:0 lets the flex items shrink below the huge scrolling track's
   intrinsic width, so the bar respects the modal's right padding. */
.htmx-request.swap-spinner.htmx-indicator { display: flex; flex: 1; min-width: 0; }
.swap-ticker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  /* soften the edges so verbs fade in/out rather than hard-clipping */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); /* hex-ok: mask gradient stop, alpha not colour */
          mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); /* hex-ok: mask gradient stop, alpha not colour */
}
.swap-ticker-track {
  flex: 0 0 auto;
  white-space: nowrap;
  will-change: transform;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  animation: swap-ticker 16s linear infinite;
}
@keyframes swap-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .swap-ticker-track { animation: none; padding-left: 16px; }
}

/* AI-001a: admin AI-credit card (analytics dashboard) */
.ai-credit-section { margin-top: 24px; }
.ai-credit-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}
.ai-credit-table th,
.ai-credit-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-divider);
}
.ai-credit-table th { color: var(--text-secondary); font-weight: 500; }
.ai-credit-topup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}
.ai-credit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.ai-credit-field input {
  padding: 6px 8px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font: inherit;
}
.ai-credit-log { margin-top: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.ai-credit-log ul { margin: 4px 0 0; padding-left: 18px; }

.swap-results { margin-top: 14px; }
.swap-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 18px 8px;
  font-size: 0.88rem;
}
.swap-empty i, .swap-empty svg { width: 22px; height: 22px; margin-bottom: 6px; }

.swap-suggestion-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.swap-suggestion {
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-surface);
}
.swap-suggestion-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swap-suggestion-name { font-weight: 500; color: var(--text-primary); }
.swap-confidence {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 999px;
}
.swap-confidence-high   { background: var(--status-pass-bg);    color: var(--status-pass-text); }
.swap-source-badge { font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-secondary); background: var(--bg-muted); border: 1px solid var(--border-divider); border-radius: var(--radius-source-badge, 4px); padding: 1px 5px; margin-left: 4px; }
.swap-confidence-medium { background: var(--status-warning-bg); color: var(--status-warning-text); }
.swap-confidence-low    { background: var(--bg-muted);          color: var(--text-secondary); }
.swap-cross-badge {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-orange-light);
  color: var(--accent-orange-text);
}

.swap-adds-allergen {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 7px 0 2px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  border: 1px solid var(--status-fail);
}
.swap-adds-allergen i, .swap-adds-allergen svg { width: 13px; height: 13px; flex-shrink: 0; }

.swap-rationale { font-size: 0.85rem; color: var(--text-primary); margin: 7px 0 4px; }
.swap-functional {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0 0 8px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.swap-functional i, .swap-functional svg {
  width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; color: var(--status-warning);
}

.swap-impact { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.swap-delta {
  font-size: 0.74rem;
  font-family: var(--font-mono, monospace);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-primary);
}
.swap-delta-down { background: var(--status-pass-bg); color: var(--status-pass-text); }
.swap-delta-up   { background: var(--status-warning-bg); color: var(--status-warning-text); }
/* COMP-008 AC8: an unmeasured delta is a state of its own, not a flat 0. */
.swap-delta-unknown { background: var(--bg-muted); color: var(--text-muted); border: 1px dashed var(--text-muted); }

.swap-hfss, .swap-claims { font-size: 0.76rem; margin-bottom: 4px; }
.swap-hfss { color: var(--text-secondary); }
.swap-claims-gained { color: var(--status-pass); }
.swap-claims-lost   { color: var(--status-fail); }

.swap-use-btn { margin-top: 8px; }

/* EXPORT-003: product specification editor ------------------------------- */
.spec-details-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.spec-details-label { margin-top: 32px; }
.spec-details .spec-error {
  color: var(--status-fail);
  font-size: 13px;
  min-height: 0;
}
.spec-details .spec-error:not(:empty) {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--status-fail-bg);
  border-radius: 6px;
}
.spec-completeness { margin-bottom: 12px; font-size: 13px; }
.spec-completeness-warn,
.spec-completeness-ok {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-banner, 6px);
}
.spec-completeness-warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
.spec-completeness-ok { background: var(--status-pass-bg); color: var(--status-pass-text); }
.spec-completeness-icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
/* DATA-025 Phase 2: Reg 2018/775 primary-ingredient origin advisory on the
   recipe spec panel. Full border + tinted fill (no side-stripe). */
.origin-advisory {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-banner, 8px);
  background: var(--bg-surface);
  font-size: 13px;
}
.origin-advisory-warn,
.origin-advisory-action { border-color: var(--status-warning); background: var(--status-warning-bg); }
.origin-advisory-ok { border-color: var(--status-pass, var(--status-pass)); background: var(--status-pass-bg, var(--status-pass-bg)); }
.origin-advisory-icon { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; color: var(--text-secondary); }
.origin-advisory-warn .origin-advisory-icon,
.origin-advisory-action .origin-advisory-icon { color: var(--status-warning); }
.origin-advisory-ok .origin-advisory-icon { color: var(--status-pass, var(--status-pass)); }
.origin-advisory-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.origin-advisory-title { font-weight: 600; color: var(--text-primary); }
.origin-advisory-body { color: var(--text-primary); }
.origin-advisory-note { font-size: 11.5px; color: var(--text-secondary); }
.origin-advisory-fix {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--status-pass, var(--status-pass));
  text-decoration: none;
}
.origin-advisory-fix:hover { text-decoration: underline; }
/* DATA-025 Phase 2: the 2018/775 check demoted to a native <details> accordion
   (matches the spec-acc accordions), collapsed by default with a state chip. */
.spec-origin-acc { margin-top: 8px; }
.spec-origin-acc > summary.spec-acc-head { cursor: pointer; list-style: none; }
.spec-origin-acc > summary.spec-acc-head::-webkit-details-marker { display: none; }
.spec-origin-acc > summary.spec-acc-head::marker { content: ""; }
.spec-origin-caret { transition: transform 0.15s ease; }
.spec-origin-acc[open] .spec-origin-caret { transform: rotate(180deg); }
/* Compound selectors so they beat the base .spec-acc-chip (green) regardless of
   source order. Green is reserved for an actual pass; warn/action are amber. */
.spec-origin-chip { display: inline-flex; align-items: center; gap: 4px; }
.spec-origin-chip svg,
.spec-origin-chip i { width: 12px; height: 12px; }
.spec-acc-chip.spec-origin-chip-ok { background: var(--status-pass-bg, var(--status-pass-bg)); color: var(--status-pass-text); }
.spec-acc-chip.spec-origin-chip-warn,
.spec-acc-chip.spec-origin-chip-action { background: var(--status-warning-bg); color: var(--status-warning-text); }
.spec-acc-chip.spec-origin-chip-info { background: var(--bg-muted); color: var(--text-secondary); }
.spec-origin-headline { margin: 4px 0 6px; font-size: 13px; color: var(--text-primary); }
.spec-origin-note { margin: 0 0 6px; font-size: 11.5px; color: var(--text-secondary); }
/* Core block: the retailer-expected fields, always visible. */
.spec-core { margin-bottom: 18px; }
.spec-core-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-divider);
}
.spec-core-title { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.spec-core-hint { font-size: 11px; color: var(--text-secondary); }
/* The "expected on a retailer spec" marker: a small gold dot after the label. */
.spec-req-dot,
.spec-field-req::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-teal);
  vertical-align: middle;
}
.spec-field-req::after { margin-left: 5px; }
.spec-req-dot { margin: 0 2px; }
/* Additional-detail accordions. */
.spec-additional-head {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 4px 0 8px;
}
.spec-acc { border-bottom: 1px solid var(--border-divider); }
.spec-acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 2px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.spec-acc-head:hover { color: var(--brand-espresso); }
.spec-acc-title { flex: 1; }
.spec-acc-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--status-pass-text);
  background: var(--status-pass-bg);
  padding: 2px 7px;
  border-radius: var(--radius-chip, 10px);
}
.spec-acc-caret {
  display: inline-flex;
  color: var(--text-secondary);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.spec-acc-caret i, .spec-acc-caret svg { width: 16px; height: 16px; }
.spec-acc-caret-open { transform: rotate(180deg); }
.spec-acc-body { padding: 2px 2px 14px; }
@media (prefers-reduced-motion: reduce) { .spec-acc-caret { transition: none; } }
.spec-field-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.spec-field-label { font-size: 12px; color: var(--text-secondary); }
.spec-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spec-field-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.spec-field {
  width: 100%;
  padding: 7px 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-field-sm, 6px);
  box-sizing: border-box;
}
.spec-field:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 18%, transparent);
}
.spec-textarea { resize: vertical; min-height: 56px; line-height: 1.4; }
.spec-note {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 6px;
}
.spec-dietary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.spec-dietary-label { font-size: 13px; color: var(--text-primary); }
.spec-dietary-toggle { display: inline-flex; border: 1px solid var(--border-primary); border-radius: var(--radius-toggle, 6px); overflow: hidden; }
.dietary-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: none;
  border-left: 1px solid var(--border-primary);
  cursor: pointer;
}
.dietary-btn:first-child { border-left: none; }
.dietary-btn.active { background: var(--brand-espresso); color: var(--text-on-dark); }
.spec-emphasis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 5px;
  cursor: pointer;
}
.spec-details-locked { text-align: center; }
.spec-locked-copy { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.spec-locked-cta {
  display: inline-block;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-espresso);
  background: var(--accent-teal);
  border-radius: 6px;
  text-decoration: none;
}

/* PLAT-015 Releases page */
.rel-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.75rem; }
.rel-card { background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 10px; padding: 1rem 1.25rem; }
.rel-card-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.rel-headline { font-family: var(--font-display); font-size: 1rem; font-weight: 500; color: var(--text-primary); margin: 0; }
.rel-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.rel-bullets { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--text-primary); font-size: 0.875rem; }
.rel-bullets li { margin: 0.15rem 0; }
.rel-group { margin-top: 0.75rem; }
.rel-group:first-of-type { margin-top: 0.5rem; }
.rel-type { font-family: var(--font-primary); font-size: 0.625rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.25rem 0.5rem; border-radius: 6px; white-space: nowrap; }
.rel-type-feature { background: var(--status-pass-bg); color: var(--status-pass-text); }
.rel-type-fix { background: var(--status-warning-bg); color: var(--status-warning-text); }
.rel-type-improvement { background: var(--info-bg); color: var(--info-text); }
.rel-empty { color: var(--text-muted); font-style: italic; }
/* A deploy the summariser judged quiet. Shown, not hidden: the page used to
   filter these out, so a wrong verdict removed the deploy from the record
   entirely. Dimmed so it reads as background without competing with a real
   release note. */
.rel-card--quiet { background: transparent; border-style: dashed; }
.rel-card--quiet .rel-headline { color: var(--text-muted); font-weight: 400; font-style: italic; }
.rel-quiet-tag { font-family: var(--font-primary); font-size: 0.625rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.25rem 0.5rem; border-radius: 6px; white-space: nowrap; background: var(--bg-muted); color: var(--text-muted); }

/* === Catalogue-gap export unblock (WS1/WS5) === */

/* Inline gap flag on a recipe ingredient row (early surfacing). */
.ing-row-gap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--status-warning-text);
  background: var(--status-warning-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}
.ing-row-gap-icon { width: 14px; height: 14px; }

/* Export menu pre-state when the label is blocked by a missing value. */
/* Lune & Wild feedback 2026-10-07: an export item waiting on a value the
   customer must enter. Greyed and inert, with the fix as visible text. */
/* UX-013: the tertiary rung (core/ink-muted, 5.44:1), as in Figma frame 37;
   --text-secondary is too close to body text in the Canoli palette to read as
   blocked. */
.recipe-menu-item-blocked { align-items: flex-start; color: var(--text-label); cursor: default; }
.recipe-menu-item-blocked:hover { background: none; }
.recipe-menu-item-blocked svg { flex-shrink: 0; }

/* The friendly export-blocked panel. */
.export-gap-card { display: flex; flex-direction: column; gap: 1.25rem; }
.export-gap-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--bg-muted);
  border-radius: 8px;
}
.export-gap-intro-icon { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }
.export-gap-intro-text { margin: 0; color: var(--text-primary); font-size: 0.9rem; line-height: 1.5; }

.export-gap-item {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  background: var(--bg-surface);
}
.export-gap-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}
.export-gap-nutrient { font-weight: 600; color: var(--text-primary); }
.export-gap-sep { color: var(--text-secondary); font-size: 0.85rem; }
.export-gap-ingredient { font-weight: 500; color: var(--text-primary); }

.export-gap-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.export-gap-actions-secondary { margin-top: 0.6rem; }
.export-gap-secondary-note { margin: 0.6rem 0 0; color: var(--text-secondary); font-size: 0.8rem; }
.export-gap-alternatives:empty, .export-gap-review:empty { display: none; }
.export-gap-alternatives, .export-gap-review { margin-top: 0.75rem; }

.export-gap-draft {
  padding-top: 1rem;
  border-top: 1px solid var(--border-divider);
}
.export-gap-draft-title { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1rem; font-weight: 500; color: var(--text-primary); }
.export-gap-draft-note { margin: 0 0 0.75rem; color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; }

.export-gap-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-divider);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Disabled form controls (assistant create form locks after a successful submit). */
.btn-primary:disabled, .btn-secondary:disabled, .form-input:disabled, .form-textarea:disabled { opacity: 0.55; cursor: not-allowed; }

/* UX-004: ingredient category pills (Stage A) + quick-picks (Stage B).
   Fills the ingredient right panel at the catalogue root and once a category
   is selected. */
.category-pills-panel {
  padding: 24px;
}
.category-pills-title,
.category-quick-picks-title {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-size: 1.25rem;
  margin: 0 0 16px;
}
.category-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.category-pill:hover {
  background: var(--bg-muted);
  border-color: var(--text-secondary);
}
.category-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-chip, 10px);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}
.category-quick-picks {
  padding: 24px;
}
.category-quick-picks-header {
  margin-bottom: 16px;
}
.category-quick-picks-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 12px;
}
.category-quick-picks-back:hover {
  color: var(--text-primary);
}
.category-quick-picks-count {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 400;
}
.category-quick-picks-subtitle {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin: 4px 0 0;
}

/* Browse routes on the detail panel. Sits BELOW the action buttons: routes are
   secondary to the ingredient's own data. */
/* Now an .ingredient-section too, so the panel's 26px flex gap owns the space
   above it; the old margin-top stacked on top of that gap. */
.ingredient-routes {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ingredient-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.15s;
}
.ingredient-route:hover { background: var(--bg-muted); }
.ingredient-route.is-canonical { background: var(--bg-muted); }

.ingredient-route-path { min-width: 0; overflow-wrap: anywhere; }

.ingredient-route-tag {
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.ingredient-routes-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* UX-005: canonical route under the ingredient title, replacing the flat
   category badge. Small and quiet: it is orientation, not a headline. */
.ingredient-detail-path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 13px;
}
.ingredient-detail-path-link {
  color: var(--text-secondary);
  text-decoration: none;
}
.ingredient-detail-path-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.ingredient-detail-path-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   UX-007: Recipe ingredient inspector
   Right-hand slide-over (desktop/tablet-wide) that becomes a bottom sheet
   below 1024px. Geometry forked from .version-history-panel (app.css:10203);
   same z-index (950) so the two never fight, and the draft-conflict modal
   (z-index 1000) still layers above either. Namespace: .ingredient-inspector*
   for the panel shell/sections, .ing-chip* for the row-level state chips
   (spec 2.1) and .ing-row-chevron/.ing-row.is-inspected on the existing row.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Panel shell
   -------------------------------------------------------------------------- */
.ingredient-inspector {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-primary);
  box-shadow: -8px 0 24px color-mix(in srgb, var(--text-primary) 8%, transparent);
  z-index: 950;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 200ms ease-out;
}

.ingredient-inspector.is-open {
  transform: translateX(0);
}

/* Reduced motion drops the slide/sheet animation entirely: the panel still
   opens and closes via the same transform, but the change is instant rather
   than an animated move. */
@media (prefers-reduced-motion: reduce) {
  .ingredient-inspector {
    transition: none;
  }
}

.ingredient-inspector-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Header: name, allergen status line, close
   -------------------------------------------------------------------------- */
.ingredient-inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-divider);
}

/* Figma parity (2026-08-03): the name and the allergen status stack in a
   column so the name spans the header width instead of wrapping around
   the status text; the close button sits beside the column. */
.ingredient-inspector-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ingredient-inspector-name {
  margin: 0;
  font-family: var(--font-display, "Roboto Slab", serif);
  font-size: 18px;
  color: var(--text-primary);
  overflow-wrap: break-word;
}

/* The panel has room for the whole catalogue name, so it wraps here. */
.ingredient-inspector-identity .ing-name-catalogue {
  font-size: 12px;
  white-space: normal;
  overflow-wrap: break-word;
}

.ingredient-inspector-allergen-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.ingredient-inspector-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.ingredient-inspector-close:hover {
  color: var(--text-primary);
  background: var(--bg-muted);
}

.ingredient-inspector-close i,
.ingredient-inspector-close svg {
  width: 18px;
  height: 18px;
}

/* Drag-handle affordance for the mobile bottom sheet; hidden on desktop
   where the panel is edge-anchored and has nothing to grab. */
.ingredient-inspector-grab {
  display: none;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Selected row: highlight + chevron (lives on the existing .ing-row family)
   -------------------------------------------------------------------------- */
.ing-row {
  cursor: pointer;
}

.ing-row.is-inspected {
  background: var(--accent-teal-light);
}

.ing-row-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* A real <button> since the second-opinion review: the keyboard entry
     point to the inspector. Reset the button chrome to keep the quiet
     icon look. */
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  /* Not --decorative-muted: css_contrast_lint_test bans it as a color value
     outright (the icon inherits it as an SVG stroke). */
  color: var(--text-secondary);
}

.ing-row-chevron:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
  border-radius: 6px;
}

/* UX-007 Option A (2026-08-03): the sub-recipe name is plain text (click
   inspects, like every row); this compact arrow link beside it is the
   one-click navigation to the sub-recipe page. */
.ing-sub-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px;
  color: var(--text-secondary);
}

/* Same correction as the name hover above. --accent-teal-hover is the
   darker fill rung, still only 2.26:1 (Canoli) and 2.50:1 (Nibblr) as a
   foreground, and this is an icon, so the bar is 3:1. */
.ing-sub-open-link:hover {
  color: var(--accent-teal-text);
}

.ing-sub-open-link:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
  border-radius: 6px;
}

.ing-sub-open-link i,
.ing-sub-open-link svg {
  width: 14px;
  height: 14px;
}

.ing-row-chevron i,
.ing-row-chevron svg {
  width: 16px;
  height: 16px;
}

.ing-row:hover .ing-row-chevron,
.ing-row.is-inspected .ing-row-chevron {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Row state chips (spec 2.1). Same pill metrics as .ing-retention-chip;
   colour carries the meaning, the base rule carries the shape.
   -------------------------------------------------------------------------- */
.ing-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
  white-space: nowrap;
}

/* "Fried · NRF": green when retention is modelled, amber when it could not
   be (mirrors .ing-retention-chip/.ing-retention-caution's own split). */
.ing-chip-method {
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
}

.ing-chip-method[data-retention-state="caution"] {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

/* "QUID 42.5%": gold, matching .ing-quid-label's own checked/filled state
   (the only state this chip ever renders, since it only appears when QUID
   emphasis is on). Espresso-on-gold is the contrast-checked pair (7.79:1,
   see .ing-quid-toggle:checked + .ing-quid-label above). */
.ing-chip-quid {
  background: var(--accent-teal);
  color: var(--brand-espresso);
}

/* "Missing fibre": amber warning, with room for a glyph beside the text. */
.ing-chip-gap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.ing-chip-gap-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Panel sections: IN THIS RECIPE / ABOUT THIS INGREDIENT
   -------------------------------------------------------------------------- */
.inspector-section-label {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.ingredient-inspector-section {
  padding: 16px 24px;
}

.ingredient-inspector-divider {
  height: 1px;
  margin: 0;
  background: var(--border-divider);
}

/* Field row: fixed label column (Figma: 92px) + flexible value. */
.ingredient-inspector-field {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
}

.ingredient-inspector-field-label {
  flex: 0 0 92px;
  font-size: 12px;
  color: var(--text-secondary);
}

.ingredient-inspector-field-value {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
}

/* Micronutrients disclosure: CSS-only, same hidden-checkbox pattern as
   .ing-quid-toggle/.ing-delete-toggle so it survives hx-swap-oob without
   Alpine state (spec 4.2's "no Alpine state inside OOB-swapped nodes" holds
   for the whole panel, not just the row). */
.ingredient-inspector-micro {
  position: relative;
}

.ingredient-inspector-micro-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.ingredient-inspector-micro-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.ingredient-inspector-micro-toggle:focus-visible ~ .ingredient-inspector-micro-label {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
}

.ingredient-inspector-micro-caret {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 150ms ease-out;
}

.ingredient-inspector-micro-caret i,
.ingredient-inspector-micro-caret svg {
  width: 14px;
  height: 14px;
}

.ingredient-inspector-micro-toggle:checked ~ .ingredient-inspector-micro-label .ingredient-inspector-micro-caret {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .ingredient-inspector-micro-caret {
    transition: none;
  }
}

.ingredient-inspector-micro-content {
  display: none;
}

/* Inside the 420px panel the shared micronutrients fragment's two-column
   vitamins/minerals grid overlaps its own % NRV column (smoke-gate
   screenshot, 2026-08-03): stack the columns single-file in this context. */
.ingredient-inspector .micro-columns {
  display: block;
}

.ingredient-inspector .micro-columns .micro-section + .micro-section {
  margin-top: 14px;
}

.ingredient-inspector-micro-toggle:checked ~ .ingredient-inspector-micro-content {
  display: block;
}

/* --------------------------------------------------------------------------
   Ancestor-scope fix: .nut-table/.nut-footnote/.nut-card-footer and
   .ing-micronutrients-body all rely on an .ingredient-nut-card ancestor for
   their insets (app.css:4622-4637, 11093-11098). The inspector includes the
   same per-100g card markup without that ancestor, so it needs its own copy
   of the same paddings or the card renders flush/unpadded inside the panel.
   -------------------------------------------------------------------------- */
.ingredient-inspector .nut-table {
  padding: 4px 18px 12px;
}

.ingredient-inspector .nut-footnote {
  padding-left: 18px;
  padding-right: 18px;
}

.ingredient-inspector .nut-card-footer {
  padding-bottom: 12px;
}

.ingredient-inspector .ing-micronutrients-body {
  padding: 8px 20px 12px;
}

/* --------------------------------------------------------------------------
   Mobile/tablet: bottom sheet.
   Reuses the 1024px threshold that .login-card and the library layout
   already use for "collapse to the narrow layout" (app.css:1725, 13301),
   rather than splitting tablet/phone: a 420px fixed panel does not fit the
   ~436px tablet main pane either (app.css:4189-4191), so the sheet applies
   to both tiers, not just phone.
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .ingredient-inspector {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: auto;
    max-height: 85vh;
    overflow: hidden;
    border-left: none;
    border-top: 1px solid var(--border-primary);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--text-primary) 8%, transparent);
    transform: translateY(100%);
  }

  .ingredient-inspector.is-open {
    transform: translateY(0);
  }

  .ingredient-inspector-grab {
    display: block;
    width: 36px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: var(--border-primary);
  }

  /* Backdrop behind the sheet; pattern of .sidebar-scrim (app.css:1813). */
  .ingredient-inspector-scrim {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--text-primary) 35%, transparent);
    z-index: 949;
  }

  /* Scroll-lock applies ONLY at the sheet breakpoint. Desktop deliberately
     leaves the ingredient table scrollable/interactive behind the panel. */
  body.ingredient-inspector-open {
    overflow: hidden;
  }
}

/* Outside the sheet breakpoint the scrim never renders, whatever the open
   state thinks (mirrors .sidebar-scrim's own reset, app.css:1858). */
@media (min-width: 1025px) {
  .ingredient-inspector-scrim {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Footer: "Remove from recipe" two-step danger action (spec 2.2 item 4).
   Pinning choice: .ingredient-inspector is the flex column and
   .ingredient-inspector-body is its flex:1/overflow-y:auto scroll child
   (app.css:13378), a sibling of .ingredient-inspector-header, not a
   descendant of body. A margin-top:auto footer living *inside* body would
   only reach the bottom edge when the section content is short; once
   micronutrients/fields overflow, it would scroll away with the rest of the
   content instead of staying reachable. So the footer is placed as a
   flex-shrink:0 sibling AFTER .ingredient-inspector-body in that same
   column: body keeps its own independent scroll, the footer stays pinned
   outside it and is always visible without requiring a scroll to reach.
   -------------------------------------------------------------------------- */
.ingredient-inspector-footer {
  flex-shrink: 0;
  padding: 16px 24px;
  border-top: 1px solid var(--border-divider);
}

.ingredient-inspector-remove-wrap {
  position: relative;
}

/* Same visually-hidden checkbox idiom as .ing-delete-toggle (app.css:5688):
   toggled via the <label class="ingredient-inspector-remove">, sibling
   selectors below swap the trigger for the confirm row. No Alpine state, so
   it survives hx-swap-oob re-renders of the panel. */
.ingredient-inspector-remove-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

/* Quiet danger trigger, not a big red button: transparent until hovered,
   fail-toned text carries the meaning on its own. */
.ingredient-inspector-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 6px;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--status-fail-text);
  cursor: pointer;
  user-select: none;
}

.ingredient-inspector-remove:hover {
  background: var(--status-fail-bg);
}

.ingredient-inspector-remove-toggle:focus-visible ~ .ingredient-inspector-remove {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
}

.ingredient-inspector-remove i,
.ingredient-inspector-remove svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ingredient-inspector-remove-toggle:checked ~ .ingredient-inspector-remove {
  display: none;
}

.ingredient-inspector-remove-confirm {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.ingredient-inspector-remove-toggle:checked ~ .ingredient-inspector-remove-confirm {
  display: flex;
}

.ingredient-inspector-remove-warning {
  font-size: 12px;
  color: var(--text-secondary);
}

.ingredient-inspector-remove-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Confirm: solid fail bg. White-on-#C23B22 is ~5.3:1, above the 4.5:1 text
   threshold (checked against --status-fail's value at app.css:94). */
.ingredient-inspector-remove-confirm-yes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--status-fail);
  border-radius: 8px;
  background: var(--status-fail);
  color: var(--text-on-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ingredient-inspector-remove-confirm-yes:hover {
  background: var(--status-fail-text);
  border-color: var(--status-fail-text);
}

/* Cancel: neutral ghost, same tokens as .btn-confirm-no (app.css:5699). */
.ingredient-inspector-remove-confirm-no {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ingredient-inspector-remove-confirm-no:hover {
  /* Was var(--bg-hover), a token defined in no stylesheet, so the
     declaration was invalid and the hover did nothing. Fixed at source in
     .btn-confirm-no too; the palette parity test now catches this class of
     defect rather than leaving it to be worked around locally. */
  background: var(--bg-muted);
}

.ingredient-inspector-remove-confirm-yes:focus-visible,
.ingredient-inspector-remove-confirm-no:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
}

/* Mobile sheet: footer stays inside the sheet's own max-height/overflow
   (app.css:13674's .ingredient-inspector already clips to 85vh) and gets
   extra bottom padding so it clears a device's home-indicator safe area
   instead of sitting flush against it. */
@media (max-width: 1024px) {
  .ingredient-inspector-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------------------------
   Sub-recipe reduced panel: "Open this sub-recipe" link row. Sits directly
   in .ingredient-inspector-body, above any .ingredient-inspector-section, so
   it carries its own 24px inset rather than relying on a section wrapper.
   -------------------------------------------------------------------------- */
.ingredient-inspector-sub-link-row {
  margin: 0;
  padding: 16px 24px 0;
}

.ingredient-inspector-sub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--link-on-surface);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.ingredient-inspector-sub-link:hover {
  color: var(--link-on-surface-hover);
  text-decoration: underline;
}

.ingredient-inspector-sub-link i,
.ingredient-inspector-sub-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   QUID row: reuses .ing-quid-toggle/.ing-quid-label as-is (both branches).
   Their own row-tuned margins live on .ing-row-quid, which this wrapper does
   not use, so nothing leaks in; this only needs a positioning context for
   the absolutely-positioned toggle and the section's own vertical rhythm.
   -------------------------------------------------------------------------- */
.ingredient-inspector-quid-row {
  position: relative;
  padding: 6px 0;
}

/* Figma node 7:11 parity (2026-08-03): inside the panel QUID is a field-grid
   row with a plain VISIBLE checkbox + text, not the row's pill toggle. The
   shared .ing-quid-* classes stay (tests pin them); these overrides un-hide
   the box and strip the pill chrome in this ancestor only. */
.ingredient-inspector .ing-quid-toggle {
  position: static;
  width: 16px;
  height: 16px;
  opacity: 1;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent-teal);
}

.ingredient-inspector .ing-quid-label,
.ingredient-inspector .ing-quid-label:hover,
.ingredient-inspector .ing-quid-toggle:checked + .ing-quid-label {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-primary);
}

.ingredient-inspector .ingredient-inspector-quid-row .ingredient-inspector-field-value {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Cooking-method retention note.
   -------------------------------------------------------------------------- */
.ingredient-inspector-retention-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--status-pass-text);
}

/* retention_state can also be "caution" (raw values shown, not modelled):
   the row's own chip switches to amber for the same state
   (.ing-chip-method[data-retention-state="caution"] above), so this note
   must not stay green when it is telling the user the opposite. */
.ingredient-inspector-retention-note[data-retention-state="caution"] {
  color: var(--status-warning-text);
}

/* --------------------------------------------------------------------------
   Export-gap note ("Missing fibre - needed for a label"): an inset tinted
   banner, deliberately not a side-stripe accent (that treatment is reserved
   for .ing-row-sub's compound-ingredient marker elsewhere). Icon is sized by
   the existing .ing-chip-gap-icon class already on the <i> in the template.
   -------------------------------------------------------------------------- */
.ingredient-inspector-gap-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 24px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  font-size: 12px;
  font-weight: 500;
}
/* The declaration-mode 422 error slot in the sub-recipe inspector reuses
   this class and renders empty until the server refuses a change. Without
   this rule the empty span paints as a bare pale pill under the select. */
.ingredient-inspector-gap-note:empty {
  display: none;
}

/* ==========================================================================
   Ingredient tray (spec tmp/import/ingredient-tray-spec.md, phase 1a; Figma
   IT1 2369:8634, IT6 2377:9064). The ONE tray in layouts/app.html wears the
   inspector's shell (.ingredient-inspector: 420px right / bottom sheet under
   1024px, its scrim, header, body, gap note, fields and micronutrients
   disclosure); these rules are only where IT1 and IT6 measure differently.
   ========================================================================== */
.ingredient-tray {
  box-shadow: -8px 0 24px color-mix(in srgb, var(--text-primary) 10%, transparent);
  /* closed: off-screen AND hidden, so its shadow never paints a strip down the right edge; the hide waits for the slide-out */
  visibility: hidden;
  transition: transform 200ms ease-out, visibility 0s linear 200ms;
}

.ingredient-tray.is-open {
  visibility: visible;
  transition: transform 200ms ease-out, visibility 0s linear 0s;
}

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

.ingredient-tray .ingredient-inspector-identity {
  gap: 6px;
}

.ingredient-tray .ingredient-inspector-name {
  font-weight: 600;
  line-height: normal;
}

/* Name pill and "Your ingredient · On label as X" on one row (IT1 "kind"). */
.ingredient-tray-kind {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ABOUT THIS INGREDIENT: one column of blocks, 12px apart (IT1 section). */
.ingredient-tray-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px 24px;
}

.ingredient-tray .inspector-section-label {
  margin: 0;
  font-weight: 500;
}

.ingredient-tray-block .ingredient-section-head {
  padding-bottom: 4px;
}

.ingredient-tray .ingredient-inspector-field {
  align-items: flex-start;
  padding: 5px 0;
}

.ingredient-tray .ingredient-inspector-field-value {
  overflow-wrap: break-word;
}

.ingredient-tray-empty {
  color: var(--text-label);
}

.ingredient-tray-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Per 100g reads as a block of the section, not a card in it (IT1
   "block · Per 100g"): no frame, the title a sub-head, rows ruled. */
.ingredient-tray .ingredient-nut-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.ingredient-tray .ingredient-nut-card:hover {
  box-shadow: none;
}

.ingredient-tray .ingredient-nut-card-header {
  padding: 0 0 6px;
  border-bottom: 0;
}

.ingredient-tray .nut-subsection-head {
  padding: 0;
  font-weight: 500;
}

.ingredient-tray .nut-table {
  padding: 0;
}

.ingredient-tray .nut-row {
  padding: 5px 0;
  border-bottom: 1px solid var(--border-divider);
}

.ingredient-tray .nut-row-sub {
  padding: 4px 0 4px 16px;
}

.ingredient-tray .nut-card-footer {
  padding: 4px 0 0;
  border-top: 0;
}

.ingredient-tray .nut-card-footer .nut-row {
  border-bottom: 0;
}

.ingredient-tray .nut-footnote {
  padding-left: 0;
  padding-right: 0;
}

/* A value the ingredient does not have: the row tinted, "Missing" with the
   warning icon (IT1 "nutrient · Fibre"). */
.ingredient-tray .nut-row--missing {
  padding: 5px 8px;
  border-bottom: 0;
  border-radius: var(--radius-chip-sm, 6px);
  background: var(--status-warning-bg);
}

.ingredient-tray .nut-row-sub.nut-row--missing {
  padding-left: 24px;
}

.ingredient-tray .nut-missing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--status-warning-text);
}

.ingredient-tray .nut-missing i,
.ingredient-tray .nut-missing svg {
  width: 12px;
  height: 12px;
}

.ingredient-tray .ingredient-inspector-micro-label {
  padding: 10px 0 4px;
}

/* The block of facts under the allergens: a ruled top, field rows. */
.ingredient-tray-more {
  padding-top: 4px;
  border-top: 1px solid var(--border-divider);
}

/* The line a tray opener belongs to, while the tray shows it (Figma IT1
   2369:8985, measured): the row on surface-muted with a 3px butter bar on
   its left edge. The cells carry the fill (a row's own background loses to a
   cell's), the first cell the bar, inset so the columns do not move. */
.import-line-row.is-inspected > td {
  background: var(--bg-muted);
}

.import-line-row.is-inspected > td:first-child {
  box-shadow: inset 3px 0 0 var(--brand-gold);
}

/* A tray opener that reads as the name it opens (a line's matched
   ingredient): no button chrome, the name's own type, underlined. */
.import-tray-name {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* IT6: under 1024px the tray is the inspector's bottom sheet, measured: 104px
   of page left above it, 20px corners, a 44px close target, 16px gutters and
   a deeper scrim. */
@media (max-width: 1024px) {
  .ingredient-tray {
    max-height: calc(100vh - 104px);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--text-primary) 16%, transparent);
  }

  .ingredient-tray .ingredient-inspector-grab {
    margin-bottom: 4px;
  }

  .ingredient-tray .ingredient-inspector-header {
    gap: 8px;
    padding: 4px 8px 12px 16px;
  }

  .ingredient-tray .ingredient-inspector-identity {
    padding-top: 8px;
  }

  .ingredient-tray .ingredient-inspector-close {
    width: 44px;
    height: 44px;
  }

  /* Every control in the sheet is a 44px target (the smoke measured the
     micronutrients toggle at 38px). */
  .ingredient-tray .ingredient-inspector-micro-label {
    min-height: 44px;
    padding-top: 0;
    padding-bottom: 0;
  }

  .ingredient-tray .ingredient-inspector-close i,
  .ingredient-tray .ingredient-inspector-close svg {
    width: 20px;
    height: 20px;
  }

  .ingredient-tray .ingredient-inspector-gap-note {
    margin: 12px 16px 0;
  }

  .ingredient-tray-section {
    padding: 12px 16px 24px;
  }

  .ingredient-tray-scrim {
    background: color-mix(in srgb, var(--text-primary) 45%, transparent);
  }

  body.ingredient-tray-open {
    overflow: hidden;
  }
}

/* --------------------------------------------------------------------------
   Declaration-name field hint.
   Deliberately NOT --decorative-muted: that token is documented "non-text
   only, never legal as a foreground colour" (app.css:85) precisely because
   it fails AA as text. A hint is still text a user has to read, so it takes
   the same muted-but-AA-safe tone as every other secondary label in the
   panel rather than the placeholder-only token.
   -------------------------------------------------------------------------- */
.ingredient-inspector-field-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Source row: badge + certified badge side by side.
   Padding matches the other .ingredient-section children directly under a
   section head (e.g. .ingredient-section .allergen-body, app.css:4431).
   -------------------------------------------------------------------------- */
.ingredient-inspector-source-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 0;
}

/* --------------------------------------------------------------------------
   "Find a swap": .btn-secondary already fits the panel (content-hugging
   width, no overflow risk on "Find a swap"); this only adds the top margin
   it needs since it is a bare sibling of the field rows above it rather than
   sitting inside one.
   -------------------------------------------------------------------------- */
.ingredient-inspector-swap-btn {
  /* Figma node 7:11 parity (2026-08-03): a quiet accent link, not a boxed
     .btn-secondary (that class no longer appears on this button). Still a
     real button for keyboard access. */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-orange);
  cursor: pointer;
}

.ingredient-inspector-swap-btn:hover {
  color: var(--accent-orange-text);
  text-decoration: underline;
}

.ingredient-inspector-swap-btn:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 1px;
  border-radius: 6px;
}

.ingredient-inspector-swap-btn i,
.ingredient-inspector-swap-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   UX-008: Recipe Search
   Page-level typeahead above the recipe grids (recipes/index.html). Same
   tokens and structure as .quick-add-bar / .quick-add-dropdown / .quick-add-row
   (~line 5944) so the bar reads as one design language with the ingredient
   picker, just full width and one size up since it lives directly under the
   page header rather than inside a card. Avatar circle was modelled on
   the phone header's old initial avatar (removed with the burger nav,
   2026-09-30). Badges reuse .version-badge /
   .version-badge-draft; empty and footer states reuse .quick-add-empty /
   .quick-search-more; ownership text reuses .sr-only (~line 8948). No new
   classes for any of those, per spec 4.3.
   -------------------------------------------------------------------------- */
.recipe-search-bar {
  position: relative;
  width: 100%;
  margin-top: 16px;
  margin-bottom: 24px;
}

.recipe-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.recipe-search-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.recipe-search-input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-field, 8px);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
}

.recipe-search-input:focus {
  outline: none;
  border-color: var(--accent-teal);
}

.recipe-search-input::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

/* Absolutely positioned so it overlays the page rather than pushing the grids
   down; capped at ~60vh (spec 2.6) so it never covers the whole viewport on a
   phone, and scrolls internally past the 10-row limit rather than growing. */
.recipe-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 50;
}

.recipe-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}

/* UX-008 fix: NOT --bg-muted. .version-badge (shared with the recipe cards,
   not restyled here) is solid --bg-muted, so a hovered/keyboard-highlighted
   row in that same colour swallows the vN pill entirely. --accent-teal-light
   is the gold wash already used for a highlighted row surface elsewhere
   (.ingredient-result-row.is-active, .ing-row-sub / .quick-add-row-sub), and
   it reads as a distinct fill from the badge's beige --bg-muted so the pill
   stays legible. Drafts are unaffected either way: .version-badge-draft's
   amber already overrides this. */
.recipe-search-row:hover,
.recipe-search-row-active {
  background: var(--accent-teal-light);
}

.recipe-search-avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-dark);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Six deterministic colours, keyed off (mod user-id 6) in the handler, so a
   given teammate is always the same colour. Reuses the existing source-badge
   hues (~line 116) rather than inventing a new six-colour palette; those are
   already the one place in this file with six distinct, accessible hues. */
.recipe-search-avatar-c0 { background: var(--source-canadian); }
.recipe-search-avatar-c1 { background: var(--source-norwegian); }
.recipe-search-avatar-c2 { background: var(--source-swedish); }
.recipe-search-avatar-c3 { background: var(--source-frida); }
.recipe-search-avatar-c4 { background: var(--source-composite); }
.recipe-search-avatar-c5 { background: var(--source-user); }

/* Own recipes: the brand-filled variant (spec 2.2), --brand-cocoa.
   Declared after -c0..-c5 so it wins the tie on equal
   specificity regardless of class order in the rendered markup. */
.recipe-search-avatar-mine { background: var(--brand-cocoa); }

.recipe-search-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recipe-search-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-search-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.recipe-search-author {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Data checks on a customer's OWN ingredient (fragments/ingredients/
   data-warnings.html). Distinct from .warnings-section, which is the
   nutritionist review queue's and carries a dismiss control this does not.

   Deliberately quiet: an advisory, not an error state. It asks the owner to
   look at figures that disagree with each other, and the rule engine can be
   wrong about an unusual food, so it must not read as an accusation or as a
   blocked save.

   Tokens only, no hex literals: house rule, and the CSS hex guard enforces it.
   --------------------------------------------------------------------------- */
.data-warnings {
  /* Composes .callout.callout-warning for ground, border, icon and radius.
     The icon is a flex child on the left; this block owns only the body.
     FULL BORDER PLUS TINT, NOT A SIDE STRIPE: `css_side_stripe_lint_test`
     bans a border-left of 2px or more in an accent colour. */
  margin: 0 0 var(--space-4, 1rem);
}
.data-warnings-body { min-width: 0; }
.data-warnings-title {
  margin: 0 0 var(--space-1, 0.25rem);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--text-primary);
}
.data-warnings-lede {
  margin: 0 0 var(--space-2, 0.5rem);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-secondary);
}
.data-warnings-list { margin: 0; padding-left: var(--space-4, 1rem); }
.data-warnings-list li {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-primary);
  margin-bottom: var(--space-1, 0.25rem);
}


/* ---------------------------------------------------------------------------
   BRAND-001: sidebar variants.

   Nav marker. Nibblr rows carry a Lucide icon; the Canoli frames use a
   small dot. Driven by a class on .sidebar rather than a conditional on
   every nav row, so the admin section's markup is untouched. The icon is
   hidden rather than removed: it is decorative, the <span> label carries
   the meaning and the anchor carries aria-label, so nothing is lost to a
   screen reader.
   --------------------------------------------------------------------------- */

/* `svg` is the load-bearing half of this selector. The markup ships
   <i data-lucide="..."> and lucide.createIcons() REPLACES that element
   with an <svg> on load, so an `i`-only rule matches nothing by the time
   a human sees the page: the rail rendered dots AND icons together. */
.sidebar--marker-dot .nav-item > i,
.sidebar--marker-dot .nav-item > svg,
.sidebar--marker-dot .nav-item > .nav-icon {
  display: none;
}

.sidebar--marker-dot .nav-item::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nav-dot);
}

.sidebar--marker-dot .nav-item.active::before {
  background: var(--nav-dot-active);
}

/* ---------------------------------------------------------------------------
   `.muted` had no rule at all, in either brand, while 15 elements across the
   templates asked for it: the invoices empty state, the change-plan and
   request-invoice modals, and several admin result strips. Each rendered at
   the browser default instead of the muted role, which is why the "No
   invoices yet" line sat black and flush against the card edge.

   `.text-muted` existed and did exactly this, so the two now agree rather
   than one of them being a silent no-op.
   --------------------------------------------------------------------------- */
.muted {
  color: var(--text-muted);
}

/* The card's own empty state: same gutter as .settings-card-body so the
   message lines up with the heading above it rather than butting into the
   card's edge and its corner radius. */
.invoices-empty {
  margin: 0;
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-muted);
}

/* SUPPLY-005: supplier book, reusing the members table. Tokens only. */
.settings-supplier-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 24px;
  border-top: 1px solid var(--border-divider);
}
.settings-supplier-edit-form { display: grid; gap: 4px; }
.settings-suppliers-table tr.is-archived { color: var(--text-muted); }
.settings-suppliers-table .settings-members-td-role { width: 260px; }
.settings-supplier-contact-fields { display: grid; gap: 4px; }
@media (max-width: 900px) { .settings-supplier-form { grid-template-columns: 1fr 1fr; } }

/* ============================================================================
   PROD-013 P1a: the Versions drawer timeline, header chip and tasting sheet host
   (Task 10). Tokens only.
   ========================================================================== */
.version-status-line {
  margin: 0;
  font-size: 13px;
  color: var(--text-label);
}

.version-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The timeline line: a positioned background strip, not a side-stripe border. */
.version-timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-primary);
}

.version-timeline-item { position: relative; }

.version-entry-timeline { position: relative; }

/* left puts the 14px node's centre on the centre of the 2px line (measured 3px off at -30). */
.version-node {
  position: absolute;
  left: -27px;
  top: 20px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--text-primary);
  background: var(--bg-surface);
}

.version-timeline-newest .version-node { background: var(--text-primary); }

.version-tasting-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.tasting-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-pass);
}

.version-liking {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-basis: 100%;
}

.version-liking-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.version-liking-text {
  font-size: 13px;
  color: var(--text-label);
}

.version-actions { flex-wrap: wrap; align-items: center; }

.version-more { margin-left: auto; }

.version-more-menu {
  flex-basis: 100%;
  margin-top: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}

.version-reset-warning {
  margin: 4px 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.tasting-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  cursor: pointer;
}

.versions-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--text-primary);
  background: var(--accent-teal);
  border-radius: 999px;
}

.versions-count-empty { display: none; }

/* The tasting sheet host: a native modal <dialog>. Task 11 styles its contents. */
.sheet {
  /* The global reset zeroes margins, which removes the UA's centring of a modal <dialog>. */
  margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 24px;
  overflow-y: auto;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.4); }

/* ============================================================================
   PROD-013 P1a: Start a tasting sheet, Link and QR (Task 11). Tokens only.
   ========================================================================== */
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-title { margin: 0; font-size: 20px; color: var(--text-primary); }

.sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.sheet-close:focus-visible,
.sheet-create:focus-visible,
.sheet-copy:focus-visible,
.sheet-input:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

.sheet-version { margin: 4px 0 16px; color: var(--text-label); }

.sheet-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  color: var(--status-fail-text);
}

.sheet-note,
.sheet-warning,
.sheet-hint {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text-deep);
}

.sheet-warning {
  padding: 8px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--accent-teal);
  border-radius: 8px;
}

.sheet-form { display: flex; flex-direction: column; gap: 16px; }

.sheet-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

.sheet-legend,
.sheet-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.sheet-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: stretch;
}

/* PROD-013 P3b-2: the setup cards, one per row, only as tall as their text (Figma I1 to I3) */
.sheet-cards-stack { grid-template-columns: 1fr; }
.sheet-cards-stack .sheet-card-face { min-height: 0; }

.sheet-card { display: flex; cursor: pointer; }

.sheet-card-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sheet-card-face {
  display: flex;
  flex: 1;
  gap: 10px;
  align-items: flex-start;
  min-height: 84px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
}

.sheet-card-radio {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  background: var(--bg-surface);
  border: 2px solid var(--text-label);
  border-radius: 50%;
}

.sheet-card-text { display: flex; flex-direction: column; gap: 2px; }
.sheet-card-title { font-weight: 600; color: var(--text-primary); }
.sheet-card-hint { font-size: 13px; color: var(--text-label); }

.sheet-card-input:checked + .sheet-card-face {
  border-color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--text-primary);
}

.sheet-card-input:checked + .sheet-card-face .sheet-card-radio {
  border-color: var(--text-primary);
  background: radial-gradient(circle, var(--text-primary) 45%, var(--bg-surface) 50%);
}

.sheet-card-input:focus-visible + .sheet-card-face { outline: 2px solid var(--text-primary); outline-offset: 2px; }

.sheet-input {
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--text-label);
  border-radius: 8px;
}

.sheet-questions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* PROD-013 P3b-2: a picked setup's questions, read-only (Figma I1, I2: a shaded box). --bg-panel,
   not .sheet-warning's --bg-muted, so it never reads as a warning. */
.sheet-questions-fixed {
  padding: 12px 14px;
  color: var(--text-deep);
  background: var(--bg-panel);
  border-radius: 10px;
}

.sheet-check { display: flex; align-items: center; gap: 8px; color: var(--text-primary); }

/* PROD-024: a Choice question's answers under its label on the Start a tasting sheet, read-only. */
.sheet-answers { display: block; font-size: 13px; line-height: 1.4; color: var(--text-label); overflow-wrap: anywhere; }
.sheet-check + .sheet-answers { padding-left: 24px; }
.sheet-use-new { align-self: flex-start; margin: 4px 0 8px; }

.sheet-create,
.sheet-copy {
  min-height: 44px;
  padding: 8px 20px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--accent-teal);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.sheet-create { align-self: flex-start; }

.tasting-ready { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.tasting-ready-text { margin: 0; color: var(--text-deep); }
.tasting-ready-row { display: flex; gap: 8px; }
.tasting-ready-qr { width: 200px; max-width: 100%; }
.tasting-ready-qr svg { display: block; width: 100%; height: auto; }
.tasting-ready-downloads,
.tasting-ready-code { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
.tasting-ready-code-text { margin: 0; font-size: 20px; font-weight: 700; color: var(--text-primary); }

.tasting-action-message { padding: 8px 0; color: var(--text-deep); }

/* --------------------------------------------------------------------------
   PROD-013 P3: the Tastings page (spec 3.9, Figma board 27 C1 and C1b).
   Tasted versions down the left as a vertical tablist, joined to the results
   panel on the right. Token-only; chart colours are --chart-* tokens (Task 10).
   -------------------------------------------------------------------------- */
.tastings-page .page-title { font-size: 44px; font-weight: 700; }
.tastings-page .page-subtitle { font-size: 16px; color: var(--text-deep); }
.tback { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--text-deep); text-decoration: none; }
.tback i, .tback svg { width: 16px; height: 16px; }
.tback:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; border-radius: 2px; }

.tastings-layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); align-items: start; }
.tastings-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-right: -1px; }
@media (max-width: 1023px) {
  .tastings-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tastings-side { margin-right: 0; }
}

.tastings-list-head { padding: 6px 16px 0; }
.tastings-setup-pick { margin: 0 16px 16px; }
.tastings-list-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.tastings-list-sub { margin: 2px 0 6px; font-size: 13px; color: var(--text-label); }
.tastings-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.tastings-row { display: flex; gap: 16px; padding: 14px 16px; color: var(--text-primary); text-decoration: none; border: 1px solid transparent; border-right: 0; border-radius: 14px 0 0 14px; }
.tastings-row:hover { background: var(--bg-panel); }
/* The focus ring sits INSIDE the row with a 2px gap after the 1px border (offset -5px: the ring
   covers 3 to 5px in), so on the selected card it reads as a ring, not a heavier border. Not an
   outside ring: .tastings-list scrolls (overflow-y auto clips x too) and the selected row's right
   edge meets the panel, so an outside ring is cut off. An outline, unlike a box-shadow ring, keeps
   showing in forced-colors mode, so no fallback is needed. */
.tastings-row:focus-visible { outline: 2px solid var(--text-primary); outline-offset: -5px; }
.tastings-row-selected { background: var(--bg-surface); border-color: var(--border-primary); }
.tastings-row-selected:hover { background: var(--bg-surface); }
@media (max-width: 1023px) { .tastings-row { border-right: 1px solid transparent; border-radius: 14px; } .tastings-row-selected { border-color: var(--border-primary); } }
.tastings-row-id { flex: 0 0 48px; display: flex; flex-direction: column; gap: 6px; padding-top: 7px; }
.tastings-row-vid { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--text-deep); }
.tastings-row-selected .tastings-row-vid { color: var(--text-primary); }
.tastings-row-open { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--status-pass-text); }
.tastings-row-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tastings-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tastings-row-mean { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.tastings-row-bar { flex: 0 0 96px; }
.tastings-row-track { fill: var(--border-divider); }
.tastings-row-fill { fill: var(--text-deep); }
.tastings-row-selected .tastings-row-fill { fill: var(--text-primary); }
.tastings-row-none { font-size: 13px; color: var(--text-label); }
.tastings-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-deep); }
.tbadge-most-liked { padding: 2px 8px; border-radius: 999px; background: var(--text-primary); color: var(--text-on-dark); font-size: 12px; font-weight: 600; }
.tmarker { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.tmarker i, .tmarker svg { width: 14px; height: 14px; }
.tastings-untasted, .tastings-other-setup { margin: 12px 16px 0; font-size: 14px; color: var(--text-label); }
.tastings-notice { margin: 8px 0; font-size: 14px; color: var(--text-label); }

.tastings-panel { container-type: inline-size; display: flex; flex-direction: column; gap: 30px; min-width: 0; padding: 28px 32px 32px; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 20px; }
@media (max-width: 767px) { .tastings-panel { padding: 20px 16px; gap: 24px; } }
.tastings-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tastings-chip { padding: 6px 12px; border: 1.5px solid var(--text-label); border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-primary); text-decoration: none; }
.tastings-chip-selected { background: var(--text-primary); border-color: var(--text-primary); color: var(--text-on-dark); }
.tastings-chip:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.tastings-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.tastings-panel-line { flex: 1 1 auto; display: flex; align-items: center; gap: 14px; margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.tastings-status-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--text-label); }
.tastings-status-dot-open { background: var(--status-pass); border-color: var(--status-pass); }
.tastings-panel-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.tastings-link { flex-basis: 100%; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--bg-panel); border-radius: 12px; }
.tlink { display: inline-flex; align-items: center; min-height: 24px; padding: 0; background: none; border: 0; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tlink-sm { font-size: 14px; }
.tlink:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; border-radius: 2px; }
.tastings-headline { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.25; color: var(--text-primary); }
@media (max-width: 767px) { .tastings-headline { font-size: 22px; } }
.tastings-headline-sub { margin: 6px 0 0; font-size: 16px; line-height: 1.4; color: var(--text-deep); }
.tastings-empty { margin: 8px 0 0; color: var(--text-deep); }
.tastings-answers-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.tastings-answer-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.tastings-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 14px; }
.tastings-table th { padding: 8px 12px; text-align: left; font-weight: 600; color: var(--text-label); background: var(--bg-muted); }
.tastings-table td { padding: 8px 12px; vertical-align: top; color: var(--text-primary); border-top: 1px solid var(--border-primary); }
.tastings-hidden-row td { color: var(--text-label); }
.tastings-hidden-tag { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-label); border: 1px solid var(--text-label); border-radius: 4px; }
.tastings-none { color: var(--text-label); }

/* PROD-013 P3: results charts (spec 3.9). Inline SVG; one tab stop per chart. */
.tresults-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
@container (max-width: 660px) { .tresults-pair { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.tresults-block { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tresults-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.tresults-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text-primary); }
.tresults-note { margin: 0; font-size: 14px; color: var(--text-label); }
.tchart-svg { display: block; width: 100%; max-width: 328px; height: auto; overflow: visible; }
.tchart-word { font-family: var(--font-primary); font-size: 15px; fill: var(--text-deep); }
.tchart-bar { fill: var(--text-primary); }
.tchart-count { font-family: var(--font-mono); font-size: 14px; font-weight: 500; fill: var(--text-primary); }
.tchart-mark { outline: none; }
.tchart-focus { fill: transparent; stroke: none; pointer-events: all; }
.tchart-mark:focus-visible .tchart-focus { stroke: var(--text-primary); stroke-width: 2; }
/* The readout (the hovered or focused mark's label) is a small tag over what lies under the chart,
   so an empty one takes no space and showing one moves nothing. */
.tchart { position: relative; }
.tchart-readout { position: absolute; left: 0; top: 100%; z-index: 2; max-width: 100%; margin: 4px 0 0; padding: 2px 8px; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 6px; font-size: 13px; color: var(--text-deep); pointer-events: none; }
.tchart-readout:empty { display: none; }
.tchart-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tchart-table th, .tchart-table td { padding: 6px 10px; text-align: left; border-top: 1px solid var(--border-primary); color: var(--text-primary); }
.tchart-table thead th { font-weight: 600; color: var(--text-label); background: var(--bg-muted); }
.tjar-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-deep); }
.tjar-legend li { display: inline-flex; align-items: center; gap: 5px; }
.tjar-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.tjar { display: flex; flex-direction: column; gap: 14px; }
.tjar-row { display: grid; grid-template-columns: 130px minmax(0, 389px) 150px; gap: 14px; align-items: center; }
@container (max-width: 660px) { .tjar-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.tjar-label { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.tjar-svg { display: block; width: 100%; max-width: 389px; height: auto; }
.tjar-none { font-size: 14px; color: var(--text-label); }
.tjar-reading { font-size: 14px; color: var(--text-deep); }
.tjar-reading-strong { font-weight: 600; color: var(--status-fail-text); }
.tjar-count { font-family: var(--font-mono); font-size: 13px; font-weight: 500; fill: var(--text-primary); }
.tjar-count-on-dark { fill: var(--text-on-dark); }
.tjar-much-little { fill: var(--chart-jar-much-too-little); background: var(--chart-jar-much-too-little); }
.tjar-bit-little { fill: var(--chart-jar-bit-too-little); background: var(--chart-jar-bit-too-little); }
.tjar-right { fill: var(--chart-jar-just-right); background: var(--chart-jar-just-right); }
.tjar-bit-much { fill: var(--chart-jar-bit-too-much); background: var(--chart-jar-bit-too-much); }
.tjar-much-much { fill: var(--chart-jar-much-too-much); background: var(--chart-jar-much-too-much); }
/* Two geometries per count-bar chart and per jar bar: the wide one, and a narrow one while the
   panel is too narrow to draw the wide one at 1:1 (a phone), so the text stays 12 px or more and
   the rows 24 px or more; the other is display: none (no duplicate marks or tab stops). */
.tbar-narrow, .tjar-narrow { display: none; }
@container (max-width: 327px) { .tbar-wide { display: none; } .tbar-narrow { display: block; max-width: 280px; } }
@container (max-width: 424px) { .tjar-wide { display: none; } .tjar-narrow { display: block; max-width: 288px; } }

/* Comments (Figma C1 "What they wrote"). */
.tcomments-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; padding-bottom: 10px; }
.tcomments-count { font-size: 15px; color: var(--text-deep); }
.tcomments-list { margin: 0; padding: 0; list-style: none; }
.tcomment { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border-primary); }
.tcomment-body { flex: 1 1 280px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tcomment-text { margin: 0; font-size: 16px; line-height: 1.45; color: var(--text-primary); overflow-wrap: anywhere; }
.tcomment-meta { margin: 0; font-size: 13px; color: var(--text-label); }
.tcomment-actions { display: flex; gap: 16px; }
.tcomments-aside { margin-top: 12px; font-size: 14px; color: var(--text-deep); }
.tcomments-aside > summary { cursor: pointer; font-weight: 600; }
.tcomments-aside > summary:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* PROD-013 P3: "Liked against would buy" (Figma C1, C1b). The butter ring has an ink edge so it
   reaches 3:1 on white. No target corner until an org sets targets (P4). */
.tchart-card { margin-right: 24px; padding: 16px 16px 14px; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 16px; }
@media (max-width: 1023px) { .tchart-card { margin-right: 0; } }
.tchart-card-heading { margin: 0; font-size: inherit; }
.tchart-card-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 24px; padding: 0; background: none; border: 0; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text-primary); text-align: left; cursor: pointer; }
.tchart-card-head > i, .tchart-card-head > svg { width: 18px; height: 18px; }
.tchart-card-head:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; border-radius: 4px; }
.tchart-card-title { flex: 1; }
.tchart-card-body { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
/* The scatter body and "Link and QR" toggle with the hidden attribute (htmx settle wipes an
   x-show display:none after a workspace swap); their display:flex must not beat [hidden]. */
.tchart-card-body[hidden], .tastings-link[hidden] { display: none; }
.tchart-card-sub { margin: 0; font-size: 13px; color: var(--text-deep); }
.tscatter-svg { display: block; width: 100%; max-width: 292px; height: auto; margin-top: 10px; overflow: visible; }
.tscatter-axis { stroke: var(--border-primary); stroke-width: 1; }
.tscatter-grid { stroke: var(--border-divider); stroke-width: 1; }
.tscatter-tick { font-family: var(--font-mono); font-size: 12px; fill: var(--text-label); }
.tscatter-title { font-family: var(--font-primary); font-size: 12px; font-weight: 600; fill: var(--text-deep); }
.tscatter-path { fill: none; stroke: var(--chart-age-0); stroke-width: 1.5; }
.tscatter-ring { fill: var(--chart-ring); stroke: var(--text-primary); stroke-width: 1; }
.tscatter-dot { stroke: var(--bg-surface); stroke-width: 2; }
.tscatter-label { font-family: var(--font-mono); font-size: 12px; fill: var(--text-deep); }
.tscatter-label-strong { font-weight: 500; fill: var(--text-primary); }
.tscatter-key { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--text-deep); }
.tscatter-key-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.tscatter-footnote { margin: 0; font-size: 13px; color: var(--text-deep); }
.tscatter-switch { align-self: flex-start; }
.tchart-hit { fill: transparent; stroke: none; pointer-events: all; }
.tchart-age-0 { fill: var(--chart-age-0); background: var(--chart-age-0); }
.tchart-age-1 { fill: var(--chart-age-1); background: var(--chart-age-1); }
.tchart-age-2 { fill: var(--chart-age-2); background: var(--chart-age-2); }
.tchart-age-3 { fill: var(--chart-age-3); background: var(--chart-age-3); }
.tchart-age-4 { fill: var(--chart-age-4); background: var(--chart-age-4); }
.tchart-age-5 { fill: var(--chart-age-5); background: var(--chart-age-5); }
/* PROD-013 P3: Compare (Figma C2). */
.tcompare-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; }
.tcompare-pick > .page-title { margin: 0; }
.tcompare-pick > .tastings-notice { flex-basis: 100%; }
.tpill-select { position: relative; display: inline-flex; align-items: center; }
.tpill-select select { appearance: none; padding: 8px 36px 8px 16px; background: var(--bg-surface); border: 1.5px solid var(--text-label); border-radius: 999px; font-family: inherit; font-size: 20px; font-weight: 700; color: var(--text-primary); cursor: pointer; }
.tpill-select select:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.tpill-select i, .tpill-select svg { position: absolute; right: 12px; width: 16px; height: 16px; color: var(--text-primary); pointer-events: none; }
.tcompare-with { font-size: 20px; color: var(--text-deep); }
.tcompare-body { flex-basis: 100%; display: flex; flex-direction: column; gap: 16px; }
.tcompare-intro { margin: 12px 0 0; font-size: 16px; color: var(--text-deep); }
.tcompare-tasting { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-deep); }
.tcompare-card { container-type: inline-size; display: flex; flex-direction: column; gap: 36px; padding: 32px; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 20px; }
@media (max-width: 767px) { .tcompare-card { padding: 20px 16px; gap: 28px; } }
.tcompare-headline { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.25; color: var(--text-primary); }
.tcompare-changed { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; background: var(--bg-muted); border-radius: 14px; font-size: 16px; color: var(--text-deep); }
.tcompare-changed strong { color: var(--text-primary); }
.tcompare-section { display: flex; flex-direction: column; gap: 20px; }
.tcompare-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.tcompare-legend { display: flex; flex-wrap: wrap; gap: 20px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--text-deep); }
.tcompare-legend li { display: inline-flex; align-items: center; gap: 8px; }
.tcompare-key-a, .tcompare-key-b { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.tcompare-key-a { background: var(--bg-surface); border: 2.5px solid var(--text-label); }
.tcompare-key-b { background: var(--text-primary); }
.tdot-row { display: grid; grid-template-columns: 200px minmax(0, 640px) auto; gap: 8px 24px; align-items: center; }
@container (max-width: 820px) { .tdot-row { grid-template-columns: minmax(0, 1fr); } }
.tdot-cell { min-width: 0; }
.tdot-label { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.tdot-svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Two geometries per dot plot: the 640 one while the card is wide enough to draw it at about 1:1,
   else the 320 one (hit areas stay 24 px and the text 12 px); the other is display: none. */
.tdot-narrow { display: none; }
@container (max-width: 1019px) {
  .tdot-wide { display: none; }
  .tdot-narrow { display: block; max-width: 360px; }
  /* drawn at about 0.9 on a phone: a little larger in its own units keeps the text at 12 px */
  .tdot-narrow .tdot-tick { font-size: 13.5px; }
  .tdot-narrow .tdot-value-a, .tdot-narrow .tdot-value-b { font-size: 16.5px; }
}
.tdot-axis { stroke: var(--border-primary); stroke-width: 1; }
.tdot-tick { font-family: var(--font-mono); font-size: 12px; fill: var(--text-label); }
.tdot-link { stroke: var(--text-label); stroke-width: 3; }
.tdot-a { fill: var(--bg-surface); stroke: var(--text-label); stroke-width: 2.5; }
.tdot-b { fill: var(--text-primary); }
.tdot-value-a { font-size: 15px; font-weight: 600; fill: var(--text-deep); }
.tdot-value-b { font-size: 15px; font-weight: 700; fill: var(--text-primary); }
.tdot-change { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.tdot-counts { font-size: 16px; color: var(--text-primary); }
.tdot-switch { grid-column: 1 / -1; justify-self: start; }
.tpairs { display: flex; flex-direction: column; gap: 22px; }
.tpair-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 200px; gap: 20px; align-items: center; }
@container (max-width: 820px) { .tpair-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }
.tpair-bars { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tpair-bar { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: center; }
.tpair-v { font-size: 14px; font-weight: 700; color: var(--text-deep); }
.tpair-v-b { color: var(--text-primary); }
.tcompare-note { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-label); }

/* ===================================================================
   PLAT-017: in-app help links. {% help-link topic %} renders a small "?"
   beside a feature's label, linking to its Help Centre article. Sits inside
   uppercase mono section labels, settings headings and modal titles alike,
   so it resets the letter-spacing and casing it inherits.
   ========================================================================== */
.help-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  vertical-align: middle;
  color: var(--text-muted);
  background: var(--bg-surface);
  cursor: help;
}
.help-hint:hover,
.help-hint:focus-visible {
  color: var(--text-primary);
  border-color: var(--accent-teal);
}
.help-hint-row {
  display: flex;
  justify-content: flex-end;
}
.help-hint-row:empty {
  display: none;
}
/* EXPORT-006 1b: declared compositions */
/* A link inside a .callout: the rebrand-notice link treatment, so it never
   falls back to browser blue. Reusable by any callout. */
.callout-link {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.callout-link:hover { color: var(--text-deep); }
/* A callout placed straight in a page's content block, outside the page's
   own padded container: give it the same 32px side gutter. */
.callout-page { margin: 16px 32px 0; }
.composition-panel { display: flex; flex-direction: column; gap: 0.5rem; }
.composition-preview { margin: 0; line-height: 1.4; }
.composition-line-preview { margin-bottom: 1rem; }
.composition-answers { display: flex; flex-direction: column; gap: 0.5rem; }
.composition-answer-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; border: 0; padding: 0; margin: 0; }
.composition-paste { display: flex; flex-direction: column; gap: 0.5rem; }
.composition-paste form { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.composition-paste textarea { width: 100%; }
/* Adam's redesign (2026-10-06): one question, one main button. */
.composition-question, .composition-summary { display: flex; flex-direction: column; gap: 0.6rem; }
.composition-summary-title { display: flex; align-items: center; gap: 6px; }
.composition-summary-title [data-lucide], .composition-summary-title svg { width: 14px; height: 14px; color: var(--status-pass); }
.composition-ask { display: flex; flex-direction: column; gap: 4px; }
.composition-ask-title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 15px; font-weight: 700; color: var(--text-primary);
}
.composition-ask-title [data-lucide], .composition-ask-title svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--status-warning); }
.composition-lead { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.composition-choices { display: flex; flex-direction: column; gap: 6px; }
/* A choice card: its main radio row, then (when picked) that choice's own
   follow-up questions inside the same border. */
.composition-choice {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 8px);
  background: var(--bg-surface);
  font-size: 13px;
  line-height: 1.35;
}
.composition-choice-main { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.composition-choice-main input { margin-top: 2px; accent-color: var(--brand-espresso); }
/* Only the choices are boxes; the picked one gets a strong border on the
   plain surface, so nothing else on the panel looks like it. Keyed on the
   MAIN radio: a card's follow-up radios must not mark it as picked. */
.composition-choice:has(> .composition-choice-main input:checked) { border-color: var(--brand-espresso); box-shadow: inset 0 0 0 1px var(--brand-espresso); }
.composition-choice:has(> .composition-choice-main input:focus-visible) { outline: 2px solid var(--accent-teal); outline-offset: 1px; }
.composition-choice-hint { display: block; color: var(--text-secondary); font-size: 12px; }
/* Indented to the text after the radio (13px radio + 10px gap). */
.composition-choice-detail { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 0 0 23px; border-top: 1px solid var(--border-primary); }
.composition-choice-detail .composition-check input { accent-color: var(--brand-espresso); }
.composition-detail-label { font-size: 12px; color: var(--text-secondary); }
.composition-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
/* A result, not an option: plain text with a thin rule, no box. */
.composition-will-say { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 2px 12px; border-left: 1px solid var(--border-primary); }
.composition-actions { display: flex; align-items: center; gap: 12px; }
/* A text-style button (Change answer, Cancel). */
.composition-link-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text-primary);
  text-decoration: underline; text-underline-offset: 3px;
}
.composition-link-btn:hover { color: var(--text-deep); }
/* Compact pill selects in the flour check and paste tables, drawing the
   --select-caret chevron set in from the right like the filter bar's. */
.composition-parts-table select.input-field {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 8rem;
  padding: 6px 32px 6px 12px;
  font-size: 13px;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 7px;
}
.composition-answer-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* .status-toggle as a radio group: each option is a <label> around a
   visually hidden radio, so the choice stays a real form value (and a
   native select menu can never open off screen). */
/* position: relative anchors the hidden radio to its pill. Without it the
   radio's containing block is the page, not .main-area, so radios low on a
   long page stretch the window and a click scrolls the window to them (the
   flour check "jump to an empty bottom", 2026-10-13). */
label.status-toggle-option { white-space: nowrap; position: relative; }
.status-toggle-option input[type="radio"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.status-toggle-option:has(input:checked) {
  background: var(--brand-espresso);
  color: var(--text-on-dark);
  font-weight: 600;
}
.status-toggle-option:has(input:focus-visible) {
  outline: 2px solid var(--accent-teal);
  outline-offset: -2px;
}
/* The flour check's per-row panel cell: no gap until a panel swaps in. */
.flour-row-panel:empty { padding: 0; border: 0; }

/* ==========================================================================
   PLAT-026: exports locked on a billing gap (trial with no card, past_due)
   ========================================================================== */
/* The single recipe-menu row that stands in for the four export items (4.1). */
.recipe-menu-item--lock,
.recipe-menu-item--gap { align-items: flex-start; }
/* Lucide swaps the <i> for an <svg>, which .recipe-menu-item i does not
   reach; without this a long two-line row squashes the lock icon. */
.recipe-menu-item--lock svg,
.recipe-menu-item--gap svg { flex-shrink: 0; }
/* UX-013: the export-gap row. The icon carries the warning colour, never the
   text (amber text fails contrast). State E is a <button>, so left-align it. */
.recipe-menu-item--gap { text-align: left; }
.recipe-menu-item--gap svg { color: var(--status-warning); }
.recipe-menu-item__link { text-decoration: underline; }
.recipe-menu-item--static { cursor: default; }
.recipe-menu-item--static:hover { background: none; }
.recipe-menu-item__text { display: flex; flex-direction: column; gap: 2px; }
.recipe-menu-item__sub { font-size: 12px; color: var(--text-secondary); }

/* ==========================================================================
   GROW-005: What's New (spec 3.1, 3.2, 7.3). Desktop; the phone and tablet
   rules (bottom sheet, burger dot, rail icon) are Task 9.
   Colours only through tokens; both palettes must render. The card sits on
   the dark rail: css_contrast_lint_test
   whats-new-card-text-clears-aa-on-the-card-surface judges its text.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Card, at the foot of the rail above the org card
   -------------------------------------------------------------------------- */
.whats-new-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-org-card, 6px);
  background: var(--bg-whats-new-card);
  transition: border-color 0.15s ease;
}

.whats-new-card:hover,
.whats-new-card:focus-within {
  border-color: var(--brand-gold);
}

.whats-new-card__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-primary);
  text-align: left;
  cursor: pointer;
}

.whats-new-card__item:focus-visible,
.whats-new-card__link:focus-visible,
.whats-new-card__arrow:focus-visible,
.whats-new-card__dismiss:focus-visible {
  outline: 2px solid var(--text-on-dark-accent);
  outline-offset: 2px;
}

.whats-new-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  /* room for the x in the corner */
  padding-right: 24px;
}

/* The butter pill, shared with the drawer's tag pill. */
.whats-new-card__pill,
.whats-new-note__tag,
.whats-new-note__plan-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-chip, 4px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

.whats-new-card__pill,
.whats-new-note__tag {
  background: var(--brand-gold);
  color: var(--brand-espresso);
}

.whats-new-card__date {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-on-dark-subtle);
}

.whats-new-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-on-dark);
}

.whats-new-card__summary {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-on-dark-subtle);
}

.whats-new-card__link {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-on-dark-accent);
  cursor: pointer;
}

.whats-new-card__link:hover {
  text-decoration: underline;
}

.whats-new-card__pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.whats-new-card__dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.whats-new-card__dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--nav-dot);
  transition: width 0.15s ease;
}

/* The showing note: a short butter bar (Figma A2). */
.whats-new-card__dot--on {
  width: 16px;
  background: var(--brand-gold);
}

.whats-new-card__step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-on-dark-subtle);
}

.whats-new-card__arrow {
  padding: 0 4px;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  color: var(--text-on-dark-subtle);
  cursor: pointer;
}

.whats-new-card__arrow:hover {
  color: var(--text-on-dark);
}

.whats-new-card__dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-on-dark-subtle);
  cursor: pointer;
}

.whats-new-card__dismiss:hover {
  color: var(--text-on-dark);
}

.whats-new-card__dismiss i,
.whats-new-card__dismiss svg {
  width: 14px;
  height: 14px;
}

/* Spec 3.3: the collapsed tablet rail has no room for the card; Task 9 adds
   the gift icon that stands in for it there. Keyed on .rail-open only (not
   :hover or :focus-within): a pointer entering the rail matches :hover at
   once, and the icon must stay put under it so the click lands. */
@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar:not(.rail-open) .whats-new-card {
    display: none;
  }
}

/* The footer's "What's new" opens a panel, so it is a button dressed as the
   legal links beside it. */
.sidebar-legal-link--button {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Generic right-hand drawer. Z-order (spec 3.2): drawer 1300, scrim 1290,
   above the expanded tablet rail (1200) and its scrim (1190), the phone
   header (100) and the inspector (950), below the flash toasts (9999).
   These two declarations are the only z-index for these classes; Task 9's
   phone and tablet block adds none, and its test pins exactly one each.
   Deliberately not shared with .ingredient-inspector or
   .version-history-panel (7.3).
   -------------------------------------------------------------------------- */
.side-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 420px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-card, 12px);
  box-shadow: -8px 0 24px color-mix(in srgb, var(--text-primary) 8%, transparent);
  z-index: 1300;
  /* far enough that the shadow does not peek in while closed */
  transform: translateX(calc(100% + 64px));
  transition: transform 200ms ease-out;
}

.side-drawer.is-open {
  transform: translateX(0);
}

.side-drawer-scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--text-primary) 35%, transparent);
  z-index: 1290;
}

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

/* --------------------------------------------------------------------------
   Drawer contents
   -------------------------------------------------------------------------- */
.whats-new-drawer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.whats-new-drawer__header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 20px 16px 4px 20px;
}

.whats-new-drawer__title {
  flex: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.whats-new-drawer__close i,
.whats-new-drawer__close svg {
  width: 16px;
  height: 16px;
}

.whats-new-drawer__loading,
.whats-new-drawer__error {
  margin: 0;
  padding: 20px;
  font-size: 14px;
}

.whats-new-drawer__lead {
  margin: 0;
  padding: 0 20px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.whats-new-drawer__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px 20px;
}

.whats-new-drawer__earlier {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.whats-new-drawer__more {
  padding-top: 8px;
}

/* --------------------------------------------------------------------------
   One note, always shown in full: a filled panel. No folded rows (Adam,
   12 Oct 2026).
   -------------------------------------------------------------------------- */
.whats-new-note {
  border-radius: var(--radius-card-sm, 8px);
  background: var(--bg-muted);
}

.whats-new-note__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 12px;
}

.whats-new-note__dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-primary);
}

.whats-new-note__dot--unseen {
  background: var(--brand-gold);
}

.whats-new-drawer--all-seen .whats-new-note__dot--unseen {
  background: var(--border-primary);
}

/* "Mark all as seen": the screen-reader "Unseen." goes with the gold dot. */
.whats-new-drawer--all-seen .whats-new-note__dot--unseen + .sr-only {
  display: none;
}

.whats-new-note__date {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-secondary);
}

.whats-new-note__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Upgrade view (spec 6.3, Figma B2): the plan that includes the feature. */
.whats-new-note__plan-pill {
  background: var(--brand-espresso);
  color: var(--bg-surface);
}

.whats-new-note__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.whats-new-note__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}

.whats-new-note__cover-link {
  display: block;
}

.whats-new-note__cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-card-sm, 8px);
}

/* Clamped until "Read more"; whatsNewBody (app.js) decides whether the
   button is needed. */
.whats-new-note__body {
  max-height: 240px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

.whats-new-note__body--expanded {
  max-height: none;
}

.whats-new-note__body > :first-child {
  margin-top: 0;
}

.whats-new-note__body p,
.whats-new-note__body ul,
.whats-new-note__body ol {
  margin: 0 0 8px;
}

.whats-new-note__body ul,
.whats-new-note__body ol {
  padding-left: 20px;
}

.whats-new-note__body h1,
.whats-new-note__body h2,
.whats-new-note__body h3 {
  margin: 12px 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

.whats-new-note__body h1 { font-size: 16px; }
.whats-new-note__body h2 { font-size: 15px; }
.whats-new-note__body h3 { font-size: 14px; }

.whats-new-note__body a {
  color: var(--link-on-surface);
}

.whats-new-note__body a:hover {
  color: var(--link-on-surface-hover);
}

/* Quotes and code blocks take a tint, never a side stripe
   (css_side_stripe_lint_test). */
.whats-new-note__body blockquote,
.whats-new-note__body pre {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: var(--radius-card-sm, 8px);
  background: var(--bg-surface);
}

.whats-new-note__body pre {
  overflow-x: auto;
}

.whats-new-note__body code {
  font-family: var(--font-mono);
  font-size: 12px;
}

.whats-new-note__body table {
  width: 100%;
  margin: 0 0 8px;
  border-collapse: collapse;
  font-size: 12px;
}

.whats-new-note__body th,
.whats-new-note__body td {
  padding: 4px 6px;
  border: 1px solid var(--border-primary);
  text-align: left;
}

/* Spec 5.5: every image fills the drawer width, inside a link to the full
   size file. Styled by element as well as by the renderer's class, so the
   figure holds its shape whatever the Safelist keeps. */
.whats-new-note__body img,
.whats-new-figure img {
  display: block;
  max-width: 100%;
  height: auto;
}

.whats-new-note__body figure,
.whats-new-figure {
  margin: 0 0 8px;
}

.whats-new-note__body figcaption,
.whats-new-figure figcaption {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.whats-new-note__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* GROW-005 step 3 start: What's New on phone and tablet (spec 3.2, 3.3).
   Part 2 (Task 8) owns the card, drawer and note styles, and the drawer's
   z-order (1300 over a 1290 scrim). This block adds only what the narrow
   tiers need. */

/* Butter dots on the phone burger and the collapsed-rail icon. Non-text,
   so the floor is 3:1 (WCAG 1.4.11). The burger sits on the light
   header, where butter alone is too faint, so it takes an ink edge (as
   the .tchart-card butter ring does). The rail dot sits on the dark rail
   and takes a rail-coloured gap ring to part it from the gift icon. */
.burger-dot,
.whats-new-rail-icon__dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-gold);
  pointer-events: none;
}

.burger-dot {
  top: 4px;
  right: 4px;
  border: 1.5px solid var(--text-primary);
}

/* The burger is an X while its drawer is open; the dot would sit on an
   arm of the X. */
.mobile-burger[aria-expanded="true"] .burger-dot {
  display: none;
}

.whats-new-rail-icon__dot {
  top: 6px;
  right: 6px;
  box-shadow: 0 0 0 2px var(--bg-sidebar);
}

/* A <button> wearing .nav-item: shed the UA button chrome. Hidden
   everywhere except the collapsed tablet rail (below). .nav-item:hover
   still paints the hover fill (higher specificity). */
.whats-new-rail-icon {
  display: none;
  position: relative;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

@media (min-width: 768px) and (max-width: 1024px) {
  /* Collapsed rail: 64px leaves no room for the card, and the footer link
     is hidden with the legal links, so the gift icon stands in for both. */
  /* The card's hide rule is Task 8's, above (one rule, keyed on .rail-open).
     The icon and the card swap on .rail-open alone, so the icon does not
     vanish when a pointer or focus widens the rail. */
  .sidebar:not(.rail-open) .whats-new-rail-icon {
    display: flex;
  }

  /* The collapsed rail hides every span in a .nav-item (the labels) with
     the label-hiding selector earlier in this media block, which carries
     three negations (specificity 0,5,1). The dot is a span and must stay,
     so the first selector below out-ranks it (0,6,1) without keying on
     the pointer; the icon and dot still swap on .rail-open alone. x-show's
     inline display:none still wins while nothing is unseen. */
  .sidebar.sidebar:not(.rail-open) .nav-item.whats-new-rail-icon span.whats-new-rail-icon__dot,
  .sidebar:not(.rail-open) .whats-new-rail-icon .whats-new-rail-icon__dot {
    display: block;
  }
}

/* Up to 1024px the drawer is a bottom sheet, with the same threshold and
   geometry as .ingredient-inspector: a right-hand panel does not fit the
   tablet main pane or a phone. */
@media (max-width: 1024px) {
  .side-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: auto;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: none;
    border-top: 1px solid var(--border-primary);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--text-primary) 8%, transparent);
    padding-bottom: env(safe-area-inset-bottom);
    /* past the edge by the shadow reach, so no band shows while closed */
    transform: translateY(calc(100% + 32px));
  }

  .side-drawer.is-open {
    transform: translateY(0);
  }
}
/* GROW-005 step 3 end */

/* GROW-005 4.2: /admin/whats-new Preview drafts */
/* The "Preview drafts" card holds a form, not a table, so it keeps the
   card's own padding and only takes the table cards' spacing. */
.whats-new-preview-card {
  margin-top: 24px;
}

.whats-new-preview {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.whats-new-preview__intro {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.whats-new-preview__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.whats-new-preview__form .form-input {
  max-width: 480px;
}

.whats-new-preview__item {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-card-sm, 8px);
  background: var(--bg-surface);
}

.whats-new-preview__card {
  max-width: 260px;
}

.whats-new-preview__card .whats-new-card__item {
  cursor: default;
}

.whats-new-preview__meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.whats-new-preview__body {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-primary);
}

.whats-new-preview__json {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: var(--radius-field-sm, 6px);
  background: var(--bg-muted);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.whats-new-preview__flag {
  font-weight: 600;
  color: var(--text-primary);
}

.whats-new-preview__list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  .whats-new-preview__item {
    grid-template-columns: 1fr;
  }
}

/* PROD-013 P4a-1: the sheet's "Question set" label with its "Manage sets" link. */
.sheet-label-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }

/* ========================================================================
   PROD-013 P4a-1: Settings > Tasting feedback sets (spec 3.5, 3.14; Figma board 27 D1 and D2).
   The list and the editor reuse the Tastings page's joined tabs (.tastings-layout, .tastings-side,
   .tastings-list, .tastings-row, .tastings-row-selected, .tastings-panel), which already stack below
   1024 px; these rules add only what a set needs. Every name wraps anywhere, so an 80-character
   name with no spaces never pushes the page sideways at 320 px or 200% text (Review Focus 3).
   ======================================================================== */
.settings-content-wide { max-width: 1200px; }
.tset-workspace { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tset-toolbar { display: flex; justify-content: flex-end; }
.tset-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.tset-inline-form .input-field { flex: 1 1 200px; min-width: 0; }
.tset-field-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tset-group { margin: 12px 16px 4px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-label); }
.tset-side-link { margin: 8px 16px 0; }
.tset-row { align-items: center; }
.tset-row-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tset-row-name { font-size: 15px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.tset-row-line { font-size: 13px; color: var(--text-label); }
.tset-row-mark { flex: 0 0 16px; width: 16px; height: 16px; color: var(--text-label); }
.tset-pill { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; background: var(--bg-muted); color: var(--text-deep); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tset-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tset-title { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--text-primary); overflow-wrap: anywhere; }
.tset-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tset-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-deep); cursor: pointer; }
.tset-icon-btn:hover { background: var(--bg-muted); }
.tset-icon-btn i, .tset-icon-btn svg { width: 16px; height: 16px; }
/* The editor toggles these with the hidden attribute (htmx settle wipes an x-show display:none
   after a workspace swap); the display set by their classes must not beat [hidden]. */
.tset-inline-form[hidden], .tset-toolbar .btn-primary[hidden], .tset-head .tset-icon-btn[hidden], .tset-title[hidden] { display: none; }
.tset-icon-btn:focus-visible, .tset-handle:focus-visible, .tset-chip:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.tset-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--bg-muted); color: var(--text-deep); font-size: 14px; line-height: 1.5; }
.tset-note i, .tset-note svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; }
.tset-note-lock { background: var(--status-warning-bg); color: var(--status-warning-text); }
.tset-note-open { flex-direction: column; gap: 6px; }
.tset-note-open p { margin: 0; }
.tset-open-list { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.tset-eyebrow { margin: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-label); }
.tset-questions { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tset-q { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--bg-muted); color: var(--text-primary); }
.tset-q-held, .tset-q-editing { border-color: var(--text-primary); background: var(--bg-surface); }
.tset-q-main { flex: 1 1 160px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tset-q-label { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.tset-q-sub { font-size: 13px; color: var(--text-label); overflow-wrap: anywhere; }
.tset-handle, .tset-handle-spacer { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-label); }
.tset-handle { cursor: grab; touch-action: none; }
.tset-handle[aria-pressed="true"] { color: var(--text-primary); background: var(--bg-surface); }
.tset-handle i, .tset-handle svg, .tset-handle-spacer i, .tset-handle-spacer svg { width: 16px; height: 16px; }
.tset-form { flex: 1 1 100%; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tset-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.tset-kind { margin: 0; font-size: 15px; font-weight: 600; }
/* PROD-024 spec 12.2: one box per Choice answer, each with its remove button; + Add answer under the list. */
.tset-answer-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tset-answer-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tset-answer-row .input-field { flex: 1 1 auto; min-width: 0; }
.tset-answer-add { align-self: flex-start; }
.tset-answer-row .tset-icon-btn[hidden], .tset-answer-add[hidden] { display: none; }
/* A refused save's message under its field (PROD-024): the field's edge and the words, not colour alone. */
.tset-form .input-field.is-error { border-color: var(--status-fail); }
.tset-field-error { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--status-fail-text); }
.tset-scale { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tset-scale-word { padding: 6px 10px; border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-surface); color: var(--text-deep); font-size: 13px; }
.tset-radio { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; }
.tset-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tset-remove { margin-left: auto; }
.tset-add { display: flex; flex-direction: column; gap: 8px; }
.tset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tset-chip { min-height: 36px; padding: 6px 14px; border: 1px solid var(--text-label); border-radius: 999px; background: var(--bg-surface); color: var(--text-primary); font-size: 14px; font-weight: 500; cursor: pointer; }
.tset-chip:hover { background: var(--bg-muted); }
.tset-chip:disabled { border-color: var(--border-primary); color: var(--text-label); cursor: not-allowed; }
.tset-foot { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-label); }
@media (max-width: 767px) {
  .tset-title { font-size: 22px; }
  .tset-q { gap: 8px; padding: 10px; }
}

/* PROD-013 P4a-1: a reworded Overall liking's asked wording, under the "Overall liking" heading. */
.tresults-asked { margin: 0; font-size: 14px; line-height: 1.4; color: var(--text-label); overflow-wrap: anywhere; }

/* PROD-013 P4a-2: an extra Liking or Intensity question's wording heads its own results and Compare block. */
.tresults-wording { overflow-wrap: anywhere; }

/* ==========================================================================
   IMPORT-001 imports (Phase 1a: home, add and sort, the nav item)
   Reuses .dropzone*, .page-*, .card, .btn-* and .stage-pill; everything
   below is what those do not cover. Text is 12px or larger, targets 24px or
   larger, and every state has words or an icon beside its colour.
   ========================================================================== */

/* Nav: not in the phone drawer (spec 12, Q8). .desktop-only would set
   display: block and break the row's flex layout. */
.mobile-drawer .nav-item--no-phone { display: none; }
.sidebar .nav-item--no-phone { position: relative; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-gold);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

@media (min-width: 768px) and (max-width: 1024px) {
  /* The collapsed rail hides every span in a .nav-item (0,5,1); the badge
     out-ranks it the way the What's New dot does, and sits on the icon. */
  .sidebar.sidebar:not(.rail-open):not(:hover):not(:focus-within) .nav-item.nav-item--no-phone span.nav-badge {
    display: block;
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    line-height: 18px;
  }
}

/* Home (I1, I10) */
.imports-page { display: flex; flex-direction: column; gap: 20px; }
.import-dropzone { padding: 56px 24px; }
.import-drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.import-pick { cursor: pointer; }
.import-pick:focus-within { outline: 2px solid var(--brand-clay); outline-offset: 2px; }

.import-kinds { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.import-kinds li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-secondary); }
.import-kinds svg, .import-kinds i { width: 16px; height: 16px; }

.import-band {
  padding: 16px 20px;
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-card, 12px);
  background: var(--bg-muted);
  font-size: 14px;
  color: var(--text-primary);
}
.import-band p { margin: 4px 0 0; }
.import-band-title { margin: 0; font-size: 16px; font-weight: 600; }

.import-batches { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.import-batch-card { padding: 16px 20px; }
.import-batch-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}
.import-batch-name { overflow-wrap: anywhere; }
.import-batch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 0; font-size: 13px; color: var(--text-secondary); }

/* The drop strip: a slim .dropzone for "Add more files" and "Start a new import". */
.import-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; text-align: left; }
.import-strip .import-drop-actions { margin: 0 0 0 auto; }
.import-strip-icon { width: 24px; height: 24px; color: var(--text-secondary); }
.import-strip-title { margin: 0; font-weight: 600; color: var(--text-primary); }
.import-strip-hint { flex-basis: 100%; margin: 0; }

/* Add and sort (I2) */
.import-workspace { display: flex; flex-direction: column; gap: 16px; }
.import-header-main { display: flex; flex: 1 1 320px; flex-direction: column; gap: 6px; min-width: 280px; }
.import-back { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; font-size: 12px; font-weight: 500; line-height: normal; color: var(--text-secondary); text-decoration: none; }
.import-back svg, .import-back i { width: 14px; height: 14px; }
.import-rename { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
/* F11: the name takes the header's width and always shows its box, so a long
   name is not clipped and the field reads as editable. */
.import-rename-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-surface);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}
.import-rename-input:hover, .import-rename-input:focus { border-color: var(--brand-clay); }
.import-rename-error { margin: 0; font-size: 13px; color: var(--status-fail-text); }

.import-refusal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-card, 12px);
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}
.import-refusal p { margin: 0; flex: 1 1 240px; }

.import-stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.import-step { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.import-step + .import-step::before { content: ""; width: 14px; height: 1px; margin: 0; background: var(--border-primary); }
.import-step-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border: 0; border-radius: var(--radius-chip, 999px); background: var(--bg-surface); color: var(--text-secondary); font-weight: 500; line-height: normal; }
.import-step-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: var(--radius-chip, 999px);
  font-family: var(--font-mono, inherit);
  font-size: 10px;
  font-weight: 500;
}
.import-step-marker svg, .import-step-marker i { width: 11px; height: 11px; }
.import-step--current .import-step-chip { background: var(--brand-espresso); color: var(--text-on-dark); font-weight: 600; }
.import-step--current .import-step-marker { background: var(--brand-gold); color: var(--text-primary); }
.import-step--done .import-step-chip { background: var(--bg-muted); color: var(--text-primary); }
.import-step--done .import-step-label { text-decoration: underline; }
.import-step--done .import-step-marker { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-step--later .import-step-chip { box-shadow: inset 0 0 0 1px var(--border-primary); }
.import-item-page .import-r9b-note { flex: 1 1 100%; font-size: 12px; color: var(--text-label); }
/* Slice 2: the picker's allergen filter row ("Show only") */
.import-allergen-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; max-width: 100%; margin-top: 4px; }
/* long allergen chips wrap their words inside the chip (Figma 2049:2722) instead of running off the card at 390 px */
.import-allergen-chips > .import-pill { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.import-candidate-body, .import-candidate-main, .import-candidate-chips { min-width: 0; max-width: 100%; }
.import-picker-hidden { margin: 4px 0 8px; }
.import-picker-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.import-picker-filter .import-label { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.import-picker-filter .import-filter-select { box-sizing: border-box; width: auto; min-width: 0; height: 34px; min-height: 34px; padding: 0 10px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-surface); font-size: 13px; color: var(--text-primary); }
.import-sheet-confirm { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-surface); }
.import-sheet-confirm-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.import-sheet-confirm-words { margin: 0 0 10px; font-size: 13px; color: var(--text-label); }
.import-sheet-confirm-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-sheet-confirm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.import-sheet-confirm-name { font-weight: 600; color: var(--text-primary); }
.import-sheet-confirm-allergens { color: var(--text-primary); }
.import-sheet-confirm-still { flex: 1 1 100%; color: var(--text-label); }
.import-sheet-review-back { margin: 0 0 12px; }
.import-step-link { display: inline-flex; color: inherit; text-decoration: none; }
.import-step-link:hover .import-step-chip, .import-step-link:focus-visible .import-step-chip { background: var(--bg-muted); }
/* Figma 2050:2156: a skipped step has a dashed line border, the skip icon and the words Skipped */
.import-step--skipped .import-step-chip { border: 1px dashed var(--border-primary); padding: 5px 11px 5px 7px; color: var(--text-label); }
.import-step--skipped .import-step-marker { background: transparent; box-shadow: inset 0 0 0 1px var(--border-primary); color: var(--text-label); }
.import-step--later .import-step-chip { color: var(--text-label); }
.import-step-count { padding: 1px 8px; border-radius: var(--radius-chip, 999px); background: var(--brand-gold); color: var(--text-primary); font-size: 11px; font-weight: 600; }
.import-step-note { font-size: 11px; font-weight: 600; color: var(--text-label); }
/* Files and Reading PR: an unreadable import says so and what to do; a card with no reader says why */
.import-notice--unreadable { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-surface); }
.import-notice-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.import-notice-body { margin: 0; font-size: 13px; color: var(--text-label); }
.import-notice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 0; }
.import-notice-line { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-read-bar a.btn-primary, .import-read-bar a.btn-secondary, .import-part-card a.btn-secondary { text-decoration: none; }
.import-card-reads { margin: 0; font-size: 12px; color: var(--text-label); }
.import-unread-note, .import-card-unread { margin: 0; font-size: 12px; color: var(--text-label); }
.import-card-question { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-home-status-link { color: inherit; text-decoration: none; position: relative; z-index: 1; }
.import-step--complete .import-step-chip { background: var(--status-pass-bg); color: var(--status-pass-text); font-weight: 600; }
.import-step--complete .import-step-marker { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-step--later .import-step-marker { background: var(--bg-muted); color: var(--text-secondary); }
@media (max-width: 767px) {
  .import-step--done .import-step-label, .import-step--later .import-step-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
  }
  .import-step--done .import-step-chip, .import-step--later .import-step-chip { padding-right: 4px; }
  .import-step--complete .import-step-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .import-step--complete .import-step-chip { padding-right: 12px; }
}
/* Figma 2050:2156: the stepper has its own full-width row under the title row */
.import-header > .import-stepper { flex: 0 0 100%; width: 100%; }
/* Figma I4.02 and I4.04: the page title and the sub-line under it. */
.import-header .page-title { margin: 0; font-size: 32px; font-weight: 700; line-height: normal; color: var(--text-primary); }
.import-header-line { margin: 0; font-size: 13px; font-weight: 400; line-height: normal; color: var(--text-secondary); }

.import-upload-problems { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--status-fail-bg); border-radius: 14px; }
.import-upload-problems[hidden] { display: none; } /* W3-1: upload problems, one row per reason; hidden while empty */
.import-upload-problems .import-problem-group { display: flex; flex-direction: column; background: var(--bg-surface); border-radius: 8px; overflow: hidden; }
.import-upload-problems .import-problem-row, .import-upload-problems .import-problem-file { padding: 6px 10px; }
.import-upload-problems .import-problem-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.import-upload-problems .import-problem-icon { flex-shrink: 0; width: 16px; height: 16px; color: var(--status-fail-text); }
.import-upload-problems .import-problem-icon svg { width: 16px; height: 16px; }
.import-upload-problems .import-problem-count { flex-shrink: 0; font-family: var(--font-primary); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-upload-problems .import-problem-reason { flex: 1 1 160px; min-width: 0; font-family: var(--font-primary); font-size: 12px; font-weight: 400; color: var(--status-fail-text); overflow-wrap: anywhere; }
.import-upload-problems .import-problem-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.import-upload-problems .import-problem-actions .btn-sm { font-size: 12px; }
.import-upload-problems .import-problem-files { display: flex; flex-direction: column; max-height: 200px; overflow-y: auto; }
.import-upload-problems .import-problem-files[hidden] { display: none; }
.import-upload-problems .import-problem-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border-divider); }
.import-upload-problems .import-problem-name { min-width: 0; font-family: var(--font-primary); font-size: 13px; font-weight: 400; color: var(--text-primary); overflow-wrap: anywhere; }
.import-upload-problems .import-problem-cross { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 2px; border: 0; background: none; cursor: pointer; color: var(--text-secondary); }
.import-upload-problems .import-problem-cross svg, .import-upload-problems .import-problem-cross i { width: 14px; height: 14px; }
@media (max-width: 767px) {
  .import-upload-problems .import-problem-reason { flex-basis: 100%; order: 3; }
  .import-upload-problems .import-problem-actions { order: 4; flex-basis: 100%; margin-left: 0; }
}
.import-upload-bar { position: sticky; top: 16px; z-index: 5; display: flex; flex-direction: column; gap: 12px; padding: 16px 24px; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 18px; }
.import-upload-bar[hidden] { display: none; }
.import-upload-bar-row { display: flex; align-items: center; gap: 12px; }
.import-upload-bar-disc { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 999px; background: var(--cream-tag); color: var(--text-primary); }
.import-upload-bar-disc--done { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-upload-bar-disc--problems { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-upload-bar-disc svg, .import-upload-bar-disc i { width: 16px; height: 16px; }
.import-upload-bar-disc--uploading svg { animation: spin 1s linear infinite; }
.import-upload-bar-words { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.import-upload-bar-title { margin: 0; line-height: normal; font-family: var(--font-primary); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-upload-bar-sub { margin: 0; line-height: normal; font-family: var(--font-primary); font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.import-upload-bar-sub:empty { display: none; }
.import-upload-bar-disc--problems ~ .import-upload-bar-words .import-upload-bar-sub { color: var(--status-fail-text); }
.import-upload-bar-amount { flex-shrink: 0; line-height: normal; font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--text-label); }
.import-progress.import-upload-bar-progress { width: 100%; height: 8px; border-radius: 999px; background: var(--border-divider); }
.import-progress.import-upload-bar-progress::-webkit-progress-bar { border-radius: 999px; background: var(--border-divider); }
.import-progress.import-upload-bar-progress::-webkit-progress-value { border-radius: 999px; }
.import-progress.import-upload-bar-progress::-moz-progress-bar { border-radius: 999px; }

.import-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}
.import-lane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.import-lane--sorting:not(:has(.import-card)),
.import-lane--failed:not(:has(.import-card)) { display: none; }
.import-lane-title { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-lane-title svg, .import-lane-title i { width: 16px; height: 16px; color: var(--text-secondary); }
.import-lane-cards { display: flex; flex-direction: column; gap: 8px; min-height: 24px; margin: 0; padding: 0; list-style: none; }

.import-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-surface);
  font-size: 13px;
}
.import-card p { margin: 0; }
.import-card-name { display: flex; align-items: flex-start; gap: 6px; font-weight: 600; color: var(--text-primary); }
.import-card-name span { overflow-wrap: anywhere; }
.import-card-name svg, .import-card-name i { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; }
.import-card-reason, .import-card-state { display: flex; align-items: flex-start; gap: 6px; color: var(--text-secondary); }
.import-card-reason svg, .import-card-reason i,
.import-card-state svg, .import-card-state i,
.import-card-error svg, .import-card-error i { flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; }
.import-card-error { display: flex; align-items: flex-start; gap: 6px; color: var(--status-fail-text); }
.import-card-fixes { /* switch-on pack A3: a failed file's fixes */ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.import-card-hint { margin: 0; font-size: 13px; color: var(--text-label); flex-basis: 100%; }
.import-card-dismiss { align-self: flex-start; margin-top: 6px; }
.import-failed-count { /* switch-on pack A3: how many files could not be opened */ margin: 0; color: var(--status-fail-text); font-weight: 600; }
.import-empty-summary .import-card-name { font-weight: 400; color: var(--text-label); }
.import-file-card--refused, .import-file-card--failed { border-color: var(--status-fail); background: var(--status-fail-bg); }

.import-candidates { display: flex; flex-wrap: wrap; gap: 6px; }
.import-candidates .btn-sm { min-height: 24px; }

.import-move { position: relative; align-self: flex-start; }
.import-move-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
}
.import-move-toggle::-webkit-details-marker { display: none; }
.import-move-toggle svg, .import-move-toggle i { width: 14px; height: 14px; }
.import-move-toggle:hover { background: var(--bg-muted); color: var(--text-primary); }
.import-move-menu {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.import-move-menu form { margin: 0; }
.import-move-option {
  width: 100%;
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
}
.import-move-option:hover, .import-move-option:focus-visible { background: var(--bg-muted); }

/* IMPORT-001 F6: a refused Move shows here, above the workspace. */
.import-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--status-fail-bg);
  color: var(--status-fail-text);
  font-size: 14px;
}
.import-error:empty { display: none; }

/* IMPORT-001 PR 2: the Read bar, Reading (I3), Review (I4), Nothing dropped,
   the failures panel (I11) and the item view (I5). */
.import-lanes-wrap { display: flex; flex-direction: column; gap: 16px; }
.import-read-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.import-read-bar .btn-primary, .import-read-bar .btn-secondary { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
/* the unreadable notice takes a full row of the bar, so it never touches the button beside it */
.import-read-bar .import-notice--unreadable { flex: 1 1 100%; }
.import-read-bar svg, .import-read-bar i { width: 16px; height: 16px; }
.import-read-bar--sending > .btn-primary:not([data-import-uploading]) { display: none; }

.import-reading { display: flex; flex-direction: column; gap: 12px; }
.import-reading-counts { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; font-size: 16px; color: var(--text-primary); }
.import-reading-files { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.import-reading-file { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-divider); border-radius: 8px; background: var(--bg-surface); font-size: 13px; }
.import-reading-state { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.import-reading-state svg, .import-reading-state i { width: 14px; height: 14px; }
.import-steps-list { margin: 8px 0; padding-left: 20px; }

/* UI-E2: the three review tabs are outlined pills, the current one has the dark edge (aria-current). */
.import-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.import-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-card-sm); background: var(--bg-surface); color: var(--text-primary); font-size: 14px; font-weight: 600; line-height: normal; text-decoration: none; white-space: nowrap; }
.import-tab i, .import-tab svg { flex: none; width: 16px; height: 16px; stroke: var(--text-primary); }
.import-tab[aria-current="page"] { border: 1.5px solid var(--text-primary); }
.import-tab-n { color: var(--text-label); font-family: var(--font-mono, inherit); font-size: 12px; font-weight: 500; }
.import-tab-note { padding: 2px 8px; border-radius: var(--radius-chip, 999px); background: var(--status-warning-bg); color: var(--status-warning-text); font-size: 10px; font-weight: 600; }
.import-count { font-size: 12px; font-weight: 700; }
.import-ledger-line { margin: 0; font-size: 14px; color: var(--text-primary); }
.import-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.import-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip, 999px); background: var(--bg-surface); color: var(--text-primary); font-size: 13px; text-decoration: none; }
.import-chip svg, .import-chip i { width: 14px; height: 14px; }
.import-chip--on { border-color: var(--text-primary); background: var(--bg-muted); font-weight: 600; }
/* Figma I4.13: the recipe filter chips. Scoped to the landing results so the Spec sheets chips keep theirs. */
.import-results .import-chip { gap: 6px; min-height: 0; padding: 6px 12px; font-size: 12px; font-weight: 600; line-height: normal; }
.import-results .import-chip--on { border-color: var(--brand-espresso); background: var(--brand-espresso); color: var(--text-on-dark); }
.import-results .import-chip-code { border-color: var(--border-primary); background: var(--bg-muted); color: var(--text-primary); }
.import-results .import-count { font-family: var(--font-mono, inherit); font-size: 11px; font-weight: 500; color: var(--text-label); }
.import-results .import-chip--on .import-count { color: var(--text-on-dark); }

/* G18b: positioned, so a .sr-only span inside the table cannot widen the page. */
.import-table-wrap { position: relative; display: flex; flex-direction: column; gap: 8px; overflow-x: auto; }
/* G18: the table keeps its width and the wrapper scrolls sideways on a phone. */
.import-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
.import-table th, .import-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-divider); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.import-table th { font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.import-table td.import-table-name { min-width: 10em; overflow-wrap: break-word; }
.import-table td.import-needs-cell { /* switch-on pack A1: "1 blocked" never breaks inside a word on a tablet */ overflow-wrap: normal; min-width: 8em; }
.import-table td.import-state-cell { /* switch-on pack A1: the state pill stays on one line */ white-space: nowrap; }
.import-item-link { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.import-item-link:hover, .import-item-link:focus-visible { text-decoration: underline; }

/* IMPORT-001 PR 3a: Match names (I6, I23). One list of names, one picker pane. */
.import-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The header wraps at every width, so it is not squeezed between 768 and 1100 px. */
.import-header { flex-wrap: wrap; }
/* R13: on a phone the header's buttons take a row of their own under the
   title, so the title keeps its width. */
@media (max-width: 767px) {
  .import-header { align-items: flex-start; gap: 8px; }
  .import-header-main { flex: 1 1 100%; }
  .import-header > :not(.import-header-main) { flex: 1 1 100%; }
}
.import-names-panes { display: flex; flex-direction: column; gap: 16px; }
.import-names-col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.import-names { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.import-name-row { border: 1px solid transparent; border-radius: 12px; background: var(--bg-surface); padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.import-name-row:hover { background: var(--bg-muted); }
.import-name-row--decided { background: var(--bg-muted); }
.import-name-open { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.import-name-display { font-weight: 600; overflow-wrap: break-word; }
.import-name-count, .import-name-aliases, .import-name-overridden, .import-name-carried { color: var(--text-label); font-size: 13px; margin: 0; }
.import-name-alias { margin-left: 6px; }
.import-name-alias + .import-name-alias::before { content: "·"; margin-right: 6px; }
.import-name-match { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.import-name-match svg, .import-name-match i { width: 14px; height: 14px; }
/* Pack B1 (K-10): a to-do name's top suggestion, with Use or Search */
.import-name-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; }
.import-name-top-candidate, .import-name-top-none { margin: 0; font-size: 13px; }
.import-name-top-candidate { overflow-wrap: anywhere; min-width: 0; }
.import-name-top-use { margin: 0; }
.import-name-top .btn-sm { min-height: 44px; }
.import-name-picker-pane { border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-surface); padding: 12px; }
.import-picker-placeholder, .import-picker-note, .import-picker-keys { color: var(--text-label); font-size: 13px; }
.import-picker-title { margin: 0 0 4px; font-size: 18px; overflow-wrap: break-word; }
.import-picker-impact { font-weight: 600; }
.import-picker-search { display: flex; gap: 8px; margin: 8px 0; }
.import-picker-q { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border-primary); border-radius: 6px; font: inherit; }
.import-name-candidates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.import-candidate { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-divider); border-radius: 12px; background: var(--bg-surface); cursor: pointer; }
.import-candidate:hover { background: var(--bg-muted); }
.import-candidate:has(.import-candidate-radio:checked) { border-color: var(--text-primary); border-width: 2px; padding: 9px 11px; }
.import-candidate:has(.import-candidate-radio:focus-visible) { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-candidate-radio { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--text-primary); }
.import-candidate-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.import-candidate-main, .import-candidate-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.import-candidate-main kbd, .import-picker-use kbd { font-size: 11px; padding: 0 4px; border: 1px solid var(--border-primary); border-radius: 4px; }
.import-candidate-kcal { flex: none; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.import-kcal-n { font-weight: 600; }
.import-kcal-per { color: var(--text-label); font-size: 12px; }
.import-candidates-set { min-width: 0; margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.import-label-caps { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-label); }
.import-decide-form { margin: 0; }
.import-written-as { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 8px; font-size: 13px; }
.import-written-chip { padding: 2px 10px; border-radius: 999px; background: var(--bg-muted); color: var(--text-primary); font-size: 12px; overflow-wrap: anywhere; }
.import-used-in { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.import-picker-back { display: none; }
.import-picker-search { display: flex; gap: 8px; margin: 12px 0; }
.import-picker-q { flex: 1 1 auto; min-width: 0; padding: 6px 12px; border: 1px solid var(--border-primary); border-radius: 8px; font: inherit; }
.import-picker-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.import-picker-tiles form { margin: 0; display: flex; }
.import-tile--action { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; text-align: left; text-decoration: none; color: var(--text-primary); background: var(--bg-muted); cursor: pointer; }
.import-tile--action:hover { border-color: var(--text-primary); }
.import-tile--action i, .import-tile--action svg { flex: none; width: 18px; height: 18px; }
.import-tile-text { display: flex; flex-direction: column; min-width: 0; }
.import-tile-title { font-weight: 600; font-size: 14px; }
.import-impact { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--status-pass-bg); color: var(--status-pass-text); font-size: 13px; }
.import-impact i, .import-impact svg { flex: none; width: 16px; height: 16px; }
.import-picker-scroll { min-width: 0; overflow-y: auto; }
.import-picker-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 0; background: var(--bg-surface); }
.import-picker-hint { margin-right: auto; color: var(--text-label); font-size: 12px; }
.import-picker-use { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.import-picker-use[disabled] { opacity: 0.5; cursor: not-allowed; }
.import-picker-skip { min-height: 44px; }
.import-picker-lines > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.import-name-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.import-name-line .import-name-open { min-height: 40px; flex: 1 1 auto; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
.import-name-sub { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.import-name-open { min-width: 0; }
.import-name-row .import-pill { padding: 1px 8px; font-size: 11px; }
.import-name-row .import-name-count { line-height: 1.3; }
.import-name-status { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 45%; text-align: right; }
.import-name-status .import-pill { white-space: normal; }
.import-name-status .import-name-top-use { display: inline-flex; }
.import-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text-secondary); }
.import-crumb-name { overflow-wrap: anywhere; }
.import-sub { margin: 0; font-size: 14px; color: var(--text-secondary); }
.import-name-progress { min-width: 180px; display: flex; flex-direction: column; gap: 6px; align-self: flex-start; }
.import-name-progress-text { margin: 0; font-size: 13px; text-align: right; }
.import-candidate-name { font-weight: 600; overflow-wrap: break-word; }
.import-candidate-meta { color: var(--text-label); font-size: 13px; }
.import-candidate-status { font-size: 12px; font-weight: 400; color: var(--text-label); }
.import-picker-lines { margin-top: 16px; }
.import-picker-lines-title { font-size: 14px; margin: 0 0 6px; }
.import-picker-recipe-name { font-weight: 600; margin: 8px 0 4px; }
.import-picker-recipe-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.import-picker-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.import-picker-line > details summary { cursor: pointer; text-decoration: underline; }
.import-line-override-rows { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.import-picker-line > details form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.import-picker-line > details select { min-height: 44px; min-width: 0; max-width: 100%; padding: 6px 10px; border: 1px solid var(--border-primary); border-radius: 6px; font: inherit; }
.import-conflict-title { font-weight: 600; margin: 0 0 4px; }
.import-names-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* R6: 44 px touch targets for the page links. */
.import-names-pages .btn-sm { min-height: 44px; display: inline-flex; align-items: center; }
.import-picker-failed { margin: 0 0 8px; color: var(--text-label); font-size: 14px; }
/* H15: the picker's first open asks the embedding provider (2 to 3 s), so say so. */
.import-picker-loading { display: none; margin: 0 0 8px; color: var(--text-label); font-size: 13px; }
.import-picker-loading.htmx-request { display: block; }
.import-name-open[disabled] { cursor: progress; }
/* R5: the tapped name says it is working, where the person is looking. The
   button is disabled for the length of its request (hx-disabled-elt="this"),
   which is a surer hook than .htmx-request: with hx-indicator set, htmx puts
   that class on the indicator instead. */
.import-name-open[disabled] .import-name-count::after { content: " · Finding matches..."; }
/* M1: 44 px touch targets in the picker. */
.import-picker-q, .import-name-picker .btn-sm, .import-picker-line > details summary { min-height: 44px; }
.import-picker-line > details summary { display: inline-flex; align-items: center; }
/* UI-F1: from 900 px the two panes sit side by side and each scrolls on its own. */
@media (min-width: 900px) {
  .import-names-panes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
  .import-names-col { max-height: calc(100vh - 160px); overflow-y: auto; }
  .import-name-picker-col { position: sticky; top: 16px; max-height: calc(100vh - var(--import-picker-top, 160px) - 16px); min-height: 320px; display: flex; flex-direction: column; overflow: hidden; }
  .import-name-picker-col .import-name-picker-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .import-name-picker-col .import-name-picker { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .import-picker-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .import-picker-footer { flex: none; }
}
/* UI-F1: on a phone the detail is a full-screen sheet, opened by a name and closed by Back to names. */
@media (max-width: 767px) {
  .import-name-picker-col { display: none; }
  .import-names-panes--detail .import-name-picker-col { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 50; overflow: hidden; padding: calc(12px + var(--app-header-offset, 0px)) 16px 12px; scroll-padding-top: calc(12px + var(--app-header-offset, 0px)); background: var(--bg-surface); }
  /* the phone header (sticky, z-index 100) sits over the sheet: the top padding clears it while it shows (app.js publishes the offset);
     the same scroll-padding stops the open's scrollIntoView and any focus scroll below the header, not at the sheet's top edge */
  .import-names-panes--detail .import-name-picker-pane, .import-names-panes--detail .import-name-picker { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .import-picker-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  /* the Use this match bar is 44px + 2 x 8px: the last heading and row stay clear of it */
  .import-picker-scroll, .imports-page--names .import-picker-scroll { padding-bottom: 64px; scroll-padding-bottom: 64px; }
  .import-names-panes--detail .import-picker-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }
  .import-picker-tiles { grid-template-columns: minmax(0, 1fr); }
  .import-picker-footer { flex: none; flex-wrap: wrap; }
  .import-picker-use, .import-picker-skip, .import-tile--action { min-height: 44px; }
  .import-name-progress { min-width: 0; width: 100%; }
}
.import-table th.import-table-group { text-align: center; border-bottom: 1px solid var(--border-primary); }
.import-table-empty { color: var(--text-secondary); }
.import-page-count { margin: 0; font-size: 12px; color: var(--text-secondary); }

.import-part-panel { padding: 12px 16px; }
.import-part-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.import-part-summary::-webkit-details-marker { display: none; }
.import-part-line { font-size: 13px; color: var(--text-secondary); }
.import-columns { display: flex; flex-direction: column; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; }
.import-column { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 6px 0; border-bottom: 1px solid var(--border-divider); }
.import-column--unplaced { color: var(--status-fail-text); }
.import-column-source { flex: 1 1 200px; font-weight: 600; overflow-wrap: anywhere; }
.import-column-target { display: inline-flex; align-items: center; gap: 6px; }
.import-column-target svg, .import-column-target i { width: 14px; height: 14px; }
.import-column-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.import-column-actions form { margin: 0; }

.import-failures, .import-not-read, .import-drafts, .import-documents, .import-photos { display: flex; flex-direction: column; gap: 8px; }
.import-photos .import-card .btn-sm { align-self: flex-start; }
.import-photo-pick-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-photo-message { color: var(--text-secondary); }
.import-drafts-counts, .import-drafts-note { margin: 0; }
.import-drafts .import-card .btn-sm { align-self: flex-start; }
.import-drafts-making { margin-left: 8px; color: var(--text-secondary); }
/* simple path PR 1b: each stored file with its Open link */
.import-document .btn-sm { align-self: flex-start; }
/* simple path PR 1: each unread file's one next step, under its reason */
.import-not-read-next { margin: 0; }
/* simple path PR 2 (F9): a long file name wraps inside its card instead of running out of it */
.import-not-read-name { min-width: 0; overflow-wrap: anywhere; }
.import-fixes { display: flex; flex-wrap: wrap; gap: 6px; }
.import-fixes form { margin: 0; }

.import-item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
/* Pack B2 (K-12): the "Needs you" band leads its column; Next names the next item that needs a person */
.import-needs-you { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; }
.import-item-page .import-needs-you { margin: 0; }
/* N3: a part with nothing inside, or a band of such parts, takes no room (the ids stay in the DOM) */
.import-item-page .import-needs-you > :not(:has(*)) { display: none; }
.import-item-page .import-needs-you:not(:has(.import-flag, .import-allergen-fieldset, .import-may-contain, .import-library-match)) { display: none; }
.import-needs-you:empty { display: none; }
.import-item-next { margin: 0; font-size: 14px; }
.import-item-col { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.import-item-page .import-item-col { gap: 12px; }
/* Item page PR 1: the title row and the two card grid, scoped under .import-item-page */
/* PR B round 3 (C3): nowrap, as .import-header's wrap left a blank gap under a short header in this column */
.import-item-page .import-item-header { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
.import-item-page .import-item-title-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.import-item-page .import-item-title-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1 1 320px; }
.import-item-page .import-item-title { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: normal; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-size: 12px; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-item-meta .stage-pill { padding: 4px 10px; font-size: 11px; font-weight: 600; }
/* PR B (Figma B2, B2b): the one status pill and the 'What to do here' line under the title */
.import-item-page .import-item-state { margin: 0; }
.import-item-page .import-item-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.import-item-page .import-item-status .import-pill { gap: 5px; padding: 4px 10px; font-size: 11px; font-weight: 600; }
.import-item-page .import-item-status .stage-pill { padding: 4px 10px; font-size: 11px; font-weight: 600; }
.import-item-page .import-item-todo { font-size: 15px; line-height: 1.4; color: var(--text-primary); }
.import-item-page .import-item-todo .import-item-link { color: var(--text-primary); text-decoration: underline; }
.import-item-page .import-source-ref { font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--text-label); overflow-wrap: anywhere; }
.import-item-page .import-item-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.import-item-page .import-item-position { font-size: 13px; font-weight: 600; color: var(--text-secondary-app, var(--text-secondary)); margin-right: 4px; }
.import-item-page .import-item-chevron { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 32px; height: 32px; border: 1px solid var(--border-primary); border-radius: 50%; background: var(--bg-surface); color: var(--text-primary); text-decoration: none; }
.import-item-page .import-item-chevron svg, .import-item-page .import-item-chevron i { width: 16px; height: 16px; }
.import-item-page a.import-item-chevron:hover, .import-item-page a.import-item-chevron:focus-visible { background: var(--bg-muted); }
.import-item-page .import-item-chevron[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.import-item-page .import-item-nav { max-width: 340px; }
.import-item-page .import-item-nav .import-item-next { flex: 1 1 100%; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: right; font-size: 12px; color: var(--text-label); }
.import-item-page .import-source-more summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-source-more .import-source-block { margin-top: 8px; }
.import-item-page .import-item-grid { grid-template-columns: minmax(0, 380fr) minmax(0, 732fr); gap: 16px; align-items: start; }
@media (max-width: 899px) {
  .import-item-page .import-item-grid { grid-template-columns: minmax(0, 1fr); }
  .import-item-page .import-item-nav { justify-content: flex-start; }
  .import-item-page .import-item-nav .import-item-next { text-align: left; }
}
/* PR B (Figma B4): on a phone the pager is a full-width bar under the title block */
@media (max-width: 767px) {
  .import-item-page .import-item-nav { flex: 1 1 100%; max-width: none; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-card, 12px); }
  .import-item-page .import-item-nav #import-item-prev { order: 0; }
  .import-item-page .import-item-nav .import-item-position { order: 1; flex: 1 1 auto; margin: 0; text-align: center; }
  .import-item-page .import-item-nav #import-item-next { order: 2; }
}
/* Item page PR 2: the left card (What we read), scoped under .import-item-page */
.import-item-page .import-read-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.import-item-page .import-read-header .import-band-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-read-pill { padding: 3px 8px; border-radius: 999px; background: var(--bg-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-read-head { margin: 6px 0 0; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-label); overflow-wrap: anywhere; }
.import-item-page .import-source-block { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--bg-primary); }
.import-item-page .import-source-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 3px 0; font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.import-item-page .import-source-row dt { font-weight: 400; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-source-row dd { margin: 0; font-weight: 500; color: var(--text-primary); text-align: right; }
.import-item-page .import-pill-info { align-self: flex-start; padding: 3px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info-text); font-size: 10px; font-weight: 600; }
.import-item-page .import-label-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 0; padding: 8px 12px; border: 1px solid var(--border-divider); border-radius: 14px; }
.import-item-page .import-label-grid .import-label-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.import-item-page .import-label-grid .import-label-row dt { color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-label-grid .import-label-row dd { margin: 0; font-weight: 500; color: var(--text-primary); }
.import-item-page .import-carried { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 12px; overflow-wrap: anywhere; }
.import-item-page .import-carried-row { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.import-item-page .import-carried-label { font-weight: 600; color: var(--text-primary); }
.import-item-page .import-carried-arrow { color: var(--text-label); }
.import-item-page .import-carried-went { flex: 1 1 160px; min-width: 0; font-weight: 400; color: var(--text-secondary-app, var(--text-secondary)); }
@media (max-width: 720px) {
  .import-item-page .import-label-grid { grid-template-columns: minmax(0, 1fr); }
}
.import-quid, .import-pairing-note { margin: 0; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-pdf-lines { /* 1b P6: a PDF page's lines as printed */ margin: 0 0 8px; padding-left: 20px; font-size: 13px; overflow-wrap: anywhere; }
.import-line-measure { /* 1b P6: a PDF line's household measure, under its name */ display: block; font-size: 12px; color: var(--text-label); overflow-wrap: anywhere; }
.import-pairs { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.import-pairs dt { color: var(--text-secondary); overflow-wrap: anywhere; }
.import-pairs dd { margin: 0; overflow-wrap: anywhere; }
.import-item-name { margin: 0; font-weight: 600; }
.import-flags { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.import-flags:empty { display: none; }
.import-flag { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.import-flag svg, .import-flag i { flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; }
.import-flag-link { color: var(--text-primary); font-weight: 600; text-decoration: underline; }
/* IMPORT-001 3c: the item page's fixes, and the review table's flag filter and lazy cell */
.import-flag-words { flex: 1 1 240px; min-width: 0; }
.import-flag-fixes { display: flex; flex-wrap: wrap; gap: 6px; }
.import-flag-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.import-flag-fix .btn-sm, .import-line-actions .btn-sm, .import-line-edit .btn-sm, .import-line-add .btn-sm,
.import-item-fields .btn-sm, .import-allergen-choice .btn-sm, .import-may-contain .btn-sm, .import-library-match .btn-sm { min-height: 44px; }
.import-item-fields, .import-may-contain, .import-library-match, .import-line-add { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.import-line-add { flex-direction: row; flex-wrap: wrap; align-items: center; }
.import-line-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.import-line-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.import-line-actions form { margin: 0; }
.import-supplier-allergens { display: flex; flex-direction: column; gap: 10px; }
.import-allergen-fieldset { margin: 0; padding: 10px 12px; border: 1px solid var(--border-divider); border-radius: 8px; }
.import-allergen-fieldset legend { padding: 0 4px; font-weight: 600; }
.import-allergen-choice { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.import-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.import-caveat { font-size: 12px; color: var(--text-label); }
.import-label-cell { min-width: 9rem; }
.import-label-cell-value { font-size: 13px; }
.import-flag-filters { margin-top: 8px; }
.import-flag-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-divider); border-radius: 999px; color: var(--text-primary); text-decoration: none; font-size: 13px; }
.import-flag-filter:hover, .import-flag-filter:focus-visible { border-color: var(--brand-clay); }
.import-flag-filter.import-chip--on { border-color: var(--text-primary); font-weight: 600; }
.import-flag-filter-count { color: var(--text-label); }
/* Z23, Z24: the item page's edit fields at the standard input size; the lines table fits its column */
.import-number-field { width: 7rem; min-height: 44px; }
.import-unit-field { min-height: 44px; }
.import-reason-field { flex: 1 1 14rem; min-width: 0; min-height: 44px; }
.import-item-page .import-lines-source { margin: 0; font-size: 12px; color: var(--text-label); overflow-wrap: anywhere; }
.import-lines-table { min-width: 0; table-layout: fixed; width: 100%; }
.import-lines-table th:nth-child(1), .import-lines-table td:nth-child(1) { width: 26%; overflow-wrap: anywhere; }
.import-lines-table th:nth-child(3), .import-lines-table td:nth-child(3) { width: 22%; overflow-wrap: anywhere; }
.import-lines-table .import-line-edit { flex-wrap: wrap; }
.import-lines-table .import-number-field { width: 5rem; }
/* Z34, Z43: words break only between words; a button label wraps between its words, never inside one,
   so the table fits its column with no sideways scroll */
.import-lines-table th, .import-lines-table td { overflow-wrap: break-word; }
.import-line-actions .btn-sm, .import-line-edit .btn-sm { white-space: normal; overflow-wrap: normal; word-break: normal; text-align: left; max-width: 100%; }
/* Z34: on a phone each line stacks: name, amount, as written, then its actions under it */
@media (max-width: 767px) {
  .import-lines-table, .import-lines-table tbody, .import-lines-table tr, .import-lines-table td { display: block; width: 100%; }
  .import-lines-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .import-lines-table tr { padding: 10px 0; border-bottom: 1px solid var(--border-divider); }
  .import-lines-table th:nth-child(1), .import-lines-table td:nth-child(1),
  .import-lines-table th:nth-child(3), .import-lines-table td:nth-child(3) { width: 100%; }
  .import-lines-table td { padding: 4px 0; border-bottom: 0; }
  .import-lines-table td:nth-child(1) { font-weight: 600; }
  .import-lines-table td.import-line-actions { display: flex; padding-top: 8px; }
}
.import-recipe-fields { margin-bottom: 12px; }
/* Item page PR 3: the right card's title, the fields row and the lines table with flags on their line, scoped under .import-item-page */
.import-item-page .import-canoli-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.import-item-page .import-canoli-header .import-band-title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-canoli-note { margin: 0; font-size: 12px; font-weight: 400; color: var(--text-label); }
.import-item-page .import-recipe-fields { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.import-item-page .import-recipe-fields .import-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 0 1 130px; }
.import-item-page .import-recipe-fields .import-field--name { flex: 1 1 200px; }
.import-item-page .import-recipe-fields .import-label { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-label); }
.import-item-page .import-recipe-fields .input-field { box-sizing: border-box; width: 100%; min-height: 34px; padding: 8px 10px; border: 1px solid var(--border-primary); border-radius: 10px; font-size: 13px; }
.import-item-page .import-lines-count { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-lines-table th { padding: 6px 8px; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-align: left; color: var(--text-label); }
.import-item-page .import-lines-table td { padding: 9px 8px; border-bottom: 1px solid var(--border-divider); vertical-align: top; font-size: 12px; }
/* Z2: one line a row at 1440; widths 22, 30, 28, 20 (6 Nov: the grams cell needs input + select, about 144 px at 1180).
   PR C round 4 (V7): the "..." menu has its own last column (44 px: the 28 px button and the cell padding); the status
   column takes what is left */
.import-item-page .import-lines-table th:nth-child(1), .import-item-page .import-lines-table td:nth-child(1) { width: 22%; }
.import-item-page .import-lines-table th:nth-child(2), .import-item-page .import-lines-table td:nth-child(2) { width: 30%; overflow-wrap: anywhere; }
.import-item-page .import-lines-table th:nth-child(3), .import-item-page .import-lines-table td:nth-child(3) { width: 26%; }
.import-item-page .import-lines-table th:nth-child(4), .import-item-page .import-lines-table td:nth-child(4) { width: auto; }
.import-item-page .import-lines-table th:nth-child(5), .import-item-page .import-lines-table td:nth-child(5) { width: 44px; }
.import-item-page .import-lines-table td.import-line-menu-cell { text-align: right; }
.import-item-page .import-table-wrap { overflow-x: visible; }
.import-item-page .import-line-words { display: block; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-line-quid { display: block; margin-top: 1px; font-family: var(--font-mono, 'DM Mono', monospace); font-size: 10px; font-weight: 400; color: var(--text-label); }
.import-item-page .import-line-matched { margin-right: 6px; font-weight: 400; color: var(--text-primary); }
/* --------------------------------------------------------------------------
   Ingredient tray phase 1b (Figma IT1 Edit buttons, IT2 2371:8591 edit
   allergens, IT3 2372:8791 edit nutrition and its grid 2383:9129, IT3b
   2372:9528 after save), measured. Edit mode is a form that is the tray's
   scrolling body, an unsaved-edits prompt and a footer (Cancel, the butter
   Save) pinned under it.
   -------------------------------------------------------------------------- */

/* "Tray / Edit link": an outlined pill, 5px 14px, 12px 600 (btn-sm). */
.ingredient-tray .ingredient-tray-edit {
  margin-left: auto;
  border-radius: 999px;
  flex-shrink: 0;
}

.ingredient-tray .ingredient-section-head,
.ingredient-tray .ingredient-nut-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* IT3b "saved note": pass tint, 8px 12px, 12px 500, 16px from the header. */
.ingredient-tray-saved {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 24px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
  font-size: 12px;
  font-weight: 500;
}

.ingredient-tray-saved i,
.ingredient-tray-saved svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* The edit form: 20px 24px 16px, the blocks 12px apart (IT3 "form"). */
.ingredient-tray-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px 16px;
}

/* "Tray / Sub-head": Jost 16 600, 22px line. */
.ingredient-tray-subhead {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: var(--text-primary);
}

.ingredient-tray-intro {
  margin: -10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* IT2: the 14 rows, ruled, the chips on the right (the import rows' chooser). */
.ingredient-tray-allergens {
  display: flex;
  flex-direction: column;
}

.ingredient-tray-allergen .allergen-edit-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ingredient-tray-allergen .allergen-edit-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Re-review S10: a row a refused save left unanswered (aria-invalid), the field error's colour. */
.ingredient-tray-allergen--invalid .allergen-edit-name,
.ingredient-tray-allergen--invalid .allergen-edit-hint {
  color: var(--status-fail-text);
}

.ingredient-tray-differs {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--status-warning-text);
}

.ingredient-tray-differs[hidden] {
  display: none;
}

.ingredient-tray-differs i,
.ingredient-tray-differs svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* IT3 grid: three equal columns, 10px rows, 12px columns; the label box two
   lines tall and bottom-aligned so a row's inputs line up. */
.ingredient-tray-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}

/* Smoke L1: the Add values dialog's .import-values-field (min-width 140px) and
   .import-values-input (width 140px) come later in this file at one class, so
   the tray's cells and inputs name the grid too (two classes) and fit their
   equal columns at any tray width; a note wraps inside its own cell. */
.ingredient-tray-values .ingredient-tray-value {
  min-width: 0;
}

.ingredient-tray-values .import-values-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ingredient-tray-values .ingredient-tray-value-note {
  overflow-wrap: anywhere;
}

.ingredient-tray-value .import-field-label {
  min-height: 22px;
  align-content: flex-end;
}

.ingredient-tray-value .import-values-input,
.ingredient-tray-text-input {
  width: 100%;
  box-sizing: border-box;
}

.ingredient-tray-text-input {
  height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.ingredient-tray-name-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* A missing value: the warning border (2px) and its reason under it. */
.ingredient-tray-value--missing .import-values-input {
  border: 2px solid var(--status-warning);
}

.ingredient-tray-value-note {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--status-warning-text);
}

.ingredient-tray-value-note:empty {
  display: none;
}

.ingredient-tray-value--error .import-values-input,
.ingredient-tray-value--error .ingredient-tray-text-input {
  border-color: var(--status-fail);
}

.ingredient-tray-value--error .ingredient-tray-value-note {
  color: var(--status-fail-text);
}

.ingredient-tray-name-field:not(.ingredient-tray-value--error) .ingredient-tray-value-note {
  color: var(--text-secondary);
  font-weight: 400;
}

.ingredient-tray-hint {
  margin: 0;
}

.ingredient-tray-fibre {
  padding-top: 4px;
}

/* IT3 "reach note": info tint, 8px 12px, 12px 500. */
.ingredient-tray-reach {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 12px;
  font-weight: 500;
}

.ingredient-tray-reach i,
.ingredient-tray-reach svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ingredient-tray-error:empty {
  display: none;
}

/* Review round (27 Nov 2026): an unchanged save says so in a neutral tint; the
   values Canoli worked out and the save's Needs-a-look findings sit under the
   saved line. */
.ingredient-tray-saved--none {
  background: var(--info-bg);
  color: var(--info-text);
}

.ingredient-tray-saved-note,
.ingredient-tray-look {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 24px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.ingredient-tray-edit-form .ingredient-tray-look {
  margin: 0;
}

.ingredient-tray-look {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.ingredient-tray-look i,
.ingredient-tray-look svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Clear to unknown: a small Clear under a field with a value; once ticked the
   box is dashed and says it is saved as unknown. */
.ingredient-tray-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.ingredient-tray-cleared-note {
  display: none;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--status-warning-text);
}

.ingredient-tray-value--cleared .ingredient-tray-cleared-note {
  display: block;
}

.ingredient-tray-value--cleared .import-values-input {
  border-style: dashed;
}

/* The unsaved-edits prompt: above the footer, a warning tint. */
.ingredient-tray-unsaved {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 24px;
  border-top: 1px solid var(--border-divider);
  background: var(--status-warning-bg);
}

.ingredient-tray-unsaved[hidden] {
  display: none;
}

.ingredient-tray-unsaved-words {
  flex: 1 1 auto;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--status-warning-text);
}

/* IT2/IT3 "tray footer": 14px 24px, the count, Cancel and the butter Save,
   32px pills. */
.ingredient-tray-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--border-divider);
  background: var(--bg-surface);
}

.ingredient-tray-count {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.ingredient-tray-footer .ingredient-tray-cancel,
.ingredient-tray-footer .ingredient-tray-save {
  height: 32px;
  border-radius: 999px;
}

.ingredient-tray-footer .ingredient-tray-cancel {
  border-width: 1.5px;
}

@media (max-width: 1024px) {
  .ingredient-tray .ingredient-tray-edit,
  .ingredient-tray .ingredient-tray-unsaved-btn,
  .ingredient-tray .ingredient-tray-footer .ingredient-tray-cancel,
  .ingredient-tray .ingredient-tray-footer .ingredient-tray-save {
    min-height: 44px;
  }

  .ingredient-tray-edit-form,
  .ingredient-tray-footer,
  .ingredient-tray-unsaved {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ingredient-tray-saved {
    margin: 12px 16px 0;
  }

  /* Smoke L2: Clear is a 44px touch target on the bottom sheet. */
  .ingredient-tray-clear {
    min-height: 44px;
    padding-right: 12px;
  }

  .ingredient-tray-clear-input {
    width: 18px;
    height: 18px;
  }

  /* Re-review nit: the lines under the saved line keep its 16px phone margin (the form's own look lines stay 0). */
  .ingredient-tray-saved-note,
  .ingredient-tray-look {
    margin: 8px 16px 0;
  }
}

/* Unscoped since the ingredient tray (phase 1a) shows the same pill in its header, outside the import page. */
.import-source-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--source-cofid-bg); color: var(--source-cofid-text); font-family: var(--font-mono, 'DM Mono', monospace); font-size: 9px; font-weight: 500; }
.import-item-page .import-line-grams { font-family: var(--font-mono, 'DM Mono', monospace); }
.import-item-page .import-line-pill { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px 4px 0; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; }
.import-item-page .import-line-pill--matched, .import-item-page .import-line-pill--linked { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-item-page .import-line-pill--state-differs, .import-item-page .import-line-pill--choose { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-item-page .import-line-pill--blocked { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-item-page .import-pill-neutral { display: inline-block; margin: 0 4px 4px 0; padding: 3px 8px; border-radius: 999px; background: var(--bg-muted); color: var(--text-secondary-app, var(--text-secondary)); font-size: 9px; font-weight: 600; }
.import-item-page .import-line-menu { position: relative; display: inline-block; }
.import-item-page .import-line-menu summary { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; list-style: none; color: var(--text-primary); }
.import-item-page .import-line-menu summary::-webkit-details-marker { display: none; }
.import-item-page .import-line-menu summary:hover, .import-item-page .import-line-menu summary:focus-visible { background: var(--bg-muted); }
.import-item-page .import-line-menu[open] .import-line-menu-items { position: absolute; right: 0; z-index: 5; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 140px; padding: 6px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-surface); }
.import-item-page .import-line-menu-items { display: none; }
.import-item-page .import-line-flag-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-item-page .import-line-menu-items form { margin: 0; }
.import-item-page .import-line-menu-item { display: flex; align-items: center; justify-content: flex-start; width: 100%; box-sizing: border-box; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--text-primary); font-family: var(--font-primary); font-size: 12px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.import-item-page .import-line-menu-item:hover, .import-item-page .import-line-menu-item:focus-visible { background: var(--bg-muted); }
.import-item-page .import-line-flags td { padding: 0; border-bottom: 1px solid var(--border-divider); }
/* Z1: a line with no flags draws no flag line; the row stays in the DOM for the out of band swap */
.import-item-page .import-line-flags:empty { display: none; }
.import-item-page .import-line-flags .import-flag { margin: 0 0 8px; padding: 10px 14px 12px; border-radius: 14px; }
.import-item-page .import-line-flag--amber { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-item-page .import-line-flag--red { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-item-page .import-line-flag--info { background: var(--bg-primary); color: var(--text-secondary-app, var(--text-secondary)); border: 1px solid var(--border-primary); }
/* Fix round: Y4 the grams and unit sit inline, one line tall; Y5 the line under a flagged row is kept; Y7 one dots size */
.import-item-page .import-lines-table td { vertical-align: middle; }
.import-item-page .import-line-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; min-width: 0; }
.import-item-page .import-line-edit .import-number-field { flex: 0 0 auto; width: 68px; min-width: 0; }
.import-item-page .import-line-edit .import-unit-field { flex: 0 0 auto; width: 58px; min-width: 0; }
.import-item-page .import-line-edit .input-field { min-height: 28px; padding: 3px 6px; font-size: 12px; box-sizing: border-box; }
.import-item-page .import-line-status .btn-sm { white-space: nowrap; }
.import-item-page .import-line-pill { margin-bottom: 0; }
.import-item-page .import-line-menu summary svg, .import-item-page .import-line-menu summary i { display: block; width: 16px; height: 16px; }
.import-item-page .import-lines-fold { margin-top: 4px; }
.import-item-page .import-lines-fold summary { padding: 8px 8px 0; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-primary); }
/* Item page buttons as Figma I5 (6 Nov): flag fixes primary / secondary / tertiary, Save, Add. The old btn-secondary btn-sm look came from
   .import-flag-fix .btn-sm { min-height: 44px } plus the base .btn-sm padding and 7px radius; these classes sit under .import-item-page only. */
.import-item-page .import-flag-fixes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-item-page .import-flag-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.import-item-page .import-fix-btn, .import-item-page .import-save-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 0; line-height: 1.2; cursor: pointer; text-decoration: none; }
.import-item-page .import-fix-btn { gap: 7px; padding: 7px 14px; border: 1px solid transparent; border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; text-align: left; }
.import-item-page .import-fix-btn--primary { background: var(--text-primary); color: var(--text-on-dark); padding: 7px 14px; gap: 7px; border: 1px solid var(--text-primary); border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; }
.import-item-page .import-fix-btn--primary:hover { background: var(--text-secondary-app, var(--text-primary)); }
.import-item-page .import-fix-btn svg, .import-item-page .import-fix-btn i { margin-top: 0; }
.import-item-page .import-fix-btn--primary svg, .import-item-page .import-fix-btn--primary i { flex-shrink: 0; width: 15px; height: 15px; }
.import-item-page .import-fix-btn--secondary { background: var(--bg-surface); color: var(--text-primary); padding: 7px 14px; border: 1px solid var(--text-primary); border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; }
.import-item-page .import-fix-btn--secondary:hover { background: var(--bg-muted); }
.import-item-page .import-fix-btn--tertiary { background: none; color: var(--text-primary); padding: 7px 10px; border: 1px solid transparent; border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; }
.import-item-page .import-fix-btn--tertiary:hover { background: var(--bg-muted); }
.import-item-page .import-save-btn { background: var(--bg-surface); color: var(--text-primary); padding: 7px 14px; border: 1px solid var(--text-primary); border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; align-self: flex-end; }
.import-item-page .import-save-btn:hover { background: var(--bg-muted); }
@media (pointer: coarse) { .import-item-page .import-fix-btn, .import-item-page .import-save-btn { min-height: 44px; } }
.import-item-page .import-reason-field { flex: 1 1 200px; min-width: 0; max-width: 320px; box-sizing: border-box; height: 34px; min-height: 34px; padding: 8px 10px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-surface); font-size: 13px; }
/* The item page picker says what to do: heading, one context line, Close at the top right, a quiet impact line after a pick, and the
   line's "Now matched to ..." words. Existing button classes are reused. */
.import-item-page .import-name-picker { position: relative; }
.import-item-page .import-picker-close { position: absolute; top: 0; right: 0; }
.import-item-page .import-picker-title { margin: 0; padding-right: 72px; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-picker-context { margin: 4px 0 8px; font-size: 13px; color: var(--text-label); overflow-wrap: anywhere; }
.import-item-page .import-picker-search-label { display: block; margin: 8px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-picker-keep { margin: 4px 0 8px; }
.import-item-page .import-picker-impact { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-line-changed { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--status-pass-text); }
.import-item-page .import-saved { align-self: flex-end; padding-bottom: 7px; font-size: 12px; font-weight: 600; color: var(--status-pass-text); }
.import-item-page .import-saved:empty { display: none; }
@media (max-width: 767px) {
  .import-item-page .import-lines-table th:nth-child(n), .import-item-page .import-lines-table td:nth-child(n) { width: 100%; }
  .import-item-page .import-line-status { white-space: normal; }
  .import-item-page .import-lines-table td { border-bottom: 0; }
  .import-item-page .import-line-menu[open] .import-line-menu-items { position: static; }
}
/* IMPORT-001 PR C (spec tmp/import/pr-c-recipe-page-spec.md, Figma C1 to C4): the recipe page, actions first. Tokens only. */
/* C-11: the one main button of a To do box is butter, never ink; every other control is outlined or a text link */
.import-item-page .import-fix-btn--main { background: var(--brand-gold); color: var(--text-primary); padding: 7px 14px; gap: 7px; border: 1px solid var(--brand-gold); border-radius: 999px; font-family: var(--font-primary); font-size: 12px; font-weight: 600; }
.import-item-page .import-fix-btn--main:hover { background: var(--brand-gold-hover); border-color: var(--brand-gold-hover); }
.import-item-page .import-fix-btn--main svg, .import-item-page .import-fix-btn--main i { flex-shrink: 0; width: 15px; height: 15px; }
.import-item-page .btn-primary.btn-butter { background: var(--brand-gold); color: var(--text-primary); border-color: var(--brand-gold); }
.import-item-page .btn-primary.btn-butter:hover { background: var(--brand-gold-hover); border-color: var(--brand-gold-hover); }
.import-item-page .import-todo-link, .import-file-notes .import-todo-link { display: inline; margin: 0; padding: 0; border: 0; background: none; color: var(--text-primary); font-family: var(--font-primary); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.import-item-page .import-todo-link:hover, .import-item-page .import-todo-link:focus-visible, .import-file-notes .import-todo-link:hover, .import-file-notes .import-todo-link:focus-visible { color: var(--brand-clay); }
/* C-1: To do, under the header and before the grid */
.import-item-page .import-todo { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
/* PR D2 (D2-4): an empty To do and a next step that is not drawn take no room; the elements stay, hidden, for out-of-band redraws */
.import-item-page .import-todo[hidden], .import-item-page .import-item-next-step[hidden] { display: none; }
.import-item-page .import-todo-title { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-label); }
.import-item-page .import-todo-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.import-item-page .import-todo-box { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: var(--radius-card, 12px); background: var(--bg-surface); scroll-margin-top: 16px; }
.import-item-page .import-todo-box:target { border-color: var(--brand-gold); }
.import-item-page .import-todo-num { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-gold); color: var(--text-primary); font-size: 12px; font-weight: 700; }
.import-item-page .import-todo-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 8px; min-width: 0; }
.import-item-page .import-todo-box-title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-todo-rows { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-item-page .import-todo-row { display: flex; flex-direction: column; gap: 6px; }
.import-item-page .import-todo-row + .import-todo-row { padding-top: 8px; border-top: 1px solid var(--border-divider); }
.import-item-page .import-todo-why { margin: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-todo-links { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; }
.import-item-page .import-todo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.import-item-page .import-todo-actions:empty { display: none; }
.import-item-page .import-todo-actions .import-flag-fixes, .import-item-page .import-todo-actions .import-flag-fix { gap: 8px; }
.import-item-page .import-todo-keep-body { padding-top: 6px; }
.import-item-page .import-todo-keep-body[hidden], .import-item-page .import-read-note-details[hidden], .import-file-notes .import-read-note-details[hidden] { display: none; }
.import-item-page .import-todo-keep-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.import-item-page .import-todo-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.import-item-page .import-todo-field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* smoke 25 Nov (R16): a reason field and the button that sends it are one row, bottoms aligned, the button as tall as
   the field (34 px). The accept form in flag-fixes.html (every Keep or Accept with a reason) and the R3 Keep row share it.
   min-height is left alone, so touch keeps its 44 px target. The button never grows; a long label (R9b) may shrink it to
   two lines, which still fit its 34 px. In a To do box the row takes the full width and, from 768 px, never wraps. */
.import-item-page .import-reason-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.import-item-page .import-reason-row > .import-fix-btn { box-sizing: border-box; flex: 0 1 auto; height: 34px; padding-top: 0; padding-bottom: 0; }
.import-item-page .import-todo-actions .import-reason-row { flex: 1 1 100%; }
@media (min-width: 768px) {
  .import-item-page .import-todo .import-reason-row { flex-wrap: nowrap; }
}
/* N2 (smoke 26 Nov, 390 px with a fine pointer measured 34 px): at phone width the button keeps a 44 px target whatever
   the pointer; the bottoms stay aligned */
@media (max-width: 767px) {
  .import-item-page .import-reason-row > .import-fix-btn { min-height: 44px; }
}
.import-item-page .import-todo .import-may-contain, .import-item-page .import-todo .import-library-match { border: 0; padding: 0; background: none; }
/* C-6: an error sits under its field, in the error colour with its icon; the field's border follows it (no JS) */
.import-item-page .import-todo-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--status-fail-text); }
.import-item-page .import-todo-error:empty { display: none; }
.import-item-page .import-todo-error::before { content: "!"; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: var(--status-fail); color: var(--text-on-dark); font-size: 10px; line-height: 1; }
.import-item-page .import-todo-keep-form:has(.import-todo-error:not(:empty)) .import-todo-field,
.import-item-page .import-recipe-fields:has(.import-recipe-error:not(:empty)) .input-field,
.import-item-page .import-recipe-fields:has(.import-recipe-error--name:not(:empty)) .import-recipe-input--name,
.import-item-page .import-recipe-fields:has(.import-recipe-error--cooked:not(:empty)) .import-recipe-input--cooked,
.import-item-page .import-recipe-fields:has(.import-recipe-error--servings:not(:empty)) .import-recipe-input--servings,
.import-item-page .import-line-grams:has(.import-todo-error:not(:empty)) .import-number-field,
.import-item-page .import-todo-row:has(.import-todo-error:not(:empty)) .import-reason-field { border-color: var(--status-fail); }
/* C-7: How we read your file, one quiet line */
.import-item-page .import-read-note, .import-file-notes .import-read-note { margin: 0 0 16px; font-size: 12px; color: var(--text-label); }
/* K11 (Figma C1b): the read note is a quiet bordered strip: the info icon, the words, then Show details right aligned */
.import-item-page .import-read-note-line, .import-file-notes .import-read-note-line { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-primary); }
.import-item-page .import-read-note-icon, .import-item-page .import-read-note-line > svg, .import-file-notes .import-read-note-icon, .import-file-notes .import-read-note-line > svg { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 1px; color: var(--text-label); }
.import-item-page .import-read-note-text, .import-file-notes .import-read-note-text { flex: 1 1 auto; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.import-item-page .import-read-note-more, .import-file-notes .import-read-note-more { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.import-item-page .import-read-note-lead, .import-file-notes .import-read-note-lead { font-weight: 600; color: var(--text-primary); }
.import-item-page .import-read-note-details, .import-file-notes .import-read-note-details { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--border-primary); border-radius: 14px; background: var(--bg-primary); }
.import-item-page .import-read-note-title, .import-file-notes .import-read-note-title { margin: 0; font-size: 12px; font-weight: 700; color: var(--text-primary); }
.import-item-page .import-read-note-words, .import-file-notes .import-read-note-words { margin: 0; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-read-note-notes, .import-file-notes .import-read-note-notes { margin: 0; padding-left: 18px; }
.import-item-page .import-read-note-undo { margin: 0; }
/* C-8: a line's marks: its pill only when it has a problem, the To do box numbers, an allergen it brings */
.import-item-page .import-line-mark { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; vertical-align: middle; }
.import-item-page .import-line-mark:empty { display: none; }
.import-item-page .import-line-marker { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-gold); color: var(--text-primary); font-size: 10px; font-weight: 700; text-decoration: none; }
.import-item-page .import-line-allergen { padding: 2px 7px; border-radius: 999px; background: var(--status-warning-bg); color: var(--status-warning-text); font-size: 10px; font-weight: 600; }
.import-item-page .import-line-ingredient .import-landing-sub { margin: 0 6px 0 0; }
/* C-9: the recipe's fields as a grid: labels one row, inputs one row, Save on the inputs' row, the kg hint under Cooked weight */
.import-item-page .import-recipe-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "l-name l-cooked l-servings ." "name cooked servings save" ". hint . saved" "e-name e-cooked e-servings ." "error error error error"; align-items: center; gap: 4px 10px; }
.import-item-page .import-recipe-label--name { grid-area: l-name; }
.import-item-page .import-recipe-label--cooked { grid-area: l-cooked; }
.import-item-page .import-recipe-label--servings { grid-area: l-servings; }
.import-item-page .import-recipe-input--name { grid-area: name; }
.import-item-page .import-recipe-input--cooked { grid-area: cooked; }
.import-item-page .import-recipe-input--servings { grid-area: servings; }
.import-item-page .import-recipe-fields .import-save-btn { grid-area: save; justify-self: start; }
.import-item-page .import-recipe-hint { grid-area: hint; font-size: 11px; color: var(--text-label); }
.import-item-page .import-recipe-fields .import-saved { grid-area: saved; align-self: center; padding: 0; }
.import-item-page .import-recipe-error { grid-area: error; }
/* K8: each field's error under its own field */
.import-item-page .import-recipe-error--name { grid-area: e-name; }
.import-item-page .import-recipe-error--cooked { grid-area: e-cooked; }
.import-item-page .import-recipe-error--servings { grid-area: e-servings; }
/* smoke: Save is as tall as the inputs (34 px) */
.import-item-page .import-recipe-fields .import-save-btn { box-sizing: border-box; height: 34px; min-height: 34px; padding-top: 0; padding-bottom: 0; }
.import-item-page .import-recipe-fields .import-number-field { width: 100%; }
/* C-10: What we read is a quiet card; C-12: its body opens with Show on a phone and is always open from 768 px */
.import-item-page .import-read-col { box-shadow: none; background: var(--bg-primary); border: 1px solid var(--border-primary); }
.import-item-page .import-read-body { display: flex; flex-direction: column; gap: 8px; }
.import-item-page .import-read-body[hidden] { display: none; }
@media (min-width: 768px) {
  .import-item-page .import-read-body[hidden] { display: flex; }
  .import-item-page .import-read-toggle { display: none; }
}
/* C-11: the footer's missing count is plain text */
.import-item-page .import-item-missing-words { font-size: 13px; font-weight: 600; color: var(--text-label); }
/* C-12: 390 px: To do stacked full width with full-width main buttons, the fields stacked, What we read last */
@media (max-width: 767px) {
  .import-item-page .import-todo-box { padding: 12px; }
  .import-item-page .import-todo-actions { flex-direction: column; align-items: stretch; }
  .import-item-page .import-todo-actions .import-fix-btn--main { width: 100%; justify-content: center; }
  .import-item-page .import-todo-actions .import-todo-link { align-self: flex-start; }
  .import-item-page .import-recipe-fields { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l-name" "name" "e-name" "l-cooked" "cooked" "hint" "e-cooked" "l-servings" "servings" "e-servings" "save" "saved" "error"; }
  .import-item-page .import-recipe-fields .import-save-btn { justify-self: stretch; }
  .import-item-page .import-read-col { order: 2; }
  .import-item-page .import-canoli-col { order: 1; }
}
/* K11 (Figma C1 2338:8533): box links carry their lucide icons; the Keep disclosure's chevron turns when it is open */
.import-item-page a.import-todo-link, .import-item-page .import-todo-keep > .import-todo-link, .import-item-page button.import-todo-link[data-ingredient-tray] { display: inline-flex; align-items: center; gap: 4px; }
.import-item-page .import-todo-link-icon, .import-item-page .import-todo-link > svg { flex: 0 0 auto; width: 14px; height: 14px; }
.import-item-page .import-todo-keep > .import-todo-link > svg { transition: transform 0.15s ease; }
.import-item-page .import-todo-keep > .import-todo-link[aria-expanded="true"] > svg { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .import-item-page .import-todo-keep > .import-todo-link > svg { transition: none; } }
/* K11: two or more boxes sit in two columns at desktop width */
@media (min-width: 1024px) {
  .import-item-page .import-todo--cols .import-todo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px; }
}
/* smoke (1280 and 1440): a line with a pill and a marker wraps in its status cell, so the line menu stays inside the card */
.import-item-page .import-line-status { white-space: normal; }
.import-item-page .import-line-status .import-line-mark { max-width: 100%; }
.import-item-page .import-line-status .import-line-pill { white-space: nowrap; }
/* smoke: a line's grams error is the normal error text, not the grams cell's monospace */
.import-item-page .import-line-grams .import-todo-error { font-family: var(--font-primary); }
/* smoke, Figma C4 (390 px): a box's main button spans the box (under the number disc too: 24 px disc + 12 px gap), and a
   line's marks and menu sit at its top right */
@media (max-width: 767px) {
  .import-item-page .import-todo-actions .import-fix-btn--main { width: calc(100% + 36px); margin-left: -36px; }
  .import-item-page .import-lines-table tr.import-line-row { position: relative; }
  .import-item-page .import-lines-table td.import-line-file { box-sizing: border-box; padding-right: 148px; }
  .import-item-page .import-lines-table td.import-line-status { position: absolute; top: 10px; right: 32px; display: flex; align-items: center; justify-content: flex-end; gap: 4px; width: auto; max-width: 116px; padding: 0; }
  .import-item-page .import-line-status .import-line-mark { flex-wrap: nowrap; }
  /* V7: the menu's own cell sits at the row's top right, beside the marks */
  .import-item-page .import-lines-table td.import-line-menu-cell { position: absolute; top: 10px; right: 0; width: auto; padding: 0; }
  .import-item-page .import-line-menu-cell .import-line-menu[open] .import-line-menu-items { position: absolute; right: 0; }
}
.import-choice-hint { display: block; font-size: 12px; color: var(--text-label); }
.import-library-words { /* IMPORT-001 1c-1 C-14: the re-import guard's sentence */ margin: 0 0 8px; font-size: 14px; }
.import-library-diff-title { /* 1c-1 P10: the I14 side by side */ margin: 8px 0 4px; font-size: 13px; font-weight: 600; }
.import-library-diff { margin: 0 0 8px; padding-left: 18px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-item-picker:empty, .import-supplier-allergens:empty, .import-may-contain-wrap:empty, .import-library-matches:empty { display: none; }
.import-flag-link:hover, .import-flag-link:focus-visible { color: var(--brand-clay); }
.import-flag--blocked, .import-flag--needs_look { color: var(--status-fail-text); }
.import-item-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
/* Z28: Set aside and Bring back are 44 px touch targets */
.import-item-action .btn-sm { min-height: 44px; }
/* IMPORT-001 3d D1: many at once. The bar sits above the table; the checkbox cell is a 44 px target. */
.import-bulk-bar { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border-divider); border-radius: 8px; }
.import-bulk-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; border: 0; }
.import-bulk-actions legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.import-bulk-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.import-bulk-buttons .btn-sm, .import-bulk-undo .btn-sm { min-height: 44px; }
.import-bulk-result:empty, .import-bulk-note:empty { display: none; }
.import-bulk-result, .import-bulk-note { margin: 0; font-size: 13px; }
.import-bulk-undo { margin: 0 0 12px; }
.import-table td.import-bulk-cell { width: 44px; padding: 0; vertical-align: middle; text-align: center; }
.import-bulk-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
/* Pack B3 (K-13): servings per pack on the Recipes tab; the bar reuses .import-bulk-bar */
.import-spp-label { font-weight: 600; }
.import-spp-field { max-width: 10rem; min-height: 44px; }
.import-table td.import-spp-cell { white-space: nowrap; }
.import-spp-hit { gap: 6px; justify-content: flex-start; }
.import-spp-note { display: block; color: var(--text-label); font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.import-bulk-check { width: 20px; height: 20px; margin: 0; cursor: pointer; }

/* IMPORT-001 4b (B2): the Adopt window, progress, result and the Adopted panel */
.import-adopt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.import-adopt-pick { display: inline-flex; margin: 0; }
.import-adopt-slot:empty { display: none; }
.import-adopt-window { box-sizing: border-box; width: 100%; max-width: 100%; margin: 12px 0; padding: 16px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-surface); }
.import-adopt-heading { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
.import-adopt-list { margin: 0; padding-left: 20px; }
.import-adopt-list li { margin: 4px 0; }
.import-adopt-name { font-weight: 600; overflow-wrap: break-word; word-break: normal; }
.import-adopt-why { color: var(--text-label); }
.import-adopt-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.import-adopt-option { display: flex; align-items: center; gap: 8px; min-height: 44px; flex-basis: 100%; }
.import-adopt-undo { flex-basis: 100%; margin: 0; color: var(--text-label); }
.import-adopt-button { min-height: 44px; min-width: 44px; }
.import-adopt-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.import-adopt-check { width: 20px; height: 20px; margin: 0; cursor: pointer; }
.import-adopt-note { color: var(--text-label); }
.import-adopted-panel { margin-top: 16px; }
.import-reimport { /* IMPORT-001 1c-1 I16: a re-import compared with the earlier imports */ margin: 0 0 12px; }
.import-reimport-lines { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.import-retention-note { /* IMPORT-001 1c-1 C-2: when staged items clear, Keep, or that they were cleared */ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: var(--text-label); }
.import-report-sentence { /* IMPORT-001 4c C3: the migration report (I34) */ margin: 0 0 12px; font-weight: 600; }
.import-report-band { margin-top: 16px; overflow-wrap: break-word; }
.import-tap-target { /* 4c Z3: a link or small button that must still be a 44 px target */ display: inline-flex; align-items: center; min-height: 44px; }
.import-bulk-bar .import-reason-field { flex: none; } /* W15: the 20 px box sits in a 44 px tap target; in the bar's column the reason field keeps its height */
.import-flag-filters[hidden] { display: none; }
/* IMPORT-001 3d D2: when nothing fits, Ask us and Create my own in the picker */
.import-nothing-fits { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-divider); }
.import-ask-us { margin: 0; }
.import-ask-us .btn-sm, .import-create-own .btn-sm { min-height: 44px; }
.import-create-own summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.import-own-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 8px 12px; }
.import-own-value { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-label); }
/* IMPORT-001 3b: the label check bar on the item page (frame I5) */
.import-label-bar { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-divider); }
.import-label-cols { /* Y10: each column at least 240 px, so the two stack in a narrow card */ display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.import-label-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.import-label-col-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-label); }
.import-label-values { display: grid; grid-template-columns: minmax(0, max-content) minmax(120px, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.import-label-values dt { color: var(--text-label); }
.import-label-values dd { margin: 0; overflow-wrap: anywhere; }
.import-label-checking { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text-label); }
.import-label-checking svg, .import-label-checking i { width: 14px; height: 14px; animation: spin 1s linear infinite; }
.import-label-caveat { margin: 0; font-size: 12px; color: var(--text-label); }
.import-label-hold, .import-label-settled, .import-label-note { margin: 0; font-size: 13px; color: var(--text-primary); }
@media (prefers-reduced-motion: reduce) { .import-label-checking svg, .import-label-checking i { animation: none; } }
.import-label { font-size: 13px; color: var(--text-secondary); }
.import-reason-input { flex: 1; font-family: inherit; font-size: 14px; font-weight: 400; }
.import-reading-count { font-weight: 600; }

/* Import status: tones, pills, tiles, progress (UI-C). One vocabulary: pass, warn, fail, wait, busy. Words always sit
   beside the colour. */
.import-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-muted); color: var(--text-secondary); white-space: nowrap; }
.import-pill svg, .import-pill i { width: 12px; height: 12px; }
.import-pill--pass { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-pill--warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-pill--fail { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-pill--wait { background: var(--bg-muted); color: var(--text-secondary); }
.import-pill--busy { background: var(--bg-muted); color: var(--text-primary); }
.import-tiles { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.import-tile { display: block; padding: 16px 20px; border: 1px solid var(--border-divider); border-radius: var(--radius-card, 12px); background: var(--bg-muted); color: var(--text-secondary); }
.import-tile--pass { background: var(--status-pass-bg); border-color: var(--status-pass); color: var(--status-pass-text); }
.import-tile--warn { background: var(--status-warning-bg); border-color: var(--status-warning); color: var(--status-warning-text); }
.import-tile--fail { background: var(--status-fail-bg); border-color: var(--status-fail); color: var(--status-fail-text); }
.import-tile--wait { background: var(--bg-muted); border-color: var(--border-primary); color: var(--text-secondary); }
.import-tile--busy { background: var(--bg-muted); border-color: var(--brand-espresso); color: var(--text-primary); }
/* a tile at 0 asks nothing of the person: no tone */
.import-tile--neutral { background: var(--bg-muted); border-color: var(--border-divider); color: var(--text-label); }
/* Figma I4.07: a count tile is a content-sized row, number and label side by side, no border, both in the tone text. */
.import-tile-row { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 8px 16px 8px 14px; border: 0; border-radius: var(--radius-card-sm); line-height: normal; }
.import-tile-n { display: block; font-family: var(--font-display, inherit); font-size: 26px; font-weight: 700; line-height: normal; color: inherit; }
.import-tile-n--pass, .import-tile-label--pass { color: var(--status-pass-text); }
.import-tile-n--warn, .import-tile-label--warn { color: var(--status-warning-text); }
.import-tile-n--fail, .import-tile-label--fail { color: var(--status-fail-text); }
.import-tile-n--wait, .import-tile-label--wait { color: var(--text-secondary); }
.import-tile-n--neutral, .import-tile-label--neutral { color: var(--text-label); }
.import-tile-label { display: block; font-size: 13px; font-weight: 500; line-height: normal; color: inherit; }
.import-tile-sub { display: block; font-size: 12px; color: var(--text-secondary); }
.import-progress { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 4px; border: 0; border-radius: 999px; overflow: hidden; background: var(--border-divider); }
.import-progress::-webkit-progress-bar { background: var(--border-divider); }
.import-progress::-webkit-progress-value { background: var(--border-primary); }
.import-progress::-moz-progress-bar { background: var(--border-primary); }
.import-progress--pass::-webkit-progress-value { background: var(--status-pass); }
.import-progress--pass::-moz-progress-bar { background: var(--status-pass); }
.import-progress--warn::-webkit-progress-value { background: var(--status-warning); }
.import-progress--warn::-moz-progress-bar { background: var(--status-warning); }
.import-progress--fail::-webkit-progress-value { background: var(--status-fail); }
.import-progress--fail::-moz-progress-bar { background: var(--status-fail); }
.import-progress--wait::-webkit-progress-value { background: var(--border-primary); }
.import-progress--wait::-moz-progress-bar { background: var(--border-primary); }
.import-progress--busy::-webkit-progress-value { background: var(--brand-espresso); }
.import-progress--busy::-moz-progress-bar { background: var(--brand-espresso); }

/* The reading page (I3): a main card and the "What happens now" aside. */
.import-reading-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) { .import-reading-layout { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); } }
.import-reading-main, .import-reading-aside { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; border: 1px solid var(--border-divider); border-radius: var(--radius-card, 12px); background: var(--bg-surface); }
.import-reading-title { margin: 0; font-size: 18px; font-weight: 600; }
.import-reading-note { margin: 0; font-size: 13px; color: var(--text-secondary); }
.import-reading-file { flex-direction: column; justify-content: flex-start; }
.import-reading-file-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.import-reading-detail { font-size: 12px; color: var(--text-secondary); }
/* W3-2: the pinned bar spans both columns; files already read fold into one row. */
.import-reading-layout > .import-upload-bar { grid-column: 1 / -1; }
.import-reading-fold { display: flex; flex-direction: column; gap: 6px; list-style: none; }
.import-reading-fold-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--border-divider); border-radius: 8px; background: var(--bg-surface); }
.import-reading-fold-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-reading-fold-rows { margin: 0; padding: 0; }
.import-reading-fold-rows[hidden] { display: none; }
.import-reading-group { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; font-size: 13px; }
.import-reading-group-title { margin: 0; font-weight: 600; color: var(--text-label); }
.import-checklist { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.import-checklist-item { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.import-checklist-item svg, .import-checklist-item i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.import-checklist-item--done { color: var(--status-pass-text); }
.import-checklist-item--current { color: var(--text-primary); font-weight: 600; }
.import-checklist-item--todo { color: var(--text-secondary); }

/* IMPORT-001 UI-E2: the review landing (Figma I4), the Spec sheets tab (I8) and the not-read panel (I11). Tokens only. */
.import-tab-bar { display: flex; flex-direction: column; gap: 16px; }
.import-band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
/* Figma I4.06: the summary band is a white row, no border, no shadow. */
.import-band.import-landing-summary { gap: 10px; padding: 12px; border: 0; border-radius: var(--radius-band); background: var(--bg-surface); box-shadow: none; }
.import-band .import-tiles { flex: 0 1 auto; }
.import-ledger { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border: 1px solid var(--border-divider); border-radius: var(--radius-card-sm); background: var(--bg-surface); font-size: 13px; color: var(--text-secondary); }
.import-dropped-card { background: var(--bg-surface); border-color: var(--border-primary); }
.import-ledger-placed { color: var(--text-secondary); }
.import-dropped-card { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-row); background: none; }
.import-dropped-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.import-dropped-icon { flex: none; width: 16px; height: 16px; color: var(--text-primary); }
.import-dropped-icon--pass { color: var(--status-pass-text); }
.import-dropped-icon--warn { color: var(--status-warning-text); }
.import-dropped-title { font-size: 12px; font-weight: 600; line-height: normal; color: var(--text-primary); }
.import-dropped-sub { font-size: 11px; font-weight: 400; line-height: normal; color: var(--text-secondary); }
.import-dropped-sub a { color: var(--text-secondary); text-decoration: underline; }
.import-create { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.import-create form { display: flex; align-items: center; gap: 8px; margin: 0; }
/* Figma I4.09: the Create button. */
.import-create .btn-primary { gap: 8px; padding: 11px 20px 11px 16px; border-radius: var(--radius-chip, 999px); background: var(--brand-espresso); color: var(--text-on-dark); font-size: 13px; font-weight: 600; line-height: normal; }
.import-create .btn-primary i, .import-create .btn-primary svg { width: 16px; height: 16px; }
.import-all-made { margin: 0; font-weight: 600; color: var(--status-pass-text); }
/* PR B round 3 (C1): the box shares the row with the line under the tiles; its basis is capped so the note (which wraps
   under the buttons) never widens it onto a row of its own */
.import-create { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; max-width: 480px; }
.import-create-note, .import-create-checking { margin: 0; flex: 1 1 100%; text-align: right; font-size: 13px; color: var(--text-label); }
.import-create .btn-primary { text-decoration: none; }
.import-drafts-result { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--border-divider); border-radius: var(--radius-card, 12px); background: var(--bg-surface); font-size: 14px; }
.import-drafts-result-text { color: var(--text-primary); }
.import-drafts-result a { font-weight: 600; }
.import-drafts-undo { margin: 0 0 0 auto; }
.import-drafts-note { margin: 0 0 12px; font-size: 14px; color: var(--text-label); }
.import-redo-form { margin: 8px 0 0; }
.import-done-next .import-done-words { flex: 1 1 auto; }
/* D5: the layout's own width decides, not the window, so the sidebar state does not matter. Two columns need the table
   pane to hold the Recipe column (160px) beside the fixed 430px of the other four; below that the list stacks above the table. */
.import-landing-frame { container-type: inline-size; }
.import-landing-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@container (min-width: 1100px) {
  .import-landing-layout { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
}
.import-sort-out { display: flex; flex-direction: column; gap: 2px; padding: 20px 18px 16px; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); }
.import-sort-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.import-sort-head h2 { margin: 0; font-family: var(--font-display, inherit); font-size: 20px; font-weight: 600; line-height: normal; color: var(--text-primary); }
/* item 23 (Figma 2183:7196): a plain small label in the body font */
.import-sort-hint { font-size: 12px; font-weight: 400; line-height: normal; color: var(--text-label); }
.import-sort-list { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.import-sort-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius-card-sm); background: transparent; }
.import-sort-row:first-child { background: var(--bg-primary); }
/* item 23: the card's row actions are secondary (outlined); the one dark button is the summary bar's */
.import-sort-row .btn-sm { flex: none; padding: 7px 14px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip, 999px); background: var(--bg-surface); color: var(--text-primary); font-size: 12px; font-weight: 600; line-height: normal; }
.import-sort-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary); }
.import-sort-icon svg, .import-sort-icon i { width: 15px; height: 15px; }
.import-sort-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.import-sort-why { margin: 0; font-size: 12px; font-weight: 400; line-height: 1.4; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-family-icon--save-first, .import-family-icon--photos, .import-family-icon--other { background: var(--bg-muted); color: var(--text-secondary); }
.import-family-icon--names, .import-family-icon--moved, .import-family-icon--no-amount, .import-family-icon--missing-values { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-family-icon--sheets-failed, .import-family-icon--sheets-skipped { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-family-icon--flag-r3, .import-family-icon--unplaced { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-sort-words { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; font-weight: 600; line-height: normal; color: var(--text-primary); overflow-wrap: anywhere; }
.import-sort-row--save-first .import-sort-words { color: var(--text-secondary); }
.import-sort-empty { margin: 0; font-size: 14px; color: var(--text-secondary); }
/* cascade #5 (27 Nov 2026): How we read your file once per file under the Recipes tab, the item page's strip (import-read-note) */
.import-file-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.import-file-notes .import-read-note { margin: 0; }
/* cascade #7 (27 Nov 2026): the answers left at the top of What needs you, the recipes second; under each row what one answer fixes */
.import-sort-total { margin: 0; font-size: 13px; line-height: normal; color: var(--text-secondary); }
.import-sort-total-n { font-weight: 600; color: var(--text-primary); }
.import-sort-fixes { font-weight: 600; color: var(--text-primary); }
/* PR B (Figma B1, B1b, B3): the line under the tiles and the one butter button beside it; creating drafts early is a quiet
   link after the button (round 3, C2: the visual order is the DOM's). What needs you: a row per check on a warm card with its count in a disc, then the Waiting group. */
.import-next-row { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 16px; padding: 4px 6px 0; }
.import-tiles-line { flex: 1 1 280px; min-width: 0; margin: 0; font-size: 15px; line-height: 1.4; color: var(--text-primary); }
.import-create .btn-primary.btn-butter { background: var(--brand-gold); color: var(--text-primary); }
.import-create .btn-primary.btn-butter:hover { background: var(--brand-gold-hover); }
.import-create-link { padding: 0; border: 0; background: none; font: inherit; font-size: 13px; cursor: pointer; }
.import-sort-list { gap: 8px; }
.import-sort-row, .import-sort-row:first-child { background: var(--bg-primary); }
.import-sort-count { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 32px; height: 32px; padding: 0 6px; box-sizing: border-box; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-primary); font-size: 14px; font-weight: 700; }
.import-sort-group { margin: 14px 8px 4px; font-family: var(--font-mono, inherit); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-label); }
.import-sort-row--wait .import-sort-words { color: var(--text-primary); }
.import-recipes { position: relative; display: flex; flex-direction: column; gap: 0; padding: 18px 20px 10px; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); min-width: 0; }
.import-results { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.import-recipes > .import-search { position: absolute; top: 18px; right: 20px; }
.import-results .import-toolbar { padding-right: 146px; padding-bottom: 12px; }
.import-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.import-recipes .import-chips { flex: 1 1 auto; min-width: 0; }
.import-chip-code { background: var(--bg-muted); }
.import-search { display: flex; align-items: center; gap: 6px; width: 130px; margin: 0; padding: 7px 12px 7px 10px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip, 999px); background: var(--bg-surface); }
.import-search:focus-within { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-search-icon { flex: none; width: 14px; height: 14px; color: var(--text-secondary); pointer-events: none; }
.import-search-input { flex: 1 1 auto; min-width: 0; width: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; color: var(--text-primary); font-size: 12px; font-weight: 400; line-height: normal; }
.import-search-input::placeholder { color: var(--text-placeholder); opacity: 1; }
.import-landing-table { width: 100%; table-layout: fixed; border-spacing: 0; font-size: 13px; }
.import-landing-table th { padding: 4px 0 8px; border: 0; background: none; font-family: var(--font-primary, inherit); font-size: 9px; font-weight: 700; letter-spacing: 0.72px; line-height: normal; text-align: left; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; }
.import-landing-table th:nth-child(2) { width: 54px; }
.import-landing-table th:nth-child(3) { width: 150px; }
.import-landing-table th:nth-child(4) { width: 92px; }
.import-landing-table th:nth-child(5) { width: 134px; }
.import-landing-table th:first-child, .import-landing-table td:first-child { padding-left: 6px; }
.import-landing-table th:last-child, .import-landing-table td:last-child { padding-right: 6px; }
.import-landing-table td { padding: 10px 0; border-bottom: 1px solid var(--border-divider); vertical-align: middle; overflow-wrap: anywhere; line-height: normal; color: var(--text-primary); }
.import-landing-table tbody tr:last-child td { border-bottom: 0; }
.import-landing-table tbody tr:first-child td { background: var(--bg-primary); }
.import-landing-table tbody tr:first-child td:first-child { border-top-left-radius: var(--radius-row-sm); border-bottom-left-radius: var(--radius-row-sm); }
.import-landing-table tbody tr:first-child td:last-child { border-top-right-radius: var(--radius-row-sm); border-bottom-right-radius: var(--radius-row-sm); }
.import-landing-table a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.import-landing-table a:hover, .import-landing-table a:focus-visible { text-decoration: underline; }
.import-landing-name { font-size: 13px; font-weight: 600; }
.import-landing-sub { margin-left: 6px; padding: 2px 7px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary); font-size: 10px; font-weight: 600; white-space: nowrap; }
.import-landing-short { color: var(--status-warning-text); }
.import-landing-table td[data-label="Matched"] { font-family: var(--font-mono, inherit); font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.import-landing-energy { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono, inherit); font-size: 12px; }
.import-landing-old { font-weight: 400; color: var(--text-secondary); }
.import-landing-new { font-weight: 500; color: var(--text-primary); }
.import-landing-moved .import-landing-pct { color: var(--status-fail-text); }
.import-landing-pct { font-family: var(--font-mono, inherit); font-size: 11px; font-weight: 500; color: var(--text-label); }
.import-landing-arrow { font-family: var(--font-primary, inherit); font-size: 12px; color: var(--text-label); }
.import-landing-arrow svg, .import-landing-arrow i { width: 12px; height: 12px; vertical-align: middle; color: var(--text-label); }
.import-landing-grades { display: flex; align-items: center; gap: 6px; }
.import-landing-empty { margin: 0; padding: 16px 0; font-size: 14px; color: var(--text-secondary); }
.import-landing-note { margin: 0; font-size: 12px; color: var(--text-secondary); }
.import-grade { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border-radius: var(--radius-chip-sm); background: var(--bg-muted); color: var(--text-primary); font-family: var(--font-mono, inherit); font-size: 11px; font-weight: 500; line-height: normal; }
.import-grade--c, .import-grade--unknown { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-grade--d, .import-grade--e { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 6px 4px; font-size: 12px; font-weight: 400; line-height: normal; color: var(--text-label); }
.import-pager-first { display: inline-flex; align-items: center; gap: 8px; }
.import-pager-first svg, .import-pager-first i { width: 14px; height: 14px; }
.import-pager-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.import-pager a { color: var(--text-primary); font-size: 12px; font-weight: 600; text-decoration: none; }
.import-pager a:hover, .import-pager a:focus-visible { text-decoration: underline; }
.import-sheets { display: flex; flex-direction: column; gap: 12px; }
.import-sheets-summary { margin: 0; font-size: 14px; color: var(--text-primary); }
.import-sheet-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-sheet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px; border: 1px solid var(--border-divider); border-radius: var(--radius-card-sm); background: var(--bg-surface); font-size: 13px; }
.import-sheet-main { display: flex; flex: 1 1 260px; flex-direction: column; gap: 4px; min-width: 0; }
.import-sheet-name { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-sheet-words { margin: 0; color: var(--text-secondary); }
.import-sheet-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.import-sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-sheet-actions form { margin: 0; }
/* the button's label and icon sit inside this wrapper, so it lines them up itself */
.import-sheet-add-idle { display: inline-flex; align-items: center; gap: 4px; }
.import-sheet-add-busy { display: none; }
form.htmx-request .import-sheet-add-idle { display: none; }
form.htmx-request .import-sheet-add-busy { display: inline; }
.import-sheet-group { margin: 0 0 20px; }
.import-sheet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 8px; }
.import-sheet-head form { margin: 0; }
.import-sheet-group-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.import-sheet-card .import-sheet-main { flex: 1 1 260px; }
.import-sheet-name { font-weight: 600; color: var(--text-primary); }
.import-sort-first { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border-divider); border-radius: var(--radius-card, 12px); background: var(--bg-muted); }
.import-sort-first-words { margin: 0; flex: 1 1 320px; font-size: 14px; color: var(--text-primary); }
.import-locked-panel { margin: 0 0 16px; }
.import-text-link { color: var(--text-primary); font-weight: 600; text-decoration: underline; }
/* the pager's Previous / Next, the source file link and the Check link of a name: the same link style */
.import-pager-link, .import-source-file, .import-strong-check-link { color: var(--text-primary); font-weight: 600; text-decoration: underline; }
.import-pager-link:hover, .import-source-file:hover, .import-strong-check-link:hover { color: var(--text-secondary); }
.import-strong-check-link { margin-left: 6px; font-size: 12px; }
.import-text-link:hover, .import-text-link:focus-visible { color: var(--brand-clay); }
@media (max-width: 480px) {
  .import-sheet-card { flex-direction: column; align-items: stretch; gap: 8px; }
  .import-sheet-card .import-sheet-main { flex: 0 0 auto; }
}
.import-sheets-result { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--border-divider); border-radius: var(--radius-card, 12px); background: var(--bg-surface); font-size: 14px; color: var(--text-primary); }
.import-failures--fail { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 2px solid var(--status-fail); border-radius: var(--radius-card-sm); background: var(--status-fail-bg); }
.import-failures-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--status-fail-text); }
.import-failures-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-failures-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border-divider); }
.import-failures-name { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-failures-cause { margin: 0; color: var(--status-fail-text); font-size: 13px; }
/* a long status ("Waiting: Grams worked out") wraps inside its cell instead of running past the card */
.import-landing-table .import-pill { gap: 5px; padding: 4px 10px; font-size: 11px; font-weight: 600; white-space: normal; max-width: 100%; }

/* the landing's phone rules: one query text of its own */
@media screen and (max-width: 767px) {
  /* tabs and chips wrap on a phone: a nowrap scroller cut them off with no cue */
  .import-tabs, .import-chips, .import-recipes .import-chips { flex-wrap: wrap; min-width: 0; }
  .import-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-band .import-tiles { flex: 1 1 100%; }
  .import-ledger { flex: 1 1 100%; }
  .import-create { flex: 1 1 100%; margin-left: 0; max-width: none; }
  .import-create form, .import-create .btn-primary { flex: 1 1 100%; justify-content: center; }
  .import-create-note { text-align: center; }
  .import-search { flex: 1 1 100%; width: auto; }
  .import-recipes > .import-search { position: static; }
  .import-results .import-toolbar { padding-right: 0; }
  .import-search-input { width: 100%; }
  .import-landing-table, .import-landing-table tbody { display: block; }
  .import-landing-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .import-landing-table tr { display: block; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--border-divider); border-radius: var(--radius-card-sm); background: var(--bg-surface); }
  .import-landing-table td, .import-landing-table td:first-child, .import-landing-table td:last-child { display: block; padding: 4px 0; border-bottom: 0; }
  .import-landing-table tbody tr:first-child td { background: none; }
  .import-landing-energy, .import-landing-grades { display: inline-flex; }
  .import-landing-table td::before { content: attr(data-label); display: block; font-family: var(--font-mono, inherit); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-label); }
  .import-landing-name { min-width: 0; }
  .import-sheet-row { flex-direction: column; align-items: flex-start; }
}

/* The Figma I4 sizes are for a pointer; on a touch screen the landing's controls keep a 44px target. */
@media (pointer: coarse) {
  .import-tab, .import-results .import-chip, .import-search { min-height: 44px; }
  .import-sort-row .btn-sm, .import-create .btn-primary { min-height: 44px; }
}
/* Smoke: the file strips' Show details (landing and item page) and the What needs you Check buttons keep a 44px target on touch and up to tablet width; desktop layout is unchanged. */
@media (pointer: coarse), (max-width: 1024px) {
  .import-file-notes .import-todo-link, .import-item-page .import-read-note-more .import-todo-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
  .import-sort-row .btn-sm { min-height: 44px; }
}
/* IMPORT-001 UI-F2 (I13): the names tabs (scoped to #import-name-tabs so the landing tabs keep their own look) and the strong suggestions table. Tokens only. */
#import-name-tabs.import-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; border-bottom: 1px solid var(--border-divider); }
#import-name-tabs .import-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px; color: var(--text-secondary); font-size: 14px; text-decoration: none; border-bottom: 2px solid var(--bg-surface); }
#import-name-tabs .import-tab--on { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--text-primary); }
.import-strong { display: flex; flex-direction: column; gap: 12px; }
.import-strong-result { padding: 10px 12px; border-radius: 8px; background: var(--status-pass-bg); color: var(--status-pass-text); font-size: 14px; }
.import-strong-result p { margin: 0; }
.import-strong-used { font-weight: 600; }
.import-strong-skipped { margin: 6px 0 0; padding-left: 18px; }
.import-strong-reason { color: var(--text-label); }
.import-strong-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 8px; }
.import-strong-help { margin: 0; color: var(--text-label); font-size: 13px; }
.import-strong-scroll { overflow-x: auto; }
.import-strong-capped { margin: 8px 0 0; color: var(--text-label); font-size: 13px; }
.import-strong-gone-name { font-weight: 600; }
.import-strong-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.import-strong-table th { text-align: left; padding: 8px; color: var(--text-label); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border-divider); }
.import-strong-table td { padding: 8px; vertical-align: middle; border-bottom: 1px solid var(--border-divider); overflow-wrap: anywhere; }
.import-strong-box { width: 20px; height: 20px; }
.import-strong-name { font-weight: 600; cursor: pointer; display: inline-block; min-height: 44px; line-height: 44px; }
.import-strong-used-in { white-space: nowrap; color: var(--text-secondary); }
.import-strong-scroll:not(.import-strong--all) .import-strong-row--more { display: none; }
.import-strong-show { min-height: 44px; margin-top: 8px; }
.import-strong-footer { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 0; background: var(--bg-surface); border-top: 1px solid var(--border-primary); }
.import-strong-tally { margin: 0; font-weight: 600; }
.import-strong-hint { margin: 0 auto 0 0; color: var(--text-label); font-size: 12px; }
.import-strong-use { min-height: 44px; }
.import-strong-use[disabled] { opacity: 0.5; cursor: not-allowed; }

/* IMPORT-001 SPEC-NAMES: the names page (Figma I6) and the Strong suggestions tab (Figma I13) to the measured spec.
   Tokens only. Rendered colours, not variable-def hexes (spec section 0). Scoped to .imports-page--names so the review
   page keeps its own rules. Compact sizes apply to fine pointers; touch keeps the 44 px targets of the rules above. */

/* Header: breadcrumb, title, helper, and the progress block with the stepper under it. */
.imports-page--names .import-header { align-items: flex-start; }
.imports-page--names .import-header-main { gap: 8px; }
.imports-page--names .import-crumbs { gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.imports-page--names .import-back { gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.imports-page--names .import-crumb-name { color: var(--text-secondary); }
.imports-page--names .import-header .page-title { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: normal; color: var(--text-primary); }
.imports-page--names .import-sub { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.import-name-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; margin-left: auto; }
.imports-page--names .import-name-progress { align-self: auto; align-items: flex-end; gap: 6px; min-width: 220px; }
.imports-page--names .import-name-progress-text { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.imports-page--names .import-progress { width: 220px; height: 6px; border-radius: 999px; background: var(--border-divider); }
.imports-page--names .import-progress::-webkit-progress-bar { border-radius: 999px; background: var(--border-divider); }
.imports-page--names .import-progress::-webkit-progress-value { border-radius: 999px; }
.imports-page--names .import-progress::-moz-progress-bar { border-radius: 999px; }
@media (max-width: 767px) {
  .import-name-aside { align-items: stretch; width: 100%; }
  .imports-page--names .import-name-progress { align-items: stretch; min-width: 0; }
  .imports-page--names .import-progress { width: 100%; }
}

/* Mode strip (I13.01). */
.import-modes { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 0 0 16px; padding: 4px; overflow-x: auto; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); }
.import-mode { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 7px 14px; border-radius: var(--radius-chip, 999px); background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.import-mode--on { background: var(--bg-surface); color: var(--text-primary); }
.import-mode .import-count { font-size: 12px; font-weight: 600; }

/* Names card (I6.04, I6.05, I6.06, I6.07, I6.08). */
.imports-page--names .import-names-col { padding: 16px 14px; gap: 4px; border-radius: var(--radius-panel, 24px); background: var(--bg-surface); }
.imports-page--names .import-chips { gap: 6px; padding: 0 4px 8px; }
.imports-page--names .import-chip { gap: 6px; padding: 6px 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip, 999px); background: var(--bg-surface); color: var(--text-primary); font-size: 12px; font-weight: 600; }
.imports-page--names .import-chip--on { border-color: var(--brand-espresso); background: var(--brand-espresso); color: var(--text-on-dark); }
.imports-page--names .import-chip .import-count { font-family: var(--font-mono, monospace); font-size: 11px; font-weight: 500; color: var(--text-label); }
.imports-page--names .import-chip--on .import-count { color: var(--text-on-dark); }
.imports-page--names .import-names { gap: 4px; }
.imports-page--names .import-name-row { gap: 0; padding: 10px 12px; border: 1.5px solid transparent; border-radius: var(--radius-row, 12px); background: transparent; }
.imports-page--names .import-name-row:hover { background: var(--bg-primary); }
.imports-page--names .import-name-row--decided { background: transparent; }
.imports-page--names .import-name-row--open, .imports-page--names .import-name-row--open:hover { border-color: var(--text-primary); background: var(--bg-primary); }
.imports-page--names .import-name-line { align-items: center; gap: 10px; flex-wrap: wrap; }
.imports-page--names .import-name-line .import-name-open { flex: 1 1 10rem; flex-wrap: nowrap; gap: 1px; min-height: 40px; }
.imports-page--names .import-name-display { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: normal; }
.imports-page--names .import-name-row .import-name-count { font-size: 11px; font-weight: 400; line-height: normal; color: var(--text-secondary); }
.imports-page--names .import-name-status { flex: 0 1 auto; min-width: 0; max-width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; text-align: left; }
.imports-page--names .import-name-status .import-pill { gap: 5px; padding: 3px 8px; border-radius: var(--radius-chip, 999px); font-size: 10px; font-weight: 600; white-space: nowrap; }
.imports-page--names .import-name-status .import-pill svg, .imports-page--names .import-name-status .import-pill i { width: 11px; height: 11px; }
.import-pill--lower { text-transform: lowercase; }
/* ask only when it matters (Figma M1, M3, 13 Nov): a plain close match's grey "Also says" note; the quiet No state note; the Top line */
.import-also-says { font-size: 11.5px; font-weight: 400; line-height: normal; color: var(--text-secondary); overflow-wrap: anywhere; }
.imports-page--names .import-name-status .import-pill--quiet { padding: 0; background: none; font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.import-name-topline { margin: 1px 0 0; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: normal; color: var(--text-secondary); }
.imports-page--names .import-name-use { padding: 7px 14px; border-radius: var(--radius-button, 999px); background: var(--brand-espresso); color: var(--text-on-dark); font-size: 12px; font-weight: 600; }
.import-name-chevron { flex: none; width: 16px; height: 16px; color: var(--text-primary); }
.import-name-row:not(.import-name-row--open) .import-name-chevron { display: none; }

/* All matched, one next step (all-matched-cta; Figma D1 2316:8305, D2 2316:8624, D3 2316:8723 at 390): the right pane's done panel.
   The tick disc takes the stepper's done colours; the one action is the butter button. On a phone the panel comes above the list
   (the picker column is otherwise a sheet there) and the button is full width. */
.import-names-done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px 24px; text-align: center; }
.import-names-done-tick { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 56px; height: 56px; margin: 0 0 8px; border-radius: var(--radius-chip, 999px); background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-names-done-tick svg, .import-names-done-tick i { width: 28px; height: 28px; }
.import-names-done-title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 35px; color: var(--text-primary); }
.import-names-done-line { margin: 0; max-width: 44ch; font-family: var(--font-primary); font-size: 14px; line-height: normal; color: var(--text-secondary); }
.btn-primary.btn-butter.import-names-done-next { gap: 7px; margin: 28px 0 0; padding: 10px 18px; border-radius: var(--radius-button, 999px); font-size: 13px; line-height: 16px; }
.btn-primary.btn-butter.import-names-done-next:hover { background: var(--brand-gold-hover); }
.btn-primary.btn-butter.import-names-done-next svg, .btn-primary.btn-butter.import-names-done-next i { width: 15px; height: 15px; }
@media (min-width: 768px) {
  .import-names-done { padding: 48px 16px 52px; }
  .import-names-done-title { font-size: 32px; line-height: 40px; }
  .import-names-done-tick { margin-bottom: 12px; }
  .btn-primary.btn-butter.import-names-done-next { margin-top: 36px; }
}
@media (max-width: 767px) {
  .import-names-panes:has(.import-names-done) .import-name-picker-col { display: flex; flex-direction: column; position: static; inset: auto; z-index: auto; order: -1; padding: 0; border-radius: var(--radius-panel, 24px); background: var(--bg-surface); }
  .btn-primary.btn-butter.import-names-done-next { align-self: stretch; min-height: 44px; }
}

/* Decide card (I6.09 to I6.14). */
@media (min-width: 900px) {
  .imports-page--names .import-names-panes { grid-template-columns: 340px minmax(0, 1fr); gap: 16px; }
}
@media (min-width: 768px) {
  .imports-page--names .import-name-picker-col { padding: 24px 24px 20px; border-radius: var(--radius-panel, 24px); background: var(--bg-surface); }
}
.imports-page--names .import-name-picker-pane { padding: 0; border: 0; border-radius: 0; background: transparent; }
.imports-page--names .import-name-picker { gap: 16px; }
.imports-page--names .import-name-picker, .imports-page--names .import-picker-scroll { display: flex; flex-direction: column; }
.imports-page--names .import-picker-scroll { gap: 16px; padding: 6px; margin: -6px; }
.imports-page--names .import-name-row--open .import-name-top-use { display: none; }
.import-impact-name { font-weight: 600; overflow-wrap: anywhere; }
.imports-page--names .import-picker-title { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: normal; color: var(--text-primary); }
.imports-page--names .import-written-as { gap: 8px; margin: 0; font-size: 12px; color: var(--text-secondary); }
.imports-page--names .import-written-as .import-label-caps { font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-secondary); }
.imports-page--names .import-written-chip { padding: 4px 10px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.imports-page--names .import-used-in { margin: 0; font-size: 12px; color: var(--text-secondary); }
.imports-page--names .import-candidates-set { gap: 16px; }
.imports-page--names .import-candidates-set legend.import-label-caps { margin: 0 0 16px; padding: 0; font-size: 9px; font-weight: 700; letter-spacing: 0.72px; text-transform: uppercase; color: var(--text-secondary); }
.imports-page--names .import-candidates-set .import-candidates-subhead { margin: 16px 0; font-size: 9px; font-weight: 700; letter-spacing: 0.72px; color: var(--text-secondary); }
.imports-page--names .import-candidate { gap: 14px; padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: var(--radius-table, 16px); background: var(--bg-surface); }
.imports-page--names .import-candidate:hover { background: var(--bg-primary); }
.imports-page--names .import-candidate:has(.import-candidate-radio:checked) { padding: 13.5px 15.5px; border: 1.5px solid var(--text-primary); background: var(--bg-primary); }
.imports-page--names .import-candidate-radio { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--border-primary); border-radius: 50%; background: transparent; cursor: pointer; }
.imports-page--names .import-candidate-radio:checked { border-color: var(--text-primary); background: radial-gradient(circle, var(--text-primary) 0 4px, transparent 4.5px); }
.imports-page--names .import-candidate-main { gap: 8px; }
.imports-page--names .import-candidate-main kbd { display: none; }
.imports-page--names .import-candidate-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-best-chip { padding: 3px 8px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary); font-size: 10px; font-weight: 600; white-space: nowrap; }
.imports-page--names .import-candidate .import-pill { gap: 5px; padding: 3px 8px; font-size: 10px; font-weight: 600; }
.imports-page--names .import-candidate .import-pill svg, .imports-page--names .import-candidate .import-pill i { width: 11px; height: 11px; }
.import-source-tag { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary); font-family: var(--font-mono, monospace); font-size: 9px; font-weight: 500; text-transform: uppercase; white-space: nowrap; }
.import-source-tag--cofid { background: var(--source-cofid-bg); color: var(--source-cofid-text); }
.import-source-tag--user { background: var(--source-user-bg); color: var(--source-user-text); }
.imports-page--names .import-kcal-n { font-family: var(--font-mono, monospace); font-size: 14px; font-weight: 500; color: var(--text-primary); }
.imports-page--names .import-kcal-per { font-size: 10px; color: var(--text-label); }
/* Recipe suggestions R2 (Figma 2309:8286): a recipe card is the workspace sub-recipe row (.quick-add-row-sub): the tinted fill,
   and its left edge drawn inside the card border, so the card keeps its radius. Hover and picked keep the fill. */
.import-candidate.quick-add-row-sub,
.import-candidate.quick-add-row-sub:hover,
.imports-page--names .import-candidate.quick-add-row-sub,
.imports-page--names .import-candidate.quick-add-row-sub:hover,
.imports-page--names .import-candidate.quick-add-row-sub:has(.import-candidate-radio:checked) { background: var(--accent-teal-light); box-shadow: inset 3px 0 0 var(--accent-teal); }
.import-candidate.quick-add-row-sub .quick-add-sub-icon { width: 14px; height: 14px; }
.import-candidate-source { font-size: 11px; color: var(--text-muted); }
.imports-page--names .import-picker-search { align-items: center; gap: 8px; margin: 0; padding: 11px 14px; border: 1px solid var(--border-primary); border-radius: var(--radius-row, 12px); background: var(--bg-surface); }
.imports-page--names .import-picker-search:focus-within { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-picker-search-icon { flex: none; width: 15px; height: 15px; color: var(--text-secondary); }
.imports-page--names .import-picker-q { padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 13px; font-weight: 400; color: var(--text-primary); outline: none; }
.imports-page--names .import-picker-q::placeholder { color: var(--text-placeholder); opacity: 1; }
.import-picker-search-go { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.imports-page--names .import-picker-search { position: relative; }
.imports-page--names .import-picker-keys { margin: 0; font-size: 11px; color: var(--text-label); }
.imports-page--names .import-picker-tiles { gap: 10px; margin: 0; }
.imports-page--names .import-picker-tiles .import-tile { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-radius: var(--radius-card-sm, 14px); background: var(--bg-muted); color: var(--text-primary); }
.imports-page--names .import-picker-tiles .import-tile--action:hover { background: var(--bg-primary); }
.import-tile-disc { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-surface); color: var(--text-primary); }
.imports-page--names .import-tile--action .import-tile-disc svg, .imports-page--names .import-tile--action .import-tile-disc i, .imports-page--names .import-tile--wait .import-tile-disc svg, .imports-page--names .import-tile--wait .import-tile-disc i { width: 14px; height: 14px; }
.imports-page--names .import-tile-text { gap: 1px; }
.imports-page--names .import-tile-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.imports-page--names .import-picker-tiles .import-tile-sub { font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.imports-page--names .import-impact { gap: 10px; margin: 0; padding: 12px 14px; border-radius: var(--radius-card-sm, 14px); font-size: 12px; }
.imports-page--names .import-impact svg, .imports-page--names .import-impact i { width: 15px; height: 15px; }
.imports-page--names .import-picker-footer { gap: 10px; padding: 0; background: transparent; }
.imports-page--names .import-picker-hint { font-family: var(--font-mono, monospace); font-size: 11px; font-weight: 400; color: var(--text-label); }
.imports-page--names .import-picker-skip { padding: 10px 18px; border: 0; border-radius: var(--radius-button, 999px); background: transparent; color: var(--text-primary); font-size: 13px; font-weight: 600; }
.imports-page--names .import-picker-use { gap: 7px; padding: 10px 18px; border: 0; border-radius: var(--radius-button, 999px); background: var(--brand-espresso); color: var(--text-on-dark); font-size: 13px; font-weight: 600; }
.imports-page--names .import-picker-use svg, .imports-page--names .import-picker-use i { width: 15px; height: 15px; }
.imports-page--names .import-picker-use kbd { padding: 1px 6px; border: 0; border-radius: 5px; background: var(--text-secondary); color: var(--text-on-dark); font-family: var(--font-mono, monospace); font-size: 10px; font-weight: 500; }
.btn-primary.btn-ink.import-picker-use:disabled { opacity: 0.45; cursor: not-allowed; }

/* Strong suggestions card, table, footer and confirm bar (I13.02 to I13.11). */
.import-strong, .import-strong-form { display: flex; flex-direction: column; gap: 16px; }
.import-strong-form { min-height: calc(100vh - 260px); }
.import-strong-card--check { margin-top: 16px; }
.import-strong-card { display: flex; flex-direction: column; padding: 14px 20px 10px; border-radius: var(--radius-panel, 24px); background: var(--bg-surface); }
.import-strong-head { gap: 10px; margin: 0; padding-bottom: 10px; }
.import-strong-head .import-strong-all { padding: 10px 18px; border: 1.5px solid var(--text-primary); border-radius: var(--radius-button, 999px); background: var(--bg-surface); color: var(--text-primary); font-size: 13px; font-weight: 600; }
.import-strong-head .import-strong-help { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-strong-sort { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 0 auto; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.import-strong-sort svg, .import-strong-sort i { flex: none; width: 14px; height: 14px; }
.import-strong-table { min-width: 1040px; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.import-strong-col-box { width: 40px; }
.import-strong-col-name { width: 190px; }
.import-strong-col-top { width: 260px; }
.import-strong-col-from { width: 180px; }
.import-strong-cell-from { white-space: nowrap; }
.import-strong-cell-from .import-source-tag { max-width: 100%; }
.import-strong-from-status { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; line-height: normal; color: var(--text-label); white-space: normal; }
.import-pill--chip-state { text-transform: none; }
.import-strong-col-state { width: 190px; }
.import-strong-table th { padding: 2px 0 6px; border-bottom: 0; font-size: 9px; font-weight: 700; letter-spacing: 0.54px; text-transform: uppercase; color: var(--text-secondary); }
.import-strong-table td { padding: 9px 0; border-bottom: 1px solid var(--border-divider); overflow: visible; overflow-wrap: break-word; font-size: 13px; color: var(--text-primary); }
.import-strong-table th:first-child, .import-strong-table td:first-child { padding-left: 6px; text-align: center; }
.import-strong-table td:last-child { padding-right: 6px; }
.import-strong-table td:first-child { border-radius: var(--radius-row-sm, 10px) 0 0 var(--radius-row-sm, 10px); }
.import-strong-table td:last-child { border-radius: 0 var(--radius-row-sm, 10px) var(--radius-row-sm, 10px) 0; }
.import-strong-row:last-child td, .import-strong-scroll:not(.import-strong--all) .import-strong-row:nth-child(10) td { border-bottom: 0; }
.import-strong-box { appearance: none; -webkit-appearance: none; position: relative; display: inline-block; width: 18px; height: 18px; margin: 0; vertical-align: middle; border: 1.5px solid var(--text-primary); border-radius: 5px; background: var(--bg-surface); cursor: pointer; }
.import-strong-box:checked { background: var(--brand-espresso); }
.import-strong-box:checked::after { content: ""; position: absolute; left: 4px; top: 0.5px; width: 4px; height: 8px; border: solid var(--text-on-dark); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.import-strong-box:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-strong-name { display: inline; min-height: 0; line-height: normal; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-strong-top { font-weight: 400; }
.import-strong-table .import-strong-used-in { font-size: 12px; color: var(--text-secondary); }
.import-state-chip { gap: 5px; padding: 3px 8px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.import-state-chip svg, .import-state-chip i { width: 11px; height: 11px; }
.import-strong-foot { display: flex; align-items: center; gap: 6px; padding: 10px 6px 2px; }
.import-strong-showing { margin: 0; font-size: 12px; font-weight: 400; color: var(--text-label); }
.import-strong-foot .import-strong-show { min-height: 44px; margin: 0 0 0 auto; padding: 0; border: 0; background: none; color: var(--text-primary); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.import-strong-form { --import-strong-bar-h: 72px; --import-strong-bar-gap: 24px; }
.import-strong-bar { position: sticky; bottom: var(--import-strong-bar-gap); min-height: var(--import-strong-bar-h); display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: auto; padding: 14px 14px 14px 22px; border: 0; border-radius: var(--radius-band, 22px); background: var(--bg-surface); box-shadow: none; }
.import-strong-bar-text { display: flex; flex: 1 1 240px; flex-direction: column; gap: 2px; min-width: 0; }
.import-strong-bar .import-strong-tally { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-strong-bar .import-strong-hint { margin: 0; font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.btn-primary.btn-ink.import-strong-use { gap: 7px; padding: 10px 18px; border: 0; border-radius: var(--radius-button, 999px); background: var(--brand-espresso); color: var(--text-on-dark); font-size: 13px; font-weight: 600; }
.import-strong-use svg, .import-strong-use i { flex: none; width: 15px; height: 15px; }
.btn-primary.btn-ink.import-strong-use:disabled { opacity: 0.45; cursor: not-allowed; }

/* Fine pointers get the compact Figma sizes; touch keeps 44 px. */
@media (pointer: fine) {
  .import-mode, .imports-page--names .import-chip, .imports-page--names .import-name-line .import-name-open,
  .imports-page--names .import-picker-q, .imports-page--names .import-picker-use, .imports-page--names .import-picker-skip,
  .imports-page--names .import-tile--action, .import-strong-foot .import-strong-show, .import-strong-use { min-height: 0; }
}
@media (pointer: coarse) {
  .import-strong-name { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Phone (not designed in Figma: an assumption). The strong table becomes cards, one per row. */
@media (max-width: 767px) {
  .import-strong-card { padding: 14px 16px 10px; }
  .import-strong-head { flex-direction: column; align-items: flex-start; }
  .import-strong-sort { margin: 0; }
  .import-strong-table { display: block; min-width: 0; }
  .import-strong-table colgroup, .import-strong-table thead { display: none; }
  .import-strong-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .import-strong-table .import-strong-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; padding: 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-row, 12px); background: var(--bg-surface); }
  .import-strong-table .import-strong-row > td { display: block; padding: 0; border: 0; border-radius: 0; text-align: left; overflow-wrap: break-word; word-break: normal; }
  .import-strong-table .import-strong-row > td.import-strong-cell-box { flex: none; padding: 0; }
  .import-strong-table .import-strong-row > td.import-strong-cell-name { flex: 1 1 0; min-width: 0; }
  .import-strong-table .import-strong-row > td.import-strong-top { flex: 1 1 100%; }
  .import-strong-table .import-strong-row > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-label); }
  .import-strong-form { --import-strong-bar-h: 160px; --import-strong-bar-gap: 12px; padding-bottom: calc(var(--import-strong-bar-h) + var(--import-strong-bar-gap)); }
  .import-strong-bar { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) { .import-upload-bar-disc--uploading svg { animation: none; } }

.allergen-cereal-input { margin-top: 4px; max-width: 12rem; }

/* W3-15: search as you type on the names page. The dropdown sits under the box, over the lists, and does not move them.
   It scrolls inside itself past 8 rows. */
.import-typeahead-results { position: fixed; top: var(--import-typeahead-top, 0px); left: var(--import-typeahead-left, 0px); width: var(--import-typeahead-width, 320px); z-index: 60; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; max-height: var(--import-typeahead-max-height, 480px); overflow-y: auto; margin: 0; padding: 8px; list-style: none; background: var(--bg-surface); border: 1px solid var(--border-primary); border-radius: 14px; box-shadow: var(--shadow-lifted, 0 8px 24px color-mix(in srgb, var(--text-primary) 14%, transparent)); }
.import-typeahead-results[hidden] { display: none; }
.import-typeahead-row { flex: none; }
.import-typeahead-row[aria-selected="true"] { background: var(--bg-primary); outline: 2px solid var(--text-primary); outline-offset: -2px; }
.import-typeahead-empty { padding: 10px 12px; font-size: 13px; color: var(--text-label); }
/* names ask N5 (Figma 2189:8104, 2189:8398): the result bar above the right panel after Use this match, with Undo on the right */
#import-matched-bar:empty { display: none; }
.import-matched { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 16px; }
.import-matched > i, .import-matched > svg { flex: none; width: 16px; height: 16px; }
.import-matched--pass { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-matched--warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-bar-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.import-bar-line { font-weight: 600; overflow-wrap: anywhere; }
.import-bar-sub { font-size: 13px; font-weight: 400; }
.import-bar-undo { flex: none; padding: 0; border: 0; background: none; color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 600; line-height: 16px; text-decoration: underline; cursor: pointer; min-height: 44px; margin: -14px 0; }
/* names ask N5 (Figma L3b): the bar is 40 tall for one line; Undo keeps a 44px tap area that overlaps the bar padding */

/* 8.3a: "From your spec sheet" on the upload review. Reuses .shelf-life-row, .shelf-life-field, .input-field. */
.sheet-review {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-divider);
}
.sheet-review-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.sheet-review-warning { color: var(--status-warning); }
.sheet-review-field { max-width: 600px; }
.sheet-review-details { display: flex; flex-direction: column; gap: 8px; }
.sheet-detail-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.sheet-detail-row input[type="checkbox"] { accent-color: var(--accent-teal); width: 16px; height: 16px; flex-shrink: 0; margin-top: 4px; }
.sheet-detail-text { display: grid; grid-template-columns: 190px minmax(0, 1fr); column-gap: 16px; row-gap: 4px; flex: 1 1 auto; min-width: 0; align-items: start; }
.sheet-detail-text .input-hint { grid-column: 2; }
.sheet-detail-label { font-size: 13px; font-weight: 600; color: var(--text-label); }
.sheet-review .sheet-detail-label { font-size: 12px; }
.sheet-review .cost-update-label { font-size: 12px; font-weight: 600; color: var(--text-label); }
.sheet-review .input-field { height: 36px; border-radius: 10px; font-size: 13px; max-width: 100%; box-sizing: border-box; }
.sheet-review textarea.input-field { height: auto; }
.sheet-review .input-hint { font-size: 11px; color: var(--text-label); }
.sheet-review .sheet-review-warning { color: var(--status-warning); }
.sheet-review .shelf-life-duration-inputs .shelf-life-num,
.sheet-review [name="sheet-shelf-life-value"] { width: 80px; flex: 0 1 80px; }
.sheet-review .shelf-life-duration-inputs [name="sheet-shelf-life-unit"] { width: 120px; flex: 0 1 120px; }
.sheet-review [name="sheet-shelf-life-from"] { width: 200px; }
.sheet-review [name="sheet-shelf-life-basis"],
.sheet-review [name="sheet-storage-state"] { width: 180px; }
.sheet-review [name="sheet-country"] { width: 260px; }
.sheet-review-details-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-label); }
.sheet-review-supplier { display: flex; flex-direction: column; gap: 8px; }
.sheet-review-supplier .sheet-details-item { align-items: center; }

/* SUPPLY-006 PR C: the Supplier card slot adds no box of its own, so the card sits in the page like its neighbours. */
.supplier-slot { display: contents; }
.supplier-card .sheet-details-list { margin-top: 4px; }
@media (max-width: 599px) {
  .sheet-detail-text { grid-template-columns: minmax(0, 1fr); }
  .sheet-detail-text .input-hint { grid-column: 1; }
  .sheet-details-item { grid-template-columns: minmax(0, 1fr); }
}

/* 8.3a PR4: the offer of an import sheet's shelf life and details on the ingredient page. The card inside is .sheet-review. */
.sheet-offer { display: flex; flex-direction: column; gap: 12px; }
.sheet-offer-replace { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-label); }
.sheet-offer-replace input[type="checkbox"] { accent-color: var(--accent-teal); flex-shrink: 0; margin-top: 3px; }
.sheet-offer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 8.3a PR5: the Shelf life card's chip, the details card, the read button and the picker. */
.sheet-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--status-pass-bg);
  color: var(--status-pass-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
}
.ingredient-section-title-group.sheet-title-group { column-gap: 10px; }
.shelf-life-value.shelf-life-value-sheet { font-size: 14px; }
.sheet-file-link { font-size: 12px; font-weight: 600; color: var(--text-label); text-decoration: none; overflow-wrap: anywhere; }
.sheet-file-link:hover,
.sheet-file-link:focus-visible { text-decoration: underline; }
.sheet-file-link:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
.sheet-details-empty { display: none; }
.sheet-details-group { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.sheet-details-list { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.sheet-details-item { display: grid; grid-template-columns: 190px minmax(0, 1fr); column-gap: 16px; }
.sheet-details .sheet-detail-label { font-size: 12px; font-weight: 600; color: var(--text-label); }
.sheet-details > .input-hint { font-size: 12px; color: var(--text-label); }
.sheet-details-value { margin: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.sheet-details-flag { font-size: 12px; color: var(--text-label); }
.sheet-details-more summary { cursor: pointer; list-style: none; }
.sheet-details-more summary::-webkit-details-marker { display: none; }
.sheet-details-toggle { color: var(--text-label); text-decoration: underline; }
.sheet-details-more[open] summary { display: none; }
.sheet-details-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-details-again { margin: 0; }
.sheet-read { gap: 8px; }
.sheet-read-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-picker { display: flex; flex-direction: column; gap: 10px; }
.sheet-picker-list { display: flex; flex-direction: column; gap: 6px; }
.sheet-picker-option { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-primary); }
.sheet-picker-option input[type="radio"] { accent-color: var(--accent-teal); flex-shrink: 0; }
.sheet-offer-compare { display: flex; flex-direction: column; gap: 2px; }

/* PLAT-029 Figma frame 40: the emailed link's pages (F1, F2) and the inbox screen (D). The modal (unit 2c) reuses these. */
.cnl-auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  min-height: 100vh;
  padding: 40px 16px;
  box-sizing: border-box;
  background: var(--brand-espresso);
}
.cnl-auth-logo { width: 91px; height: auto; }
.cnl-auth-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  padding: 40px;
  box-sizing: border-box;
  border-radius: 16px;
  background: var(--bg-surface);
  box-shadow: 0 12px 20px color-mix(in srgb, var(--brand-espresso) 22%, transparent);
}
.cnl-auth-stack, .cnl-auth-form { display: flex; flex-direction: column; gap: 16px; }
.cnl-auth-head { display: flex; flex-direction: column; gap: 6px; }
.cnl-auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.cnl-auth-line { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text-deep); }
.cnl-auth-address { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.cnl-auth-icon {
  display: inline-flex;
  align-self: flex-start;
  padding: 12px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-primary);
}
.cnl-auth-icon svg { display: block; width: 24px; height: 24px; }
.cnl-auth-field { display: flex; flex-direction: column; gap: 8px; }
.cnl-auth-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cnl-auth-input {
  width: 100%;
  height: 52px;
  padding: 0 22px;
  box-sizing: border-box;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  background: var(--bg-surface);
  font-family: var(--font-primary);
  font-size: 16px; /* 16 px or iOS zooms on focus */
  color: var(--text-primary);
}
.cnl-auth-input:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.cnl-auth-input--error { border-color: var(--status-fail); }
.cnl-auth-error-slot:empty { display: none; }
.cnl-auth-error { margin: 0; font-size: 13px; line-height: 1.45; color: var(--status-fail-text); }
.cnl-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand-espresso);
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  color: var(--bg-surface);
  cursor: pointer;
}
.cnl-auth-btn:hover { background: var(--brand-cocoa); }
.cnl-auth-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.cnl-auth-btn--secondary { border-color: var(--border-primary); background: var(--bg-surface); color: var(--text-primary); }
.cnl-auth-btn--secondary:hover { background: var(--bg-muted); }
.cnl-auth-btn:disabled { opacity: 0.55; cursor: default; }
.cnl-auth-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-label); text-align: center; }
.cnl-auth-note--sent { color: var(--status-pass-text); }
.cnl-auth-link {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  text-align: center;
  text-decoration: underline;
}
.cnl-auth-lost { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-label); text-align: center; }
.cnl-auth-lost__link { color: inherit; }
/* Honeypot. Off-screen rather than display:none, which some bots skip. */
.cnl-auth-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* Figma B1 and B2 on a page: the divider, the two SSO buttons and the footer line. The modal on the marketing pages has
   its own copy in marketing-canoli.css, which is the stylesheet those pages load. */
.cnl-auth-divider { display: flex; align-items: center; gap: 12px; height: 20px; }
.cnl-auth-divider__line { flex: 1 0 0; min-width: 1px; height: 1px; background: var(--border-primary); }
.cnl-auth-divider__word { font-size: 13px; line-height: normal; color: var(--text-label); }
.cnl-auth-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px;
  box-sizing: border-box;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;
  color: var(--text-primary);
  text-decoration: none;
}
.cnl-auth-sso:hover { background: var(--bg-muted); }
.cnl-auth-sso:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.cnl-auth-sso__icon { display: block; flex-shrink: 0; width: 20px; height: 20px; }
.cnl-auth-switch { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-deep); text-align: center; }
.cnl-auth-switch__anchor { font-weight: 600; color: var(--text-primary); text-decoration: underline; text-decoration-skip-ink: none; }
@media (max-width: 480px) {
  .cnl-auth-card { padding: 24px; }
}
.spec-sheet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.spec-sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-divider); }
.spec-sheet-row:last-child { border-bottom: 0; }
.spec-sheet-row .sheet-file-link { min-width: 0; overflow-wrap: anywhere; }
.spec-sheet-row .btn-secondary { flex-shrink: 0; }

.import-item-page .import-item-footer { display: flex; flex-direction: column; align-items: stretch; gap: 0; box-sizing: border-box; margin-top: 16px; padding: 20px 24px 16px; border: 1px solid var(--border-primary); border-radius: 22px; background: var(--bg-surface); }
.import-item-page .import-item-footer .import-label-bar { flex: 0 0 auto; min-width: 0; gap: 12px; padding-top: 0; border-top: 0; }
.import-item-page .import-item-footer .import-footer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.import-item-page .import-label-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-item-page .import-footer-eyebrow { margin: 0; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-label); }
.import-item-page .import-label-title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-footer-head .import-pill { flex-shrink: 0; margin-top: 2px; }
.import-item-page .import-footer-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* PR D2 (D2-6, D2-8, Figma E4): the label check is two tables of even rows side by side, one list on a phone (below); the footer is one column, the bar, a divider, then one row of actions: Set aside (a quiet link) at the left, the missing count and Next at the right */
.import-item-page .import-label-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; gap: 0 20px; }
.import-item-page .import-label-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text-primary); }
.import-item-page .import-label-head th, .import-item-page .import-label-head td { padding: 0 8px 8px 0; border-bottom: 1px solid var(--border-divider); font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; color: var(--text-label); }
.import-item-page .import-label-row { vertical-align: middle; }
.import-item-page .import-label-row th, .import-item-page .import-label-row td { height: 52px; padding: 0 8px 0 0; border-bottom: 1px solid var(--border-divider); vertical-align: middle; overflow-wrap: anywhere; }
.import-item-page .import-label-row th { width: 24%; font-weight: 500; text-align: left; color: var(--text-primary); }
.import-item-page .import-label-old { color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-label-arrow { width: 20px; color: var(--text-label); }
.import-item-page .import-label-new strong { font-weight: 600; color: var(--text-primary); }
.import-item-page .import-label-row .import-label-status { width: 1%; padding-right: 0; text-align: right; white-space: nowrap; }
/* PR D2 (D2-7): one quiet footnote, the Canoli line and the standing caveat read as one; quiet, never hidden (G6) */
.import-item-page .import-label-footnote { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-label); }
.import-item-page .import-label-footnote .import-label-caveat, .import-item-page .import-label-footnote .standing-caveat { display: inline; margin: 0; padding: 0; border: 0; font-size: 12px; line-height: inherit; color: inherit; }
.import-item-page .import-item-footer .import-label-checking, .import-item-page .import-item-footer .import-label-caveat, .import-item-page .import-item-footer .import-label-hold, .import-item-page .import-item-footer .import-label-settled, .import-item-page .import-item-footer .import-label-note { font-size: 12px; }
.import-item-page .import-footer-divider { width: 100%; margin: 14px 0; border: 0; border-top: 1px solid var(--border-divider); }
.import-item-page .import-footer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; min-width: 0; }
.import-item-page .import-footer-actions .import-item-aside { margin-right: auto; }
.import-item-page .import-item-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; margin-left: auto; min-width: 0; }
.import-item-page .import-item-actions { box-sizing: border-box; margin-top: 16px; padding: 12px 14px 12px 18px; border: 1px solid var(--border-primary); border-radius: 22px; background: var(--bg-surface); justify-content: flex-end; align-self: stretch; width: 100%; box-sizing: border-box; }
.import-item-page .import-item-footer .import-item-aside, .import-item-page .import-item-actions .import-item-aside { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-item-page .import-aside-toggle { padding: 7px 10px; border: 0; border-radius: 999px; background: transparent; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.import-item-page .import-aside-toggle:hover, .import-item-page .import-aside-toggle:focus-visible { background: var(--bg-muted); }
.import-item-page .import-item-footer .import-aside-toggle { padding: 4px 0; border-radius: 0; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-item-footer .import-aside-toggle:hover, .import-item-page .import-item-footer .import-aside-toggle:focus-visible { background: transparent; color: var(--text-primary); }
.import-item-page .import-item-footer .btn-primary, .import-item-page .import-item-actions .btn-primary { padding: 10px 16px 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.import-item-page .import-item-footer .import-item-next-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.import-item-page .import-item-footer .import-item-next-button svg, .import-item-page .import-item-footer .import-item-next-button i { width: 15px; height: 15px; flex-shrink: 0; }
.import-item-page .import-item-blocked { opacity: 0.5; cursor: not-allowed; }
.import-item-page .import-item-footer .import-item-next, .import-item-page .import-item-actions .import-item-next { flex: 1 1 100%; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: right; font-size: 12px; color: var(--text-label); }
/* PR D2 (D2-1, Figma E3): a Ready recipe's next step under the status line: the one butter button, then the next recipe's name */
.import-item-page .import-item-next-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 4px; font-size: 13px; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-item-next-step .import-next-step-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.import-item-page .import-item-next-step .import-next-step-btn svg, .import-item-page .import-item-next-step .import-next-step-btn i { width: 15px; height: 15px; flex-shrink: 0; }
.import-item-page .import-item-next-step strong { font-weight: 600; color: var(--text-primary); }
.import-item-page .import-next-step-words { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .import-item-page .import-item-footer { padding: 16px 16px 14px; }
  .import-item-page .import-label-cols { grid-template-columns: minmax(0, 1fr); }
  .import-item-page .import-label-table, .import-item-page .import-label-table tbody { display: block; }
  /* the head row is said to a screen reader only: the rows say old then new in order */
  .import-item-page .import-label-table thead { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  /* round 2 F1: these row rules are scoped to the table so the read card's rows keep their own; F6: the old and the new value get a column each so a long old list cannot squeeze the new one; F4: the footer actions below take no CSS order so the visual order is the DOM and focus order */
  .import-item-page .import-label-table .import-label-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; grid-template-areas: "label label label status" "old arrow new new"; align-items: center; gap: 6px 6px; padding: 12px 0; border-bottom: 1px solid var(--border-divider); }
  .import-item-page .import-label-table .import-label-row th, .import-item-page .import-label-table .import-label-row td { width: auto; height: auto; padding: 0; border-bottom: 0; }
  .import-item-page .import-label-table .import-label-row th { grid-area: label; }
  .import-item-page .import-label-table .import-label-row .import-label-status { grid-area: status; }
  .import-item-page .import-label-table .import-label-row .import-label-old { grid-area: old; }
  .import-item-page .import-label-table .import-label-row .import-label-arrow { grid-area: arrow; }
  .import-item-page .import-label-table .import-label-row .import-label-new { grid-area: new; }
  .import-item-page .import-footer-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .import-item-page .import-footer-actions .import-item-missing { align-self: center; }
  .import-item-page .import-item-footer .import-item-next-button { width: 100%; min-height: 44px; }
  .import-item-page .import-footer-actions .import-item-aside { align-self: center; justify-content: center; margin-right: 0; }
  .import-item-page .import-item-footer .import-aside-toggle { min-height: 44px; }
  .import-item-page .import-item-footer .import-item-next { text-align: left; }
  .import-item-page .import-item-next-step { flex-direction: column; align-items: stretch; }
  .import-item-page .import-item-next-step .import-next-step-btn { width: 100%; min-height: 44px; }
}
/* Item page PR 5: the label check footer above, full width under both cards and outside the grid (Figma I5), scoped under the page class. A token in one palette only (--text-secondary-app) carries its fallback. */
/* Item page PR 4: the resolver cards (supplier allergen, may contain, library match, item flags), scoped under .import-item-page */
.import-item-page .import-resolver-card { display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; min-width: 0; margin: 0; padding: 12px 14px; border: 1px solid transparent; border-radius: 14px; font-size: 12px; }
.import-item-page .import-resolver-card--amber { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-item-page .import-resolver-card--red { background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-item-page .import-resolver-card--neutral { background: var(--bg-primary); border-color: var(--border-primary); color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-resolver-card .import-allergen-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.import-item-page .import-resolver-card .import-choice-hint, .import-item-page .import-resolver-card .import-candidate-status, .import-item-page .import-resolver-card .import-picker-note { color: inherit; opacity: 0.8; font-size: 12px; }
.import-item-page .import-resolver-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.import-item-page .import-resolver-title { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-resolver-source { font-family: var(--font-mono); font-size: 10px; font-weight: 400; color: var(--text-label); }
.import-item-page .import-resolver-pill { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: var(--bg-surface); font-size: 10px; font-weight: 600; color: inherit; }
.import-item-page .import-resolver-words { margin: 0; font-size: 12px; font-weight: 400; color: inherit; overflow-wrap: anywhere; }
.import-item-page .import-resolver-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.import-item-page .import-resolver-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bg-surface); font-size: 10px; font-weight: 600; color: inherit; }
.import-item-page .import-resolver-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-item-page .import-resolver-actions .btn-primary { background: var(--text-primary); color: var(--bg-surface); padding: 7px 14px; border-radius: 999px; }
.import-item-page .import-resolver-actions .btn-primary:hover { background: var(--text-secondary-app, var(--text-primary)); }
.import-item-page .import-resolver-actions .btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--text-primary); padding: 7px 14px; border-radius: 999px; }
.import-item-page .import-resolver-card .import-flag { gap: 6px; }
.import-item-page .import-resolver-card .import-flag-words { flex: 0 0 auto; width: 100%; }
.import-item-page .import-flag-fixes:empty { display: none; }
.import-item-page .import-resolver-actions:empty { display: none; }
@media (max-width: 720px) {
  .import-item-page .import-resolver-card { min-width: 0; }
  .import-item-page .import-resolver-pill { margin-left: 0; }
  .import-item-page .import-resolver-actions { flex-wrap: wrap; }
}
/* Item page PR 6 (frame I15): the blocked line's red block, its add panel and its aside, and the red pill. Scoped under the page or a new class. Tokens in one palette only carry a fallback. */
.import-item-page .import-item-pill--blocked { display: inline-flex; align-items: center; gap: 4px; background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-item-page .import-item-pill--blocked [data-lucide], .import-item-page .import-item-pill--blocked svg { width: 11px; height: 11px; }
.import-item-page .import-blocked-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; box-sizing: border-box; min-width: 0; margin: 4px 0 8px; padding: 14px 16px 16px; border-radius: 16px; background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-item-page .import-blocked-main, .import-item-page .import-blocked-aside { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.import-item-page .import-blocked-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.import-item-page .import-blocked-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.import-item-page .import-blocked-meta { font-family: var(--font-mono, 'DM Mono', monospace); font-size: 12px; font-weight: 400; }
.import-item-page .import-blocked-words { margin: 0; font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.import-item-page .import-blocked-search { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.import-item-page .import-blocked-search[hidden] { display: none; }
.import-item-page .import-blocked-search .input-field { width: 100%; box-sizing: border-box; min-width: 0; background: var(--bg-surface); }
.import-item-page .import-blocked-line .import-flag { margin: 0; padding: 0; background: transparent; color: inherit; }
.import-item-page .import-blocked-line .import-line-flag-list { margin: 0; }
.import-item-page .import-own-panel { display: flex; flex-direction: column; gap: 12px; box-sizing: border-box; min-width: 0; max-width: 100%; padding: 16px; border: 1.5px solid var(--text-primary); border-radius: 14px; background: var(--bg-surface); color: var(--text-primary); }
.import-item-page .import-blocked-main .import-own-title { margin: 0; font-size: 14px; font-weight: 600; }
.import-item-page .import-blocked-main .import-own-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.import-item-page .import-blocked-main .import-own-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: 8px; }
.import-item-page .import-blocked-main .import-own-value { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-item-page .import-blocked-main .import-own-value .input-field { width: 100%; min-width: 0; box-sizing: border-box; }
.import-item-page .import-blocked-main .import-own-allergen-list { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-top: 6px; }
.import-item-page .import-blocked-main .import-own-form .btn-primary { align-self: flex-start; max-width: 100%; background: var(--text-primary); color: var(--bg-surface); border-radius: 999px; overflow-wrap: anywhere; }
.import-item-page .import-blocked-main .import-own-form .btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.import-item-page .import-blocked-aside .import-aside-panel { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; box-sizing: border-box; padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: 14px; background: var(--bg-surface); color: var(--text-primary); }
.import-item-page .import-blocked-aside .import-aside-title { margin: 0; font-size: 14px; font-weight: 600; }
.import-item-page .import-blocked-aside .import-aside-words { margin: 0; font-size: 12px; font-weight: 400; color: var(--text-secondary-app, var(--text-secondary)); }
.import-item-page .import-blocked-aside .import-aside-form { margin: 0; }
.import-item-page .import-picker-row td { padding: 8px 0 12px; border-bottom: 1px solid var(--border-divider); }
@media (max-width: 720px) {
  .import-item-page .import-blocked-line { grid-template-columns: 1fr; }
  .import-item-page .import-blocked-main .import-own-values { grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr)); }
}
/* Item page PR 7: the ingredient card (values grid, caveat chip, footer), scoped under .import-item-page */
.import-item-page .import-values-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 70px)); gap: 12px 10px; margin: 0; align-items: start; }
.import-item-page .import-value-field { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.import-item-page .import-value-label { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.2; color: var(--text-label); white-space: nowrap; }
.import-item-page .import-values-grid .import-number-field { width: 70px; height: 35px; min-height: 35px; box-sizing: border-box; padding: 0 8px; font-size: 13px; }
.import-item-page .import-value-shown { display: inline-flex; align-items: center; height: 35px; font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.import-item-page .import-value-field .import-chip { min-height: 0; padding: 2px 6px; border: 0; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); color: var(--text-secondary-app, var(--text-secondary)); font-size: 9px; font-weight: 600; line-height: 1.3; }
.import-item-page .import-aside-label { font-size: 13px; color: var(--text-secondary-app, var(--text-secondary)); }

/* PR D: an import with nothing left to do (Figma 2031:2031). Same card surface and radius as To sort out. */
.import-done-card { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px 18px 18px; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); }
.import-done-card h2 { margin: 0; font-family: var(--font-display, inherit); font-size: 20px; font-weight: 600; line-height: normal; color: var(--text-primary); }
.import-done-list { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 0; padding: 0; list-style: none; }
.import-done-line { display: flex; align-items: center; gap: 12px; }
.import-done-disc { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: var(--radius-chip, 999px); background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-done-disc svg, .import-done-disc i { width: 14px; height: 14px; }
.import-done-words { flex: 0 1 auto; min-width: 0; font-size: 14px; font-weight: 600; line-height: normal; color: var(--text-primary); overflow-wrap: anywhere; }
.import-done-link { font-size: 13px; font-weight: 500; color: var(--text-secondary-app, var(--text-secondary)); text-decoration: underline; }

/* IMPORT-001 PR H: the Documents home as Figma I22 */
.import-home-strip { flex-wrap: nowrap; gap: 14px; padding: 18px 24px 18px 20px; border: 1.2px dashed var(--text-secondary); border-radius: 22px; background: var(--bg-surface); }
.import-home-strip.dropzone-active { border-color: var(--brand-gold); background: var(--accent-teal-light); }
.import-home-strip-disc { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; background: var(--cream-tag); color: var(--text-primary); }
.import-home-strip-disc svg, .import-home-strip-disc i { width: 18px; height: 18px; }
.import-home-strip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-home-strip .import-strip-title { font-size: 15px; font-weight: 600; }
.import-home-strip-sub { margin: 0; font-size: 12px; color: var(--text-secondary); }
.import-home-strip .import-drop-actions { margin: 0 0 0 auto; flex-wrap: nowrap; }
.imports-page .page-title { font-size: 32px; }
.import-home-card { margin-top: 26px; padding: 20px 24px 12px; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); }
.import-home-card-head { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; }
.import-home-card-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-primary); }
.import-home-card-count { margin: 0 0 0 auto; font-size: 12px; color: var(--text-secondary); }
.import-home-table { width: 100%; table-layout: fixed; border-spacing: 0; border-collapse: collapse; }
.import-home-table th { padding: 0 6px 6px; font-size: 9px; font-weight: 700; letter-spacing: 0.54px; line-height: normal; text-align: left; text-transform: uppercase; color: var(--text-secondary); }
.import-home-table thead tr, .import-home-row { display: grid; grid-template-columns: 300fr 360fr 220fr 190fr; align-items: center; }
.import-home-row { position: relative; border-bottom: 1px solid var(--border-divider); }
.import-home-row:last-child { border-bottom: 0; }
.import-home-row:focus-within { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.import-home-cell { padding: 14px 6px; min-width: 0; }
.import-home-link { display: block; line-height: normal; font-size: 14px; font-weight: 600; color: var(--text-primary); text-decoration: none; overflow-wrap: anywhere; }
.import-home-link::after { content: ""; position: absolute; inset: 0; }
.import-home-link:focus-visible { outline: none; }
.import-home-sub { display: block; margin-top: 2px; line-height: normal; font-size: 11px; color: var(--text-label); }
.import-home-chip { display: inline-block; margin: 0 6px 2px 0; padding: 3px 8px; border-radius: 999px; background: var(--bg-muted); font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.import-home-adopted { display: block; margin-bottom: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--text-primary); }
.import-progress.import-progress--home { max-width: 180px; height: 6px; }
.import-progress--home::-webkit-progress-bar { border-radius: 999px; background: var(--border-divider); }
.import-progress--home::-webkit-progress-value { border-radius: 999px; }
.import-progress--home::-moz-progress-bar { border-radius: 999px; }
.import-home-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.import-home-pill svg, .import-home-pill i { width: 11px; height: 11px; stroke-width: 2.5; }
.import-home-pill--warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-home-pill--info { background: var(--info-bg); color: var(--info-text); }
.import-home-pill--pass { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-home-pill--ready { background: var(--bg-muted); color: var(--text-secondary); }
.import-home-chevron { width: 16px; height: 16px; margin-left: 8px; vertical-align: middle; color: var(--text-label); }
.import-home-keep { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.import-home-keep-btn { padding: 5px 10px; border: 1px solid var(--text-primary); border-radius: 999px; background: var(--bg-surface); font: inherit; font-size: 11px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.import-home-note { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 12px 16px; border: 1px solid var(--border-primary); border-radius: 16px; background: var(--bg-surface); font-size: 12px; color: var(--text-secondary); }
.import-home-note svg, .import-home-note i { flex: none; width: 16px; height: 16px; }
/* W2b: the home row's ... menu and the Discard import dialog (Figma 2026:1921, 2027:1973) */
.import-home-cell--status { position: relative; }
.import-home-table .import-home-cell--status { padding-right: 42px; } /* room for the 28px ... menu at right 6px: a long pill wraps, never sits under it */
.import-home-cell--status .import-home-pill { max-width: 100%; }
.import-home-menu { position: absolute; top: 50%; right: 6px; z-index: 2; transform: translateY(-50%); }
.import-home-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.import-home-menu-btn:hover, .import-home-menu-btn[aria-expanded="true"] { background: var(--bg-muted); color: var(--text-primary); }
.import-home-menu-btn svg, .import-home-menu-btn i { width: 16px; height: 16px; }
.import-home-menu-list { position: absolute; top: 100%; right: 0; min-width: 168px; margin-top: 4px; padding: 6px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-surface); }
.import-home-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--status-fail-text); text-align: left; cursor: pointer; }
.import-home-menu-item:hover, .import-home-menu-item:focus-visible { background: var(--status-fail-soft); }
.import-home-menu-item svg, .import-home-menu-item i { width: 14px; height: 14px; }
/* The global reset zeroes margins, which removes the UA centring of a modal <dialog>: auto margins put it back (as .sheet does). */
.import-discard-dialog { margin: auto; max-height: calc(100vh - 32px); overflow-y: auto; width: min(580px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); color: var(--text-primary); }
.import-discard-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.import-discard-form { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; padding: 28px; margin: 0; }
.import-discard-disc { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-discard-disc svg, .import-discard-disc i { width: 18px; height: 18px; }
.import-discard-title { margin: 0 0 8px; font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; color: var(--text-primary); }
.import-discard-line { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.import-discard-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.import-discard-actions .btn-secondary, .import-discard-actions .btn-danger { border-radius: 999px; }
/* item page safety: the kilogram hint beside the cooked weight, a removed line, the names link and the add panel's toggle */
.import-field-hint { margin-left: 8px; font-size: 11px; color: var(--text-label); white-space: nowrap; }
.import-line-row--removed { background: var(--bg-muted); }
.import-line-row--removed .import-line-words { color: var(--text-label); }
.import-line-removed-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 12px; }
.import-line-removed-words { color: var(--text-label); }
.import-line-restore { margin: 0; }
.import-item-page .import-blocked-names { margin: 6px 0 12px; font-size: 12px; }
.import-item-page .import-blocked-names .import-flag-link { color: var(--text-primary); text-decoration: underline; }
.import-item-page .import-own-panel .import-own-body { margin-top: 12px; }
@media (max-width: 767px) {
  .import-home-strip { flex-wrap: wrap; }
  .import-home-strip .import-drop-actions { margin-left: 0; flex-wrap: wrap; }
  .import-home-card-head { flex-wrap: wrap; }
  .import-home-table, .import-home-table tbody, .import-home-table tr, .import-home-table td { display: block; width: 100%; }
  .import-home-table thead { display: none; }
  .import-home-table .import-home-row { padding: 14px 0; }
  .import-home-table .import-home-cell { padding: 4px 6px; }
  .import-home-table .import-home-cell--status { padding-right: 42px; }
  .import-home-table .import-progress.import-progress--home { max-width: none; }
}

/* UX walk 2 A1: another food, the question and its chip */
/* names ask N1 to N3 (Figma 2189:7343, 2189:7724, 2196:7417, 2196:7649): the card's row, then the question as a full-width block under
   it, after a divider. The answers only answer: a chosen one shows a tick and its tone. */
.import-candidate { flex-wrap: wrap; }
.import-candidate-row { display: flex; align-items: center; gap: 12px; flex: 1 1 100%; min-width: 0; }
.import-other-ask[hidden] { display: none; }
.import-other-ask { display: flex; flex-direction: column; gap: 8px; width: 100%; flex: 1 1 100%; margin-top: 2px; padding: 12px 0 0 32px; border-top: 1px solid var(--border-primary); font-size: 12.5px; line-height: 15px; color: var(--text-secondary); cursor: default; }
.import-ask-q { margin: 0; font-size: 13.5px; line-height: 16px; font-weight: 500; color: var(--text-primary); overflow-wrap: anywhere; }
.import-ask-note, .import-ask-hint { margin: 0; }
.import-ask-answers { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.import-answer { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 14px; line-height: 14px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip, 999px); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.import-answer i, .import-answer svg { width: 14px; height: 14px; }
.import-answer:not([aria-pressed="true"]) i, .import-answer:not([aria-pressed="true"]) svg { display: none; }
.import-answer:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-answer--pass[aria-pressed="true"] { border: 1.5px solid var(--status-pass); background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-answer--danger[aria-pressed="true"] { border: 1.5px solid var(--status-fail); background: var(--status-fail-bg); color: var(--status-fail-text); }
.import-another-food-chip { margin-left: 6px; }
/* A4: the Done card's actions and the review header's ... menu (Discard import lives there on a done import). */
.import-done-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.import-header-menu { position: relative; display: inline-flex; align-items: center; }
.import-header-menu .import-home-menu { position: relative; top: auto; right: auto; transform: none; }
.import-header-menu .import-home-menu-list { right: 0; z-index: 5; }

/* IMPORT-001 B-ui-3 (C L25): the one breadcrumb */
.import-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; margin: 0; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.import-crumb-link { color: var(--text-secondary); text-decoration: none; }
.import-crumb-link:hover, .import-crumb-link:focus-visible { color: var(--text-primary); text-decoration: underline; }
.import-crumb-sep { white-space: pre; }
.import-crumb-here { color: var(--text-primary); }
.import-sheet-supplier { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.import-documents-note { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }

/* IMPORT-001 B-ui-2 (Figma 2041:2049, 2042:2067, 2042:2593): tab pills, the Spec sheets cards, the lock card */
.import-tab-pill { padding: 2px 8px; border-radius: var(--radius-chip, 999px); background: var(--status-warning-bg); color: var(--status-warning-text); font-size: 12px; font-weight: 600; }
.import-tab-pill--muted { background: var(--bg-muted); color: var(--text-secondary); }
.import-tab--locked { color: var(--text-label); }
.import-tab--locked i, .import-tab--locked svg { stroke: var(--text-label); }
.import-sheets-note { margin: 0; font-size: 13px; color: var(--text-label); }
.import-sheets-result { display: flex; align-items: center; gap: 8px; background: var(--status-pass-bg); border-color: transparent; color: var(--status-pass-text); }
.import-sheets-result i, .import-sheets-result svg { flex: none; width: 16px; height: 16px; }
.import-sheets-skipped { display: flex; flex-direction: column; gap: 10px; }
.import-sheets-skipped-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.import-sheets-skipped-head .import-sheet-confirm-title { margin: 0; }
.import-sheets-skipped-n { font-size: 12px; color: var(--text-label); }
.import-sheets-skipped .import-sheet-confirm-words { margin: 0; }
.import-sheets-skipped .import-sheet-group { margin: 6px 0 0; }
.import-sheet-group-title .import-count { margin-left: 6px; padding: 1px 8px; background: var(--bg-muted); color: var(--text-secondary); font-weight: 600; }
.import-sheet-hint { margin: 0 0 6px; font-size: 12px; color: var(--text-label); }
.import-sheet-card { padding: 7px 8px 7px 12px; border: 1px solid var(--border-divider); border-radius: 12px; gap: 8px; background: transparent; }
.import-sheet-icon { flex: none; width: 16px; height: 16px; color: var(--text-label); }
a.import-sheet-name { text-decoration: underline; }
.import-sheet-confirm-row { padding: 9px 0; border-top: 1px solid var(--border-divider); }
.import-lock-card { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 560px; margin: 0 auto; padding: 40px; border-radius: 24px; background: var(--bg-surface); text-align: center; }
.import-lock-disc { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; background: var(--bg-muted); color: var(--text-primary); }
.import-lock-words { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.import-lock-why { margin: 0; font-size: 14px; color: var(--text-secondary); }
.import-lock-card .btn-primary { display: inline-flex; align-items: center; gap: 8px; }

/* I4 v2: the card's groups, rows and modals on the Spec sheets tab */
.import-confirm-group { margin: 12px 0 0; }
.import-confirm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 4px; }
.import-confirm-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-confirm-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.import-confirm-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.import-confirm-dialog { margin: auto; max-height: calc(100vh - 32px); overflow-y: auto; width: min(560px, calc(100vw - 32px)); padding: 20px; border: 0; border-radius: var(--radius-panel); background: var(--bg-surface); color: var(--text-primary); }
.import-confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.import-confirm-form { display: flex; flex-direction: column; gap: 12px; }
.import-confirm-modal-title { margin: 0; font-family: var(--font-display, inherit); font-size: 20px; font-weight: 600; color: var(--text-primary); }
.import-confirm-modal-words { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.import-confirm-modal-pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.import-confirm-modal-list { margin: 0; padding-left: 18px; font-size: 13px; }
.import-confirm-tick { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-primary); }
.import-confirm-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.import-confirm-modal-actions[hidden] { display: none; }
/* K2 re-smoke: a refusal lands inside the open dialog, above its actions */
.import-confirm-modal-error { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--status-fail-text); }
.import-confirm-modal-error:empty { display: none; }
.import-add-list { display: flex; flex-direction: column; gap: 0; }
/* item 22 (Figma 2062:2975): one row per allergen, the name left and the three options right, a line above each row. It also
   carries allergen-edit-row and allergen-edit-name (the shared editor's row); these rules set the dialog's own spacing. */
.import-add-allergen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; margin: 0; padding: 7px 0; border: 0; border-top: 1px solid var(--border-divider); }
.import-add-choice { display: flex; flex-wrap: wrap; gap: 4px; }
.import-add-dialog { width: min(600px, calc(100vw - 32px)); padding: 24px 28px 20px; }
.import-add-dialog .import-confirm-modal-title { font-size: 22px; font-weight: 700; line-height: 32px; }
/* item 22 heights (Figma 2062:2975): 14 px between blocks, 13 px words on 16 px lines, the actions row 4 px above (none below) with its
   buttons centred, not stretched to Cancel's height, and the
   standard button size (10 px by 18 px, 13 px type on a 16 px line: Save and confirm 36 px, Cancel 38 px with its line) */
.import-add-dialog .import-confirm-form { gap: 14px; }
.import-add-dialog .import-confirm-modal-words { line-height: 16px; }
.import-add-dialog .import-confirm-modal-actions { align-items: center; padding: 4px 0 0; }
.import-add-dialog .import-confirm-modal-actions .btn-primary, .import-add-dialog .import-confirm-modal-actions .btn-secondary { gap: 6px; padding: 10px 18px; font-size: 13px; font-weight: 600; line-height: 16px; }
/* the gluten cereal box shows only while Cereals containing gluten is Contains */
.import-add-cereal { display: none; flex: 1 1 100%; max-width: none; margin-top: 0; }
.import-add-allergen:has(input[value="contains"]:checked) .import-add-cereal { display: block; }
.import-add-name { flex: 1 1 10rem; min-width: 0; padding: 0; font-size: 13px; font-weight: 600; line-height: 16px; color: var(--text-primary); }
.import-add-option { display: inline-flex; align-items: center; padding: 3px 9px; border: 1px solid var(--border-primary); border-radius: var(--radius-chip-sm, 6px); font-size: 11px; line-height: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.import-add-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
/* a ring for the keyboard only, so opening the dialog with the mouse rings nothing */
.import-add-option:has(input:focus-visible) { outline: 2px solid var(--text-primary); outline-offset: 2px; }
/* a chosen option is a filled pill, no stroke: its card pill's tokens */
.import-add-option--contains:has(input:checked) { background: var(--status-fail-bg); color: var(--status-fail-text); border-color: transparent; }
.import-add-option--may:has(input:checked) { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: transparent; }
.import-add-option--none:has(input:checked) { background: var(--status-pass-bg); color: var(--status-pass-text); border-color: transparent; }
/* while the none-of-14 box is ticked the chips are disabled: no pointer, and a chosen chip loses its colour (the muted fill), as its
   row is dimmed. Its text is --text-disabled, the neutral grey that clears AA on the muted fill in both themes:
   --text-muted and --text-secondary are aubergine in Canoli, so a dimmed chip in them would still read as chosen (review fix F10) */
.import-add-option:has(input:disabled) { cursor: not-allowed; }
.import-add-option:has(input:disabled:checked) { background: var(--bg-muted); color: var(--text-disabled); border-color: var(--border-primary); }
.import-sheet-confirm-line { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
/* K cascade PR 2 (Figma K2 2394:9308): "Allergens new to your old labels" on the Spec sheets step. One row per ingredient and
   allergen: the recipe-count disc, the name with its chips, the sheet line, then Change and Confirm. Phone: the actions wrap
   under the row and keep 44 px targets. */
.import-k2-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-k2-lead { margin: 4px 0 4px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-k2-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.import-k2-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border-radius: 12px; background: var(--bg-secondary); }
.import-k2-disc { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--bg-muted); font-size: 13px; font-weight: 700; color: var(--text-primary); }
.import-k2-main { display: flex; flex: 1 1 16rem; flex-direction: column; gap: 2px; min-width: 0; }
.import-k2-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; }
.import-k2-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-k2-sub { margin: 0; font-size: 12px; color: var(--text-label); }
.import-k2-note { margin: 0; font-size: 12px; font-weight: 600; color: var(--status-warning-text); }
.import-k2-refusal { margin: 0; font-size: 12px; font-weight: 600; color: var(--status-fail-text); }
.import-k2-refusal:empty { display: none; }
.import-k2-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.import-k2-confirm { display: inline-flex; margin: 0; }
.import-k2-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 12px 0 0; }
.import-k2-foot-words { margin: 0; font-size: 12px; color: var(--text-label); }
.import-k2-go-on { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; }
.import-sheets-forward { display: flex; justify-content: flex-end; margin: 0 0 16px; }
@media (max-width: 640px) {
  .import-k2-actions { margin-left: 0; }
  .import-k2-actions .btn-sm, .import-k2-go-on { min-height: 44px; }
}
/* K cascade PR 5 (Figma K4 2396:9420): "Allergens on your old labels, not found now" on the Check recipes step. One block per
   allergen and its likely carrier: the allergen chip, the carrier with its Source chip and count, the old labels it is on, then
   the answers (each button with its note beside it), Answer per recipe as a disclosure, and the rows asked on their own.
   Phone: notes wrap under their button and every control keeps a 44 px target. */
.import-k4 .btn-primary.btn-butter { background: var(--brand-gold); color: var(--text-primary); border-color: var(--brand-gold); }
.import-k4 .btn-primary.btn-butter:hover { background: var(--brand-gold-hover); border-color: var(--brand-gold-hover); }
.import-k4-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-k4-lead { margin: 4px 0 4px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-k4-list, .import-k4-own-list, .import-k4-per-recipe-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-k4-group, .import-k4-own { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--bg-secondary); }
.import-k4-own { margin-top: 8px; }
.import-k4-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; }
.import-k4-chip { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--border-primary); border-radius: 6px; background: var(--bg-surface); font-size: 11px; color: var(--text-primary); }
.import-k4-likely { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-k4-count { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--bg-muted); font-size: 12px; color: var(--text-primary); }
.import-k4-labels, .import-k4-answered-words { margin: 0; font-size: 12px; color: var(--text-label); }
.import-k4-answered-words { font-size: 13px; color: var(--text-primary); }
.import-k4-answer, .import-k4-answered, .import-k4-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; }
.import-k4-note { font-size: 12px; color: var(--text-label); }
.import-k4-open { margin: 0; }
.import-k4-error { margin: 0; font-size: 12px; font-weight: 600; color: var(--status-fail-text); }
.import-k4-error:empty { display: none; }
.import-k4-open .btn-sm { display: inline-flex; align-items: center; gap: 6px; }
.import-k4-per-recipe-toggle { cursor: pointer; font-size: 13px; font-weight: 600; }
.import-k4-per-recipe-list { margin-top: 6px; gap: 4px; }
.import-k4-per-recipe-row { margin: 0; font-size: 13px; }
.import-k4-own-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-k4-own-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.import-k4-own-words { flex: 1 1 14rem; min-width: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.import-cascade-answers { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border-primary); border-radius: 12px; }
.import-cascade-answers[hidden] { display: none; }
.import-cascade-answer { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; color: var(--text-primary); }
.import-cascade-answer svg, .import-cascade-answer i { flex: none; width: 16px; height: 16px; }
@media (max-width: 640px) {
  .import-k4-answer .btn-sm, .import-k4-open .btn-sm, .import-k4-own-btn, .import-k4-change, .import-k4-per-recipe-toggle { min-height: 44px; }
  .import-k4-per-recipe-toggle { display: flex; align-items: center; }
}
.import-confirm-modal-words--strong { font-weight: 700; color: var(--text-primary); }
.import-confirm-modal-bold { font-weight: 700; color: var(--text-primary); }
.import-jump-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; font-size: 13px; }
.import-sort-first-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Item 13 (Figma 2114:3094): one skipped spec sheet at a time, on the nutritionists' workspace shell (review.css). Desktop: only the
   middle scrolls. Phone (Figma 2116:5588): the workspace itself scrolls, so the steps scroll away and the strip and footer stick. */
.import-sheet-steps { flex-shrink: 0; padding: 12px 24px; background: var(--bg-surface); }
.import-sheet-strip { gap: 12px; justify-content: flex-start; }
.import-sheet-strip-name { margin-left: auto; min-width: 0; overflow-wrap: anywhere; text-align: right; }
.import-sheet-progress, .import-sheet-steps-bar { flex: none; width: 160px; height: 6px; border: 0; border-radius: 4px; overflow: hidden; background: var(--border-primary); appearance: none; -webkit-appearance: none; }
.import-sheet-progress::-webkit-progress-bar, .import-sheet-steps-bar::-webkit-progress-bar { background: var(--border-primary); }
.import-sheet-progress::-webkit-progress-value { background: var(--status-pass); }
.import-sheet-progress::-moz-progress-bar { background: var(--status-pass); }
.import-sheet-review-page-form .upload-review-name-row .input-field { width: 100%; }
.import-sheets-skipped-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
body:has(.import-sheet-workspace) .flash-toast-container { bottom: 84px; }
.import-sheet-steps-compact { display: none; padding: 12px; border: 1px solid var(--border-primary); border-radius: var(--radius-card, 12px); background: var(--bg-surface); }
.import-sheet-steps-compact-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; cursor: pointer; }
.import-sheet-steps-compact-head::-webkit-details-marker { display: none; }
.import-sheet-steps-compact-at { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.import-sheet-steps-compact-at i, .import-sheet-steps-compact-at svg { width: 16px; height: 16px; }
.import-sheet-steps-compact[open] .import-sheet-steps-compact-at i, .import-sheet-steps-compact[open] .import-sheet-steps-compact-at svg { transform: rotate(180deg); }
.import-sheet-steps-bar.import-sheet-steps-bar { display: block; width: 100%; height: 4px; margin: 10px 0 0; }
.import-sheet-steps-bar::-webkit-progress-value { background: var(--brand-espresso); }
.import-sheet-steps-bar::-moz-progress-bar { background: var(--brand-espresso); }
.import-sheet-steps-compact-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-secondary); }
.import-sheet-column { display: flex; flex-direction: column; gap: 16px; max-width: 720px; margin: 0 auto; }
/* Walk item 20 W4 (Figma 2114:3094): the empty Keep and Leave forms take no place in the column, so the cards sit 16 px apart */
.import-sheet-hidden-form { display: contents; }
.import-sheet-column .import-error:empty { display: none; }
.import-sheet-notice { margin: 0 0 16px; }
.import-sheet-column .import-sheet-notice { margin: 0; }
/* Walk item 20 W4 (Figma 2114:3181): white, no border, 12 px corners, 18 / 24 / 8 / 24 padding */
.import-sheet-needs { padding: 18px 24px 8px; border-radius: 12px; background: var(--bg-surface); }
.import-sheet-needs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; }
.import-sheet-needs-title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); }
.import-sheet-open { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.import-sheet-open i, .import-sheet-open svg { width: 14px; height: 14px; }
.import-sheet-needs-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.import-sheet-need { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.import-sheet-need i, .import-sheet-need svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--status-warning); }
.import-sheet-need--none i, .import-sheet-need--none svg { color: var(--status-pass); }
.import-sheet-need-title { display: block; font-weight: 600; color: var(--text-primary); }
.import-sheet-need-words { margin: 0; color: var(--text-secondary); }
/* Walk item 20 W4 (Figma 2114:3198): the form card on the sheet page is the needs card's twin: white, no border, 12 px corners, 22 / 24 padding */
.import-sheet-review-page-form .upload-review-card { margin-top: 0; padding: 22px 24px; border: 0; border-radius: 12px; background: var(--bg-surface); }
.upload-review-density { margin: 12px 0 0; }
.upload-review-one-source { display: none; align-items: center; gap: 8px; margin: 8px 0 0; }
@media (max-width: 767px) {
  /* Item 16 smoke: a table wider than the phone scrolls inside its own box, so every column stays readable */
  .nutrition-review-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Figma J3: on a phone a per 100 ml table drops its Source column for one line under it */
  .nutrition-review-table--one-source th:last-child, .nutrition-review-table--one-source td:last-child { display: none; }
  /* Figma J3: the three columns fit 390 px with 6 px cell sides; the vertical padding, so the row height, is unchanged */
  .nutrition-review-table--one-source th, .nutrition-review-table--one-source td { padding-left: 6px; padding-right: 6px; }
  .upload-review-one-source { display: flex; }
}
.upload-review-density-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.upload-review-density-input { width: 140px; }
/* Figma J2: the gate line sits under the action buttons, and hides while a density is in */
.upload-review-gate-note { margin: 16px 0 0; }
.upload-review-gate-note[hidden] { display: none; }
.upload-review-density-missing { color: var(--status-warning-text); }
.nutrition-review-worked { color: var(--text-primary); }
.upload-review-figures-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin: 0 0 8px; }
.upload-review-figures-summary { min-width: 0; flex: 1 1 240px; }
.upload-review-figures-line { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.upload-review-figures-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.import-sheet-card-panel { padding: 16px 20px; border-radius: 12px; background: var(--bg-surface); }
.import-sheet-card-panel p { margin: 0 0 12px; font-size: 14px; color: var(--text-primary); }
.import-sheet-clash-sets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid var(--border-divider); }
.import-sheet-clash-set { padding: 14px 16px; border: 1px solid var(--border-primary); border-radius: 12px; }
.import-sheet-clash-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-sheet-clash-name { margin: 0 0 8px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-sheet-clash-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.import-sheet-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-sheet-footer form { margin: 0; }
.import-sheets-skipped.import-sheet-confirm { display: flex; flex-flow: row wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.import-sheets-skipped-main { flex: 1 1 280px; min-width: 0; }
.import-sheets-skipped-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-sheets-skipped-actions form { margin: 0; }
.import-sheets-result--done .import-text-link { margin-left: auto; color: inherit; }
.import-sheets-done { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 560px; padding: 20px 24px; border-radius: var(--radius-card, 12px); background: var(--bg-surface); }
.import-sheets-done-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-primary); }
.import-sheets-done-words { margin: 0; font-size: 13px; color: var(--text-secondary); }
.import-sheets-done-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.import-sheets-done-row { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; color: var(--text-primary); }
.import-sheets-done-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-chip, 999px); background: var(--bg-muted); }
.import-sheets-done-icon--pass { background: var(--status-pass-bg); color: var(--status-pass-text); }
.import-sheets-done-icon i, .import-sheets-done-icon svg { width: 16px; height: 16px; }
.import-sheets-done-link { display: block; font-size: 12px; }
@media (max-width: 767px) {
  /* Only the middle scrolls here too: review.css hides the workspace's overflow, so the detail area is the scroller */
  .main-area:has(> .import-sheet-workspace) { flex: 1 1 auto; min-height: 0; }
  .batch-review-workspace.import-sheet-workspace { flex: 1 1 0; height: auto; min-height: 0; }
  .import-sheet-workspace .import-sheet-steps { display: none; }
  .import-sheet-steps-compact { display: block; }
  .import-sheet-workspace .import-sheet-strip { flex-wrap: wrap; padding: 10px 16px; }
  .import-sheet-workspace .import-sheet-detail { min-height: 0; padding: 12px 16px; }
  .import-sheet-workspace .import-sheet-footer { padding: 10px 16px; }
  .import-sheet-strip .btn-setup-back { order: 3; margin-left: auto; }
  .import-sheet-strip .progress-strip-count { order: 0; }
  .import-sheet-strip .import-sheet-progress { order: 1; flex: 1 1 calc(100% - 140px); width: auto; }
  .import-sheet-strip .import-sheet-strip-name { order: 2; flex: 1 1 140px; margin-left: 0; text-align: left; font-size: 13px; }
  .import-sheet-clash-sets { grid-template-columns: 1fr; }
  .import-sheets-skipped-actions { width: 100%; }
}

/* --------------------------------------------------------------------------
   Names page dialogs (Adam, 13 Nov 2026; Figma U1 2208:7505, U2 2208:7731, U3 2208:7939, C1 2208:8329, C2a/C2b at 390):
   Upload a spec sheet and Create my own, over the names page. 600 wide, 28 radius, 24/28/20/28 padding, 14 between blocks;
   the primary action is butter (btn-primary btn-butter) and stays faded until its fields are given.
   -------------------------------------------------------------------------- */
.import-dialog { margin: auto; width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 28px; background: var(--bg-surface); color: var(--text-primary); overflow: hidden; }
.import-dialog[hidden] { display: none; }
.import-dialog::backdrop { background: color-mix(in srgb, var(--brand-espresso) 45%, transparent); }
.import-dialog-body { display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 32px); padding: 24px 28px 20px; overflow-y: auto; }
.import-dialog-title { margin: 0; font-family: var(--font-display, inherit); font-size: 22px; font-weight: 700; line-height: 32px; color: var(--text-primary); overflow-wrap: anywhere; }
.import-dialog-sub { margin: 0; font-size: 13px; line-height: 16px; color: var(--text-secondary); }
.import-dialog-head { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 16px; color: var(--text-primary); }
.import-dialog-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.import-dialog-step { display: flex; flex-direction: column; gap: 14px; }
.import-dialog-step[hidden], .import-reading[hidden] { display: none; }
.import-dialog-label { display: block; margin: 0 0 6px; }
.import-dialog-error { margin: 0; font-size: 13px; color: var(--status-fail-text); }
.import-dialog-error:empty { display: none; }
.import-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 6px 0 0; }
.import-dialog-actions .btn-primary, .import-dialog-actions .btn-secondary { gap: 6px; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 16px; }
.btn-primary.btn-butter { background: var(--brand-gold); color: var(--text-primary); }
.btn-primary.btn-butter:disabled { opacity: 0.45; cursor: not-allowed; }
/* U1: the drop zone and the web link */
.import-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; padding: 22px 20px; border: 1px solid var(--border-primary); border-radius: 16px; background: var(--bg-primary); text-align: center; }
.import-drop-disc { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bg-muted); color: var(--text-primary); }
.import-drop-disc i, .import-drop-disc svg { width: 16px; height: 16px; }
.import-drop-title { font-size: 14px; font-weight: 600; line-height: 17px; color: var(--text-primary); }
.import-drop-sub { font-size: 12px; line-height: 14px; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-drop-choose { gap: 6px; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 16px; cursor: pointer; }
.import-drop-choose:has(input:focus-visible) { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.import-or { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 12px; line-height: 14px; color: var(--text-secondary); }
.import-or::before, .import-or::after { content: ""; flex: 1 1 0; height: 1px; background: var(--border-primary); }
.import-link-field { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-surface); }
.import-link-field:focus-within { border-color: var(--text-primary); }
.import-link-field i, .import-link-field svg { flex: none; width: 15px; height: 15px; color: var(--text-secondary); }
.import-link-input { flex: 1 1 auto; min-width: 0; border: 0; background: none; font: inherit; font-size: 13px; line-height: 16px; color: var(--text-primary); outline: none; }
.import-link-input::placeholder, .import-dialog .input-field::placeholder { color: var(--text-placeholder); }
/* U2: reading */
.import-reading { display: flex; align-items: center; gap: 10px; margin: 0; padding: 22px 20px; border: 1px solid var(--border-primary); border-radius: 16px; background: var(--bg-primary); font-size: 13px; line-height: 16px; color: var(--text-secondary); }
.import-reading-spin { flex: none; width: 16px; height: 16px; border: 2px solid var(--border-primary); border-top-color: var(--text-primary); border-radius: 50%; animation: import-reading-spin 0.9s linear infinite; }
@keyframes import-reading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .import-reading-spin { animation: none; } }
/* U3: Check what we read, its source line; the shared review (a per 100 ml or per serving read) sits flat in the body */
.import-check-source { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; line-height: 15px; color: var(--text-secondary); overflow-wrap: anywhere; }
.import-check-source i, .import-check-source svg { flex: none; width: 13px; height: 13px; }
.import-dialog .upload-review-card { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
/* C1: the fields, the per 100 g grid and the 14 rows */
.import-own-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.import-own-field .input-field { min-height: 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 17px; }
.import-own-grid .import-own-field .input-field { width: 100%; height: 35px; }
.import-own-field .confidence-badge { align-self: flex-start; }
.import-own-note { margin: 0; font-size: 11px; line-height: 13px; }
.import-own-field .confidence-badge[hidden] { display: none; }
.import-own-field .import-number-field { font-family: var(--font-mono); }
.import-own-field input[hidden] { display: none; }
.import-field-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 9px; font-weight: 700; line-height: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
/* smoke (D), Figma 2208:8145 and 2208:8530: 100 x 35 fields in a wrapping row, 8 px between columns and 10 px between rows (5 x 100 +
   4 x 8 = 532 inside the 544 inner width); salt or sodium is 150 wide */
.import-own-grid { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.import-own-grid > .import-own-field { flex: 0 0 100px; width: 100px; }
.import-own-grid > .import-own-field--salt { flex-basis: 150px; width: 150px; }
.import-own-toggle { padding: 0; border: 0; background: none; font: inherit; font-size: 10.5px; font-weight: 600; line-height: 13px; letter-spacing: 0; text-transform: none; color: var(--text-secondary); text-decoration: underline; cursor: pointer; }
.import-own-allergens .import-add-allergen:first-child { border-top: 0; }
/* U4 and C3: the pass bar the picker comes back with */
.import-picker-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border-radius: 14px; background: var(--status-pass-bg); color: var(--status-pass-text); font-size: 13.5px; font-weight: 600; line-height: 16px; }
.import-picker-bar > i, .import-picker-bar > svg { flex: none; width: 16px; height: 16px; }
.import-picker-bar--warn { background: var(--status-warning-bg); color: var(--status-warning-text); }
/* C2a, C2b: on a phone the dialog is a sheet from the bottom, its buttons full width, the primary on top */
@media (max-width: 767px) {
  .import-dialog { width: 100vw; max-width: 100vw; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: 28px 28px 0 0; }
  .import-dialog-body { max-height: calc(100dvh - 24px); padding: 20px 16px 16px; }
  .import-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .import-dialog-actions .btn-primary, .import-dialog-actions .btn-secondary { justify-content: center; width: 100%; min-height: 44px; }
}
/* PR D1 (D1-3, Figma E1, E5a): the missing-values box. One row per ingredient: the words left, its control right (stacked at
   390 px), a rule between rows; the sub-recipe is an underlined link; then Go to line. The line it names carries the warn
   pill 'Values missing'. */
.import-item-page .import-item-link.import-item-link--sub { font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.import-item-page .import-missing-rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-divider); }
.import-item-page .import-missing-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--border-divider); }
.import-item-page .import-missing-words { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }
.import-item-page .import-missing-name { font-weight: 600; }
.import-item-page .import-missing-row > .import-fix-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.import-item-page .import-missing-row > .import-fix-btn svg, .import-item-page .import-missing-row > .import-fix-btn i { flex-shrink: 0; width: 14px; height: 14px; }
.import-item-page .import-missing-saved { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--status-pass-text); }
.import-item-page .import-missing-saved svg, .import-item-page .import-missing-saved i { width: 14px; height: 14px; }
.import-item-page .import-line-pill--values { background: var(--status-warning-bg); color: var(--status-warning-text); }
.import-item-page .import-line-pill--values svg, .import-item-page .import-line-pill--values i { flex: 0 0 auto; width: 11px; height: 11px; }
@media (max-width: 767px) {
  .import-item-page .import-missing-row { flex-direction: column; align-items: stretch; }
  .import-item-page .import-missing-row > .import-fix-btn { justify-content: center; }
}
/* PR D1 (D1-5, Figma E2, E2b, E5b): the Add values dialog, the names page's dialog with only the missing fields, the hint,
   what the ingredient already has (read only, compact, monospace) and how many recipes the save reaches. A field with an
   error takes the error border (:has, no JS). On a phone it is the bottom sheet above, fitting its content. */
.import-values-fields { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.import-values-field { display: flex; flex-direction: column; gap: 4px; flex: 0 1 auto; min-width: 140px; }
.import-values-error { white-space: nowrap; }
.import-values-input { width: 140px; height: 38px; padding: 8px 10px; border-radius: 10px; font-family: var(--font-mono); font-size: 13px; }
.import-values-field:has(.import-values-error:not(:empty)) .import-values-input { border-color: var(--status-fail); }
.import-values-hint { margin: -6px 0 0; font-size: 12px; line-height: 15px; color: var(--text-secondary); }
.import-values-fibre .input-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.import-values-fibre .input-hint { margin: 4px 0 0; font-size: 11.5px; line-height: 14px; color: var(--text-secondary); }
.import-values-known-head { margin: 0; }
.import-values-known { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; margin: -6px 0 0; padding: 12px 14px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-primary); font-family: var(--font-mono); font-size: 11.5px; line-height: 14px; color: var(--text-primary); }
.import-values-known-cell { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.import-values-known dt, .import-values-known dd { margin: 0; }
.import-values-known dd { white-space: nowrap; }
.import-values-used { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; line-height: 15px; color: var(--text-primary); }
.import-values-used svg, .import-values-used i { flex: none; width: 14px; height: 14px; }
.import-values-dialog .btn-butter svg, .import-values-dialog .btn-butter i { width: 14px; height: 14px; }
/* Round 3 (F1): an existing copy whose allergens differ from the Library row's, named above the buttons. */
.import-values-allergens { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--status-warning); border-radius: 10px; background: var(--status-warning-bg); font-size: 12.5px; line-height: 16px; color: var(--status-warning-text); }
.import-values-allergens svg, .import-values-allergens i { flex: none; width: 14px; height: 14px; margin-top: 1px; }
@media (max-width: 767px) {
  .import-values-field { flex: 1 1 100%; }
  .import-values-input { width: 100%; }
  .import-values-error { white-space: normal; }
  .import-values-known { grid-template-columns: minmax(0, 1fr); }
}

/* UX-015 base (T5b) */
.lib-columns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 32px 40px;
  height: 100%;
}
.lib-columns .lib-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}
.lib-columns .lib-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
}
.lib-columns .lib-search-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--text-primary);
}
.lib-columns .lib-search-scope {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.lib-columns .lib-search-scope:empty {
  display: none;
}
.lib-columns .lib-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 6px 0 10px;
  background: var(--cream-tag);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
}
.lib-columns .lib-scope-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
}
.lib-columns .lib-search-input.input-field {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-family: var(--font-primary);
  font-size: 16px;
}
.lib-columns .lib-search-input.input-field:focus {
  outline: none;
  box-shadow: none;
}
.lib-columns .lib-search:focus-within {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.lib-columns .lib-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
.lib-columns .lib-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-primary);
}
.lib-columns .lib-crumb {
  color: var(--text-primary);
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.lib-columns .lib-crumb:last-child {
  text-decoration: none;
  font-weight: 600;
}
.lib-columns .lib-crumb-sep {
  color: var(--text-secondary);
}

.lib-columns .lib-body {
  container: lib / inline-size;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  overflow: hidden;
}
.lib-columns .lib-panes {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
.lib-columns .lib-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 12px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border-primary);
}
.lib-columns .lib-col:last-child {
  border-right: 0;
}
.lib-columns .lib-col--root { flex: 0 1 264px; min-width: 220px; }
.lib-columns .lib-col--node { flex: 0 1 232px; min-width: 200px; }
.lib-columns .lib-col--items,
.lib-columns .lib-col--results { flex: 1 1 340px; min-width: 300px; }
.lib-columns .lib-col--preview { flex: 1 1 440px; min-width: 400px; }
/* Columns with no .lib-col-head start their content at the same height as
   the head-led columns (the head's 20px top padding). Compare pads itself. */
.lib-columns .lib-col--results,
.lib-columns .lib-col--preview:not(.lib-col--compare) { padding-top: 20px; }
.lib-columns .lib-col.is-stale { display: none; }

.lib-columns .lib-col-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 20px 8px 10px;
  background: var(--bg-surface);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.lib-columns .lib-col-title {
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-columns .lib-col-count {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-secondary);
}
.lib-columns .lib-col-line { display: none; }
.lib-columns .lib-col-count:not(:empty)::before {
  content: "\00B7\00A0";
}
.lib-columns .lib-heading {
  padding: 14px 8px 6px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.lib-columns .lib-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lib-columns .lib-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lib-columns .lib-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
.lib-columns .lib-row:hover {
  background: var(--bg-muted);
}
/* The open path is blush (core); only the current pick is Butter. Selected
   comes second so a row that is both reads as the pick. */
.lib-columns .lib-row[aria-current="true"] {
  background: var(--cream-tag);
  font-weight: 600;
}
.lib-columns .lib-row[aria-selected="true"] {
  background: var(--nav-active-fill);
  color: var(--text-primary);
  font-weight: 600;
}
.lib-columns .lib-row[aria-current="true"] .lib-row-icon,
.lib-columns .lib-row[aria-selected="true"] .lib-row-icon {
  background: var(--bg-surface);
}
.lib-columns .lib-row:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}
.lib-columns .lib-row-icon {
  flex: 0 0 32px;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 7px;
  background: var(--cream-tag);
  border-radius: 10px;
  color: var(--text-primary);
}
.lib-columns .lib-row-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-columns .lib-row-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.lib-columns .lib-row[aria-current="true"] .lib-row-count {
  color: var(--text-primary);
}
.lib-columns .lib-row[aria-selected="true"] .lib-row-count {
  color: var(--text-primary);
}
.lib-columns .lib-row-chevron {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.lib-columns .lib-row--other .lib-row-name,
.lib-columns .lib-row--uncat .lib-row-name {
  font-weight: 500;
}
.lib-columns .lib-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-columns .lib-item-meta {
  flex: 0 0 auto;
}

.lib-columns .lib-empty {
  margin: 0;
  padding: 12px 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-secondary);
}

/* Loading skeleton and the column error (spec 3.9) */
.lib-columns .lib-col--loading {
  flex: 1 1 232px;
  min-width: 200px;
}
.lib-columns .lib-skeleton-row {
  height: 14px;
  margin: 17px 10px;
  background: var(--cream-tag);
  border-radius: 999px;
  animation: lib-shimmer 1.2s ease-in-out infinite;
}
.lib-columns .lib-skeleton-row:nth-child(even) { width: 60%; }
@keyframes lib-shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .lib-columns .lib-skeleton-row { animation: none; }
}
.lib-columns .lib-col-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--text-primary);
}
.lib-columns .lib-col-error-text {
  margin: 0;
  color: var(--text-primary);
}
.lib-columns .lib-retry {
  min-height: 44px;
  padding: 0 20px;
  background: transparent;
  border: 1.5px solid var(--text-primary);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.lib-columns .lib-retry:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
.lib-columns .ingredient-detail-back { display: none; }

@media (max-width: 767px) {
  .lib-columns { padding: 20px 16px; }
  .lib-columns .lib-row { min-height: 44px; }
}


/* UX-015 fold, tablet, phone (T6) */
.lib-columns .lib-pathcol {
  display: none;
  flex: 0 0 232px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 20px 12px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border-primary);
}
.lib-columns .lib-pathrow {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
}
.lib-columns .lib-pathrow:hover { background: var(--bg-muted); }
.lib-columns .lib-pathrow[aria-current="true"] {
  background: var(--cream-tag);
  font-weight: 600;
}
.lib-columns .lib-pathrow--all {
  margin-bottom: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
}
.lib-columns .lib-pathrow:focus-visible,
.lib-columns .lib-phone-back:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}
/* The path steps in as it deepens. */
.lib-columns .lib-pathrow--d2 { margin-left: 8px; }
.lib-columns .lib-pathrow--d3 { margin-left: 16px; }
.lib-columns .lib-pathrow--d4 { margin-left: 24px; }
.lib-columns .lib-pathrow--d5,
.lib-columns .lib-pathrow--d6 { margin-left: 32px; }
.lib-columns .lib-phone-back { display: none; }

/* Fold tiers: K panes stay, the rest hide and the path column shows. The
   measure is the body's own width (a container query), not the viewport:
   the sidebar changes size between desktop and tablet. */
@container lib (max-width: 789px) {
  .lib-columns .lib-body:not(.lib-body--preview) .lib-panes > :nth-last-child(n+2 of .lib-col) { display: none; }
  .lib-columns .lib-body:not(.lib-body--preview):has(.lib-panes > :nth-last-child(2 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="1"] { display: none; }
}
@container lib (min-width: 790px) and (max-width: 1019px) {
  .lib-columns .lib-body:not(.lib-body--preview) .lib-panes > :nth-last-child(n+3 of .lib-col) { display: none; }
  .lib-columns .lib-body:not(.lib-body--preview):has(.lib-panes > :nth-last-child(3 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="2"] { display: none; }
}
@container lib (min-width: 1020px) and (max-width: 1279px) {
  .lib-columns .lib-body:not(.lib-body--preview) .lib-panes > :nth-last-child(n+4 of .lib-col) { display: none; }
  .lib-columns .lib-body:not(.lib-body--preview):has(.lib-panes > :nth-last-child(4 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="3"] { display: none; }
}
@container lib (min-width: 1280px) and (max-width: 1499px) {
  .lib-columns .lib-body:not(.lib-body--preview) .lib-panes > :nth-last-child(n+5 of .lib-col) { display: none; }
  .lib-columns .lib-body:not(.lib-body--preview):has(.lib-panes > :nth-last-child(5 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="3"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="4"] { display: none; }
}
@container lib (min-width: 1500px) {
  .lib-columns .lib-body:not(.lib-body--preview) .lib-panes > :nth-last-child(n+6 of .lib-col) { display: none; }
  .lib-columns .lib-body:not(.lib-body--preview):has(.lib-panes > :nth-last-child(6 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="3"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="4"],
  .lib-columns .lib-body:not(.lib-body--preview) .lib-pathcol .lib-pathrow[data-fe="5"] { display: none; }
}
@container lib (max-width: 999px) {
  .lib-columns .lib-body.lib-body--preview .lib-panes > :nth-last-child(n+2 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview:has(.lib-panes > :nth-last-child(2 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="1"] { display: none; }
}
@container lib (min-width: 1000px) and (max-width: 1219px) {
  .lib-columns .lib-body.lib-body--preview .lib-panes > :nth-last-child(n+3 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview:has(.lib-panes > :nth-last-child(3 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="2"] { display: none; }
}
@container lib (min-width: 1220px) {
  .lib-columns .lib-body.lib-body--preview .lib-panes > :nth-last-child(n+4 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview:has(.lib-panes > :nth-last-child(4 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body.lib-body--preview .lib-pathcol .lib-pathrow[data-fe="3"] { display: none; }
}
@container lib (max-width: 999px) {
  .lib-columns .lib-body--preview .lib-col--preview { min-width: 320px; }
}

/* Touch sizes below 1280 px */
@media (max-width: 1279px) {
  .lib-columns .lib-row,
  .lib-columns .lib-pathrow,
  .lib-columns .lib-chip,
  .lib-columns .lib-group-head,
  .lib-columns .lib-phone-back { min-height: 44px; }
}

/* Phone: one column fills the screen, Back names the parent */
@keyframes lib-slide-in {
  from { transform: translateX(32px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes lib-slide-back {
  from { transform: translateX(-32px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (max-width: 767px) {
  .lib-columns { height: auto; }
  .lib-columns .lib-body {
    flex-direction: column;
    overflow: visible;
  }
  /* Beats the fold tiers' display:flex; the path column never shows here. */
  .lib-columns .lib-body .lib-pathcol { display: none !important; }
  .lib-columns .lib-panes {
    flex-direction: column;
    overflow-x: clip;
  }
  .lib-columns .lib-panes > :not(:last-child) { display: none; }
  .lib-columns .lib-panes > .lib-col {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: visible;
    border-right: 0;
  }
  .lib-columns .lib-phone-back {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  .lib-columns .lib-col-head { position: static; padding: 8px 8px 12px; }
  .lib-columns .lib-col--results,
  .lib-columns .lib-col--preview:not(.lib-col--compare) { padding-top: 12px; }
  .lib-columns .lib-col-title,
  .lib-columns .lib-col-count { display: none; }
  .lib-columns .lib-col-line {
    display: block;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text-primary);
    overflow-wrap: anywhere;
  }
}
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .lib-columns .lib-panes--anim > :last-child { animation: lib-slide-in 200ms ease-out; }
  .lib-columns .lib-panes--anim.lib-panes--back > :last-child { animation-name: lib-slide-back; }
}


/* UX-015 rows and chips (T7a) */
.lib-columns .lib-item {
  align-items: flex-start;
  min-height: 56px;
}
.lib-columns .lib-item-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lib-columns .lib-item-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.lib-columns .lib-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 45%;
  padding-top: 2px;
}
/* The certified rosette: the app's certified glyph, green, with the pale green
   fill inside the wavy edge only (first path of the lucide badge-check). About
   1.25 px of visible stroke at 16 px: 1.9 units on the 24 unit icon. */
.lib-columns .lib-rosette {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--status-pass-text);
}
.lib-columns .lib-rosette svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.9;
}
.lib-columns .lib-rosette svg path:first-child {
  fill: var(--status-pass-bg);
}
.lib-columns .lib-pill-yours {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Processing groups: a folding heading, then the rows. */
.lib-columns .lib-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 14px 8px 6px;
  background: none;
  border: 0;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}
.lib-columns .lib-group-head:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}
.lib-columns .lib-group-chevron {
  width: 16px;
  height: 16px;
  transition: transform 120ms ease-out;
}
.lib-columns .lib-group-head[aria-expanded="false"] .lib-group-chevron {
  transform: rotate(-90deg);
}
.lib-columns .lib-group-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* display set by the class above must not beat the fold's hidden attribute */
.lib-columns .lib-group-body[hidden] { display: none; }
.lib-columns .lib-more {
  padding: 12px 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.lib-columns .lib-empty-link {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Filter chips and their menus */
.lib-columns .lib-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 0 8px 4px;
}
.lib-columns .lib-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}
.lib-columns .lib-chip::-webkit-details-marker { display: none; }
.lib-columns .lib-chip.is-on {
  background: var(--cream-tag);
  border-color: var(--text-primary);
  font-weight: 600;
}
.lib-columns .lib-chip:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
.lib-columns .lib-chip-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.lib-columns .lib-menu {
  position: relative;
}
.lib-columns .lib-menu-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
  width: 280px;
  max-width: calc(100vw - 32px);
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  background: var(--bg-surface);
}
.lib-columns .lib-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.lib-columns .lib-menu-item:hover { background: var(--bg-muted); }
.lib-columns .lib-menu-item:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}
.lib-columns .lib-menu-item::before {
  content: "";
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1.5px solid var(--text-secondary);
  border-radius: 4px;
}
.lib-columns .lib-menu-item[aria-pressed="true"]::before {
  background: var(--text-primary);
  border-color: var(--text-primary);
}
.lib-columns .lib-menu-item[aria-disabled="true"] {
  color: var(--text-secondary);
  cursor: default;
}
.lib-columns .lib-menu-note {
  margin: 8px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.lib-columns .lib-source-key {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  align-items: start;
  margin: 0 8px 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.lib-columns .lib-source-key dt,
.lib-columns .lib-source-key dd { margin: 0; }
/* Each entry stacks: the badge on its own line, the text below it. */
.lib-columns .lib-source-key dd { margin-bottom: 8px; }
@media (max-width: 1279px) {
  .lib-columns .lib-chip { min-height: 44px; }
}


/* UX-015 preview additions (T7b) */
/* The certified state pill. .certified-badge is 9px (review.css); the spec's
   11px minimum wins here. The look is otherwise the same plate. */
.lib-columns .lib-cert-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.lib-columns .lib-cert-pill i[data-lucide],
.lib-columns .lib-cert-pill svg {
  width: 14px;
  height: 14px;
}
.lib-columns .lib-cert-pill--not {
  background: var(--bg-muted);
  color: var(--text-secondary);
}
/* Where a Composite row's values come from */
.lib-columns .lib-composite {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.lib-columns .lib-composite p,
.lib-columns .lib-composite ul {
  margin: 0;
}
.lib-columns .lib-composite-head {
  font-weight: 600;
  color: var(--text-primary);
}
.lib-columns .lib-composite-sources,
.lib-columns .lib-composite-from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lib-columns .lib-composite-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  list-style: none;
}
.lib-columns .lib-field-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lib-columns .lib-field-edited {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}


/* UX-015 search (T8) */
.lib-columns .lib-scope-chip i[data-lucide],
.lib-columns .lib-scope-chip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.lib-columns .lib-scope-clear:focus-visible {
  outline: 2px solid var(--text-primary);
}
.lib-columns .lib-results-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-width: 0;
}
.lib-columns .lib-results-line,
.lib-columns .lib-results-cap {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.lib-columns .lib-results-headline {
  color: var(--text-primary);
  font-weight: 600;
}
.lib-columns .lib-results-all {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: underline;
}
.lib-columns .lib-results-hint {
  font-size: 12px;
  color: var(--text-secondary);
}
.lib-columns .lib-results-group-head {
  padding: 14px 8px 6px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.lib-columns .lib-keypane {
  flex: 0 0 300px;
  min-width: 0;
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid var(--border-primary);
}
.lib-columns .lib-empty--search {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
}
.lib-columns .lib-empty-icon {
  width: 28px;
  height: 28px;
  color: var(--text-primary);
}
.lib-columns .lib-empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.lib-columns .lib-empty-text {
  margin: 0;
  max-width: 36ch;
}
.lib-columns .lib-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.lib-columns .lib-empty-main,
.lib-columns .lib-empty-second {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.lib-columns .lib-empty-request {
  margin-top: 8px;
  font-size: 13px;
}
.lib-columns .lib-empty-request-btn {
  background: none;
  border: 0;
  padding: 8px;
  color: var(--text-secondary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
@container lib (max-width: 899px) {
  .lib-columns .lib-keypane { display: none; }
}
@media (max-width: 767px) {
  .lib-columns .lib-keypane { display: none; }
}


/* UX-015 compare (T9) */
.lib-columns .lib-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: normal; /* a link inherits 18px; the sibling <button>s use normal */
}
/* 44px tap target on phones only; on desktop Compare matches the height of
   the panel's other buttons (Add to recipe, Save to My Ingredients). */
@media (max-width: 767px) {
  .lib-columns .lib-compare-btn { min-height: 44px; }
}
.lib-columns .lib-compare-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 16px;
  background: var(--cream-tag);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
}
.lib-columns .lib-compare-banner i[data-lucide],
.lib-columns .lib-compare-banner svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.lib-columns .lib-compare-banner-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-columns .lib-compare-cancel {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: underline;
}
.lib-columns .lib-compare {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
}
.lib-columns .lib-compare-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lib-columns .lib-compare-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.lib-columns .lib-compare-title i[data-lucide],
.lib-columns .lib-compare-title svg {
  width: 20px;
  height: 20px;
}
.lib-columns .lib-compare-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  color: var(--text-primary);
}
.lib-columns .lib-compare-close:focus-visible,
.lib-columns .lib-compare-cancel:focus-visible {
  outline: 2px solid var(--text-primary);
}
.lib-columns .lib-compare-note {
  margin: 0;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}
.lib-columns .lib-compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 14px;
}
.lib-columns .lib-compare-table th,
.lib-columns .lib-compare-table td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.lib-columns .lib-compare-name,
.lib-columns .lib-compare-value,
.lib-columns .lib-compare-diff { overflow-wrap: anywhere; }
/* Labels, badges, buttons and pills never wrap or break inside a word. */
.lib-columns .lib-compare-corner,
.lib-columns .lib-compare-label { width: 26%; min-width: 120px; }
.lib-columns .lib-compare-label,
.lib-columns .lib-compare-add-btn,
.lib-columns .lib-compare-badge,
.lib-columns .lib-compare-badge *,
.lib-columns .lib-compare-cert,
.lib-columns .lib-compare-diffhead { white-space: nowrap; }
.lib-columns .lib-compare-head {
  font-weight: 400;
}
.lib-columns .lib-compare-head > span {
  display: block;
  margin-bottom: 4px;
}
.lib-columns .lib-compare-name {
  font-weight: 600;
  color: var(--text-primary);
}
.lib-columns .lib-compare-source {
  font-size: 12px;
  color: var(--text-secondary);
}
.lib-columns .lib-compare-cert {
  font-size: 12px;
  color: var(--text-secondary);
}
.lib-columns .lib-compare-cert.is-certified {
  color: var(--status-pass-text);
}
.lib-columns .lib-compare-cert i[data-lucide],
.lib-columns .lib-compare-cert svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}
.lib-columns .lib-compare-diffhead {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.lib-columns .lib-compare-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}
.lib-columns .lib-compare-label {
  font-weight: 400;
  color: var(--text-secondary);
}
.lib-columns .lib-compare-table tbody tr {
  border-top: 1px solid var(--border-divider);
}
.lib-columns .lib-compare-value,
.lib-columns .lib-compare-diff {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.lib-columns .lib-compare-foot {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}
@media (max-width: 767px) {
  .lib-columns .lib-compare-table th,
  .lib-columns .lib-compare-table td { padding: 8px 6px; }
  .lib-columns .lib-compare-table { font-size: 13px; }
}

/* UX-015 compare width. The compare panel keeps at least 560 px, so one pane
   fewer stays beside it than for a plain preview (tiers K = 1, 2, 3 by the
   body's own width). Same row-hiding pattern as the preview tiers above;
   these come later and carry one more class, so they win. */
.lib-columns .lib-col--compare { flex: 1 1 560px; }
@container lib (min-width: 800px) {
  .lib-columns .lib-body--preview .lib-col--compare { min-width: 560px; }
}
@container lib (max-width: 1099px) {
  .lib-columns .lib-body.lib-body--preview.lib-body--compare .lib-panes > :nth-last-child(n+2 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview.lib-body--compare:has(.lib-panes > :nth-last-child(2 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="1"] { display: none; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="3"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="4"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="5"] { display: flex; }
}
@container lib (min-width: 1100px) and (max-width: 1329px) {
  .lib-columns .lib-body.lib-body--preview.lib-body--compare .lib-panes > :nth-last-child(n+3 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview.lib-body--compare:has(.lib-panes > :nth-last-child(3 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="2"] { display: none; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="3"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="4"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="5"] { display: flex; }
}
@container lib (min-width: 1330px) {
  .lib-columns .lib-body.lib-body--preview.lib-body--compare .lib-panes > :nth-last-child(n+4 of .lib-col) { display: none; }
  .lib-columns .lib-body.lib-body--preview.lib-body--compare:has(.lib-panes > :nth-last-child(4 of .lib-col)) .lib-pathcol { display: flex; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="1"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="2"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="3"] { display: none; }
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="4"],
  .lib-columns .lib-body.lib-body--compare .lib-pathcol .lib-pathrow[data-fe="5"] { display: flex; }
}
@media (max-width: 767px) {
  .lib-columns .lib-body--preview .lib-col--compare { min-width: 0; }
  .lib-columns .lib-compare-corner,
  .lib-columns .lib-compare-label { min-width: 0; width: auto; }
  .lib-columns .lib-compare-label { white-space: normal; }
}

/* UX-015: the detail panel's Vitamins and Minerals pair sits side by side on
   the old page and stacks only under a 720px VIEWPORT. In the column preview
   the panel is narrow while the viewport is wide, so the pair squeezed and
   the % NRV column spilled out. Here it stacks by default and goes side by
   side only when the preview itself is wide (a container query). */
.lib-columns .lib-col--preview { container: lib-preview / inline-size; }
.lib-columns .micro-columns { grid-template-columns: 1fr; gap: 16px; }
@container lib-preview (min-width: 760px) {
  .lib-columns .micro-columns { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* UX-015 review fixes: the Esc hint is for keyboards only; the workspace-level
   error sits above the columns. */
@media (hover: none), (max-width: 767px) {
  .lib-columns .lib-hint-keyboard { display: none; }
}
.lib-columns .lib-ws-error { padding: 16px; }

/* PR B round 2 (R10): the pager's prev chevron and position lay out as the nav's own items; a recipe with no pager keeps
   the element, hidden, so an answer can fill it, and the nav goes when nothing in it shows */
.import-item-page #import-item-pager { display: contents; }
.import-item-page #import-item-pager[hidden], .import-item-page .import-item-nav .import-item-chevron[hidden] { display: none; }
.import-item-page .import-item-nav:not(:has(> :not([hidden]))) { display: none; }
.import-redo-forms { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.import-redo-forms .import-redo-form { margin: 0; }
/* IMPORT-001 cascade #3 (27 Nov 2026): the another-food confirm's reason field, under the answers; hidden until that answer */
.import-ask-reason { display: flex; margin: 0; }
.import-ask-reason[hidden] { display: none; }
/* K cascade PR 3 (Figma K1 2393:9156): "Values to add before recipes" on the Spec sheets step. One row per ingredient: the
   recipe-count disc, the name with what is missing and the Source chip, the reason line, then Add value. Phone: Add value wraps
   under the row and keeps a 44 px target. */
.import-k1-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.import-k1-lead { margin: 4px 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-k1-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.import-k1-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border-radius: 12px; background: var(--bg-secondary); }
.import-k1-disc { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--bg-muted); font-size: 13px; font-weight: 700; color: var(--text-primary); }
.import-k1-main { display: flex; flex: 1 1 16rem; flex-direction: column; gap: 2px; min-width: 0; }
.import-k1-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; }
.import-k1-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-k1-sub { margin: 0; font-size: 12px; color: var(--text-label); }
.import-k1-add { margin-left: auto; }
.import-k1-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 12px 0 0; }
.import-k1-foot-words { margin: 0; font-size: 12px; color: var(--text-label); }
.import-k1-go-on { display: inline-flex; margin: 0; }
@media (max-width: 640px) {
  .import-k1-add { margin-left: 0; }
  .import-k1 .btn-sm { min-height: 44px; }
}
/* K cascade PR 3 (5.3): a Ready recipe whose values are added once on the Spec sheets step says so under its status */
.import-landing-k1-note { display: block; margin-top: 4px; font-size: 12px; }
/* K cascade PR 3 (2.2): a typed figure that differs from the sheet's has the warning border until 'Save anyway' */
.ingredient-tray-value--differs .import-values-input { border: 2px solid var(--status-warning); }

/* --------------------------------------------------------------------------
   K cascade PR 4 (K3, Figma 2395:9367): "May contain, from your old labels" on the Recipes tab, one group per may-contain line,
   and the item page's R13 form. The choices reuse the allergen chooser chips (.import-add-choice / .import-add-option): Keep on
   the label takes the may-contain tone, Leave it off the not-present tone. Tokens only.
   -------------------------------------------------------------------------- */
.import-mc-card { margin: 0 0 16px; padding: 16px 18px; border: 1px solid var(--border-primary); border-radius: var(--radius-card, 12px); background: var(--bg-surface); }
.import-mc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-mc-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 24px; color: var(--text-primary); }
.import-mc-lead { margin: 10px 0 4px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.import-mc-words { margin: 0 0 12px; font-size: 13px; color: var(--text-label); }
.import-mc-group { margin: 0 0 10px; padding: 12px 14px; border-radius: var(--radius-card-sm, 8px); background: var(--bg-muted); }
.import-mc-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.import-mc-form[hidden], .import-mc-choice[hidden], .import-mc-per-recipe[hidden], .import-mc-answered-list[hidden], .import-mc-answered[hidden] { display: none; }
.import-mc-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.import-mc-heading { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.import-mc-recipes { margin: 0; font-size: 12px; color: var(--text-label); overflow-wrap: anywhere; }
.import-mc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.import-mc-allergen { min-width: 9rem; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.import-mc-answered { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-primary); }
.import-mc-hint { flex: 1 1 14rem; min-width: 0; font-size: 12px; color: var(--text-label); }
.import-mc-error { margin: 0; font-size: 13px; color: var(--status-fail-text); }
.import-mc-error:empty { display: none; }
.import-mc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.import-mc-actions .btn-primary.btn-butter { background: var(--brand-gold); color: var(--text-primary); border-color: var(--brand-gold); }
.import-mc-actions .btn-primary.btn-butter:hover { background: var(--brand-gold-hover); border-color: var(--brand-gold-hover); }
.import-mc-per-recipe { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.import-mc-summary { margin: 0; font-size: 13px; color: var(--text-primary); }
.import-mc-answered-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.import-mc-answered-list { margin: 8px 0 0; }
.import-mc-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; padding: 0; border: 0; }
@media (max-width: 640px) {
  .import-mc-card { padding: 14px 16px; }
  .import-mc-choice .import-add-option, .import-mc-actions .btn-sm, .import-mc-change, .import-mc-per-recipe-toggle, .import-mc-answered-toggle { min-height: 44px; }
  .import-mc-per-recipe a { display: inline-flex; align-items: center; min-height: 44px; }
}
.import-mc-settled { margin: 0 0 16px; }
.import-mc-settled[hidden] { display: none; }
