/* Lead Scraper Admin — Dashboard Design System */

:root {
  --sidebar-width: 248px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html[data-theme="dark"],
html:not([data-theme]) {
  color-scheme: dark;
  --bg-primary: #0b1119;
  --bg-secondary: #111827;
  --bg-card: #141c26;
  --bg-card-hover: #1a2433;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.15);
  --red: #ef4444;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
  --hover-bg: rgba(255, 255, 255, 0.04);
  --hover-bg-medium: rgba(255, 255, 255, 0.05);
  --hover-bg-strong: rgba(255, 255, 255, 0.06);
  --row-hover-bg: rgba(255, 255, 255, 0.03);
  --row-hover-bg-subtle: rgba(255, 255, 255, 0.02);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --shadow-dropdown: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.4);
  --scrollbar-thumb: #334155;
  --pending-bg: rgba(255, 255, 255, 0.06);
  --failed-bg: rgba(239, 68, 68, 0.15);
  --failed-bg-soft: rgba(239, 68, 68, 0.12);
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);
  --danger-text: #fca5a5;
  --danger-text-hover: #fecaca;
  --danger-action: #f87171;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.25);
  --link-blue: #60a5fa;
  --star-empty: #334155;
  --star-filled: #fbbf24;
  --avatar-gradient: linear-gradient(135deg, #1e293b, #334155);
  --score-ring-track: #1e293b;
  --progress-gradient-end: #4ade80;
  --chart-tooltip-bg: #1a2433;
  --chart-tooltip-title: #f1f5f9;
  --chart-tooltip-body: #94a3b8;
  --chart-grid: rgba(255, 255, 255, 0.04);
  --chart-empty: rgba(255, 255, 255, 0.08);
  --toggle-track: #334155;
  --toggle-knob: #ffffff;
  --toggle-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --purple-hover-bg: rgba(168, 85, 247, 0.25);
  --purple-hover-bg-strong: rgba(168, 85, 247, 0.35);
  --yellow-dim: rgba(251, 191, 36, 0.15);
  --green-glow: rgba(34, 197, 94, 0.25);
  --btn-primary-hover: #16a34a;
  --icon-filter: none;
  --theme-toggle-bg: rgba(255, 255, 255, 0.06);
  --theme-toggle-icon: #e2e8f0;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: rgba(15, 23, 42, 0.1);
  --border-light: rgba(15, 23, 42, 0.14);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --green: #15803d;
  --green-dim: rgba(21, 128, 61, 0.12);
  --blue: #1d4ed8;
  --blue-dim: rgba(29, 78, 216, 0.1);
  --orange: #c2410c;
  --orange-dim: rgba(194, 65, 12, 0.1);
  --purple: #7e22ce;
  --purple-dim: rgba(126, 34, 206, 0.1);
  --red: #dc2626;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --hover-bg: rgba(15, 23, 42, 0.04);
  --hover-bg-medium: rgba(15, 23, 42, 0.06);
  --hover-bg-strong: rgba(15, 23, 42, 0.08);
  --row-hover-bg: rgba(15, 23, 42, 0.03);
  --row-hover-bg-subtle: rgba(15, 23, 42, 0.025);
  --overlay-bg: rgba(15, 23, 42, 0.35);
  --shadow-dropdown: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-menu: 0 8px 24px rgba(15, 23, 42, 0.1);
  --scrollbar-thumb: #cbd5e1;
  --pending-bg: rgba(15, 23, 42, 0.06);
  --failed-bg: rgba(220, 38, 38, 0.1);
  --failed-bg-soft: rgba(220, 38, 38, 0.08);
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.22);
  --danger-text: #b91c1c;
  --danger-text-hover: #991b1b;
  --danger-action: #dc2626;
  --info-bg: rgba(29, 78, 216, 0.08);
  --info-border: rgba(29, 78, 216, 0.2);
  --link-blue: #1d4ed8;
  --star-empty: #cbd5e1;
  --star-filled: #d97706;
  --avatar-gradient: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  --score-ring-track: #e2e8f0;
  --progress-gradient-end: #22c55e;
  --chart-tooltip-bg: #ffffff;
  --chart-tooltip-title: #0f172a;
  --chart-tooltip-body: #475569;
  --chart-grid: rgba(15, 23, 42, 0.08);
  --chart-empty: rgba(15, 23, 42, 0.08);
  --toggle-track: #cbd5e1;
  --toggle-knob: #ffffff;
  --toggle-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
  --purple-hover-bg: rgba(126, 34, 206, 0.12);
  --purple-hover-bg-strong: rgba(126, 34, 206, 0.18);
  --yellow-dim: rgba(217, 119, 6, 0.12);
  --green-glow: rgba(21, 128, 61, 0.2);
  --btn-primary-hover: #166534;
  --icon-filter: brightness(0) saturate(100%) invert(28%) sepia(12%) saturate(800%) hue-rotate(176deg) brightness(92%) contrast(92%);
  --theme-toggle-bg: rgba(15, 23, 42, 0.06);
  --theme-toggle-icon: #334155;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

