/* Review workspace - OPS-001 Wave 1
 * Nutritionist ingredient review UI. Modelled on the Pencil NI-1..NI-5
 * mockups. Uses the warm/Nibblr design tokens from app.css. Concrete
 * spacing values (4/8/10/12/16/24/32 px) and radii (4/6/7/8 px) match
 * the rest of the site and the mockup frames. */

/* ==========================================================================
   Icon defaults
   ========================================================================== *
 * Lucide replaces <i data-lucide="..."> with an <svg> at runtime. The SVG
 * uses stroke="currentColor" so we drive icon colour via the parent's
 * `color` property. Default icons in the review workspace are 14 px;
 * specific contexts (action buttons, empty state, titles) override. */

.review-workspace i[data-lucide],
.review-workspace svg[data-lucide] {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================================
   Workspace shell
   ========================================================================== */

.review-workspace {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Neutralise .main-area's own scroll when it contains the review workspace,
 * so the queue column and detail column can scroll independently instead of
 * pushing the sticky action footer below the fold. */
.main-area:has(> .review-workspace),
.main-area:has(> .batch-review-workspace) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.review-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
}

.review-filter-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.review-filter-spacer {
  flex: 1;
}

.review-filter-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-secondary);
}

.review-filter-meta .dot {
  width: 1px;
  height: 14px;
  background: var(--bg-muted);
}

.review-filter-meta .muted {
  color: var(--text-muted);
  font-size: 11px;
}

.review-columns {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.review-queue-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
}

.review-detail-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow-y: auto;
}

/* ==========================================================================
   Progress panel
   ========================================================================== */

.progress-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-divider);
}

.progress-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-title {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-bar {
  position: relative;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--status-pass);
  border-radius: 3px;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.progress-meta .pace {
  margin-left: auto;
  color: var(--status-pass);
  font-weight: 500;
}

/* ==========================================================================
   Queue controls / section headers
   ========================================================================== */

.queue-controls {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-divider);
}

.queue-filter {
  width: 100%;
  padding: 6px 8px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
}

.queue-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.queue-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.queue-preset-chip:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.queue-preset-chip-active {
  color: var(--bg-surface);
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.queue-preset-chip-active:hover {
  color: var(--bg-surface);
  opacity: 0.9;
}

.queue-preset-chip svg {
  width: 12px;
  height: 12px;
}

.queue-filter-count {
  margin: 0;
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-divider);
}

.queue-section-header {
  padding: 12px 16px 6px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.queue-section-header-muted {
  border-top: 1px solid var(--border-divider);
  color: var(--text-muted);
}

/* ==========================================================================
   Queue cards
   ========================================================================== */

.queue-list,
.queue-recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.queue-card {
  border-bottom: 1px solid var(--border-divider);
}

.queue-card a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
}

.queue-card:hover {
  background: var(--bg-muted);
}

.queue-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-card-number {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 14px;
}

