/* ── Google Fonts — Inter ────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Mr Vitamins Brand Palette ──────────────────────────────────────────────── */
:root {
  --red:          #e2323a;
  --red-dark:     #c42930;
  --red-pale:     #fef2f2;
  --charcoal:     #281e1e;
  --charcoal-90:  #342828;
  --white:        #ffffff;
  --sand:         #fee4d2;
  --sand-pale:    #fff4ed;
  --plum:         #50174b;
  --plum-muted:   #a88ba5;
  --plum-pale:    #f0eaef;
  --salmon:       #fdb7b5;
  --salmon-pale:  #fedbda;

  /* Elevation shadows */
  --shadow-sm:  0 1px 3px rgba(40,30,30,0.08), 0 1px 2px rgba(40,30,30,0.04);
  --shadow-md:  0 4px 12px rgba(40,30,30,0.10), 0 2px 4px rgba(40,30,30,0.06);
  --shadow-lg:  0 12px 32px rgba(40,30,30,0.12), 0 4px 8px rgba(40,30,30,0.06);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(226,50,58,0.18);
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }

body {
  background-color: var(--sand-pale);
  /* Subtle warm noise texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.022'/%3E%3C/svg%3E");
  color: var(--charcoal);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Tailwind custom colour overrides ────────────────────────────────────────── */
.text-red         { color: var(--red) !important; }
.text-charcoal    { color: var(--charcoal) !important; }
.text-plum        { color: var(--plum) !important; }
.text-plum-muted  { color: var(--plum-muted) !important; }
.bg-red           { background-color: var(--red) !important; }
.bg-charcoal      { background-color: var(--charcoal) !important; }
.bg-plum          { background-color: var(--plum) !important; }
.bg-plum-pale     { background-color: var(--plum-pale) !important; }
.bg-sand          { background-color: var(--sand) !important; }
.bg-sand-pale     { background-color: var(--sand-pale) !important; }
.bg-salmon-pale   { background-color: var(--salmon-pale) !important; }
.border-sand      { border-color: var(--sand) !important; }
.border-salmon    { border-color: var(--salmon) !important; }
.border-red       { border-color: var(--red) !important; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--charcoal) 0%, var(--charcoal-90) 100%);
  color: var(--white);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Accent lines — red diagonal marks */
.site-header::before {
  content: '';
  position: absolute;
  top: 0; right: 100px;
  width: 2px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--red), transparent);
  opacity: 0.5;
  transform: skewX(-18deg);
}
.site-header::after {
  content: '';
  position: absolute;
  top: 0; right: 114px;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--red), transparent);
  opacity: 0.2;
  transform: skewX(-18deg);
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 1;
}

.header-wordmark {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--white);
  line-height: 1;
}
.header-wordmark span { color: var(--red); }

.header-sub {
  font-size: 0.65rem;
  color: var(--plum-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
}

.header-tagline {
  font-size: 0.72rem;
  color: rgba(168,139,165,0.7);
  font-style: italic;
}

/* Back navigation link used in sub-page headers (review, pipeline, tech-sheets) */
.header-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}
.header-back-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.header-back-link:active {
  background: rgba(255,255,255,0.07);
}
.header-back-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.card-raised {
  box-shadow: var(--shadow-md);
}

/* Left-accent variant — for callout cards */
.card-accent {
  border-left: 3px solid var(--red);
}

