/* ================================================================
   Udyam Fetcher — Design tokens & shared styles
   Bootstrap 5.3 sits underneath; this file overrides theme & adds
   custom components. Class names are semantic for Blade portability.
   ================================================================ */

:root {
  /* Brand */
  --color-brand-red: #d2151e;
  --color-brand-red-hover: #b01219;
  --color-brand-red-soft: #fde8e9;
  --color-brand-red-softer: #fef4f5;

  /* Neutrals */
  --color-black: #000000;
  --color-white: #ffffff;
  --color-bg: #f7f9fb;
  --color-pattern: #f1f1f1;
  --color-text: #1a1f2c;
  --color-text-muted: #6b7280;
  --color-text-subtle: #9ca3af;
  --color-border: #e5e7eb;
  --color-border-soft: #eef0f3;
  --color-surface-hover: #f4f6f9;

  /* Semantic */
  --color-success: #16a34a;
  --color-success-soft: #dcfce7;
  --color-warning: #d97706;
  --color-warning-soft: #fef3c7;
  --color-info: #0284c7;
  --color-info-soft: #e0f2fe;
  --color-danger: var(--color-brand-red);
  --color-danger-soft: var(--color-brand-red-soft);
  --color-neutral: #4b5563;
  --color-neutral-soft: #f1f3f5;

  /* Enterprise type colors (used in classification history) */
  --color-micro: #7c3aed;
  --color-micro-soft: #ede9fe;
  --color-small: #0891b2;
  --color-small-soft: #cffafe;
  --color-medium: #c2410c;
  --color-medium-soft: #ffedd5;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 60px;

  /* Density */
  --card-padding: 16px;
  --card-radius: 10px;
  --table-row-py: 10px;
  --table-cell-px: 14px;
  --gap-section: 18px;
  --gap-card: 14px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-sidebar: 1px 0 0 var(--color-border-soft), 4px 0 24px -8px rgba(15, 23, 42, 0.04);

  /* Type */
  --font-sans: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-cond: 'Roboto Condensed', 'Roboto', sans-serif;
}

/* Bootstrap theme overrides ----------------------------------- */
:root {
  --bs-primary: var(--color-brand-red);
  --bs-primary-rgb: 210, 21, 30;
  --bs-success: var(--color-success);
  --bs-warning: var(--color-warning);
  --bs-info: var(--color-info);
  --bs-danger: var(--color-brand-red);
  --bs-body-bg: var(--color-bg);
  --bs-body-color: var(--color-text);
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: 14px;
  --bs-border-color: var(--color-border);
  --bs-border-radius: var(--card-radius);
}

/* Base ---------------------------------------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--color-brand-red); text-decoration: none; }
a:hover { color: var(--color-brand-red-hover); text-decoration: underline; }

/* In-table links read as normal text; only color on hover */
.log-link {
  color: var(--color-text);
  text-decoration: none;
}
.log-link:hover {
  color: var(--color-brand-red);
  text-decoration: underline;
}

::selection { background: var(--color-brand-red-soft); color: var(--color-brand-red-hover); }

/* Numbers / IDs */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.cond { font-family: var(--font-cond); }

/* Layout shell ------------------------------------------------- */
.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border-soft);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.18s ease;
  box-shadow: var(--shadow-sidebar);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--color-border-soft);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--color-brand-red);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.sidebar-brand-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.sidebar-brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: -1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  padding: 14px 12px 6px;
  white-space: nowrap;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}
.sidebar-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-link i {
  font-size: 17px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.sidebar-link.active {
  background: var(--color-brand-red-soft);
  color: var(--color-brand-red);
}
.sidebar-link.active i { color: var(--color-brand-red); }
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  font-family: var(--font-cond);
}
.sidebar-link.active .badge-count {
  background: var(--color-brand-red);
  color: white;
}
.sidebar-sublink {
  display: block;
  padding: 6px 12px 6px 43px;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 400;
  border-radius: 7px;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}
.sidebar-sublink:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-sublink.active {
  color: var(--color-brand-red);
  font-weight: 600;
  background: var(--color-brand-red-soft);
}

/* Sidebar group — non-collapsible parent with sub-items */
.sidebar-group { display: flex; flex-direction: column; }
.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px 4px;
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.sidebar-group-label i {
  font-size: 17px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.sidebar-sublinks {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 2px;
}

/* Collapsed: show only the group's icon, hide the label text + sublinks */
:root[data-sidebar-collapsed="true"] .sidebar-group-label {
  justify-content: center;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
}
:root[data-sidebar-collapsed="true"] .sidebar-group-label span { display: none; }
:root[data-sidebar-collapsed="true"] .sidebar-sublinks { display: none; }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--color-border-soft);
  font-size: 11px;
  color: var(--color-text-subtle);
  white-space: nowrap;
  overflow: hidden;
}

/* Sidebar collapse toggle (built into sidebar) */
.sidebar-collapse-btn {
  margin-left: auto;
  background: transparent;
  border: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-subtle);
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.sidebar-collapse-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.sidebar-collapse-btn .collapsed-icon { display: none; }

/* Collapsed sidebar */
:root[data-sidebar-collapsed="true"] .sidebar { width: var(--sidebar-width-collapsed); }
:root[data-sidebar-collapsed="true"] .sidebar-brand-text,
:root[data-sidebar-collapsed="true"] .sidebar-link span,
:root[data-sidebar-collapsed="true"] .sidebar-link .badge-count,
:root[data-sidebar-collapsed="true"] .sidebar-section-label,
:root[data-sidebar-collapsed="true"] .sidebar-sublink,
:root[data-sidebar-collapsed="true"] .sidebar-footer { display: none; }
:root[data-sidebar-collapsed="true"] .sidebar-link { justify-content: center; padding: 9px 12px; }
:root[data-sidebar-collapsed="true"] .sidebar-brand {
  padding: 0 12px;
  gap: 6px;
  justify-content: center;
  position: relative;
}
:root[data-sidebar-collapsed="true"] .sidebar-brand-mark { display: none; }
:root[data-sidebar-collapsed="true"] .sidebar-collapse-btn {
  margin-left: 0;
  width: 34px;
  height: 34px;
  font-size: 14px;
}
:root[data-sidebar-collapsed="true"] .sidebar-collapse-btn i:not(.collapsed-icon) { display: none; }
:root[data-sidebar-collapsed="true"] .sidebar-collapse-btn .collapsed-icon { display: inline-block; }
:root[data-sidebar-collapsed="true"] .app-main { margin-left: var(--sidebar-width-collapsed); }

/* Main area + topbar ------------------------------------------ */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  transition: margin-left 0.18s ease;
}

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 17px;
}
.topbar-toggle:hover { background: var(--color-surface-hover); color: var(--color-text); }
@media (max-width: 768px) {
  .topbar-toggle { display: inline-flex; }
}