a { color: inherit; text-decoration: none; }

/* ---- App Shell ---- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
}

.page-content {
  flex: 1;
  padding: 24px 28px 32px;
  overflow-x: hidden;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 90;
}

/* ---- Sidebar ---- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 24px;
}

.sidebar-brand-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.sidebar-link:hover:not(.disabled) {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--green-dim);
  color: var(--green);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--green);
  border-radius: 0 2px 2px 0;
}

.sidebar-link.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.sidebar-link-icon {
  opacity: 0.7;
  flex-shrink: 0;
  transition: opacity 0.15s, filter 0.15s;
}

.sidebar-link:hover:not(.disabled) .sidebar-link-icon {
  opacity: 0.9;
}

.sidebar-link.active .sidebar-link-icon {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(58%) sepia(93%) saturate(425%) hue-rotate(93deg) brightness(95%) contrast(91%);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link-row {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  position: relative;
}

.sidebar-link-row.active .sidebar-link-main {
  background: var(--green-dim);
  color: var(--green);
}

.sidebar-link-row.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--green);
  border-radius: 0 2px 2px 0;
}

.sidebar-link-main {
  flex: 1;
  min-width: 0;
}

.sidebar-submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-submenu-toggle:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.sidebar-chevron {
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.sidebar-group.is-open .sidebar-chevron,
.sidebar-group.is-hover .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: grid;
  gap: 2px;
  padding-left: 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.18s ease;
  margin-top: 0;
}

.sidebar-group.is-open .sidebar-submenu,
.sidebar-group.is-hover .sidebar-submenu {
  max-height: 220px;
  opacity: 1;
  margin-top: 2px;
  margin-bottom: 4px;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-sublink img {
  opacity: 0.75;
  flex-shrink: 0;
}

.sidebar-sublink:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.sidebar-sublink.active {
  background: var(--green-dim);
  color: var(--green);
}

.sidebar-sublink.active img {
  opacity: 1;
}

.stat-icon img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.sidebar-status {
  margin: 16px 12px 20px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sidebar-status-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.sidebar-status-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-status-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Header ---- */

.top-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 28px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.menu-toggle:hover { background: var(--hover-bg-medium); }

.header-spacer { flex: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-btn:hover { background: var(--hover-bg-medium); }

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
}

.header-profile-wrap {
  position: relative;
}

.header-profile-wrap.open .header-chevron,
.header-profile-wrap:hover .header-chevron {
  opacity: 1;
  transform: rotate(180deg);
}

.header-profile:hover,
.header-profile-wrap.open .header-profile {
  background: var(--hover-bg);
}

.header-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  background: var(--bg-card, #111827);
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 120;
}

.header-profile-wrap.open .header-profile-dropdown,
.header-profile-wrap:hover .header-profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header-profile-dropdown-head {
  padding: 8px 10px;
}

.header-profile-dropdown-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-profile-dropdown-role {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.header-profile-dropdown-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border-light, rgba(255, 255, 255, 0.08));
}

.header-profile-dropdown-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.header-profile-dropdown-item:hover {
  background: var(--hover-bg-strong);
  color: var(--danger-text-hover);
}

.header-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light);
}

.header-profile-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.header-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-profile-role {
  font-size: 11px;
  color: var(--text-muted);
}

.header-chevron {
  opacity: 0.5;
  transition: transform 0.15s ease, opacity 0.15s;
}