.queue-card-title {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-card-description {
  display: block;
  font-family: var(--font-primary);
  font-size: 11px;
  color: var(--text-secondary);
  padding-left: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-card-bot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.queue-card-bot .tier {
  color: var(--text-muted);
  font-weight: 500;
}

.queue-card-bot .flag-count {
  color: var(--status-warning);
  font-weight: 500;
}

.queue-card-bot .error-count {
  color: var(--status-fail);
  font-weight: 500;
}

/* Selected state. Strong enough to read at a glance without hovering;
   the hover state bumps it a touch more so it still feels interactive. */
.queue-card-selected {
  background: #F0A50033 !important;
  border-left: 3px solid var(--brand-gold);
}

.queue-card-selected .queue-card-number {
  color: var(--brand-gold);
  font-weight: 600;
}

.queue-card-selected .queue-card-title {
  font-weight: 600;
}

.queue-card-selected:hover {
  background: #F0A50044;
}

/* Flagged / error row tints */
.queue-card-flagged {
  background: #D4890A08;
}

.queue-card-error {
  background: #C23B2206;
}

.queue-card-recent a {
  opacity: 0.7;
  padding: 8px 16px;
}

.queue-empty {
  padding: 16px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Source badges (per-row + queue)
   ========================================================================== */

.source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-width: 72px;
}

.source-badge-mccance,
.source-badge-cofid,
.source-badge-mcw {
  background: var(--source-mcw-bg);
  color: var(--source-mcw);
}

.source-badge-swedish {
  background: #D4890A15;
  color: var(--status-warning);
}

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

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

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

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

.source-badge-nib,
.source-badge-nibblr {
  background: var(--source-pro-bg);
  color: var(--brand-gold);
}

/* ==========================================================================
   Status badges (row + header)
   ========================================================================== */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-pill-flagged {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.status-pill-error {
  background: var(--status-fail-bg);
  color: var(--status-fail);
}

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

.status-pill-reviewing {
  background: var(--info-bg);
  color: var(--info);
}

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

.status-pill i[data-lucide],
.status-pill svg[data-lucide] {
  width: 12px;
  height: 12px;
}

/* Confidence chip */
.confidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
}

.confidence-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

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

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

/* ==========================================================================
   Detail header
   ========================================================================== */

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 32px;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.detail-description {
  margin: 2px 0 0 0;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 12px;
}

.detail-source-row .source-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-source-row .source-description {
  color: var(--text-muted);
}

.detail-source-row .detail-ingredient-id {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  user-select: all;
}

.detail-source-row .detail-external-ref {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  user-select: all;
}

.certified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--status-pass-bg);
  color: var(--status-pass);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.certified-badge i[data-lucide],
.certified-badge svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.detail-divider {
  height: 1px;
  background: var(--border-divider);
}

/* ==========================================================================
   Consistency warnings (amber flag box)
   ========================================================================== */

.consistency-warnings-slot:empty {
  display: none;
}

.consistency-warnings-slot:not(:empty) {
  padding: 0 32px;
}

.warnings-section {
  padding: 10px 14px;
  border: 1px solid #D4890A40;
  background: #D4890A08;
  border-radius: 8px;
}

.warnings-section h3 {
  display: none;
}

.warning-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--font-primary);
  font-size: 12px;
}

.warning-card {
  color: var(--status-warning);
}

.warning-card i[data-lucide],
.warning-card svg[data-lucide] {
  width: 14px;
  height: 14px;
}

.warning-card code,
.warning-gate {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--status-warning);
}

.warning-message {
  color: var(--text-secondary);
  font-weight: normal;
  flex: 1;
}

.btn-dismiss-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border-divider);
  border-radius: 4px;
  background: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

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

.btn-dismiss-warning i[data-lucide],
.btn-dismiss-warning svg[data-lucide] {
  width: 10px;
  height: 10px;
}

.warning-meta {
  display: none;
}

/* ==========================================================================
   Agent review panel (collapsible)
   ========================================================================== */

.agent-review-panel {
  padding: 16px 32px;
  font-family: var(--font-primary);
}

.agent-review-panel > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.agent-review-panel > summary::-webkit-details-marker {
  display: none;
}

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

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

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

.agent-scores-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.agent-score-chip {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-score-chip-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.agent-model-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: none;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-teal-faint, #F0A50015);
  color: var(--text-secondary);
}

.agent-model-badge-det {
  background: var(--bg-muted);
}

/* --- Body (inside collapsible) --- */

.agent-review-body {
  padding-top: 12px;
  padding-left: 13px; /* aligns content with bot icon (past disclosure triangle) */
}

.agent-scores {
  display: flex;
  gap: 24px;
  margin: 0 0 16px;
}

.agent-score-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-score-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.agent-score-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-score-low {
  color: var(--status-fail, #C0392B);
}

.agent-score-high {
  color: var(--status-pass, #4A7C3F);
}

.agent-score-muted {
  font-size: 14px;
  color: var(--text-secondary);
}

.agent-no-ai p {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 10px;
}

.btn-trigger-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--accent-teal, #F0A500);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-trigger-ai:hover {
  background: #D99200;
}

.btn-trigger-ai[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.btn-trigger-ai i[data-lucide],
.btn-trigger-ai svg[data-lucide] {
  width: 15px;
  height: 15px;
}

.ai-review-spinner {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 10px;
}

.ai-review-spinner.htmx-request {
  display: inline-flex;
}

.ai-review-spinner i[data-lucide],
.ai-review-spinner svg[data-lucide] {
  width: 14px;
  height: 14px;
}

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

.spin {
  animation: spin 1s linear infinite;
}


/* --- Summary --- */

.agent-summary {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--bg-muted);
  border-radius: 6px;
}

.agent-summary-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.agent-summary-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

/* --- Recommended name --- */

.agent-recommendation {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-surface);
}