.breadcrumb-trail {
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.breadcrumb-trail .crumb-current { color: var(--color-text); font-weight: 500; }
.breadcrumb-trail .crumb-sep { color: var(--color-text-subtle); }
.breadcrumb-trail a { color: var(--color-text-muted); }
.breadcrumb-trail a:hover { color: var(--color-brand-red); text-decoration: none; }

.topbar-spacer { flex: 1; }

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

/* Pipeline control — unified status + action segmented pill */
.pipeline-control {
  display: inline-flex;
  align-items: stretch;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  background: white;
  box-shadow:
    inset 0 0 0 1px var(--color-border),
    var(--shadow-xs);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}
.pipeline-control.is-running {
  background: var(--color-info-soft);
  box-shadow:
    inset 0 0 0 1px #bae6fd,
    0 1px 2px rgba(2, 132, 199, 0.08);
}

.pipeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px 0 14px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-weight: 500;
  background: transparent;
  border-radius: 0;
  white-space: nowrap;
  letter-spacing: 0;
}
.pipeline-pill b {
  font-weight: 700;
  color: var(--color-text);
}
.pipeline-pill-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pipeline-pill-sep {
  color: var(--color-border);
  font-weight: 400;
}
.pipeline-pill-divider {
  width: 1px;
  align-self: stretch;
  margin: 2px 2px;
  background: currentColor;
  opacity: 0.22;
}
.pp-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}
.pp-stat i {
  font-size: 11px;
  opacity: 0.75;
  line-height: 1;
}
.pp-stat b {
  font-weight: 700;
}
.pipeline-control.is-running .pp-stat.is-paused {
  color: #92400e;
}
.pipeline-control.is-running .pp-stat.is-paused b { color: #78350f; }
.pipeline-pill .pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-text-subtle);
  flex-shrink: 0;
}
.pipeline-control.is-running .pipeline-pill { color: #0c4a6e; }
.pipeline-control.is-running .pipeline-pill b { color: #075985; }
.pipeline-control.is-running .pipeline-pill-sep { color: #7dd3fc; }
.pipeline-control.is-running .pipeline-pill .pulse-dot {
  background: var(--color-info);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(2, 132, 199, 0); }
}

.pipeline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 600;
  border: 0;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.01em;
  align-self: stretch;
}
.pipeline-btn i {
  font-size: 14px;
  line-height: 1;
}
.pipeline-control.is-running .pipeline-btn { border-right-color: #bae6fd; }
.pipeline-btn-start {
  background: transparent;
  color: var(--color-success);
}
.pipeline-btn-start:hover {
  background: var(--color-success);
  color: white;
}
.pipeline-btn-stop {
  background: var(--color-brand-red);
  color: white;
}
.pipeline-btn-stop:hover { background: var(--color-brand-red-hover); color: white; }

.user-menu {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
}
.user-menu:hover { background: var(--color-surface-hover); border-color: var(--color-border); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--color-brand-red);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.user-name { font-size: 13px; font-weight: 500; }

/* Page content */
.page-content {
  padding: var(--gap-section) 22px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--gap-section);
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
.page-subtitle { font-size: 13px; color: var(--color-text-muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Cards & surfaces -------------------------------------------- */
.card-x {
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}
.card-x-pad { padding: var(--card-padding); flex: 1; display: flex; flex-direction: column; }
.card-x-head {
  padding: 12px var(--card-padding);
  border-bottom: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-x-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card-x-head-link {
  color: inherit;
  text-decoration: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.card-x-head-link::after {
  content: '\f285'; /* bi-arrow-right */
  font-family: 'bootstrap-icons';
  font-size: 12px;
  color: var(--color-text-subtle);
  font-weight: 400;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.card-x-head-link:hover {
  color: var(--color-brand-red);
  text-decoration: none;
}
.card-x-head-link:hover::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--color-brand-red);
}
.card-x-head .head-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}
.card-x-head .head-links {
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-x-head .head-links a { color: var(--color-text-muted); }
.card-x-head .head-links a:hover { color: var(--color-brand-red); text-decoration: none; }

/* KPI / stat card --------------------------------------------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-card);
  margin-bottom: var(--gap-section);
}
@media (max-width: 1100px) { .kpi-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .kpi-strip { grid-template-columns: 1fr; } }

.kpi-card {
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  min-width: 0;
}
.kpi-icon {
  position: static;
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-size: 22px;
  flex-shrink: 0;
}
.kpi-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi-card[data-tone="red"]   .kpi-icon { background: var(--color-brand-red-soft); color: var(--color-brand-red); }
.kpi-card[data-tone="amber"] .kpi-icon { background: var(--color-warning-soft);   color: var(--color-warning);   }
.kpi-card[data-tone="green"] .kpi-icon { background: var(--color-success-soft);   color: var(--color-success);   }
.kpi-card[data-tone="blue"]  .kpi-icon { background: var(--color-info-soft);      color: var(--color-info);      }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.kpi-value {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
}
.kpi-trend.up { color: var(--color-success); }
.kpi-trend.down { color: var(--color-brand-red); }
.kpi-trend.flat { color: var(--color-text-muted); }
.kpi-trend-note { color: var(--color-text-muted); font-weight: 400; margin-left: 4px; }

/* Badges ------------------------------------------------------ */
.badge-x {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-x .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* 6 job statuses — see design revisions §2.
   Each badge gets a colour token + an icon (icon rendered inline in HTML,
   sized via .badge-x i). Waiting / Skipped / Failed all use grey but are
   differentiated by their icons. */
.badge-running  { background: var(--color-brand-red-soft); color: var(--color-brand-red-hover); }
.badge-paused   { background: var(--color-warning-soft);   color: #92400e; }
.badge-waiting  { background: var(--color-neutral-soft);   color: var(--color-neutral); }
.badge-skipped  { background: var(--color-neutral-soft);   color: var(--color-neutral); }
.badge-failed   { background: var(--color-neutral-soft);   color: var(--color-neutral); }
.badge-finished { background: var(--color-success-soft);   color: #14532d; }
.badge-x i {
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.badge-active { background: var(--color-success-soft); color: #14532d; }
.badge-delisted { background: var(--color-neutral-soft); color: var(--color-neutral); }
.badge-info { background: var(--color-info-soft); color: #075985; }
.badge-micro { background: var(--color-micro-soft); color: #5b21b6; }
.badge-small { background: var(--color-small-soft); color: #155e75; }
.badge-medium { background: var(--color-medium-soft); color: #9a3412; }
.badge-neutral { background: var(--color-neutral-soft); color: var(--color-neutral); }

/* Progress bar ------------------------------------------------ */
.progress-x {
  height: 6px;
  background: var(--color-neutral-soft);
  border-radius: 10px;
  overflow: hidden;
}
.progress-x-fill {
  height: 100%;
  background: var(--color-brand-red);
  border-radius: 10px;
  transition: width 0.4s ease;
}
/* Status-driven progress bar colors */
.progress-x.status-running  .progress-x-fill { background: var(--color-brand-red); }
.progress-x.status-paused   .progress-x-fill { background: var(--color-warning); }
.progress-x.status-finished .progress-x-fill { background: var(--color-success); }
.progress-x.status-skipped  .progress-x-fill { background: var(--color-text-subtle); }
.progress-x.status-waiting  .progress-x-fill { background: var(--color-text-subtle); }
.progress-x.status-failed   .progress-x-fill { background: var(--color-text-subtle); }
.progress-x.thick { height: 8px; }
.progress-x-row { display: flex; align-items: center; gap: 10px; }
.progress-x-row .progress-x { flex: 1; }
.progress-x-row .progress-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Buttons (override Bootstrap slightly for tighter look) ------ */
.btn { font-size: 13px; font-weight: 500; border-radius: 7px; padding: 6px 13px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn:hover, .btn:focus, .btn:active { text-decoration: none; }
.btn-primary {
  background: var(--color-brand-red);
  border-color: var(--color-brand-red);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--color-brand-red-hover) !important;
  border-color: var(--color-brand-red-hover) !important;
}
.btn-outline-primary {
  --bs-btn-color: var(--color-brand-red);
  --bs-btn-border-color: var(--color-brand-red);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-brand-red);
  --bs-btn-hover-border-color: var(--color-brand-red);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--color-brand-red-hover);
  --bs-btn-active-border-color: var(--color-brand-red-hover);
  --bs-btn-focus-shadow-rgb: 210, 21, 30;
}
.btn-outline-success {
  --bs-btn-color: var(--color-success);
  --bs-btn-border-color: var(--color-success);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-success);
  --bs-btn-hover-border-color: var(--color-success);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #15803d;
  --bs-btn-active-border-color: #15803d;
  --bs-btn-focus-shadow-rgb: 22, 163, 74;
}
.btn-outline-warning {
  --bs-btn-color: var(--color-warning);
  --bs-btn-border-color: var(--color-warning);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-warning);
  --bs-btn-hover-border-color: var(--color-warning);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #b45309;
  --bs-btn-active-border-color: #b45309;
  --bs-btn-focus-shadow-rgb: 217, 119, 6;
}
.btn-outline-danger {
  --bs-btn-color: var(--color-brand-red);
  --bs-btn-border-color: var(--color-brand-red);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--color-brand-red);
  --bs-btn-hover-border-color: var(--color-brand-red);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--color-brand-red-hover);
  --bs-btn-active-border-color: var(--color-brand-red-hover);
  --bs-btn-focus-shadow-rgb: 210, 21, 30;
}
.btn-outline-secondary {
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline-secondary:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--color-surface-hover); }
.btn-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 7px;
}

/* Integrated refresh control --------------------------------- */
/* Pill that combines manual Refresh and Auto-refresh toggle.   */
/* Used on Dashboard, Live Status (and elsewhere). Persisted    */
/* per-page via localStorage; wire up with the inline IIFE.     */
.refresh-control {
  display: inline-flex;
  align-items: stretch;
  height: 31px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  font-size: 12.5px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.refresh-control:hover { border-color: #d4d8df; }
.refresh-control.is-auto { border-color: #bae6fd; }

.refresh-control__btn,
.refresh-control__toggle {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.refresh-control__btn:hover { background: var(--color-surface-hover); }
.refresh-control__btn:focus-visible,
.refresh-control__toggle:focus-visible {
  outline: 2px solid var(--color-brand-red);
  outline-offset: -2px;
}
.refresh-control__btn i { font-size: 13px; color: var(--color-text-muted); }
.refresh-control__btn:hover i { color: var(--color-text); }

.refresh-control__divider {
  width: 1px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* Auto-refresh segment */
.refresh-control__toggle {
  padding-right: 12px;
  color: var(--color-text-muted);
}
.refresh-control__toggle .rc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #cdd2da;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.refresh-control__toggle .rc-label { letter-spacing: 0; }
.refresh-control__toggle .rc-countdown {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--color-info);
  text-align: right;
  /* Collapsed when auto is off — no empty gap. */
  display: inline-block;
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.28s cubic-bezier(.22,.61,.36,1),
              margin-left 0.28s cubic-bezier(.22,.61,.36,1),
              opacity 0.18s ease 0.05s;
}
.refresh-control__toggle:hover { background: var(--color-surface-hover); color: var(--color-text); }
.refresh-control__toggle[aria-pressed="true"] {
  background: var(--color-info-soft);
  color: #075985;
}
.refresh-control__toggle[aria-pressed="true"]:hover { background: #cfeafb; }
.refresh-control__toggle[aria-pressed="true"] .rc-dot {
  background: var(--color-info);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
  animation: rc-dot-pulse 1.8s ease-in-out infinite;
}
.refresh-control__toggle[aria-pressed="true"] .rc-countdown {
  max-width: 40px;
  margin-left: 2px;
  opacity: 1;
}

/* Spin the refresh icon while a fetch is in flight or when auto fires */
.refresh-control__btn.is-spinning i { animation: rc-spin 0.7s ease; }
@keyframes rc-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes rc-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16); }
  50%      { box-shadow: 0 0 0 5px rgba(2, 132, 199, 0.05); }
}
@media (prefers-reduced-motion: reduce) {
  .refresh-control__btn.is-spinning i,
  .refresh-control__toggle[aria-pressed="true"] .rc-dot { animation: none; }
}

/* Tables ------------------------------------------------------ */
.table-x {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table-x thead th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 10px var(--table-cell-px);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.table-x tbody td {
  padding: var(--table-row-py) var(--table-cell-px);
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
}
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover { background: var(--color-surface-hover); }
.table-x tbody tr.clickable { cursor: pointer; }
.table-x.no-hover tbody tr:hover { background: transparent; }

.table-x .col-actions { width: 40px; text-align: right; }
.table-x .col-tight { white-space: nowrap; }
/* col-center beats DataTables' auto type alignment (e.g. dt-type-date → right) */
.table-x .col-counts { white-space: nowrap; font-size: 12.5px; }
table.table-x th.col-center,
table.table-x td.col-center { text-align: center !important; }

/* Equalize padding on centered orderable headers so the title sits at true visual center
   (DataTables adds extra padding-right for the absolute-positioned sort arrow). */
table.table-x th.col-center.dt-orderable-asc,
table.table-x th.col-center.dt-orderable-desc { padding-left: 30px !important; padding-right: 30px !important; }

/* DataTables override --------------------------------------- */
.dt-container { font-family: var(--font-sans); }
.dt-container .dt-top { display: none; }
.dt-container .dt-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-bg);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  font-size: 12.5px;
}
.dt-container .dt-bot-left {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 12.5px;
  min-height: 30px;
}
.dt-container .dt-bot-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dt-container .dt-info {
  color: var(--color-text-muted) !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.4;
}
.dt-container .dt-length {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.dt-container .dt-length label {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  font-size: 0;
  color: transparent;
}
.dt-container .dt-length select {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 24px 4px 9px;
  font-size: 12px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3e%3cpath d='M3.204 5h9.592L8 10.481 3.204 5zm-.753.659 4.796 5.48a1 1 0 0 0 1.506 0l4.796-5.48c.566-.647.106-1.659-.753-1.659H3.204a1 1 0 0 0-.753 1.659z'/%3e%3c/svg%3e");
  background-position: right 7px center;
  background-size: 9px 9px;
  background-repeat: no-repeat;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: white;
  color: var(--color-text);
}
.dt-container .dt-length select:hover { border-color: var(--color-text-muted); }
.dt-container .dt-paging { margin: 0; }
.dt-container .dt-paging .pagination {
  --bs-pagination-color: var(--color-text-muted);
  --bs-pagination-bg: white;
  --bs-pagination-border-color: var(--color-border-soft);
  --bs-pagination-hover-color: var(--color-brand-red);
  --bs-pagination-hover-bg: var(--color-brand-red-softer);
  --bs-pagination-hover-border-color: var(--color-border-soft);
  --bs-pagination-focus-color: var(--color-brand-red);
  --bs-pagination-focus-bg: var(--color-brand-red-softer);
  --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
  --bs-pagination-active-color: var(--color-brand-red);
  --bs-pagination-active-bg: var(--color-brand-red-soft);
  --bs-pagination-active-border-color: var(--color-brand-red-soft);
  --bs-pagination-disabled-color: var(--color-text-subtle);
  --bs-pagination-disabled-bg: white;
  --bs-pagination-disabled-border-color: var(--color-border-soft);
  --bs-pagination-border-radius: 6px;
  --bs-pagination-padding-x: 10px;
  --bs-pagination-padding-y: 3px;
  --bs-pagination-font-size: 12px;
  gap: 4px;
  margin: 0;
}
.dt-container .dt-paging .pagination .page-link {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 500;
  line-height: 1;
}
.dt-container .dt-paging .pagination .page-item.active .page-link {
  font-weight: 600;
}
.dt-container .dt-paging .dt-paging-button {
  border-radius: 6px;
}

/* Bootstrap pagination — brand red active state (DT + anywhere else) */
.pagination {
  --bs-pagination-color: var(--color-text-muted);
  --bs-pagination-bg: transparent;
  --bs-pagination-border-color: transparent;
  --bs-pagination-hover-color: var(--color-brand-red);
  --bs-pagination-hover-bg: var(--color-brand-red-softer);
  --bs-pagination-hover-border-color: transparent;
  --bs-pagination-focus-color: var(--color-brand-red);
  --bs-pagination-focus-bg: var(--color-brand-red-softer);
  --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
  --bs-pagination-active-color: var(--color-brand-red);
  --bs-pagination-active-bg: var(--color-brand-red-soft);
  --bs-pagination-active-border-color: var(--color-brand-red-soft);
  --bs-pagination-disabled-color: var(--color-text-subtle);
  --bs-pagination-disabled-bg: transparent;
  --bs-pagination-disabled-border-color: transparent;
  --bs-pagination-border-radius: 6px;
  --bs-pagination-padding-x: 9px;
  --bs-pagination-padding-y: 3px;
  --bs-pagination-font-size: 12px;
  gap: 2px;
}
.pagination .page-item .page-link {
  border-radius: 6px !important;
  font-weight: 500;
  min-width: 28px;
  text-align: center;
  line-height: 1.5;
}
.pagination .page-item.active .page-link {
  font-weight: 600;
}
.pagination .page-item.disabled .page-link {
  opacity: 0.5;
}

/* Status tabs (Linear-style) ---------------------------------- */
.status-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: var(--gap-card);
  border-bottom: 1px solid var(--color-border-soft);
  padding: 0 4px;
}
.status-tab {
  background: transparent;
  border: 0;
  padding: 10px 14px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s;
  white-space: nowrap;
}
.status-tab > i {
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}
.status-tab.is-active > i { opacity: 1; }
.status-tab:hover { color: var(--color-text); }
.status-tab.is-active {
  color: var(--color-brand-red);
  border-bottom-color: var(--color-brand-red);
  font-weight: 600;
}
.status-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 6px;
  height: 18px;
  border-radius: 999px;
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.status-tab.is-active .status-tab-count {
  background: var(--color-brand-red-soft);
  color: var(--color-brand-red);
}

/* Multi-row filter card (Companies state view) ---------------- */
.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.filter-row {
  display: grid;
  gap: 12px;
  align-items: end;
}
.filter-divider {
  margin: 16px 0 12px;
  border: 0;
  border-top: 1px solid var(--color-border);
}
.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

/* Filter fieldset (groups always-on pills with a labelled border) */
.filter-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 14px 12px;
  margin: 0 0 var(--gap-card);
  background: transparent;
  min-inline-size: 0;
}
.filter-fieldset-legend {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 0 8px;
  margin: 0 0 0 4px;
  width: auto;
  float: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.filter-fieldset-legend i { font-size: 12px; }
.filter-fieldset .filter-pills { margin-bottom: 0; }

/* Always-on filter pills (data-browser-state) ---------------- */
.filter-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--gap-card);
}
.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Linear-style filter toolbar + active-filter chips ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xs);
  margin-bottom: 8px;
}
.filter-bar-input {
  flex: 0 1 240px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: 0;
  transition: background 0.12s, border-color 0.12s;
  min-width: 0;
}
.filter-bar-input::placeholder { color: var(--color-text-subtle); }
.filter-bar-input:hover { background: var(--color-surface-hover); }
.filter-bar-input:focus {
  background: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.filter-bar-divider {
  width: 1px;
  height: 22px;
  background: var(--color-border);
  margin: 0 4px;
}
.filter-bar-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.filter-bar-add:hover {
  border-color: var(--color-brand-red);
  border-style: solid;
  color: var(--color-brand-red);
  background: var(--color-brand-red-softer);
}
.filter-bar-add i { font-size: 13px; line-height: 1; }
.filter-bar-spacer { flex: 1; }
.filter-bar-clear {
  font-size: 12.5px;
  color: var(--color-text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.filter-bar-clear:hover {
  color: var(--color-brand-red);
  background: var(--color-brand-red-softer);
}

/* Add-filter dropdown menu styling */
.add-filter-menu {
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 200px;
}
.add-filter-menu .dropdown-header {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
  font-weight: 700;
  padding: 6px 10px 4px;
}
.add-filter-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--color-text);
}
.add-filter-menu .dropdown-item i {
  color: var(--color-text-subtle);
  font-size: 14px;
  width: 16px;
  text-align: center;
}
.add-filter-menu .dropdown-item:hover {
  background: var(--color-brand-red-softer);
  color: var(--color-brand-red);
  text-decoration: none;
}
.add-filter-menu .dropdown-item:hover i { color: var(--color-brand-red); }
.add-filter-menu .dropdown-divider {
  margin: 4px 4px;
  border-color: var(--color-border-soft);
}

/* Active filter chips row */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 2px 0;
  margin-bottom: var(--gap-card);
}
.active-filter {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 4px 0 10px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: 12.5px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 0.12s;
}
.active-filter:hover { border-color: var(--color-text-muted); }
.active-filter:not(:has(.af-close)) { padding-right: 10px; }
.active-filter .af-key {
  color: var(--color-text-muted);
  font-weight: 500;
}
.active-filter .af-val {
  color: var(--color-text);
  font-weight: 600;
  margin-left: 5px;
}
.active-filter .af-val {
  color: var(--color-text);
  font-weight: 600;
}
.active-filter .af-close {
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.active-filter .af-close i { font-size: 14px; line-height: 1; }
.active-filter .af-close:hover {
  background: var(--color-brand-red-softer);
  color: var(--color-brand-red);
}

/* Filter value popover (anchored to chip while editing) */
.active-filter.is-editing {
  border-color: var(--color-brand-red);
  border-style: solid;
  background: var(--color-brand-red-softer);
}
.active-filter .af-val-empty {
  color: var(--color-text-subtle);
  font-style: italic;
  font-weight: 500;
}
.af-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg, 0 10px 24px -4px rgba(15, 23, 42, 0.12));
  padding: 6px;
  z-index: 20;
  font-weight: normal;
}
.af-popover-search {
  position: relative;
  padding: 6px 6px 4px;
}
.af-popover-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  font-size: 13px;
}
.af-popover-search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--color-border-soft);
  border-radius: 6px;
  font-size: 12.5px;
  outline: 0;
  background: var(--color-bg);
}
.af-popover-search input:focus {
  background: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.af-popover-list {
  list-style: none;
  margin: 4px 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.af-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.af-popover-item.is-highlighted,
.af-popover-item:hover {
  background: var(--color-brand-red-softer);
  color: var(--color-brand-red);
}
.af-popover-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}
.af-popover-item.is-highlighted .af-popover-check {
  background: var(--color-brand-red);
  border-color: var(--color-brand-red);
}
.af-popover-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
}
.af-popover-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 4px;
  border-top: 1px solid var(--color-border-soft);
  margin-top: 4px;
}
.af-popover-foot-spacer { flex: 1; }
.af-popover-foot .btn-sm { font-size: 12px; padding: 4px 10px; }
.af-popover-clear {
  background: transparent;
  border: 0;
  color: var(--color-text-muted);
  padding: 4px 8px;
  font-weight: 500;
}
.af-popover-clear:hover { color: var(--color-brand-red); background: var(--color-brand-red-softer); border-radius: 5px; }