/* ---- Dashboard Header ---- */

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dashboard-welcome h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dashboard-welcome p {
  font-size: 13px;
  color: var(--text-secondary);
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover { background: var(--btn-primary-hover); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover { background: var(--bg-card-hover); }

/* ---- Stat Cards ---- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  min-height: 140px;
}

.stat-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-green { background: var(--green-dim); }
.stat-icon-blue { background: var(--blue-dim); }
.stat-icon-orange { background: var(--orange-dim); }
.stat-icon-purple { background: var(--purple-dim); }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.stat-value-split {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-divider {
  font-size: 18px;
  color: var(--text-muted);
  font-weight: 400;
}

.stat-change {
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }
.stat-change .neutral,
.stat-change.neutral { color: var(--text-muted); }

.stat-sparkline {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  height: 36px !important;
  width: 100% !important;
  opacity: 0.75;
  pointer-events: none;
}

.stat-accent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-accent-green { background: var(--green); }
.stat-accent-blue { background: var(--blue); }
.stat-accent-orange { background: var(--orange); }
.stat-accent-purple { background: var(--purple); }

.stat-progress {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--purple-hover-bg);
  display: flex;
  z-index: 1;
}

.stat-progress-new {
  height: 100%;
  background: var(--purple);
}

.stat-progress-contacted {
  height: 100%;
  background: var(--purple-hover-bg-strong);
}

/* ---- Panels ---- */

.charts-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.85fr;
  gap: 16px;
  margin-bottom: 20px;
}

.lists-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--hover-bg);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.panel-link {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}

.panel-link:hover { text-decoration: underline; }

.chart-container {
  position: relative;
  height: 220px;
}

/* ---- Donut Chart ---- */

.donut-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.donut-chart-area {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.donut-chart-area canvas {
  width: 150px !important;
  height: 150px !important;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center-value {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.donut-center-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  max-width: 70px;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.legend-item {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-label { color: var(--text-secondary); }

.legend-count {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.legend-pct {
  color: var(--text-muted);
  font-size: 11px;
  min-width: 36px;
  text-align: right;
}

/* ---- Locations ---- */

.locations-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.location-item {}

.location-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.location-flag { flex-shrink: 0; opacity: 0.8; }

.location-name {
  flex: 1;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-pct {
  color: var(--text-muted);
  font-size: 11px;
  min-width: 38px;
  text-align: right;
}

.location-count {
  font-weight: 600;
  color: var(--text-primary);
}

.location-bar-track {
  height: 4px;
  background: var(--hover-bg-strong);
  border-radius: 2px;
  overflow: hidden;
}

.location-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--progress-gradient-end));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ---- Recent Jobs ---- */

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.job-row:hover { background: var(--row-hover-bg); }

.job-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-status-completed { background: var(--green-dim); }
.job-status-running { background: var(--blue-dim); }
.job-status-pending { background: var(--pending-bg); }
.job-status-failed { background: var(--failed-bg); }

.job-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-leads-col { text-align: right; }

.job-leads-label {
  font-size: 10px;
  color: var(--text-muted);
}

.job-leads-value {
  font-size: 14px;
  font-weight: 700;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-pill-completed { background: var(--green-dim); color: var(--green); }
.status-pill-running { background: var(--blue-dim); color: var(--blue); }
.status-pill-pending { background: var(--pending-bg); color: var(--text-secondary); }
.status-pill-failed { background: var(--failed-bg); color: var(--red); }
.status-pill-cancelled { background: var(--pending-bg); color: var(--text-muted); }

/* ---- Recent Leads ---- */

.leads-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lead-row {
  display: grid;
  grid-template-columns: 40px 1fr auto 16px;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.lead-row:hover { background: var(--row-hover-bg); }

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--avatar-gradient);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
}

.lead-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.lead-chevron { opacity: 0.4; }

.empty-text {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
}

.empty-text a { color: var(--green); }

/* ---- Auth Layout ---- */

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.auth-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-card .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--green); }

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.form-input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.error-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.btn-full { width: 100%; justify-content: center; }

.btn-sm { padding: 8px 14px; font-size: 12px; }

/* ---- Page Header (shared) ---- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-header-text p {
  font-size: 13px;
  color: var(--text-secondary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ---- Leads Page ---- */

.leads-filters {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.leads-filters-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-field {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 36px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.search-input:focus { border-color: var(--green); }

.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  min-width: 130px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--green); }

.btn-filter {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-filter:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  cursor: pointer;
}

.btn-clear:hover { color: var(--text-primary); }

.leads-filters-extra {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.leads-filters-extra.is-open { display: flex; }

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-checkbox input { accent-color: var(--green); }

.leads-table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1100px;
}

.leads-table thead {
  background: var(--row-hover-bg-subtle);
  border-bottom: 1px solid var(--border-color);
}

.leads-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.leads-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.leads-table tbody tr:hover { background: var(--row-hover-bg-subtle); }

.leads-table tbody tr:last-child td { border-bottom: none; }

.col-check { width: 40px; }
.col-check input { accent-color: var(--green); cursor: pointer; }

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface-elevated, var(--card-bg));
  border-bottom: 1px solid var(--border-color);
}

