/* ==========================================================================
   Fonts -- self-hosted, single variable file covers weights 100-900,
   zero runtime dependency on any external font service. Apollo.io (the
   visual reference for this file) uses "ABC Diatype", a commercially
   licensed typeface from ABC Dinamo -- that file isn't ours to redistribute,
   so Inter stays as the closest freely-licensed grotesk in the same family.
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Tokens -- sampled from a real reference (Apollo.io): one flat background
   tone everywhere, surfaces separated by a border rather than a lighter
   fill, and three purpose-built accents instead of one color reused for
   everything (yellow = the one primary CTA, purple = AI/insights-flavored
   features, blue = selected/active state).
   ========================================================================== */
:root {
  /* spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* type scale */
  --font-sans: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 26px;

  /* radii -- pill-shaped controls, modest rounding on containers */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* color -- one flat surface tone, border-only separation */
  --bg: #2b2a2c;
  --bg-recessed: #221f22; /* only for genuinely-recessed bits: input fill, progress track */
  --border: #46444a;
  --border-strong: #5c5a60;
  --text: #ececee;
  --text-muted: #9b999e;
  --text-faint: #6d6b70;

  /* general interactive blue -- links, focus rings, sort arrows */
  --blue: #5b8def;
  --blue-strong: #7ea6f2;
  --blue-rgb: 91, 141, 239;
  /* muted selected/active-state treatment (Apollo's KPI-tile "Total" state) */
  --blue-selected-bg: #253f56;
  --blue-selected-text: #d4e0f2;

  /* the one primary-CTA color */
  --yellow: #eff06b;
  --yellow-hover: #e4e55a;
  --yellow-text: #232310;

  /* AI / insights-flavored features (Trends tab) */
  --purple: #8b7fe8;
  --purple-rgb: 139, 127, 232;
  --purple-soft: #e5def7;

  --good: #34d399;
  --good-rgb: 52, 211, 153;
  --warn: #fbbf24;
  --warn-rgb: 251, 191, 36;
  --bad: #f87171;
  --bad-rgb: 248, 113, 113;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Reset / base
   ========================================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-strong); text-decoration: none; }
a:hover { color: var(--blue); text-decoration: underline; }

h1, h2, h3, p { margin: 0; }

::selection { background: rgba(var(--blue-rgb), 0.35); }

/* ==========================================================================
   Layout
   ========================================================================== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.topbar-brand h1 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-brand p { margin-top: 2px; font-size: var(--text-xs); color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: var(--space-3); position: relative; }

.global-progress-bar {
  height: 2px;
  background: var(--bg);
}
.global-progress-bar.active { background: var(--bg-recessed); }
.global-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.4s ease;
}
.global-progress-bar.indeterminate .global-progress-bar-fill {
  width: 30% !important;
  animation: indeterminate-slide 1.1s ease-in-out infinite;
}

.tabs {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.tab-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab-button:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab-button.active { color: var(--text); background: rgba(255, 255, 255, 0.09); }
/* Trends is our "insights" surface -- gets the AI-flavored purple treatment
   when active, same way Apollo reserves purple for its AI features. */
.tab-button.active[data-tab="trends"] { color: var(--purple-soft); background: rgba(var(--purple-rgb), 0.16); }

.tab-panel { display: none; padding: var(--space-6); flex: 1; min-height: 0; }
.tab-panel.active { display: flex; flex-direction: column; gap: var(--space-4); }

.footnote {
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--space-5);
}

/* ==========================================================================
   Buttons -- pill-shaped; only the single primary action is a filled color,
   everything else is bare-bordered ("ghost") so the page doesn't read as a
   wall of colored buttons.
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--blue-strong); outline-offset: 2px; }

.btn-primary { background: var(--yellow); color: var(--yellow-text); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--yellow-hover); }

.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.04); }

.btn-danger { background: transparent; color: var(--bad); border-color: rgba(var(--bad-rgb), 0.4); }
.btn-danger:hover:not(:disabled) { background: rgba(var(--bad-rgb), 0.1); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  padding: 0;
}
.btn-icon:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.04); }

/* Inline stroke-icon set (icons.js) -- sized via width/height, colored via
   currentColor so they follow whatever text color their container sets. */
.icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-lg { width: 32px; height: 32px; }

/* ==========================================================================
   Form controls
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }

.field-control {
  background: var(--bg-recessed);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-control::placeholder { color: var(--text-faint); }
.field-control:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.25);
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-web { background: rgba(var(--bad-rgb), 0.15); color: var(--bad); }
.badge-seo { background: rgba(var(--warn-rgb), 0.15); color: var(--warn); }
.badge-grow { background: rgba(var(--blue-rgb), 0.18); color: var(--blue-strong); }
.badge-upsell { background: rgba(var(--good-rgb), 0.15); color: var(--good); }

/* ==========================================================================
   Panels / toolbar
   ========================================================================== */
.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
/* space-between only distributes items on the SAME wrapped line -- a lone
   trailing button on its own line would otherwise snap to the left instead
   of staying right-aligned. margin-left:auto keeps it pinned right either way. */
.toolbar > *:last-child { margin-left: auto; }
.toolbar-group { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

.count-pill { color: var(--text-muted); font-size: var(--text-sm); }

/* ==========================================================================
   Table
   ========================================================================== */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 60vh;
}
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); table-layout: fixed; }
th, td { text-align: left; padding: var(--space-4) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.col-checkbox { overflow: visible; }
th {
  position: sticky; top: 0;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .sort-arrow { margin-left: var(--space-1); opacity: 0.8; color: var(--blue-strong); }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
td.col-checkbox, th.col-checkbox { width: 36px; overflow: visible; }
td.col-numeric, th.col-numeric { text-align: right; font-variant-numeric: tabular-nums; }

#leadsTable th:nth-child(2), #leadsTable td:nth-child(2) { width: 26%; }
#leadsTable th:nth-child(3), #leadsTable td:nth-child(3) { width: 12%; }
#leadsTable th:nth-child(4), #leadsTable td:nth-child(4) { width: 18%; }
#leadsTable th:nth-child(5), #leadsTable td:nth-child(5) { width: 8%; }
#leadsTable th:nth-child(6), #leadsTable td:nth-child(6) { width: 8%; }
#leadsTable th:nth-child(7), #leadsTable td:nth-child(7) { width: 14%; }
#leadsTable th:nth-child(8), #leadsTable td:nth-child(8) { width: 14%; }
.row-actions-cell { display: flex; align-items: center; gap: var(--space-2); }

/* Small color-tile "avatar" per row -- our stand-in for Apollo's company
   favicons, same scannability trick without needing real logo assets. */
.row-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.row-name-cell { display: flex; align-items: center; gap: var(--space-3); }
.notes-btn {
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: var(--text-sm);
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.notes-btn:hover { background: var(--surface-hover, rgba(255, 255, 255, 0.06)); color: var(--text); border-color: var(--text-muted); }

/* Windows-Explorer-style folder tiles -- the primary way leads are browsed */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
}
.folder-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  position: relative;
}
.folder-tile:hover { background: var(--surface-hover, rgba(255, 255, 255, 0.04)); border-color: var(--text-muted); }
.folder-tile-icon { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.folder-tile-name { font-weight: 600; font-size: var(--text-sm); color: var(--text); word-break: break-word; }
.folder-tile-count { color: var(--text-muted); }

/* "All Leads" is a virtual view, not a real folder -- give it a distinct
   accent border so it doesn't read as just another folder tile. */
.folder-tile.folder-tile-virtual { border-color: var(--blue); border-style: dashed; }

.folder-tile-actions {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: none;
  gap: 2px;
}
.folder-tile:hover .folder-tile-actions { display: flex; }
.folder-tile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.folder-tile-action .icon { width: 13px; height: 13px; }
.folder-tile-action:hover { color: var(--text); border-color: var(--text-muted); }
.folder-tile .folder-tile-actions.confirming { display: flex; align-items: center; }
.folder-delete-confirm-label { font-size: var(--text-xs); color: var(--bad); margin-right: 2px; }
.folder-tile-new {
  border-style: dashed;
  color: var(--text-muted);
}
.folder-inline-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  padding: 2px 4px;
}

/* ==========================================================================
   Bulk action bar
   ========================================================================== */
.bulk-bar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}
.bulk-bar.visible { display: flex; }
.bulk-bar-count { font-weight: 600; }
.bulk-bar-actions { display: flex; gap: var(--space-2); margin-left: auto; }
.bulk-bar-select-all { color: var(--blue-strong); cursor: pointer; background: none; border: none; font-size: var(--text-sm); padding: 0; font-family: inherit; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pagination-info { color: var(--text-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.pagination-controls { display: flex; align-items: center; gap: var(--space-2); }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
  text-align: center;
}
.empty-state-icon { font-size: 32px; }
.empty-state-title { font-size: var(--text-md); font-weight: 600; color: var(--text); }

/* ==========================================================================
   Modal (native <dialog>)
   ========================================================================== */
dialog.modal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  padding: 0;
  width: min(480px, 92vw);
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(4, 5, 9, 0.65); backdrop-filter: blur(2px); }
.modal-header { padding: var(--space-5) var(--space-5) 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: var(--text-lg); }
.modal-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 0 var(--space-5) var(--space-5); display: flex; justify-content: flex-end; gap: var(--space-2); }
.modal-error { color: var(--bad); font-size: var(--text-sm); min-height: 1.2em; }