/* ── Stats bar ───────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--sand);
  border-radius: 10px 0 0 10px;
}

.stat-card--red::before    { background: var(--red); }
.stat-card--green::before  { background: #16a34a; }
.stat-card--plum::before   { background: var(--plum); }
.stat-card--amber::before  { background: #d97706; }
.stat-card--muted::before  { background: var(--plum-muted); }

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  position: absolute;
  top: 0.75rem; right: 0.9rem;
  opacity: 0.12;
  color: var(--charcoal);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--charcoal);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--plum-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-top: 0.1rem;
}

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tab-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--plum-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--sand-pale);
  color: var(--charcoal);
}

.tab-active {
  background: var(--charcoal) !important;
  color: var(--white) !important;
  box-shadow: var(--shadow-sm);
}

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-row {
  transition: background 0.1s;
}
.table-row:hover { background: var(--sand-pale); }
.table-row:last-child { border-bottom: none !important; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Status badge colours (used by JS renderJobRow) */
.badge-queued     { background: var(--sand-pale);   color: var(--plum-muted);  border: 1px solid var(--sand); }
.badge-processing { background: #fef9c3;             color: #854d0e;            border: 1px solid #fde68a; }
.badge-review     { background: #fff0f0;             color: var(--red);         border: 1px solid var(--salmon); }
.badge-approved   { background: #f0fdf4;             color: #15803d;            border: 1px solid #bbf7d0; }
.badge-published  { background: var(--plum-pale);   color: var(--plum);        border: 1px solid #d9c9d7; }
.badge-rejected   { background: #fef3c7;             color: #92400e;            border: 1px solid #fde68a; }
.badge-failed     { background: #fff0f0;             color: var(--charcoal);    border: 1px solid var(--salmon); }
.badge-awaiting   { background: var(--sand-pale);   color: #92400e;            border: 1px solid var(--sand); }

/* ── Confidence dot ──────────────────────────────────────────────────────────── */
.conf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Confidence bar ──────────────────────────────────────────────────────────── */
.conf-bar-track {
  background: var(--sand);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
  width: 60px;
  display: inline-block;
  vertical-align: middle;
}
.conf-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.conf-bar-fill--high   { background: linear-gradient(90deg, #16a34a, #22c55e); }
.conf-bar-fill--mid    { background: linear-gradient(90deg, #d97706, #f59e0b); }
.conf-bar-fill--low    { background: linear-gradient(90deg, var(--red-dark), var(--red)); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.845rem;
  background: var(--red);
  color: var(--white);
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(226,50,58,0.35), 0 1px 2px rgba(226,50,58,0.2);
  letter-spacing: -0.01em;
}
.btn-primary:hover:not(:disabled) {
  background: var(--red-dark);
  box-shadow: 0 3px 8px rgba(226,50,58,0.4), 0 1px 3px rgba(226,50,58,0.25);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.845rem;
  background: var(--plum);
  color: var(--white);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.btn-secondary:hover:not(:disabled) { background: #3e1139; transform: translateY(-1px); }
.btn-secondary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(80,23,75,0.25); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.845rem;
  background: var(--charcoal);
  color: var(--white);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.btn-danger:hover:not(:disabled) { background: #1a1212; transform: translateY(-1px); }
.btn-danger:active:not(:disabled) { transform: translateY(0); }
.btn-danger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(40,30,30,0.3); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.845rem;
  background: transparent;
  color: var(--charcoal);
  border: 1.5px solid rgba(40,30,30,0.25);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--charcoal);
  color: var(--white);
  border-color: var(--charcoal);
  transform: translateY(-1px);
}
.btn-ghost:active:not(:disabled) { transform: translateY(0); }
.btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(40,30,30,0.2); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* Small size modifier */
.btn-sm {
  padding: 0.3rem 0.75rem !important;
  font-size: 0.78rem !important;
  border-radius: 5px !important;
}

/* ── Form fields ─────────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--plum-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.field-input {
  display: block;
  width: 100%;
  background: var(--white);
  border: 1.5px solid var(--sand);
  border-radius: 7px;
  padding: 0.5rem 0.8rem;
  color: var(--charcoal);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
.field-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: var(--focus-ring);
}
.field-input::placeholder { color: var(--plum-muted); opacity: 0.7; }

.field-value {
  color: var(--charcoal);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.6;
}

.field-row {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--sand);
}
.field-row:last-child { border-bottom: none; padding-bottom: 0; }

.field-group { display: flex; flex-direction: column; }

.field-flagged .field-input {
  border-color: var(--salmon) !important;
  background: #fff9f9;
}
.field-flagged .field-input:focus {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(253,183,181,0.3);
}

/* ── Login screen ────────────────────────────────────────────────────────────── */
.login-card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 16px;
  padding: 2.5rem 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 48px rgba(40,30,30,0.08), 0 2px 6px rgba(40,30,30,0.04);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--plum) 100%);
}
.login-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--charcoal) 0%, #3d2e2e 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 6px 14px rgba(40,30,30,0.18);
}
.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.01em;
  margin: 0;
}
.login-subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--plum);
  margin: 0.2rem 0 0;
}
.login-caption {
  font-size: 0.74rem;
  color: var(--plum-muted);
  margin: 0.45rem 0 0;
}
.login-input-wrap { position: relative; }
.login-input-wrap .field-input { padding-right: 2.6rem; }
.login-input-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--plum-muted);
  padding: 6px;
  line-height: 0;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.login-input-toggle:hover { color: var(--charcoal); background: var(--sand-pale); }
.login-error {
  font-size: 0.78rem;
  color: var(--red);
  background: var(--salmon-pale);
  border: 1px solid var(--salmon);
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  margin: 0;
}
.login-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--plum-muted);
  margin: 1.5rem 0 0;
  line-height: 1.5;
}

/* ── Sticky footer ───────────────────────────────────────────────────────────── */
.sticky-footer {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--sand);
  padding: 1rem 1.5rem;
  z-index: 10;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}