.bulk-action-bar[hidden] { display: none; }

.bulk-action-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-selected-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.bulk-notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 14px;
}

.col-name { min-width: 180px; }

.col-date { white-space: nowrap; }

.col-actions { width: 60px; text-align: center; }

.business-name {
  font-weight: 600;
  color: var(--text-primary);
}

.business-name:hover { color: var(--green); }

.text-muted { color: var(--text-muted); }

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sort-link:hover,
.sort-link.active { color: var(--text-primary); }

.link-external,
.link-email {
  color: var(--link-blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-external:hover,
.link-email:hover { text-decoration: underline; }

.lead-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.lead-badge-qualified { background: var(--green-dim); color: var(--green); }
.lead-badge-contacted { background: var(--purple-dim); color: var(--purple); }
.lead-badge-no-website { background: var(--orange-dim); color: var(--orange); }
.lead-badge-new { background: var(--blue-dim); color: var(--blue); }
.lead-badge-default { background: var(--pending-bg); color: var(--text-secondary); }

.row-actions { position: relative; display: inline-block; }

.row-actions-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  opacity: 0.6;
}

.row-actions-btn:hover { opacity: 1; background: var(--hover-bg-medium); }

.row-actions-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 140px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-menu);
  z-index: 20;
  overflow: hidden;
}

.row-actions.open .row-actions-menu { display: block; }

.row-actions-menu a,
.row-actions-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.row-actions-menu a:hover,
.row-actions-menu button:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.row-actions-menu button { color: var(--danger-action); }

.empty-cell {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-muted);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.table-footer-info {
  font-size: 12px;
  color: var(--text-muted);
}

.table-footer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.page-btn:hover:not(.disabled):not(.active) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

.page-btn.disabled {
  opacity: 0.35;
  cursor: default;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.per-page-form { margin-left: 8px; }

.per-page-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ---- Lead Detail Page (Reference Layout) ---- */

.ld-page { max-width: 1400px; }

.ld-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.ld-breadcrumb a { color: var(--text-secondary); }
.ld-breadcrumb a:hover { color: var(--text-primary); }
.ld-breadcrumb-sep { opacity: 0.5; }

.ld-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.ld-back:hover { color: var(--text-primary); }
.ld-back-icon { transform: rotate(180deg); opacity: 0.7; }

.ld-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ld-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ld-title-row h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ld-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.ld-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.ld-meta-item img { opacity: 0.6; }

.ld-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ld-menu-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.ld-menu-btn:hover { background: var(--bg-card-hover); }

/* Tabs */
.ld-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.ld-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}

.ld-tab:hover { color: var(--text-primary); }

.ld-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.ld-panel { display: none; }
.ld-panel.active { display: block; }

/* 3-column grid */
.ld-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 300px;
  gap: 16px;
  align-items: start;
}

.ld-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ld-col-side { gap: 12px; }

/* Cards */
.ld-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.ld-card-narrow { max-width: 640px; }

.ld-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

/* Info rows inside cards */
.ld-rows { display: flex; flex-direction: column; }

.ld-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.ld-row:last-child { border-bottom: none; padding-bottom: 0; }
.ld-row:first-child { padding-top: 0; }

.ld-row-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  min-width: 120px;
}

.ld-row-label img { opacity: 0.55; }

.ld-row-value {
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
  min-width: 0;
}

.ld-mono { font-family: ui-monospace, monospace; font-size: 11px; }

.ld-about {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-line;
}