/* Tag/chip input (used inside af-popover for free-text multi-value filters) */
.af-chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 6px;
  margin: 0 6px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.af-chip-input:focus-within {
  background: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.af-input-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 7px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}
.af-input-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 3px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.af-input-chip-x:hover {
  background: var(--color-brand-red-softer);
  color: var(--color-brand-red);
}
.af-input-chip-x i { font-size: 12px; line-height: 1; }
.af-chip-input-field {
  flex: 1;
  min-width: 60px;
  height: 22px;
  padding: 0 2px;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--color-text);
}
.af-chip-input-field::placeholder { color: var(--color-text-subtle); font-family: var(--font-sans); }

/* Single-text-input variant (used inside af-popover for single free-text filters) */
.af-popover-textfield {
  display: block;
  width: calc(100% - 12px);
  margin: 0 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-text);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.af-popover-textfield:focus {
  outline: none;
  background: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.af-popover-hint {
  padding: 6px 8px 4px;
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.af-popover-hint kbd {
  display: inline-block;
  padding: 0 4px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
}

/* Filter strip ------------------------------------------------ */
.filter-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 10px 8px 14px;
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  margin-bottom: var(--gap-card);
  box-shadow: var(--shadow-xs);
}
.filter-strip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid var(--color-border-soft);
  height: 32px;
  white-space: nowrap;
}
.filter-strip-label i { font-size: 13px; color: var(--color-text-subtle); }
.filter-strip .form-select-sm,
.filter-strip .form-control-sm {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12.5px;
  height: 32px;
  width: auto;
  min-width: 140px;
  flex: 0 0 auto;
}
.filter-strip .form-select-sm:hover,
.filter-strip .form-control-sm:hover { border-color: var(--color-text-muted); }
.filter-strip .form-select-sm:focus,
.filter-strip .form-control-sm:focus {
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.filter-strip #f-daterange { min-width: 200px; }
.filter-strip .search-input { flex: 0 0 auto; }
.filter-strip .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 9px;
  background: var(--color-brand-red-softer);
  color: var(--color-brand-red-hover);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
}
.filter-strip .filter-chip i { cursor: pointer; font-size: 13px; }
.filter-strip .clear-all {
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}
.filter-strip .clear-all:hover {
  color: var(--color-brand-red);
  background: var(--color-brand-red-softer);
}
.filter-strip .strip-spacer { flex: 1; }