/* Lead-detail sidebar -- same <dialog> mechanics (backdrop, Esc, focus trap)
   as the centered modals, just docked to the right edge and taller, with a
   slide-in animation instead of the default fade/scale-in. */
dialog.modal-sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(420px, 92vw);
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border-width: 0 0 0 1px;
  animation: sidebar-slide-in 0.18s ease-out;
}
dialog.modal-sidebar .modal-body { max-height: calc(100vh - 76px); }
@keyframes sidebar-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.lead-detail-fields { display: flex; flex-direction: column; gap: var(--space-3); }
.lead-detail-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.lead-detail-label { color: var(--text-muted); font-size: var(--text-sm); flex-shrink: 0; }
.lead-detail-row select { width: auto; }
.lead-detail-divider { border: none; border-top: 1px solid var(--border); margin: var(--space-2) 0; }

.notes-list { display: flex; flex-direction: column; gap: var(--space-3); max-height: 260px; overflow-y: auto; }
.note-item { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.note-item-meta { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-1); }
.note-item-body { font-size: var(--text-sm); white-space: pre-wrap; }
.notes-empty { color: var(--text-muted); font-size: var(--text-sm); }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-region {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
}
.toast {
  min-width: 260px;
  max-width: 360px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.toast-success { border-color: rgba(var(--good-rgb), 0.4); }
.toast-error { border-color: rgba(var(--bad-rgb), 0.4); }
.toast-info { border-color: var(--border-strong); }

/* ==========================================================================
   Jobs tray
   ========================================================================== */
.jobs-tray-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: min(360px, calc(100vw - var(--space-6)));
  max-height: 460px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  display: none;
  z-index: 100;
}
.jobs-tray-panel.open { display: block; }
.job-item { padding: var(--space-3); border-radius: var(--radius-sm); }
.job-item + .job-item { border-top: 1px solid var(--border); }
.job-item-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.job-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.job-status-dot.running { background: var(--blue); animation: pulse 1.4s ease-in-out infinite; }
.job-status-dot.done { background: var(--good); }
.job-status-dot.error { background: var(--bad); }
.job-item-message { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.job-empty { padding: var(--space-4); color: var(--text-muted); font-size: var(--text-sm); text-align: center; }
.job-batch-group { padding: var(--space-3); border-radius: var(--radius-sm); }
.job-batch-group + .job-item, .job-item + .job-batch-group, .job-batch-group + .job-batch-group { border-top: 1px solid var(--border); }
.job-batch-group > summary { cursor: pointer; list-style: none; }
.job-batch-group > summary::-webkit-details-marker { display: none; }
.job-batch-group[open] > summary { margin-bottom: var(--space-2); }
.job-batch-child { padding: var(--space-2) 0 var(--space-2) var(--space-4); }
.job-batch-child + .job-batch-child { border-top: 1px solid var(--border); }

.zip-picker-panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}
.zip-range-row { display: flex; align-items: center; gap: var(--space-3); }
.zip-range-badge {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.zip-range-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Dual-handle ZIP range slider -- two native range inputs stacked on top of
   each other; each has a transparent track and pointer-events disabled
   except on its own thumb, so both handles stay independently draggable. */
.zip-range-slider { position: relative; height: 28px; flex: 1; }
.zip-range-slider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.zip-range-fill {
  position: absolute;
  top: 10px;
  height: 4px;
  background: var(--blue);
  border-radius: 2px;
  pointer-events: none;
}
.zip-range-input {
  position: absolute;
  left: 0;
  top: 10px;
  width: 100%;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}
.zip-range-input::-webkit-slider-runnable-track { height: 4px; background: transparent; border-radius: 2px; }
.zip-range-input::-moz-range-track { height: 4px; background: transparent; border-radius: 2px; }
.zip-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  margin-top: -6px;
}
.zip-range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ==========================================================================
   Live extraction progress (shared by the New Search modal + jobs tray)
   ========================================================================== */