.ld-rating-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ld-stars { display: inline-flex; gap: 1px; }

.ld-star {
  color: var(--star-empty);
  font-size: 14px;
}

.ld-star.filled { color: var(--star-filled); }

.ld-hours-open { color: var(--green); font-weight: 500; }

/* Tags */
.ld-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ld-tag {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
}

.ld-note-preview {
  margin-bottom: 12px;
}

.ld-note-preview p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.ld-note-meta { font-size: 11px; color: var(--text-muted); }

.ld-empty { font-size: 13px; margin-bottom: 12px; }

.ld-add-btn {
  background: none;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
}

.ld-add-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

/* Status & Score */
.ld-status-select { width: 100%; }

.ld-score-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ld-score-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 3.6deg), var(--score-ring-track) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.ld-score-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: var(--bg-card);
  border-radius: 50%;
}

.ld-score-num {
  position: relative;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.ld-score-num small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.ld-score-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.ld-score-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Timeline */
.ld-timeline { display: flex; flex-direction: column; gap: 0; }

.ld-timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.ld-timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: -2px;
  width: 1px;
  background: var(--border-color);
}

.ld-timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ld-timeline-icon-green { background: var(--green-dim); border-color: rgba(34, 197, 94, 0.3); }
.ld-timeline-icon-blue { background: var(--blue-dim); border-color: rgba(59, 130, 246, 0.3); }

.ld-timeline-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  padding-top: 4px;
}

.ld-timeline-body strong { font-size: 13px; font-weight: 600; }
.ld-timeline-body time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ld-timeline-full .ld-timeline-item { padding: 14px 0; }

.ld-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ld-notes-form textarea { margin-bottom: 12px; }

.ld-rows-raw .ld-row-label { min-width: 140px; }

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.btn-danger:hover {
  background: var(--failed-bg);
  color: var(--danger-text-hover);
}

@media (max-width: 1100px) {
  .ld-columns { grid-template-columns: 1fr 1fr; }
  .ld-col-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .ld-quick-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .ld-quick-actions .btn-full { flex: 1; min-width: 120px; }
}

@media (max-width: 768px) {
  .ld-columns { grid-template-columns: 1fr; }
  .ld-col-side { grid-template-columns: 1fr; }
  .ld-header { flex-direction: column; }
  .ld-row { flex-direction: column; gap: 4px; }
  .ld-row-value { text-align: left; }
}

/* ---- Legacy page styles (jobs, schedules) ---- */

.legacy-page h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.legacy-page .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.legacy-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.legacy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.legacy-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.legacy-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.legacy-table tr:hover td { background: var(--row-hover-bg-subtle); }

.legacy-table a { color: var(--green); }

.legacy-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.legacy-filters input,
.legacy-filters select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.pagination {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}