.agent-rec-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-rec-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* --- Nutrient recommendation cards --- */

.agent-nutrient-recs {
  margin: 0 0 16px;
}

.agent-rec-card {
  padding: 10px 14px;
  border: 1px solid var(--border-divider, var(--border-primary));
  border-radius: 6px;
  background: var(--bg-surface);
  margin-top: 8px;
}

.agent-rec-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-rec-field {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-rec-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.agent-rec-arrow i[data-lucide],
.agent-rec-arrow svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.agent-rec-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--status-pass, #4A7C3F);
}

.agent-rec-source {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 6px;
  background: var(--bg-muted);
  border-radius: 3px;
}

.agent-rec-reason {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 6px 0 0;
}

/* --- Accept / Reject action buttons --- */

.agent-rec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-rec-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.agent-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  padding: 0;
}

.agent-action-btn i[data-lucide],
.agent-action-btn svg[data-lucide] {
  width: 14px;
  height: 14px;
}

.agent-action-accept {
  color: var(--status-pass, #4A7C3F);
}

.agent-action-accept:hover {
  background: #4A7C3F14;
  border-color: var(--status-pass, #4A7C3F);
}

.agent-action-reject {
  color: var(--status-fail, #C0392B);
}

.agent-action-reject:hover {
  background: #C0392B14;
  border-color: var(--status-fail, #C0392B);
}

/* --- Flagged issues --- */

.agent-flagged-issues {
  margin: 0 0 16px;
}

.agent-issue-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.agent-issue {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.agent-issue-severity {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-muted);
  color: var(--text-muted);
  flex-shrink: 0;
}

.agent-issue-severity-blocker {
  background: #C0392B18;
  color: var(--status-fail, #C0392B);
}

.agent-issue-severity-warning {
  background: #D4890A18;
  color: #D4890A;
}

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

/* --- Duplicate cards --- */

.agent-duplicates,
.agent-source-recon,
.agent-completeness {
  margin: 0 0 16px;
}

.agent-dup-card {
  padding: 10px 14px;
  border: 1px solid var(--border-divider, var(--border-primary));
  border-radius: 6px;
  background: var(--bg-surface);
  margin-top: 8px;
}

.agent-dup-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.agent-dup-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.agent-dup-verdict {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: auto;
}

.agent-dup-verdict-true_duplicate {
  background: #C0392B18;
  color: var(--status-fail, #C0392B);
}

.agent-dup-verdict-different_food {
  background: #4A7C3F18;
  color: var(--status-pass, #4A7C3F);
}

.agent-dup-verdict-uncertain {
  background: #D4890A18;
  color: #D4890A;
}

.agent-dup-reasoning {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 6px 0 0;
}

/* --- Source recon / completeness --- */

.agent-recon-list,
.agent-gap-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.agent-recon-item,
.agent-gap-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

.agent-recon-field,
.agent-gap-label {
  color: var(--text-primary);
  font-weight: 500;
}

.agent-recon-cv {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.agent-gap-severity {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-muted);
  color: var(--text-muted);
  flex-shrink: 0;
}

.agent-gap-severity-blocker {
  background: #C0392B18;
  color: var(--status-fail, #C0392B);
}

.agent-gap-severity-warning {
  background: #D4890A18;
  color: #D4890A;
}

/* ==========================================================================
   Nutrition table
   ========================================================================== */

.nutrition-table-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 32px;
}

.nutrition-table-section h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.nutrition-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-primary);
}

.nutrition-table thead th {
  padding: 8px 4px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-divider);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-secondary);
}

.nutrition-table thead th:first-child {
  padding-left: 8px;
}

.nutrition-table col.col-field {
  width: 200px;
}

.nutrition-table col.col-value {
  width: 90px;
}

.nutrition-table col.col-source {
  width: 100px;
}

.nutrition-table col.col-status {
  width: 60px;
}

.nutrition-table col.col-ai-rec {
  width: 140px;
}

.nutrition-table col.col-edit {
  width: 36px;
}

.nutrition-row td {
  height: 32px;
  padding: 4px;
  border-bottom: 1px solid var(--border-divider);
  vertical-align: middle;
}

.nutrition-row td:first-child {
  padding-left: 8px;
}

.nutrition-label {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.nutrition-unit-inline {
  font-size: 11px;
  font-weight: normal;
  color: var(--text-secondary);
}

/* Higher-specificity override so sub-rows indent past the first-child
   padding-left set on .nutrition-row td:first-child. */
.nutrition-row.nutrition-row-sub td:first-child {
  padding-left: 28px;
}

.nutrition-row-sub .nutrition-label {
  font-weight: normal;
  color: var(--text-secondary);
}

.nutrition-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-left: 2px solid var(--border-divider);
  border-right: 2px solid var(--border-divider);
}

.nutrition-value-missing {
  color: var(--text-muted);
  font-weight: 500;
}

.nutrition-status {
  text-align: center;
  color: var(--text-muted);
}

.nutrition-status i[data-lucide],
.nutrition-status svg[data-lucide] {
  width: 14px;
  height: 14px;
}

.nutrition-status-ok {
  color: var(--status-pass);
}

.nutrition-status-warn {
  color: var(--status-warning);
}

.nutrition-status-fail {
  color: var(--status-fail);
}

/* Flagged rows get a subtle amber tint only. The heavier gold border is
   reserved for the row currently being edited. */
.nutrition-row-flagged {
  background: #D4890A06;
}

.npm-tag {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--status-warning);
}

.btn-inline-edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-inline-edit i[data-lucide],
.btn-inline-edit svg[data-lucide] {
  width: 14px;
  height: 14px;
}

.btn-inline-edit:hover {
  color: var(--brand-gold);
}

/* ==========================================================================
   Allergen panel
   ========================================================================== */

.allergen-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 32px;
}

.allergen-section h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.allergen-current {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.allergen-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  background: var(--status-fail-bg);
  color: var(--status-fail);
}

.allergen-chip i[data-lucide],
.allergen-chip svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.allergen-chip-absent {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: normal;
}

.allergen-chip-inferred {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px dashed var(--status-warning);
}

.allergen-chip-ai_generated {
  background: #E8D5F0;
  color: var(--text-primary);
  border: 1px dashed #A869D5;
}

.allergen-chip button {
  background: none;
  border: 0;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  text-decoration: underline;
}

.allergen-empty {
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.allergen-add {
  margin-top: 4px;
  font-family: var(--font-primary);
  font-size: 12px;
}

.allergen-add summary {
  cursor: pointer;
  color: var(--text-secondary);
}

.allergen-add form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.allergen-add select {
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--bg-surface);
}

.allergen-add button {
  padding: 4px 10px;
  background: var(--brand-gold);
  color: var(--brand-espresso);
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   Audit trail
   ========================================================================== */

.audit-trail {
  padding: 16px 32px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-secondary);
}

.audit-trail summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.audit-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-divider);
}