/* Search input */
.search-input {
  position: relative;
  display: inline-flex;
}
.search-input input {
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0 10px 0 30px;
  font-size: 12.5px;
  background: white;
}
.search-input i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  font-size: 13px;
}

/* State / district / job cards (Jobs - State View) ----------- */
.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap-card);
}
.state-card {
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.state-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.state-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.state-card-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.state-card-code {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 12px;
  color: var(--color-brand-red);
  background: var(--color-brand-red-soft);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.state-card-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex; gap: 12px;
}
.state-card-counts {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.state-card-big {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.state-card-big-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Enterprise-type breakdown bar (Companies landing) */
.state-card-ent-breakdown { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.ent-bar {
  display: flex;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-neutral-soft);
}
.ent-bar-fill { height: 100%; }
.ent-bar-fill.ent-micro  { background: #e5e7eb; }
.ent-bar-fill.ent-small  { background: #9ca3af; }
.ent-bar-fill.ent-medium { background: #374151; }
.ent-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text);
  flex-wrap: wrap;
}
.ent-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.ent-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
}
.ent-dot.ent-micro  { background: #e5e7eb; border: 1px solid #d1d5db; }
.ent-dot.ent-small  { background: #9ca3af; }
.ent-dot.ent-medium { background: #374151; }

.district-row {
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.district-row-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
}
.district-row-head:hover { background: var(--color-surface-hover); }
.district-chev {
  font-size: 13px;
  color: var(--color-text-subtle);
  width: 16px;
  transition: transform 0.15s;
}
.district-row.open .district-chev { transform: rotate(90deg); }
.district-info { flex: 1; display: flex; align-items: baseline; gap: 10px; }
.district-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-brand-red);
  font-weight: 600;
}
.district-name { font-weight: 600; font-size: 14px; }
.district-meta { color: var(--color-text-muted); font-size: 12px; }
.district-stats { display: flex; gap: 8px; }
.district-jobs {
  background: var(--color-bg);
  padding: 6px 12px 10px;
  border-top: 1px solid var(--color-border-soft);
}
.district-jobs.collapsed { display: none; }

.job-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1.4fr 0.7fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: 8px;
  margin: 6px 0;
  font-size: 13px;
}
.job-row:hover { border-color: var(--color-border); box-shadow: var(--shadow-sm); }
.job-id { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.job-range { font-family: var(--font-mono); font-size: 11.5px; color: var(--color-text-muted); }
.job-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s; }
.job-row:hover .job-actions { opacity: 1; }

/* Live Status cards ------------------------------------------ */
.live-card {
  background: white;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap-card);
  overflow: hidden;
}
.live-card.is-paused .live-card-head { background: var(--color-bg); }
.now-processing-pause-icon {
  font-size: 14px;
  color: var(--color-text-subtle);
  line-height: 1;
  opacity: 0.7;
}
.live-action {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}
.live-action i { font-size: 16px; line-height: 1; }
.live-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border-soft);
  background: linear-gradient(180deg, #fafbfc 0%, white 100%);
}
.live-card-head-main { flex: 1; min-width: 0; }
.live-card-body { padding: 14px 18px; display: grid; gap: 14px; }
.live-pulse {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-info);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live-pulse .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-info);
  animation: pulse 1.4s infinite;
}
.now-processing {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.now-processing .spinner-small {
  width: 14px; height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-brand-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.now-processing-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.now-processing-id { font-family: var(--font-mono); font-weight: 600; }
.now-processing-note { color: var(--color-text-muted); }

.live-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.live-stat {
  background: var(--color-bg);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.live-stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.live-stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-stat-label { font-size: 10.5px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.live-stat-value { font-family: var(--font-cond); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .live-stats { grid-template-columns: repeat(2, 1fr); } }

/* Mini log — tabular, light, DB-backed (replaces terminal styling) ----- */
.mini-log {
  border: 1px solid var(--color-border-soft);
  border-radius: 8px;
  background: white;
}
.mini-log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.mini-log-table thead th {
  background: var(--color-bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--color-border-soft);
  white-space: nowrap;
}
.mini-log-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
  color: var(--color-text);
}
.mini-log-table tbody tr:last-child td { border-bottom: 0; }
.mini-log-table tbody tr:hover td { background: var(--color-surface-hover); }

.mini-log-table .col-ts {
  width: 1%;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.mini-log-table .col-lvl {
  width: 1%;
  white-space: nowrap;
}
.mini-log-table .col-msg { color: var(--color-text); }

.log-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}
.log-chip i { font-size: 11px; line-height: 1; }
.log-chip.info  { background: var(--color-info-soft);       color: #075985; }
.log-chip.ok    { background: var(--color-success-soft);    color: #14532d; }
.log-chip.warn  { background: var(--color-warning-soft);    color: #92400e; }
.log-chip.error { background: var(--color-brand-red-soft); color: var(--color-brand-red-hover); }

.mini-log-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

/* Job-queue list (dashboard) ---------------------------------- */
.queue-list {
  display: flex;
  flex-direction: column;
  min-height: 920px;
}
.queue-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 6px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 12.5px;
  align-items: center;
}
.queue-item:last-child { border-bottom: 0; }
.queue-item { padding: 12px 0; }
.queue-item.is-queued .queue-id,
.queue-item.is-queued .queue-sub { opacity: 0.88; }
.queue-pos {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: 0.04em;
  align-self: start;
  padding-top: 2px;
}
.queue-item.is-queued .queue-pos { color: var(--color-text-muted); }
.queue-id { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.queue-sub { font-size: 11px; color: var(--color-text-muted); margin-top: 6px; }
.queue-right { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.queue-meta { font-size: 11px; color: var(--color-text-muted); }
.queue-progress {
  grid-column: 2 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
}
.queue-progress .progress-x { flex: 1; }
.queue-progress .progress-text {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Top states bar rows (dashboard) ----------------------------- */
#states-bars {
  min-height: 320px;
}
.state-bar-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.state-bar-row:last-child { border-bottom: 0; }
.state-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.state-bar-name { font-weight: 600; }
.state-bar-value {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
}
.state-bar-line {
  display: flex;
  align-items: center;
  gap: 12px;
}
.state-bar-line .progress-x { flex: 1; }
.state-bar-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Queue: View all footer link --------------------------------- */
.queue-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color 0.12s, gap 0.15s;
  border-top: 1px solid var(--color-border-soft);
}
.queue-view-all:hover {
  color: var(--color-brand-red);
  text-decoration: none;
  gap: 9px;
}
.queue-view-all i { font-size: 13px; line-height: 1; }
.queue-list { margin-bottom: 4px; }

/* Form ------------------------------------------------------- */
.form-label-x {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  display: block;
}
.form-help { font-size: 11.5px; color: var(--color-text-muted); margin-top: 3px; }
.form-control, .form-select {
  font-size: 13px;
  border-color: var(--color-border);
  border-radius: 7px;
  padding: 7px 11px;
}
.form-select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3e%3cpath d='M3.204 5h9.592L8 10.481 3.204 5zm-.753.659 4.796 5.48a1 1 0 0 0 1.506 0l4.796-5.48c.566-.647.106-1.659-.753-1.659H3.204a1 1 0 0 0-.753 1.659z'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-size: 12px 12px;
  background-repeat: no-repeat;
}
.form-select-sm {
  padding: 5px 28px 5px 10px;
  background-position: right 8px center;
  background-size: 10px 10px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-brand-red);
  box-shadow: 0 0 0 3px rgba(210, 21, 30, 0.10);
}
.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-card);
}
@media (max-width: 768px) { .form-row-grid { grid-template-columns: 1fr; } }

/* Empty state ----------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state.empty-state--lg { padding: 60px 24px; }
.empty-state .empty-icon {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  background: var(--color-bg);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: var(--color-text-subtle);
}
.empty-state h4 {
  font-size: 15px;
  margin: 0 0 4px;
  color: var(--color-text);
  font-weight: 600;
}
.empty-state p {
  font-size: 13px;
  margin: 0 0 14px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* Tabs ------------------------------------------------------- */
.tabs-x {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--gap-card);
}
.tab-x {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-x:hover { color: var(--color-text); }
.tab-x.active {
  color: var(--color-brand-red);
  border-bottom-color: var(--color-brand-red);
  font-weight: 600;
}
.tab-x .tab-count {
  font-size: 10.5px;
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  padding: 1px 6px;
  border-radius: 9px;
  font-weight: 600;
}
.tab-x.active .tab-count { background: var(--color-brand-red-soft); color: var(--color-brand-red); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Timeline -------------------------------------------------- */
.timeline-x {
  position: relative;
  padding-left: 22px;
}
.timeline-x::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px; bottom: 4px;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  padding-bottom: 16px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-text-subtle);
}
.timeline-item.micro::before { border-color: var(--color-micro); }
.timeline-item.small::before { border-color: var(--color-small); }
.timeline-item.medium::before { border-color: var(--color-medium); }
.timeline-item.brand::before { border-color: var(--color-brand-red); }
.timeline-item-head { display: flex; align-items: baseline; gap: 8px; }
.timeline-date { font-size: 11.5px; color: var(--color-text-muted); font-family: var(--font-mono); }
.timeline-detail { font-size: 12.5px; color: var(--color-text-muted); margin-top: 3px; }
.timeline-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--color-bg);
  padding: 8px 12px;
  border-radius: 7px;
  margin-top: 6px;
  font-size: 12px;
}
.timeline-diff .diff-before, .timeline-diff .diff-after {
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.timeline-diff .diff-label { font-size: 10px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.timeline-diff .diff-before { color: var(--color-brand-red); }
.timeline-diff .diff-after { color: var(--color-success); }

/* Login ----------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-soft);
  padding: 32px 30px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}
.login-logo .sidebar-brand-mark { width: 36px; height: 36px; font-size: 17px; }
.login-logo .sidebar-brand-text { font-size: 17px; }
.login-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.login-sub {
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0 0 24px;
}

/* Misc ------------------------------------------------------ */
.text-muted-x { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-mono { font-family: var(--font-mono); }
.text-cond { font-family: var(--font-cond); }
.text-brand { color: var(--color-brand-red); }

/* Cell utilities — used in DataTable cells across pages.
   .cell-id        mono identifier (job id, udyam number) — bold
   .cell-meta      muted secondary text inside a cell (timestamps, sub-notes)
   .cell-num-ok    success-tone tabular number (counts of found / ok)
   .cell-num-bad   danger-tone  tabular number (failed / errored)        */
.cell-id          { font-family: var(--font-mono); font-weight: 600; }
.cell-meta        { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-muted); }
.cell-num-ok      { font-family: var(--font-mono); font-weight: 600; color: var(--color-success); }
.cell-num-bad     { font-family: var(--font-mono); font-weight: 600; color: var(--color-brand-red); }
.cell-num-muted   { font-family: var(--font-mono); color: var(--color-text-muted); }
.text-strong      { font-weight: 600; }

/* DataTable — keep its host table at 100% width without inline style */
.table-x.dt-host { width: 100%; }

/* Create-job modal — shared markup between Dashboard and Jobs pages.
   The modal itself uses Bootstrap's classes; this is just the page-app
   styling (rounded corners, soft borders, range-preview block).        */
.modal-x .modal-content {
  border-radius: 12px;
  border: 1px solid var(--color-border);
}
.modal-x .modal-header,
.modal-x .modal-footer {
  border-color: var(--color-border-soft);
}
.modal-x .modal-title {
  font-size: 16px;
  font-weight: 700;
}
.create-job-row + .create-job-row {
  margin-top: 12px;
}
.create-job-preview {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-soft);
}
.create-job-preview-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.create-job-preview-range {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}
.create-job-preview-count {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.divider { height: 1px; background: var(--color-border-soft); margin: var(--gap-card) 0; }

.copy-btn {
  background: transparent;
  border: 0;
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover { background: var(--color-surface-hover); color: var(--color-brand-red); }

/* Two-col layout for dashboard / detail */
.dash-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--gap-card);
  margin-bottom: var(--gap-section);
  align-items: start;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-card);
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

/* Variant switcher chip */
.variant-switch {
  display: inline-flex;
  background: var(--color-neutral-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 0;
}
.variant-switch button {
  background: transparent;
  border: 0;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.variant-switch button.on {
  background: white;
  color: var(--color-text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Spinner inline */
.spinner-inline {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-brand-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}

/* Litepicker — theme to match app -------------------------- */
.litepicker .container__main,
.litepicker .container__months,
.litepicker .container__footer,
.litepicker .container__predefined-ranges {
  box-shadow: none !important;
}
.litepicker {
  --litepicker-day-color: var(--color-text);
  --litepicker-day-color-hover: var(--color-text);
  --litepicker-is-today-color: var(--color-brand-red);
  --litepicker-is-in-range-color: var(--color-brand-red-hover);
  --litepicker-is-in-range-bg: var(--color-brand-red-soft);
  --litepicker-is-start-color: white;
  --litepicker-is-start-color-bg: var(--color-brand-red);
  --litepicker-is-end-color: white;
  --litepicker-is-end-color-bg: var(--color-brand-red);
  --litepicker-button-prev-month-color: var(--color-text-muted);
  --litepicker-button-prev-month-color-hover: var(--color-brand-red);
  --litepicker-button-next-month-color: var(--color-text-muted);
  --litepicker-button-next-month-color-hover: var(--color-brand-red);
  --litepicker-month-header-color: var(--color-text);
  --litepicker-container-months-color-bg: white;
  --litepicker-container-months-box-shadow-color: transparent;
  --litepicker-container-footer-color-bg: white;
  --litepicker-container-footer-box-shadow-color: transparent;
  --litepicker-footer-color-bg: white;
  --litepicker-footer-button-color: white;
  --litepicker-footer-button-bg: var(--color-brand-red);
  --litepicker-footer-button-hover-bg: var(--color-brand-red-hover);
  --litepicker-footer-button-cancel-color: var(--color-text);
  --litepicker-footer-button-cancel-bg: var(--color-neutral-soft);
  --litepicker-footer-button-cancel-hover-bg: var(--color-border);

  font-family: var(--font-sans);
  border-radius: var(--card-radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: 0;
  overflow: hidden;
  background: white;
}
.litepicker .container__months {
  box-shadow: none !important;
  padding: 4px;
}
.litepicker .container__months .month-item-header {
  padding: 8px 8px 4px;
}
.litepicker .container__months .month-item-header > div > .month-item-name,
.litepicker .container__months .month-item-header > div > .month-item-year {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.litepicker .container__months .month-item-header div > .month-item-name { margin-right: 4px; }

.litepicker .container__months .month-item-weekdays-row > div {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 0 6px;
}

.litepicker .container__days .day-item {
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text);
  padding: 0;
  height: 36px;
  line-height: 36px;
  box-shadow: none !important;
}
.litepicker .container__days .day-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  box-shadow: none !important;
}
.litepicker .container__days .day-item.is-today {
  color: var(--color-brand-red);
  font-weight: 600;
}
.litepicker .container__days .day-item.is-in-range {
  background: var(--color-brand-red-soft);
  color: var(--color-brand-red-hover);
  border-radius: 0;
}
.litepicker .container__days .day-item.is-start-date,
.litepicker .container__days .day-item.is-end-date,
.litepicker .container__days .day-item.is-start-date.is-end-date {
  background: var(--color-brand-red);
  color: white;
  font-weight: 600;
}
.litepicker .container__days .day-item.is-start-date { border-radius: 6px 0 0 6px; }
.litepicker .container__days .day-item.is-end-date { border-radius: 0 6px 6px 0; }
.litepicker .container__days .day-item.is-start-date.is-end-date { border-radius: 6px; }
.litepicker .container__days .day-item.is-locked {
  color: var(--color-text-subtle);
  opacity: 0.4;
}

.litepicker .container__months .button-previous-month,
.litepicker .container__months .button-next-month {
  border-radius: 6px;
  padding: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.litepicker .container__months .button-previous-month svg,
.litepicker .container__months .button-next-month svg {
  fill: var(--color-text-muted);
}
.litepicker .container__months .button-previous-month:hover,
.litepicker .container__months .button-next-month:hover {
  background: var(--color-surface-hover);
}
.litepicker .container__months .button-previous-month:hover svg,
.litepicker .container__months .button-next-month:hover svg {
  fill: var(--color-brand-red);
}

.litepicker .container__footer {
  padding: 10px 12px;
  border-top: 1px solid var(--color-border-soft);
  background: white;
}
.litepicker .container__footer .preview-date-range {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}
.litepicker .container__footer .button-cancel,
.litepicker .container__footer .button-apply {
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  padding: 5px 12px;
  border: 0;
  margin-left: 6px;
}
.litepicker .container__footer .button-apply {
  background: var(--color-brand-red);
  color: white;
}
.litepicker .container__footer .button-apply:hover {
  background: var(--color-brand-red-hover);
}
.litepicker .container__footer .button-apply:disabled {
  background: var(--color-neutral-soft);
  color: var(--color-text-subtle);
  cursor: not-allowed;
}
.litepicker .container__footer .button-cancel {
  background: transparent;
  color: var(--color-text-muted);
}
.litepicker .container__footer .button-cancel:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* Ranges plugin — preset shortcuts on the right side */
.litepicker .container__predefined-ranges {
  background: var(--color-bg);
  border-left: 1px solid var(--color-border-soft);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.litepicker .container__predefined-ranges button {
  background: transparent;
  border: 0;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--color-text);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.litepicker .container__predefined-ranges button:hover {
  background: var(--color-brand-red-soft);
  color: var(--color-brand-red);
}

/* Responsive ----------------------------------------------- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  :root[data-sidebar-collapsed="true"] .app-main { margin-left: 0; }
  .breadcrumb-trail { display: none; }
  .page-content { padding: 14px 14px; }
}

/* DataTables — keep wide tables horizontally scrollable inside the card
   instead of overflowing the card (and the body) on narrow viewports. */
.card-x > .dt-container {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
/* The dt-bot toolbar sits inside the same scroll container; pin it to the
   visible scrollport so it stays usable even when the user scrolls the table. */
.card-x > .dt-container > .dt-bot {
  position: sticky;
  left: 0;
}

/* Narrow viewports: stack the dt-bot pieces so pagination doesn't get crushed
   into a tiny column that wraps every button onto its own row. */
@media (max-width: 640px) {
  .card-x > .dt-container > .dt-bot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .card-x > .dt-container > .dt-bot .dt-bot-left {
    justify-content: center;
    text-align: center;
    min-height: 0;
  }
  .card-x > .dt-container > .dt-bot .dt-bot-right {
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 8px;
  }
  .card-x > .dt-container > .dt-bot .dt-paging .pagination {
    flex-wrap: wrap;
    row-gap: 4px;
  }
}

/* --- Mobile cleanup for elements that overflow the viewport --- */

/* Pipeline pill in the topbar — drop the per-state breakdown
   ("2 active", "1 paused") on narrow viewports so the topbar fits. */
@media (max-width: 640px) {
  .pipeline-control { height: 32px; }
  .pipeline-pill { padding: 0 12px 0 10px; font-size: 12px; }
  .pipeline-pill .pipeline-pill-divider,
  .pipeline-pill .pp-stat { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 8px; }
  .pipeline-btn { padding: 0 12px; font-size: 12.5px; }
}

/* Horizontal tab strips: status-tabs (jobs / data-browser) and
   tabs-x (company-detail). On narrow viewports the full strip can't
   fit; swipe horizontally instead of breaking out of the page. */
@media (max-width: 640px) {
  .status-tabs,
  .tabs-x {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    /* keep the bottom border full-width as the strip scrolls */
    padding-bottom: 1px;
  }
  .status-tabs::-webkit-scrollbar,
  .tabs-x::-webkit-scrollbar { height: 2px; }
  .status-tabs::-webkit-scrollbar-thumb,
  .tabs-x::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
  .status-tab,
  .tab-x { flex: 0 0 auto; }
}

/* Active-filter popovers anchored to chips can extend past the right
   edge of narrow viewports. Cap their width to fit. */
@media (max-width: 640px) {
  .af-popover {
    min-width: 0;
    max-width: calc(100vw - 24px);
    width: max-content;
  }
  .af-popover-list { max-height: 50vh; }
  /* Items become tight at narrow widths — let labels wrap, keep checks/counts pinned. */
  .af-popover-item {
    flex-wrap: wrap;
    row-gap: 2px;
  }
}

/* Belt-and-braces: clip any residual horizontal overflow at the page
   level on mobile (open popovers anchored mid-row, long flash content,
   etc.) so the whole page never side-scrolls. The sidebar (off-canvas
   at this breakpoint) and the table scroll wrapper are unaffected. */
@media (max-width: 768px) {
  html, body { overflow-x: clip; }
}