.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.pagination a {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.pagination a:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.pagination .current {
  background: var(--green-dim);
  color: var(--green);
  font-weight: 600;
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ---- Job Form Page ---- */

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.page-breadcrumb a {
  color: var(--text-secondary);
  transition: color 0.15s;
}

.page-breadcrumb a:hover { color: var(--text-primary); }

.page-breadcrumb-sep { opacity: 0.45; }

.btn-icon-left {
  transform: rotate(180deg);
  opacity: 0.7;
}

.job-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.job-config-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.job-config-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.job-config-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--green-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-config-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.job-config-header-split {
  margin-bottom: 20px;
}

.job-config-header-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.job-config-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-header-with-icon {
  align-items: center;
}

.page-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--green-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.page-header-icon img {
  filter: brightness(0) saturate(100%) invert(58%) sepia(93%) saturate(425%) hue-rotate(93deg) brightness(95%) contrast(91%);
}

.schedule-info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  font-size: 12px;
  color: var(--text-secondary);
}

.schedule-info-banner strong {
  color: var(--green);
  font-weight: 600;
}

.schedule-enable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.schedule-enable-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.schedule-enable-desc {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.category-tag-input-select {
  padding-right: 4px;
}

.category-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

.category-select-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.category-add-link {
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.category-add-link:hover { text-decoration: underline; }

.job-info-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.job-info-panel-head h3 {
  margin-bottom: 0;
}

.job-info-panel-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.job-info-panel-icon-green { background: var(--green-dim); }
.job-info-panel-icon-yellow { background: var(--yellow-dim); }

.job-steps-connected li {
  position: relative;
}

.job-steps-connected li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 28px;
  width: 2px;
  height: calc(100% - 8px);
  background: var(--green-glow);
}

.job-form-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.job-form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.job-form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-field { margin-bottom: 0; }

.form-field > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.label-optional {
  color: var(--text-muted);
  font-weight: 400;
}

.label-required { color: var(--green); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-input-icon-wrap {
  position: relative;
}

.form-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.55;
  pointer-events: none;
}

.form-input-with-icon {
  padding-left: 38px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.category-tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 0.15s;
}

.category-tag-input:focus-within { border-color: var(--green); }
.category-tag-input.is-invalid { border-color: var(--red); }

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: var(--green-dim);
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
}

.category-tag-remove {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.category-tag-remove:hover { opacity: 1; }

.category-tag-text {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  padding: 4px 2px;
}

.category-tag-text::placeholder { color: var(--text-muted); }

.job-advanced-section {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.job-advanced-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.job-toggle-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.job-toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.job-toggle-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.job-toggle-card-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.job-toggle-icon-green { background: var(--green-dim); }
.job-toggle-icon-purple { background: var(--purple-dim); }
.job-toggle-icon-orange { background: var(--orange-dim); }

.job-toggle-card-body {
  flex: 1;
  min-width: 0;
}

.job-toggle-card-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}

.job-toggle-card-desc {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.toggle-switch {
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--toggle-track);
  position: relative;
  transition: background 0.2s;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--toggle-knob);
  transition: transform 0.2s;
  box-shadow: var(--toggle-shadow);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--green);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

.job-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.job-form-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.job-info-panel h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.job-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.job-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-dim);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.job-steps strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.job-steps p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-pills.hidden { display: none; }

.category-pill {
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.category-pill:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

.category-pill-more {
  color: var(--green);
  border-color: transparent;
  background: transparent;
}

.job-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-tips li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.job-tips img {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.85;
}

.hidden { display: none !important; }

/* ---- Jobs List Page ---- */

.jobs-page { max-width: 1400px; }

.jobs-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.jobs-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
}

.jobs-stat-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.jobs-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jobs-stat-icon-green { background: var(--green-dim); }
.jobs-stat-icon-blue { background: var(--blue-dim); }
.jobs-stat-icon-purple { background: var(--purple-dim); }
.jobs-stat-icon-orange { background: var(--orange-dim); }

.jobs-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.jobs-stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.jobs-stat-foot {
  font-size: 11px;
  color: var(--text-muted);
}

.jobs-stat-green { border-bottom: 3px solid var(--green); }
.jobs-stat-blue { border-bottom: 3px solid var(--blue); }
.jobs-stat-purple { border-bottom: 3px solid var(--purple); }
.jobs-stat-orange { border-bottom: 3px solid var(--orange); }

.jobs-filters {
  margin-bottom: 16px;
}

.jobs-filters-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.jobs-filters-main .search-field {
  flex: 1;
  min-width: 220px;
}

.jobs-table-panel { margin-bottom: 24px; }

.jobs-table .col-job-name { min-width: 220px; }
.jobs-table .col-created { white-space: nowrap; }

.jobs-name-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: inherit;
}

.jobs-name-cell:hover .jobs-name { text-decoration: underline; }

.jobs-row-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.jobs-row-icon-completed { background: var(--green-dim); }
.jobs-row-icon-running { background: var(--blue-dim); }
.jobs-row-icon-pending { background: var(--pending-bg); }
.jobs-row-icon-failed { background: var(--failed-bg-soft); }

.jobs-name-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.jobs-name {
  font-weight: 600;
  color: var(--green);
  font-size: 13px;
}

.jobs-id {
  font-size: 11px;
  color: var(--text-muted);
}

.jobs-created-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.jobs-target,
.jobs-categories {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.jobs-categories-more {
  color: var(--green);
  font-weight: 500;
  white-space: nowrap;
}

.jobs-depth {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.jobs-depth-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.jobs-status-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jobs-status-cell .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
}

.jobs-leads-found {
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}

/* ---- Theme Toggle ---- */

.theme-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--theme-toggle-bg);
  cursor: pointer;
  color: var(--theme-toggle-icon);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.theme-toggle-btn:hover {
  background: var(--hover-bg-medium);
  border-color: var(--border-color);
}