.audit-header {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}

.audit-action {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.audit-action-approved {
  background: var(--status-pass-bg);
  color: var(--status-pass);
}

.audit-action-flagged {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.audit-action-skipped {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.audit-action-certified {
  background: var(--accent-teal-light);
  color: var(--brand-gold);
}

.audit-action-edit {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.audit-action-certify {
  background: var(--accent-teal-light);
  color: var(--brand-gold);
}

.audit-notes {
  font-size: 11px;
  color: var(--text-secondary);
  padding-left: 2px;
}

.audit-changes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.audit-change-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.audit-change-field {
  min-width: 100px;
  color: var(--text-secondary);
}

.audit-change-old {
  color: var(--status-fail);
  text-decoration: line-through;
}

.audit-change-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.audit-change-arrow svg {
  width: 12px;
  height: 12px;
}

.audit-change-new {
  color: var(--status-pass);
  font-weight: 500;
}

.audit-restore-btn {
  background: transparent;
  border: 1px solid var(--border-divider);
  border-radius: 4px;
  padding: 1px 4px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  margin-left: auto;
}

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

.audit-restore-btn svg {
  width: 11px;
  height: 11px;
}

.audit-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* ==========================================================================
   Action footer
   ========================================================================== */

.review-detail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.review-detail-spacer {
  flex: 1;
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-primary);
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.review-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 7px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
}

.review-actions .btn i[data-lucide],
.review-actions .btn svg[data-lucide] {
  width: 16px;
  height: 16px;
}

.btn-approve {
  background: var(--status-pass);
  color: #FFFFFF;
}

.btn-approve:hover {
  filter: brightness(0.95);
}

.btn-flag {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  padding: 7px 20px;
  font-size: 12px;
}

.btn-skip {
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
}

.btn-certify {
  background: var(--status-pass);
  color: #FFFFFF;
}

.btn-certify:hover {
  filter: brightness(0.95);
}

.btn-certify.btn-disabled:hover {
  filter: none;
}

.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.review-actions-spacer {
  flex: 1;
}

.certify-error {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--status-warning);
}

.certify-error i[data-lucide],
.certify-error svg[data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.review-hotkeys {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.review-hotkeys kbd {
  font-family: inherit;
  background: transparent;
  padding: 0;
  border: 0;
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: 4px;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.review-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
  flex: 1;
}

.review-empty-state i[data-lucide],
.review-empty-state svg[data-lucide] {
  width: 32px;
  height: 32px;
}

/* ==========================================================================
   Comment modal
   ========================================================================== */

.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 23, 18, 0.5);
}

.comment-modal-body {
  position: relative;
  background: var(--bg-surface);
  padding: 24px;
  border-radius: 12px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(30, 23, 18, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-modal-body h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.comment-modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-secondary);
}

.comment-modal-body input[type="text"],
.comment-modal-body textarea {
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: 8px 10px;
  resize: vertical;
}

.comment-modal-body input[type="text"]:focus,
.comment-modal-body textarea:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 2px var(--accent-teal-light);
}

.comment-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.comment-modal-actions .btn {
  padding: 8px 16px;
  border-radius: 7px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
}

.comment-modal-actions .btn-primary {
  background: var(--brand-gold);
  color: var(--brand-espresso);
}

.comment-modal-actions .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.comment-modal-actions .btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

/* ==========================================================================
   Shared heading for review sub-sections
   ========================================================================== */

.nut-heading {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-muted));
  margin: 0 0 10px 0;
}