.job-progress { display: flex; flex-direction: column; gap: var(--space-3); }

.phase-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.phase-step { display: flex; align-items: center; gap: var(--space-1); white-space: nowrap; }
.phase-step.done { color: var(--good); }
.phase-step.active { color: var(--text); font-weight: 600; }
.phase-step:not(:last-child)::after { content: "\203a"; margin-left: var(--space-2); color: var(--border-strong); }

.progress-bar {
  position: relative;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-recessed);
  overflow: hidden;
}
.progress-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  background: var(--blue);
  transition: width 0.4s ease;
}
.progress-bar.indeterminate .progress-bar-fill {
  width: 40% !important;
  animation: indeterminate-slide 1.2s ease-in-out infinite;
}
@keyframes indeterminate-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.progress-meta { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.live-feed { display: flex; flex-direction: column; gap: var(--space-1); max-height: 168px; overflow: hidden; }
.live-feed-item {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: feed-in 0.3s ease;
}
.live-feed-item:first-child { color: var(--text); border-color: rgba(var(--blue-rgb), 0.4); }
@keyframes feed-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.job-progress-success { display: flex; align-items: center; gap: var(--space-2); color: var(--good); font-weight: 600; }
.job-progress-error { color: var(--bad); font-size: var(--text-sm); }

/* ==========================================================================
   Admin panel: per-agent performance cards
   ========================================================================== */
.perf-card {
  background: var(--bg-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 180px;
  flex: 1 1 180px;
}
.perf-card-name { font-weight: 700; margin-bottom: var(--space-2); }
.perf-card-row { display: flex; justify-content: space-between; font-size: var(--text-sm); color: var(--text-muted); padding: 2px 0; }
.perf-card-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Trends panel -- our "insights" surface, gets the purple AI-flavored accent
   ========================================================================== */
.trend-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2);
}
.trend-list li {
  background: var(--bg-recessed);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.trend-list li span:last-child { color: var(--purple-soft); font-weight: 700; }

.status-line { font-size: var(--text-sm); color: var(--text-muted); min-height: 1.2em; }
.status-line.error { color: var(--bad); }
.muted { color: var(--text-muted); }