.theme-toggle-btn:active {
  transform: scale(0.96);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-btn .theme-icon-sun,
.theme-toggle-btn .theme-icon-moon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle-btn .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-toggle-btn .theme-icon-moon {
  opacity: 0;
  transform: rotate(-20deg) scale(0.85);
}

.theme-toggle-btn.is-light-active .theme-icon-sun {
  opacity: 0;
  transform: rotate(20deg) scale(0.85);
}

.theme-toggle-btn.is-light-active .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light theme: darken UI icons designed for dark backgrounds */
html[data-theme="light"] img[src*="/icons/"] {
  filter: var(--icon-filter);
}

html[data-theme="light"] .sidebar-link.active img.sidebar-link-icon {
  filter: brightness(0) saturate(100%) invert(32%) sepia(85%) saturate(650%) hue-rotate(93deg) brightness(92%) contrast(92%);
}

html[data-theme="light"] .sidebar-brand-text,
html[data-theme="light"] .header-profile-name,
html[data-theme="light"] .stat-value,
html[data-theme="light"] .page-header-text h1,
html[data-theme="light"] .dashboard-welcome h1,
html[data-theme="light"] .jobs-stat-value,
html[data-theme="light"] .table th {
  color: #020617;
}

html[data-theme="light"] .form-group label,
html[data-theme="light"] .stat-label,
html[data-theme="light"] .panel-header h2 {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Light theme: Tailwind slate utilities used on legacy pages */
html[data-theme="light"] .bg-slate-900 {
  background-color: var(--bg-card) !important;
  color: var(--text-primary);
}

html[data-theme="light"] .bg-slate-800,
html[data-theme="light"] .bg-slate-800\/50 {
  background-color: var(--bg-card-hover) !important;
}

html[data-theme="light"] .bg-slate-700 {
  background-color: var(--pending-bg) !important;
}

html[data-theme="light"] .border-slate-800,
html[data-theme="light"] .border-slate-700 {
  border-color: var(--border-color) !important;
}

html[data-theme="light"] .text-slate-200,
html[data-theme="light"] .text-slate-300 {
  color: var(--text-primary) !important;
}

html[data-theme="light"] .text-slate-400 {
  color: var(--text-secondary) !important;
}

html[data-theme="light"] .text-slate-500 {
  color: var(--text-muted) !important;
}

html[data-theme="light"] .hover\:bg-slate-700:hover {
  background-color: var(--hover-bg-medium) !important;
}

html[data-theme="light"] .hover\:text-slate-200:hover,
html[data-theme="light"] .hover\:text-white:hover {
  color: var(--text-primary) !important;
}

/* ---- Responsive ---- */

@media (max-width: 1280px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .jobs-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr 1fr; }
  .panel-locations { grid-column: 1 / -1; }
  .job-form-layout { grid-template-columns: 1fr; }
  .job-form-sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); display: grid; }
  .job-toggle-cards { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .menu-toggle { display: flex; }
  .charts-row { grid-template-columns: 1fr; }
  .lists-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .stat-cards { grid-template-columns: 1fr; }
  .jobs-stat-cards { grid-template-columns: 1fr; }
  .jobs-filters-main { flex-direction: column; align-items: stretch; }
  .jobs-filters-main .filter-select { width: 100%; }
  .page-content { padding: 16px; }
  .dashboard-header { flex-direction: column; }
  .dashboard-actions { width: 100%; }
  .dashboard-actions .btn { flex: 1; justify-content: center; }
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
  .job-form-grid-2,
  .job-form-grid-3 { grid-template-columns: 1fr; }
  .job-form-sidebar { grid-template-columns: 1fr; display: grid; }
  .job-form-actions { flex-direction: column-reverse; }
  .job-form-actions .btn { width: 100%; justify-content: center; }
  .leads-filters-main { flex-direction: column; align-items: stretch; }
  .filter-select { width: 100%; }
  .table-footer { flex-direction: column; align-items: flex-start; }
  .job-row {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
  }
  .job-leads-col, .status-pill { grid-column: 2; }
  .header-profile-info { display: none; }
  .header-chevron { display: none; }
}