/* ==========================================================================
   Nutrition inline editing
   ========================================================================== */

.nutrition-value-text {
  display: inline-block;
  cursor: text;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 40px;
}

.nutrition-value-text:hover {
  background: var(--bg-muted);
}

.nutrition-row-editing td {
  height: 36px;
  background: #F0A50008;
  border-bottom: 2px solid var(--brand-gold);
}

.nutrition-edit-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.nutrition-edit-input {
  width: 64px;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--brand-gold);
  border-radius: 4px;
  outline: none;
}

.nutrition-edit-input:focus {
  box-shadow: 0 0 0 2px var(--accent-teal-light, #F0A50024);
}

.nutrition-row-overridden .nutrition-value {
  color: var(--brand-gold);
}

.restore-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: #5B7282;
  border-radius: 4px;
}

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

.restore-chip i[data-lucide],
.restore-chip svg[data-lucide] {
  width: 10px;
  height: 10px;
}

/* Source badge rendered as button for the picker trigger. Do NOT use
   `font: inherit` here: the badge lives inside a .nutrition-table cell
   whose font-size is 13 px, which would blow the badge up. Keep the
   badge's own compact mono typography (9 px) so it matches the source
   badge under the ingredient title. */
button.source-badge {
  border: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

button.source-badge:hover {
  filter: brightness(0.95);
}

/* Status column icon colour classes. These sit on the <i data-lucide>
   element so they win over the muted colour set on .nutrition-status. */
.nutrition-status .icon-ok {
  color: var(--status-pass);
}

.nutrition-status .icon-warn {
  color: var(--status-warning);
}

.nutrition-status .icon-fail {
  color: var(--status-fail);
}

/* ==========================================================================
   Source picker popup (NI-2)
   ========================================================================== */

#source-picker-slot {
  position: relative;
}