.toast {
  min-width: 260px;
  animation: slide-in 0.22s cubic-bezier(0.16,1,0.3,1);
  box-shadow: var(--shadow-lg) !important;
  border-radius: 10px !important;
}

@keyframes slide-in {
  from { transform: translateX(110%) scale(0.95); opacity: 0; }
  to   { transform: translateX(0)    scale(1);    opacity: 1; }
}

/* ── Processing spinner ──────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--sand);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

/* ── Section divider ─────────────────────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--sand);
  margin: 1.5rem 0;
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.9rem 0 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--sand);
  font-size: 0.77rem;
  font-weight: 500;
}

.breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sand);
  margin-bottom: 1rem;
}
.breadcrumb-row .breadcrumb {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0.9rem;
}

.breadcrumb a {
  color: var(--plum-muted);
  text-decoration: none;
  transition: color 0.12s;
}
.breadcrumb a:hover { color: var(--charcoal); }

.breadcrumb-sep {
  color: var(--sand);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}

.breadcrumb-current {
  color: var(--charcoal);
  font-weight: 600;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.7rem;
  color: var(--plum-muted);
  border-top: 1px solid var(--sand);
  margin-top: 3rem;
  letter-spacing: 0.02em;
}

/* ── Dashboard layout (sidebar + main) ────────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  align-items: flex-start;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────────── */
:root {
  --sidebar-w: 210px;
  --sidebar-w-collapsed: 60px;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--charcoal) 0%, #1e1616 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow: hidden;
  transition: width 0.22s cubic-bezier(.4,0,.2,1), min-width 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 20;
  flex-shrink: 0;
}

.sidebar.sidebar-collapsed {
  width: var(--sidebar-w-collapsed);
  min-width: var(--sidebar-w-collapsed);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  /* right-aligned when expanded so it sits at the sidebar edge */
  margin: 14px 8px 10px auto;
  flex-shrink: 0;
  border: none;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.55);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, margin 0.22s cubic-bezier(.4,0,.2,1);
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,0.14);
  color: var(--white);
}
/* Re-centre when collapsed — sidebar is icon-width so centred = same position */
.sidebar.sidebar-collapsed .sidebar-toggle {
  margin: 14px auto 10px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Sidebar view-tab overrides (vertical layout) ─────────────────────────────── */
.sidebar .view-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.62rem 0.7rem;
  border-radius: 8px;
  font-size: 0.815rem;
  font-weight: 500;
  color: rgba(255,255,255,0.52);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.sidebar .view-tab:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.88);
}
.sidebar .view-tab-active {
  background: rgba(226,50,58,0.14);
  color: var(--white) !important;
  font-weight: 600;
}
.sidebar .view-tab-active::after { display: none; }

/* Collapsed: centre icons, hide labels */
.sidebar.sidebar-collapsed .sidebar-nav .view-tab {
  justify-content: center;
  padding: 0.62rem;
  gap: 0;
}
.sidebar.sidebar-collapsed .sidebar-footer .view-tab {
  justify-content: center;
  padding: 0.62rem;
  gap: 0;
}

.sidebar-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.18s, max-width 0.18s;
  max-width: 160px;
  opacity: 1;
}
.sidebar.sidebar-collapsed .sidebar-label {
  opacity: 0;
  max-width: 0;
}

/* Sidebar footer — processing + sign out */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-processing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-processing.hidden { display: none !important; }
.sidebar.sidebar-collapsed .sidebar-processing {
  justify-content: center;
  padding: 0.6rem;
  gap: 0;
}

/* ── Fallback: keep old view-tab styles for any non-sidebar usage ─────────────── */
.view-tab {
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--plum-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.view-tab:hover { background: var(--sand-pale); color: var(--charcoal); }

.view-tab-active {
  color: var(--charcoal) !important;
  font-weight: 700;
  position: relative;
}
.view-tab-active::after {
  content: '';
  position: absolute;
  bottom: -0.55rem;
  left: 0.25rem; right: 0.25rem;
  height: 2px;
  background: var(--red);
  border-radius: 2px 2px 0 0;
}

/* ── Pipeline diagram ─────────────────────────────────────────────────────────── */
.pipeline-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 148px;
  max-width: 160px;
  flex-shrink: 0;
}

.pipeline-node {
  background: var(--white);
  border: 1.5px solid var(--sand);
  border-radius: 10px;
  padding: 1rem 0.75rem;
  text-align: center;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.pipeline-node:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pipeline-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 6px rgba(226,50,58,0.35);
}

.pipeline-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.pipeline-desc {
  font-size: 0.68rem;
  color: var(--plum-muted);
  line-height: 1.45;
}

.pipeline-arrow {
  display: flex;
  align-items: center;
  padding: 0 0.3rem;
  margin-top: 2.4rem;
  color: var(--plum-muted);
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Log viewer ───────────────────────────────────────────────────────────────── */
.log-output {
  background: #1a1212;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  height: 480px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.75;
  border: 1px solid rgba(40,30,30,0.5);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding: 0.12rem 0;
}

.log-ts {
  color: #6e5a6b;
  white-space: nowrap;
  flex-shrink: 0;
}

.log-level {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.62rem;
  padding: 0.06rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.log-level-info    { background: rgba(80,23,75,0.45);  color: #c8a8c5; }
.log-level-warning { background: rgba(245,158,11,0.22); color: #fbbf24; }
.log-level-error   { background: rgba(226,50,58,0.3);   color: #fca5a8; }

.log-event { color: #ede8ec; flex: 1; }
.log-meta  { color: #5a4857; font-size: 0.65rem; }

/* ── Settings ─────────────────────────────────────────────────────────────────── */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--sand);
}
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }

.setting-label { font-size: 0.875rem; color: var(--charcoal); font-weight: 600; }
.setting-hint  { font-size: 0.73rem; color: var(--plum-muted); margin-top: 0.15rem; line-height: 1.4; }

.btn-group {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.btn-option {
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  font-size: 0.77rem;
  font-weight: 600;
  background: var(--sand-pale);
  color: var(--plum-muted);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-option:hover { background: var(--sand); color: var(--charcoal); }
.btn-option-active { background: var(--charcoal) !important; color: var(--white) !important; border-color: var(--charcoal) !important; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 0.75rem;
  text-align: center;
}

.empty-state-icon {
  width: 48px; height: 48px;
  background: var(--sand-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum-muted);
  font-size: 1.25rem;
  border: 1px solid var(--sand);
  margin-bottom: 0.25rem;
}

.empty-state-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--charcoal);
}

.empty-state-sub {
  font-size: 0.78rem;
  color: var(--plum-muted);
  max-width: 280px;
  line-height: 1.5;
}

/* ── Inline code / mono ──────────────────────────────────────────────────────── */
.inline-code {
  font-family: ui-monospace, monospace;
  background: var(--sand-pale);
  border: 1px solid var(--sand);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-size: 0.82em;
  color: var(--plum);
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.font-mono {
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
}

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a88ba5' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ── Fade-in animation ───────────────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fade-in 0.25s ease-out both;
}

/* ── Reduced motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Review image cards ──────────────────────────────────────────────────────── */
.img-card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.15s;
}
.img-card:hover { box-shadow: var(--shadow-md); }

.img-card-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--sand-pale);
  padding: 0.5rem;
  cursor: zoom-in;
  display: block;
}

.img-card-footer {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--sand);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.img-card-delete {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--plum-muted);
  padding: 0.2rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: color 0.12s, background 0.12s;
}
.img-card-delete:hover { color: var(--red); background: var(--salmon-pale); }

/* ── Upload zone ─────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--sand);
  border-radius: 10px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--sand-pale);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--plum-muted);
  background: var(--plum-pale);
}

/* ── Image lightbox overlay ──────────────────────────────────────────────────── */
.img-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(40, 30, 30, 0.88);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.img-lightbox.open { display: flex; }
.img-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.img-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.img-lightbox-close:hover { background: rgba(255,255,255,0.22); }