.source-picker-popup {
  position: fixed;
  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.09);
  z-index: 10;
  overflow: hidden;
}

.source-picker-head {
  padding: 10px 14px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.source-picker-divider {
  height: 1px;
  background: var(--border-divider);
}

.source-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 12px;
  color: var(--text-primary);
  text-align: left;
}

.source-picker-option:hover {
  background: var(--bg-muted);
}

.source-picker-option-active {
  background: #4A7C3F08;
  border-left-color: #4A7C3F40;
  cursor: default;
}

.source-picker-option-active:hover {
  background: #4A7C3F08;
}

.source-picker-left,
.source-picker-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.source-picker-name {
  color: var(--text-secondary);
}

.source-picker-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

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

.source-picker-option i[data-lucide],
.source-picker-option svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.source-picker-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0;
  background: var(--bg-primary);
}

.source-picker-custom i[data-lucide],
.source-picker-custom svg[data-lucide] {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.source-picker-custom input {
  flex: 1;
  padding: 4px 6px;
  font-family: var(--font-primary);
  font-size: 12px;
  font-style: italic;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  outline: none;
}

.source-picker-custom input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Classification section
   ========================================================================== */

.review-classification {
  padding: 16px 32px;
}

.classification-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 13px;
}

.classification-label {
  color: var(--text-secondary);
}

.classification-value {
  color: var(--text-primary);
  font-weight: 500;
}

.classification-value-missing {
  color: var(--status-fail, #C2392A);
  font-weight: 600;
}

.classification-spacer {
  flex: 1;
}

.btn-classification-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-classification-edit:hover {
  color: var(--brand-gold);
  border-color: var(--brand-gold);
}

.classification-edit-row {
  margin: 0;
}

.classification-input {
  flex: 1;
  max-width: 320px;
  padding: 5px 10px;
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--brand-gold);
  border-radius: 6px;
  outline: none;
}

.classification-input:focus {
  box-shadow: 0 0 0 2px var(--accent-teal-light, #F0A50024);
}

.btn-classification-save,
.btn-classification-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
}

.btn-classification-save {
  background: var(--brand-gold);
  color: var(--brand-espresso);
  border: 0;
}

.btn-classification-save:hover {
  filter: brightness(0.95);
}

.btn-classification-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-primary);
  padding: 5px 8px;
}

.btn-classification-cancel:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-classification-save i[data-lucide],
.btn-classification-save svg[data-lucide],
.btn-classification-cancel i[data-lucide],
.btn-classification-cancel svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.btn-classification-edit i[data-lucide],
.btn-classification-edit svg[data-lucide] {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   Allergens grid (all allergens as toggles)
   ========================================================================== */

.review-allergens {
  padding: 16px 32px;
}

.allergen-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.allergen-grid .allergen-chip {
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 11px;
}

.allergen-grid .allergen-chip-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 6px;
  font-weight: 600;
}

.allergen-chip-verified {
  background: #C23B2210;
  color: #C23B22;
}

.allergen-chip-verified i[data-lucide],
.allergen-chip-verified svg[data-lucide] {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.allergen-chip-unverified {
  background: #D4890A15;
  color: #8A5A00;
  box-shadow: inset 0 0 0 1px #D4890A60;
}

.allergen-chip-unverified:hover {
  background: #D4890A25;
}

.allergen-chip-verify,
.allergen-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1;
}

.allergen-chip-verify i[data-lucide],
.allergen-chip-verify svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.allergen-chip-verify {
  background: #4A7C3F;
  color: #FFFFFF;
}

.allergen-chip-verify:hover {
  filter: brightness(1.08);
}

.allergen-chip-remove:hover {
  background: rgba(0, 0, 0, 0.08);
}

.allergen-chip-inactive {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: normal;
}

.allergen-chip-inactive:hover {
  background: #E3DCD1;
  color: var(--text-secondary);
}

/* ==========================================================================
   AI Rec column in nutrition table
   ========================================================================== */

.nutrition-ai-rec-cell {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

.ai-rec-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-rec-num {
  color: var(--accent-teal, #F0A500);
  font-weight: 600;
}

.ai-rec-actions {
  display: inline-flex;
  gap: 2px;
}

.ai-rec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}

.ai-rec-btn i[data-lucide],
.ai-rec-btn svg[data-lucide] {
  width: 13px;
  height: 13px;
}

.ai-rec-accept:hover {
  background: var(--status-pass, #4A7C3F);
  color: #fff;
}

.ai-rec-reject:hover {
  background: var(--status-fail, #C0392B);
  color: #fff;
}

.ai-rec-agreed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--status-pass, #4A7C3F);
  font-size: 12px;
  font-weight: 500;
}

.ai-rec-agreed i[data-lucide],
.ai-rec-agreed svg[data-lucide] {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   Agent review: accepted name revert + reasoning
   ========================================================================== */

.agent-rec-row-accepted {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-rec-accepted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--status-pass, #4A7C3F);
  background: rgba(74, 124, 63, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

.agent-rec-accepted-badge i[data-lucide],
.agent-rec-accepted-badge svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.agent-action-revert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-divider);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.agent-action-revert:hover {
  background: var(--status-fail, #C0392B);
  color: #fff;
  border-color: var(--status-fail, #C0392B);
}

.agent-action-revert i[data-lucide],
.agent-action-revert svg[data-lucide] {
  width: 12px;
  height: 12px;
}

.agent-nutrient-reasoning {
  margin-top: 12px;
}

.agent-reasoning-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13px;
  line-height: 1.4;
}

.agent-reasoning-item:last-child {
  border-bottom: none;
}

.agent-reasoning-field {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  min-width: 100px;
  flex-shrink: 0;
  padding-top: 1px;
}

.agent-reasoning-text {
  color: var(--text-primary);
}

/* ==========================================================================
   Setup Mode (OPS-003)
   ========================================================================== */

.setup-workspace {
  padding: 32px;
  max-width: 1000px;
  margin: 0 auto;
}

.setup-header {
  margin-bottom: 24px;
}

.setup-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.setup-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.setup-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* Admin direct-edit search */

.admin-search-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.admin-search-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.admin-search-label i {
  width: 14px;
  height: 14px;
}

.admin-search-field {
  position: relative;
}

.admin-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-primary);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-gold) 25%, transparent);
}

.admin-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
}

.admin-search-dropdown-empty {
  padding: 12px 14px;
}

.admin-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-divider);
}

.admin-search-result:last-child {
  border-bottom: none;
}

.admin-search-result:hover {
  background: var(--bg-muted);
}

.admin-search-result-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 56px;
}

.admin-search-result-name {
  font-size: 14px;
  flex: 1;
}

.admin-search-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.admin-search-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.setup-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 24px;
}

.setup-card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.setup-field {
  margin-bottom: 16px;
}

.setup-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.setup-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-primary);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.setup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.setup-chip {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-family: var(--font-primary);
  background: var(--bg-muted);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
}

.setup-chip-active {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.setup-match-count {
  background: var(--bg-muted);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-primary);
}

.setup-estimate {
  font-size: 13px;
  color: var(--text-muted);
}

.setup-helper-text {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 0;
  text-align: center;
}

.btn-checkout {
  width: 100%;
  padding: 12px;
  background: var(--brand-gold);
  color: var(--text-primary);
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
}

.btn-checkout:disabled,
.btn-checkout.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Active Batch card */

.batch-progress-display {
  background: var(--bg-muted);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}

.batch-big-number {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--text-primary);
}

.batch-big-divider {
  font-size: 28px;
  color: var(--text-muted);
  margin: 0 2px;
}

.batch-big-total {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text-muted);
}

.batch-progress-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.batch-progress-bar {
  background: var(--border-primary);
  border-radius: 4px;
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
}

.batch-progress-bar-fill {
  background: var(--status-pass);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.batch-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.batch-stat {
  text-align: center;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: 6px;
}

.batch-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.batch-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

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

.btn-continue {
  flex: 1;
  padding: 12px;
  background: var(--status-pass);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-release {
  padding: 12px 16px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

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

/* Batch History */

.setup-history {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 24px;
}

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

.batch-history-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-primary);
}

.batch-history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg-muted);
}

.batch-history-table .text-right {
  text-align: right;
}

/* ==========================================================================
   Review Mode (OPS-003)
   ========================================================================== */

.batch-review-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.batch-detail-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.progress-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.progress-strip-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-setup-back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-primary);
}

.progress-strip-count {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-strip-bar {
  background: var(--border-primary);
  border-radius: 4px;
  height: 6px;
  width: 160px;
  overflow: hidden;
}

.progress-strip-bar-fill {
  background: var(--status-pass);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-strip-centre {
  text-align: center;
}

.progress-strip-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.progress-strip-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.progress-strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.progress-strip-separator {
  color: var(--border-primary);
}

.progress-strip-remaining {
  color: var(--status-pass);
}

/* Review actions - batch mode additions */

.review-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-next-preview {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-primary);
  cursor: pointer;
}

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

.btn-nav.btn-disabled,
.btn-nav[disabled] {
  color: var(--text-muted);
}

/* ==========================================================================
   Batch Completion (OPS-003)
   ========================================================================== */

.batch-complete-workspace {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 32px;
}

.batch-complete-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

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

.batch-complete-big {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  color: var(--status-pass);
}

.batch-complete-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.batch-complete-details {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 32px;
}

.batch-complete-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.batch-complete-detail-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.batch-complete-detail-label {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-next-batch {
  display: inline-block;
  padding: 12px 32px;
  background: var(--brand-gold);
  color: var(--text-primary);
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  text-decoration: none;
  cursor: pointer;
}

/* ==========================================================================
   Decoupled review layout (2026-04-17)
   - Status badge at top of detail when a terminal decision exists
   - Decisions section inline between classification and audit-trail
   - Floating nav footer outside #review-detail for pure-positional nav
   ========================================================================== */

.review-status-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.review-status-badge i[data-lucide],
.review-status-badge svg[data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.review-status-badge-reason {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 2px;
}

.review-status-badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.review-status-badge-title {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.review-status-badge-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.review-status-badge--certify {
  background: var(--status-pass-bg);
  border-color: var(--status-pass);
  color: var(--status-pass);
}

.review-status-badge--approve {
  background: var(--status-pass-bg);
  border-color: var(--status-pass);
  color: var(--status-pass);
}

.review-status-badge--flag {
  background: var(--status-warning-bg);
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.review-status-badge--delist {
  background: #B23A2A12;
  border-color: #B23A2A;
  color: #B23A2A;
}

/* Inline review decisions section (replaces sticky action footer) */
.review-decisions {
  padding: 16px 0;
  margin: 8px 0;
}

.review-decisions-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.review-decisions-header h3 {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.review-decisions-blockers {
  margin: 0;
  font-size: 12px;
  color: var(--status-warning);
  font-style: italic;
}

.review-decisions-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.review-decisions-actions-left,
.review-decisions-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-decisions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.review-decisions .btn i[data-lucide],
.review-decisions .btn svg[data-lucide] {
  width: 16px;
  height: 16px;
}

/* Floating nav footer: pure positional nav + batch-complete CTA */
.review-nav-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 32px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-primary);
  z-index: 2;
}

.review-nav-footer-prev,
.review-nav-footer-next {
  flex: 0 0 auto;
}

.review-nav-footer-centre {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-nav-footer-progress {
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-muted);
}

.review-nav-footer .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.review-nav-footer .btn-primary i[data-lucide],
.review-nav-footer .btn-primary svg[data-lucide] {
  width: 16px;
  height: 16px;
}
