:root {
  /* Base palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f4f6fa;
  --bg-tertiary: #e8ecf2;
  --bg-hover: #eef1f6;
  --border-color: #dce3ed;
  --border-hover: #c5cedc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --sidebar-bg: #ffffff;
  --sidebar-bg-deep: #f1f5f9;
  --sidebar-bg-gradient: radial-gradient(
      120% 90% at 0% -10%,
      color-mix(in srgb, var(--primary-color) 14%, transparent),
      transparent 52%
    ),
    linear-gradient(168deg, #ffffff 0%, #f8fafc 42%, var(--sidebar-bg-deep) 100%);
  --sidebar-border: #e2e8f0;
  --sidebar-edge-glow: color-mix(in srgb, var(--primary-color) 8%, transparent);
  --sidebar-width: 288px;
  --sidebar-width-collapsed: 76px;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 12px rgba(15, 23, 42, 0.06);
  --card-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.06),
    0 12px 28px rgba(15, 23, 42, 0.08);
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --success-color: #10b981;
  --danger-color: #e11d48;
  --warning-color: #d97706;
  --info-color: #2563eb;

  /* Semantic surfaces */
  --surface-page: var(--bg-secondary);
  --surface-panel: var(--card-bg);
  --surface-inset: var(--bg-tertiary);
  --canvas-spotlight: radial-gradient(
    ellipse 100% 72% at 50% -18%,
    color-mix(in srgb, var(--primary-color) 9%, transparent),
    transparent 52%
  );

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary-color) 28%, transparent);

  --tint-info: color-mix(in srgb, var(--info-color) 16%, transparent);
  --tint-success: color-mix(in srgb, var(--success-color) 16%, transparent);
  --tint-warning: color-mix(in srgb, var(--warning-color) 18%, transparent);
  --tint-danger: color-mix(in srgb, var(--danger-color) 16%, transparent);
  --tint-primary: color-mix(in srgb, var(--primary-color) 14%, transparent);
}

[data-theme="dark"] {
  --bg-primary: #0c1222;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-hover: #1a2332;
  --border-color: #2d3a52;
  --border-hover: #3d4d66;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --sidebar-bg: #0a0f1a;
  --sidebar-bg-deep: #050810;
  --sidebar-bg-gradient: radial-gradient(
      130% 95% at 0% -5%,
      color-mix(in srgb, var(--primary-color) 26%, transparent),
      transparent 55%
    ),
    linear-gradient(
      168deg,
      #141c32 0%,
      #0f172a 38%,
      var(--sidebar-bg) 72%,
      var(--sidebar-bg-deep) 100%
    );
  --sidebar-border: color-mix(in srgb, var(--primary-color) 12%, #1a2332);
  --sidebar-edge-glow: color-mix(in srgb, var(--primary-color) 14%, transparent);
  --sidebar-width: 288px;
  --sidebar-width-collapsed: 76px;
  --card-bg: #151f33;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.28);
  --card-shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.35),
    0 16px 40px rgba(0, 0, 0, 0.32);
  --primary-color: #a5b4fc;
  --primary-hover: #818cf8;
  --success-color: #34d399;
  --danger-color: #fb7185;
  --warning-color: #fbbf24;
  --info-color: #60a5fa;

  --surface-page: var(--bg-secondary);
  --surface-panel: var(--card-bg);
  --surface-inset: var(--bg-tertiary);
  --canvas-spotlight: radial-gradient(
    ellipse 100% 72% at 50% -18%,
    color-mix(in srgb, var(--primary-color) 9%, transparent),
    transparent 50%
  );

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary-color) 32%, transparent);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--surface-page);
  background-image: var(--canvas-spotlight);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.sidebar-backdrop {
  display: none;
}

.mobile-chrome {
  display: none;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  background-image: var(--sidebar-bg-gradient);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: inset -1px 0 0 var(--sidebar-edge-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.sidebar-header {
  padding: 20px 18px 18px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.25s ease, padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-collapse-btn {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.sidebar-collapse-btn:hover {
  color: var(--text-primary);
}

.sidebar-collapse-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 50% 50%;
}

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

.logo svg {
  color: var(--primary-color);
  flex-shrink: 0;
}

.logo h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}

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

.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 28px;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 14px 16px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent);
  transition: border-color 0.25s ease, padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-inset) 55%, transparent);
  color: var(--text-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-logout-btn:hover {
  background: var(--surface-inset);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.sidebar-logout-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sidebar-logout-btn svg {
  flex-shrink: 0;
}

.queues-section h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  font-weight: 600;
}

.queues-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-item {
  position: relative;
  padding: 14px 16px 14px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid color-mix(in srgb, var(--border-color) 92%, transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.queue-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

@media (prefers-reduced-motion: no-preference) {
  .queue-item:hover {
    transform: translateX(2px);
  }
}

.queue-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.queue-item.active {
  background: var(--tint-primary);
  border-color: color-mix(in srgb, var(--primary-color) 38%, var(--border-color));
  box-shadow: var(--shadow-sm);
}

.queue-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary-color);
}

.queue-item.active .queue-item-name {
  color: var(--text-primary);
  font-weight: 600;
}

.queue-item.active .queue-item-stats {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--primary-color) 18%, var(--bg-primary));
}

.queue-item-name {
  font-weight: 500;
  font-size: 16px;
  color: var(--text-primary);
}

.queue-item-stats {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-inset);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-weight: 600;
  min-width: 34px;
  text-align: center;
}

.loading-queues {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

@media (min-width: 769px) {
  .app-container.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
    min-width: var(--sidebar-width-collapsed);
  }

  .app-container.sidebar-collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
  }

  .app-container.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    padding: 16px 10px 14px;
    gap: 14px;
  }

  .app-container.sidebar-collapsed .sidebar-header-body {
    flex-direction: column;
    width: 100%;
    gap: 14px;
  }

  .app-container.sidebar-collapsed .logo {
    flex-direction: column;
    gap: 0;
  }

  .app-container.sidebar-collapsed .logo h1 {
    display: none;
  }

  .app-container.sidebar-collapsed .header-actions {
    flex-direction: column;
    gap: 4px;
  }

  .app-container.sidebar-collapsed .sidebar-content {
    padding: 12px 10px 22px;
  }

  .app-container.sidebar-collapsed .sidebar-footer {
    padding: 10px 8px 12px;
  }

  .app-container.sidebar-collapsed .sidebar-logout-btn {
    padding: 10px 8px;
    gap: 0;
  }

  .app-container.sidebar-collapsed .sidebar-logout-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .app-container.sidebar-collapsed .queues-section h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .app-container.sidebar-collapsed .queues-list {
    gap: 8px;
  }

  .app-container.sidebar-collapsed .queue-item {
    flex-direction: column;
    justify-content: center;
    padding: 10px 8px;
    gap: 6px;
    text-align: center;
  }

  .app-container.sidebar-collapsed .queue-item-name {
    display: none;
  }

  .app-container.sidebar-collapsed .queue-item-stats {
    min-width: 0;
    padding: 4px 8px;
    font-size: 12px;
  }

  .app-container.sidebar-collapsed .queue-item.active::before {
    top: 6px;
    bottom: 6px;
  }

  .app-container.sidebar-collapsed .loading-queues {
    padding: 14px 8px;
    font-size: 12px;
  }
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: transparent;
  transition: background-color 0.25s ease;
}

.empty-state-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  color: var(--text-secondary);
  padding: clamp(28px, 6vw, 48px) clamp(20px, 5vw, 40px);
}

.empty-icon {
  margin-bottom: 28px;
  opacity: 0.45;
  color: var(--text-tertiary);
}

.empty-state-main h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state-main p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 360px;
  text-align: center;
}

.queue-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 3vw, 32px) clamp(28px, 5vw, 48px);
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}

/* Job detail page — full width of main column (no narrow content cap) */
.job-detail-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vw, 20px) clamp(14px, 2.5vw, 28px) clamp(20px, 3vw, 28px);
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}

.job-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 20px;
  flex-shrink: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
  position: relative;
}

.job-detail-toolbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--primary-color) 45%, transparent),
    transparent
  );
  opacity: 0.85;
  pointer-events: none;
}

.job-detail-back {
  gap: 8px;
}

.job-detail-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.job-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  width: 100%;
  min-width: 0;
}

.job-detail-content-inner {
  width: 100%;
  max-width: none;
  min-width: 0;
}

/* Job detail: row1 timing+execution | options; row2 payload | response (or full-width payload) */
.job-detail-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  align-items: stretch;
}

.job-detail-body__cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-body__cell > .job-detail-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-body__cell > .job-detail-section-code {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-body__cell--full {
  grid-column: 1 / -1;
}

.job-detail-body__cell .job-detail-section {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .job-detail-body {
    grid-template-columns: 1fr;
  }

  .job-detail-body__cell--full {
    grid-column: auto;
  }
}

.job-detail-loading,
.job-detail-error {
  color: var(--text-secondary);
  font-size: 15px;
  padding: 16px 0;
}

.job-detail-error {
  color: var(--danger-color);
}

/* Hero — compact; title + meta stack left, ID tools align right on wide viewports */
.job-detail-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--primary-color) 8%, var(--surface-panel)) 0%,
    var(--surface-panel) 50%
  );
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.job-detail-hero-top {
  flex: 1 1 200px;
  min-width: 0;
  margin-bottom: 0;
}

.job-detail-title {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin: 0 0 8px;
}

.job-detail-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.job-detail-pills .job-state-badge {
  padding: 5px 11px;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.job-detail-queue-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-primary) 70%, transparent);
  border: 1px solid var(--border-color);
}

.job-detail-queue-pill-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
}

.job-detail-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  margin-left: auto;
}

.job-detail-id-chip {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.job-detail-copy-chip.job-detail-copied,
.job-detail-copy-json.job-detail-copied,
.job-detail-icon-copy.job-detail-copied {
  border-color: var(--success-color);
  color: var(--success-color);
}

.job-detail-panel {
  background: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

/* Shared header row: uppercase label, hairline rule, optional actions (job detail) */
.job-detail-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text-tertiary) 22%, var(--border-color));
  background: color-mix(in srgb, var(--bg-primary) 40%, transparent);
}

.job-detail-block-head__title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--text-secondary) 78%, var(--text-tertiary));
  line-height: 1.35;
}

.job-detail-block-head__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Timing & execution — horizontal pipeline + metric strip */
.job-detail-panel--timing {
  border-color: color-mix(in srgb, var(--info-color) 22%, var(--border-color));
}

.job-detail-panel--timing-execution {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--info-color) 24%, var(--border-color));
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--info-color) 14%, transparent);
  background: radial-gradient(
      ellipse 100% 120% at 50% -40%,
      color-mix(in srgb, var(--info-color) 14%, transparent),
      transparent 58%
    ),
    linear-gradient(
      155deg,
      color-mix(in srgb, var(--info-color) 8%, var(--surface-panel)) 0%,
      var(--surface-panel) 45%,
      color-mix(in srgb, var(--primary-color) 5%, var(--surface-panel)) 100%
    );
}

.job-detail-panel--timing-execution > .job-detail-block-head {
  background: color-mix(in srgb, var(--bg-primary) 48%, transparent);
  border-bottom-color: color-mix(in srgb, var(--border-color) 72%, transparent);
}

.job-detail-te-body {
  flex: 1;
  min-height: 0;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.job-detail-te-core {
  flex-shrink: 0;
}

.job-detail-te-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.job-detail-te-stat {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.job-detail-te-stat--wide {
  grid-column: 1 / -1;
}

.job-detail-te-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.job-detail-te-stat-display {
  margin: 0;
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.job-detail-te-stat-sep {
  margin: 0 2px;
  opacity: 0.35;
  font-weight: 500;
}

.job-detail-te-stat-den {
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text-secondary);
}

.job-detail-te-worker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.job-detail-te-worker-row .job-detail-mono-clip {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail-te-worker-row .job-detail-copy-chip:not(.btn) {
  flex-shrink: 0;
}

.job-detail-te-stat-block .job-detail-error-box {
  margin: 0;
}

.job-detail-te-foot {
  flex: 1 1 auto;
  min-height: 108px;
  margin-top: 14px;
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--bg-primary) 88%, transparent) 0%,
    color-mix(in srgb, var(--info-color) 7%, var(--bg-primary)) 48%,
    color-mix(in srgb, var(--primary-color) 6%, var(--bg-primary)) 100%
  );
  border: 1px solid color-mix(in srgb, var(--border-color) 65%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.job-detail-te-foot-strip {
  flex-shrink: 0;
}

.job-detail-te-foot-eyebrow {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.job-detail-te-milestone-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.job-detail-te-mile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.job-detail-te-mile--done {
  opacity: 1;
}

.job-detail-te-mile-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-inset);
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

.job-detail-te-mile--done .job-detail-te-mile-dot {
  background: color-mix(in srgb, var(--success-color) 85%, var(--surface-panel));
  border-color: color-mix(in srgb, var(--success-color) 55%, var(--border-color));
  box-shadow: 0 0 12px color-mix(in srgb, var(--success-color) 32%, transparent);
}

.job-detail-te-mile--fail.job-detail-te-mile--done .job-detail-te-mile-dot {
  background: color-mix(in srgb, var(--danger-color) 88%, var(--surface-panel));
  border-color: var(--danger-color);
  box-shadow: 0 0 12px color-mix(in srgb, var(--danger-color) 28%, transparent);
}

.job-detail-te-mile-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.job-detail-te-mile-conn {
  flex: 1 1 auto;
  height: 2px;
  min-width: 8px;
  margin-bottom: 16px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--border-color) 90%, transparent);
  opacity: 0.65;
}

.job-detail-te-mile-conn--lit {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--primary-color) 70%, transparent),
    color-mix(in srgb, var(--info-color) 75%, transparent),
    color-mix(in srgb, var(--success-color) 65%, transparent)
  );
  opacity: 0.95;
}

.job-detail-te-mile-conn--lit.job-detail-te-mile-conn--danger {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--info-color) 70%, transparent),
    var(--danger-color)
  );
}

.job-detail-te-durations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.job-detail-te-dur {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.job-detail-te-dur-k {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.job-detail-te-dur strong {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.job-detail-te-dur-na {
  font-size: 15px;
  color: var(--text-tertiary);
}

.job-detail-te-attempts-viz {
  flex-shrink: 0;
  padding-top: 2px;
}

.job-detail-te-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.job-detail-te-slot {
  flex: 1 1 auto;
  min-width: 18px;
  max-width: 36px;
  height: 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border-color) 75%, var(--surface-inset));
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.job-detail-te-slot--used {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--warning-color) 90%, transparent),
    color-mix(in srgb, var(--primary-color) 65%, var(--warning-color))
  );
  box-shadow: 0 0 10px color-mix(in srgb, var(--warning-color) 22%, transparent);
}

.job-detail-te-slots-hint {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

@media (max-width: 560px) {
  .job-detail-te-durations {
    grid-template-columns: 1fr;
  }

  .job-detail-te-milestone-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .job-detail-te-milestone-row--timeline {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
  }

  .job-detail-te-mile-conn {
    flex: 1 1 40px;
    margin-bottom: 12px;
  }
}

.job-detail-panel--placeholder {
  border-style: dashed;
  background: color-mix(in srgb, var(--surface-inset) 65%, var(--surface-panel));
}

.job-detail-body__cell > .job-detail-panel--response-placeholder {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.job-detail-panel--response-placeholder .job-detail-response-placeholder-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.job-detail-section {
  margin-bottom: 20px;
}

.job-detail-section-code > .job-detail-block-head {
  margin: 0 0 12px;
}

.job-detail-icon-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--text-tertiary) 28%, var(--border-color));
  background: color-mix(in srgb, var(--surface-inset) 55%, var(--surface-panel));
  color: color-mix(in srgb, var(--text-secondary) 90%, var(--text-tertiary));
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.job-detail-icon-copy:hover {
  background: var(--surface-inset);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.job-detail-icon-copy:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* JSON blocks: paired columns + optional full-width payload */
.job-detail-section-code .job-detail-json {
  flex: 1;
  min-height: 180px;
  max-height: none;
}

.job-detail-section-code--scroll-col .job-detail-json {
  min-height: 120px;
  max-height: none;
}

.job-detail-section-code--detail-col .job-detail-json {
  min-height: 160px;
  max-height: min(50vh, 480px);
}

.job-detail-body__cell--full .job-detail-section-code--detail-col .job-detail-json {
  max-height: min(56vh, 560px);
}

.job-detail-dl--stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  font-size: 15px;
}

.job-detail-dl--stack dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 12px 0 4px;
}

.job-detail-dl--stack dt:first-child {
  margin-top: 0;
}

.job-detail-dl--stack dd {
  color: var(--text-primary);
  margin: 0 0 4px;
  word-break: break-word;
  line-height: 1.45;
}

.job-detail-dl--stack dd:last-child {
  margin-bottom: 0;
}

.job-detail-dl--stack dd:has(.job-detail-time-rel) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.job-detail-time-rel {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.job-detail-time-abs {
  font-size: 13px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.job-detail-time-abs::before {
  content: "·";
  margin-right: 6px;
  color: var(--border-hover);
  font-weight: 400;
}

.job-detail-mono-clip {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 14px;
  color: var(--text-secondary);
}

.job-detail-dl--stack dd:has(.job-detail-mono-clip) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Label | value rows — tighter vertical rhythm for timing & execution */
.job-detail-dl--compact {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(0, 1fr);
  gap: 6px 20px;
  align-items: baseline;
  font-size: 15px;
}

.job-detail-dl--compact dt {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.job-detail-dl--compact dd {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
  min-width: 0;
}

.job-detail-dl--compact dd:has(.job-detail-time-rel) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.job-detail-dl--compact dd:has(.job-detail-mono-clip) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.job-detail-dl--compact dt:has(+ dd .job-detail-error-box),
.job-detail-dl--compact dd:has(.job-detail-error-box) {
  grid-column: 1 / -1;
}

.job-detail-dl--compact dt:has(+ dd .job-detail-error-box) {
  margin-top: 6px;
}

.job-detail-dl--compact dd:has(.job-detail-error-box) {
  margin-top: 2px;
}

.job-detail-copy-chip:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.job-detail-copy-chip:not(.btn):hover {
  background: var(--surface-inset);
  color: var(--text-primary);
}

.job-detail-copy-chip:not(.btn):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.job-detail-error-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
  color: var(--danger-color);
  background: var(--tint-danger);
  border: 1px solid color-mix(in srgb, var(--danger-color) 28%, var(--border-color));
}

.job-detail-json {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-inset) 92%, var(--bg-primary)) 0%,
    color-mix(in srgb, var(--surface-inset) 100%, var(--bg-primary)) 100%
  );
  color: var(--text-primary);
  padding: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.65;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
  border-left: 3px solid var(--primary-color);
  display: flex;
  flex-direction: column;
}

.job-detail-json--tone-options {
  border-left-color: var(--info-color);
}

.job-detail-json--tone-payload {
  border-left-color: var(--warning-color);
}

.job-detail-json--tone-response {
  border-left-color: var(--success-color);
}

.job-json-key {
  color: color-mix(in srgb, var(--info-color) 75%, var(--text-secondary));
  font-weight: 600;
}

[data-theme="light"] .job-json-key {
  color: color-mix(in srgb, var(--info-color) 65%, var(--text-primary));
}

.job-detail-json pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  flex: 1;
  min-height: 0;
}

.job-detail-json pre code.job-detail-code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.job-detail-response-wrap .job-detail-json {
  border-left-color: var(--success-color);
}

.job-detail-response-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 8px 6px 4px;
}

.job-detail-response-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--surface-inset) 70%, transparent);
  border: 1px dashed color-mix(in srgb, var(--border-color) 90%, transparent);
}

.job-detail-response-empty-lead {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.job-detail-panel--placeholder .job-detail-response-empty {
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 0;
  max-width: 38ch;
}

.job-detail-panel--response-placeholder {
  padding: 0;
  overflow: hidden;
  border-style: solid;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--success-color) 6%, var(--surface-panel)) 0%,
    var(--surface-panel) 55%
  );
  border-color: color-mix(in srgb, var(--success-color) 22%, var(--border-color));
}

.job-detail-panel--response-placeholder > .job-detail-block-head {
  background: color-mix(in srgb, var(--bg-primary) 38%, transparent);
  border-bottom-color: color-mix(in srgb, var(--success-color) 22%, var(--border-color));
}

.job-detail-response-placeholder-body {
  padding: 18px 18px 20px;
}

.job-detail-inline-code {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.queue-header {
  margin-bottom: clamp(20px, 4vw, 36px);
}

.queue-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.queue-title-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.queue-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}

.queue-title h2 {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.queue-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
  justify-content: flex-end;
}


/* Job state rail (single strip: filter + counts) */
.stats-cards {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  margin-bottom: clamp(20px, 3.5vw, 32px);
  background: var(--surface-inset);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.stat-card {
  flex: 1 1 0;
  min-width: 148px;
  background: color-mix(in srgb, var(--bg-primary) 52%, transparent);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease,
    transform 0.2s ease;
  box-shadow: none;
  position: relative;
  flex-shrink: 0;
}

.stat-card:hover {
  border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-color));
  background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  .stat-card:hover {
    transform: translateY(-1px);
  }
}

.stat-card.active {
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--primary-color) 12%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--primary-color) 35%, transparent),
    0 12px 36px color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.stat-card[data-state="waiting"].active {
  border-color: color-mix(in srgb, var(--info-color) 50%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--info-color) 12%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--info-color) 30%, transparent),
    0 12px 36px color-mix(in srgb, var(--info-color) 10%, transparent);
}

.stat-card[data-state="active"].active {
  border-color: color-mix(in srgb, var(--success-color) 50%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--success-color) 12%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--success-color) 28%, transparent),
    0 12px 36px color-mix(in srgb, var(--success-color) 10%, transparent);
}

.stat-card[data-state="delayed"].active {
  border-color: color-mix(in srgb, var(--warning-color) 50%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--warning-color) 12%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--warning-color) 30%, transparent),
    0 12px 36px color-mix(in srgb, var(--warning-color) 10%, transparent);
}

.stat-card[data-state="failed"].active {
  border-color: color-mix(in srgb, var(--danger-color) 50%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--danger-color) 12%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--danger-color) 28%, transparent),
    0 12px 36px color-mix(in srgb, var(--danger-color) 10%, transparent);
}

.stat-card[data-state="completed"].active {
  border-color: color-mix(in srgb, var(--success-color) 45%, var(--border-color));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--success-color) 10%, var(--surface-panel)) 0%,
    var(--surface-panel) 48%
  );
  box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--success-color) 25%, transparent),
    0 12px 36px color-mix(in srgb, var(--success-color) 8%, transparent);
}

.stat-card:focus-visible {
  outline: none;
  z-index: 1;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  .stat-card:hover {
    transform: none;
  }
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.waiting {
  background: var(--tint-info);
  color: var(--info-color);
}

.stat-icon.active {
  background: var(--tint-success);
  color: var(--success-color);
}

.stat-icon.delayed {
  background: var(--tint-warning);
  color: var(--warning-color);
}

.stat-icon.failed {
  background: var(--tint-danger);
  color: var(--danger-color);
}

.stat-icon.completed {
  background: var(--tint-success);
  color: var(--success-color);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* Jobs Section */
.jobs-section {
  background: var(--surface-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.jobs-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 20px;
  transition: border-color 0.25s ease;
}

.jobs-context-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  min-width: 0;
  flex: 1 1 auto;
}

.jobs-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(360px, 100%);
}

.search-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  width: 100%;
  min-width: 0;
  height: 42px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--border-color));
  box-shadow: var(--focus-ring);
}

.page-size-select {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  height: 42px;
  flex-shrink: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.page-size-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--border-color));
  box-shadow: var(--focus-ring);
}

.jobs-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  margin: 0 24px 16px;
  background: var(--surface-inset);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.bulk-selection-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Jobs Table */
.jobs-table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(65vh, 720px);
  -webkit-overflow-scrolling: touch;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
}

.jobs-table thead {
  background: var(--surface-inset);
  transition: background-color 0.25s ease;
}

.jobs-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.25s ease;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border-color);
  background: var(--surface-inset);
}

.jobs-table th.col-select,
.jobs-table td.col-select {
  width: 44px;
  padding-left: 18px;
  padding-right: 12px;
  text-align: center;
  vertical-align: middle;
}

.jobs-table th.col-select {
  text-transform: none;
  letter-spacing: normal;
}

.jobs-table th.col-select input[type="checkbox"],
.jobs-table td.col-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.jobs-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  transition: border-color 0.25s ease, background-color 0.15s ease;
  vertical-align: middle;
}

.jobs-table tbody tr {
  transition: background-color 0.15s ease;
}

.jobs-table tbody tr:hover {
  background: color-mix(in srgb, var(--bg-hover) 88%, var(--bg-primary));
}

.job-id {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-inset);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.job-name {
  font-weight: 600;
  color: var(--text-primary);
}

.job-state-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.job-state-badge.waiting {
  background: var(--tint-info);
  color: var(--info-color);
  border-color: color-mix(in srgb, var(--info-color) 22%, transparent);
}

.job-state-badge.active {
  background: var(--tint-success);
  color: var(--success-color);
  border-color: color-mix(in srgb, var(--success-color) 22%, transparent);
}

.job-state-badge.delayed {
  background: var(--tint-warning);
  color: var(--warning-color);
  border-color: color-mix(in srgb, var(--warning-color) 24%, transparent);
}

.job-state-badge.failed {
  background: var(--tint-danger);
  color: var(--danger-color);
  border-color: color-mix(in srgb, var(--danger-color) 22%, transparent);
}

.job-state-badge.completed {
  background: var(--tint-success);
  color: var(--success-color);
  border-color: color-mix(in srgb, var(--success-color) 20%, transparent);
}

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

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 8px 16px;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary-color) 35%, transparent);
    transition: background-color 0.15s ease, transform 0.18s ease, box-shadow 0.18s ease;
  }
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--surface-inset);
  border-color: var(--border-hover);
}

.btn-success {
  background: var(--success-color);
  color: #ffffff;
}

.btn-success:hover {
  filter: brightness(1.06);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--success-color) 35%, transparent);
  }
}

.btn-danger {
  background: var(--danger-color);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(1.06);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--danger-color) 35%, transparent);
  }
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger-color);
  border: 1px solid color-mix(in srgb, var(--danger-color) 45%, var(--border-color));
}

.btn-danger-outline:hover {
  background: var(--tint-danger);
  border-color: color-mix(in srgb, var(--danger-color) 55%, var(--border-color));
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn:disabled:hover {
  filter: none;
  background: inherit;
  box-shadow: none;
}

.loading-jobs,
.empty-jobs {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-secondary);
}

.empty-jobs-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* Pagination */
.pagination {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  transition: border-color 0.25s ease;
}

.page-info {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-inset);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-header,
  .sidebar-collapse-icon {
    transition: none;
  }

  .queue-item:hover {
    transform: none;
  }

  .btn-primary:hover,
  .btn-success:hover,
  .btn-danger:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Tablet: slightly denser chrome, room for main column */
@media (max-width: 1024px) {
  .queue-title {
    gap: 14px;
  }

  .jobs-header {
    padding: 18px 20px;
  }

  .jobs-table th,
  .jobs-table td {
    padding-left: 14px;
    padding-right: 14px;
  }

  .pagination {
    padding: 16px 20px;
  }
}

/* Narrow main: stack queue actions, fluid stat rail */
@media (max-width: 640px) {
  .queue-actions {
    width: 100%;
    justify-content: stretch;
  }

  .queue-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
  }

  .stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .stat-card {
    padding: 12px 14px;
    gap: 10px;
  }
}

/* Responsive — sidebar becomes off-canvas drawer */
@media (max-width: 768px) {
  .app-container {
    flex-direction: row;
    position: relative;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    margin: 0;
    border: none;
    padding: 0;
    background: color-mix(in srgb, var(--bg-primary) 55%, #000 45%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .app-container.mobile-nav-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar-backdrop:focus {
    outline: none;
  }

  body.mobile-nav-lock {
    overflow: hidden;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: min(var(--sidebar-width), min(320px, 88vw));
    min-width: 0;
    height: 100dvh;
    max-height: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .app-container.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    min-height: 0;
    padding: 10px 12px 10px 10px;
    padding-left: max(10px, env(safe-area-inset-left, 0));
    padding-right: max(10px, env(safe-area-inset-right, 0));
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 75%, transparent);
    background: color-mix(in srgb, var(--surface-panel) 92%, var(--surface-page));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-chrome-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .mobile-chrome-mark {
    flex-shrink: 0;
    display: block;
    color: var(--primary-color);
  }

  .mobile-nav-open-btn {
    flex-shrink: 0;
    color: var(--text-secondary);
  }

  .mobile-chrome-title {
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
  }

  .stats-cards {
    gap: 6px;
    padding: 6px;
  }

  .stat-card {
    padding: 14px 14px;
  }

  .jobs-header {
    flex-direction: column;
    align-items: stretch;
  }

  .jobs-context-label {
    flex: none;
  }

  .jobs-controls {
    width: 100%;
    flex-wrap: nowrap;
  }

  .search-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .search-input {
    width: 100%;
    max-width: none;
  }

  .queue-view {
    padding: 22px 18px 32px;
  }

  .job-detail-view {
    padding: 22px 18px 32px;
  }

  /*
   * Toolbar (back, live, actions): row 1 back + overflow; row 2 full-width live.
   */
  .job-detail-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .job-detail-toolbar > .job-detail-back {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    width: max-content;
    max-width: 100%;
  }

  .job-detail-toolbar-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  .job-detail-toolbar-live {
    grid-column: 1 / -1;
    grid-row: 2;
    flex: none;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 52%, transparent);
    margin-top: 0;
  }

  .job-detail-toolbar-live .job-detail-toolbar-refresh {
    margin-left: auto;
  }

  .job-detail-updated-label {
    min-width: 0;
    flex: 1 1 auto;
  }

  .job-detail-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .job-detail-id-row {
    margin-left: 0;
    width: 100%;
  }

  .jobs-bulk-bar {
    margin: 0 16px 12px;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop {
    transition: none;
  }
}

/* Scrollable stat chips between 521px and 768px wide viewports */
@media (max-width: 768px) and (min-width: 521px) {
  .stat-card {
    min-width: 132px;
  }
}

/* Small phones: stat rail as a 2-col grid (no horizontal scrubbing) */
@media (max-width: 520px) {
  .stats-cards {
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: stretch;
  }

  .stat-card {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    box-sizing: border-box;
  }

  .stat-card:nth-child(5):last-child {
    flex: 1 1 100%;
  }

  .jobs-table-container {
    max-height: min(58vh, 560px);
  }

  .job-detail-log-ts {
    font-size: 10px;
  }
}

@media (max-width: 400px) {
  .jobs-table th,
  .jobs-table td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .jobs-table th.col-select,
  .jobs-table td.col-select {
    padding-left: 10px;
    padding-right: 8px;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .pagination .page-info {
    order: -1;
  }

  .job-detail-dl--compact {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .job-detail-dl--compact dt {
    margin-top: 10px;
  }

  .job-detail-dl--compact dt:first-child {
    margin-top: 0;
  }
}

/* ——— Job detail v2: toolbar meta, tabs, hero, grid, cards, logs ——— */

.job-detail-toolbar > .job-detail-back {
  flex-shrink: 0;
}

.job-detail-toolbar-live {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.job-detail-updated-label {
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 7.5rem;
  font-variant-numeric: tabular-nums;
}

.job-detail-toolbar-refresh {
  width: 38px;
  height: 38px;
}

.job-detail-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.job-detail-auto-refresh input {
  accent-color: var(--primary-color);
}

.job-detail-overflow {
  position: relative;
}

.job-detail-overflow-trigger {
  list-style: none;
  width: 40px;
  height: 40px;
}

.job-detail-overflow-trigger::-webkit-details-marker {
  display: none;
}

.job-detail-overflow[open] .job-detail-overflow-trigger {
  background: var(--surface-inset);
  color: var(--text-primary);
}

.job-detail-overflow-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.job-detail-overflow-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
}

.job-detail-overflow-item:hover {
  background: var(--surface-inset);
}

.job-detail-overflow-item--danger {
  color: var(--danger-color);
}

.job-detail-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.job-detail-tablist {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-primary) 55%, var(--surface-inset));
  border: 1px solid color-mix(in srgb, var(--border-color) 55%, transparent);
  width: fit-content;
}

.job-detail-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.job-detail-tab[aria-selected="true"] {
  background: var(--surface-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.job-detail-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.job-detail-tabpanel--logs {
  padding-top: 4px;
}

.job-detail-logs-panel {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: color-mix(in srgb, var(--surface-inset) 35%, var(--surface-panel));
  border: 1px solid color-mix(in srgb, var(--border-color) 65%, transparent);
}

.job-detail-logs-intro {
  font-size: 13px;
  margin-bottom: 14px;
}

.job-detail-logs-body {
  font-size: 13px;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.job-detail-logs-loading {
  padding: 12px 0;
}

.job-detail-logs-empty {
  text-align: center;
  padding: 28px 16px 20px;
  max-width: 420px;
  margin: 0 auto;
}

.job-detail-logs-empty-icon {
  color: var(--text-tertiary);
  margin-bottom: 12px;
  opacity: 0.85;
}

.job-detail-logs-empty-lead {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.job-detail-logs-empty-copy {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.job-detail-log-line {
  display: grid;
  grid-template-columns: minmax(0, clamp(5.5rem, 24vw, 9.5rem)) minmax(3rem, max-content) minmax(0, 1fr);
  gap: 8px 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 45%, transparent);
  align-items: baseline;
}

.job-detail-log-ts {
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail-log-level {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--info-color);
}

.job-detail-log-line--error .job-detail-log-level,
.job-detail-log-line--err .job-detail-log-level {
  color: var(--danger-color);
}

.job-detail-log-line--warn .job-detail-log-level {
  color: var(--warning-color);
}

.job-detail-log-msg {
  color: var(--text-primary);
  min-width: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  /* Must follow base .job-detail-log-* so these rules win in the cascade */
  .job-detail-log-line {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 6px 10px;
    align-items: center;
  }

  .job-detail-log-ts {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .job-detail-log-level {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
  }

  .job-detail-log-msg {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.job-detail-hero--v2 {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 18px 20px 20px;
  margin-bottom: 24px;
  border: none;
  background: color-mix(in srgb, var(--surface-panel) 97%, var(--bg-primary));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--border-color) 55%, transparent);
  position: relative;
  overflow: hidden;
}

.job-detail-hero-accent {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--primary-color) 35%, transparent),
    transparent
  );
  opacity: 0.75;
  pointer-events: none;
}

.job-detail-hero--state-completed .job-detail-hero-accent {
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--success-color) 55%, transparent),
    transparent
  );
  opacity: 0.95;
}

.job-detail-hero--state-failed .job-detail-hero-accent {
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--danger-color) 45%, transparent),
    transparent
  );
}

.job-detail-hero--state-active .job-detail-hero-accent,
.job-detail-hero--state-waiting .job-detail-hero-accent {
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--info-color) 40%, transparent),
    transparent
  );
}

.job-detail-hero--state-delayed .job-detail-hero-accent {
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--warning-color) 45%, transparent),
    transparent
  );
}

.job-detail-hero-row--primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.job-detail-hero-title {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-primary);
  flex: 1 1 200px;
  min-width: 0;
}

.job-detail-hero-row--primary .job-state-badge--hero.job-state-badge.completed {
  border-color: color-mix(in srgb, var(--success-color) 42%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success-color) 20%, transparent),
    0 4px 20px color-mix(in srgb, var(--success-color) 12%, transparent);
}

.job-detail-hero-summary {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 35%, transparent);
}

.job-detail-hero-row--tertiary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 28%, transparent);
  font-size: 12px;
  color: var(--text-tertiary);
}

.job-detail-hero-tertiary-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  opacity: 0.85;
}

.job-detail-hero-tertiary-val {
  color: color-mix(in srgb, var(--text-secondary) 70%, var(--text-tertiary));
  font-weight: 500;
}

.job-detail-hero-tertiary-dot {
  opacity: 0.45;
  user-select: none;
}

.job-detail-hero-tertiary-id {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  background: none;
  border: none;
  padding: 0;
}

.job-detail-copy-chip--mini {
  padding: 4px 10px;
  font-size: 11px;
  margin-left: 4px;
}

.job-state-badge--hero {
  padding: 7px 13px;
  font-size: 11px;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .job-state-badge--pulse.job-state-badge.completed {
    animation: jobDetailBadgeGlow 2.4s ease-in-out infinite;
  }
}

@keyframes jobDetailBadgeGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success-color) 0%, transparent);
  }
  50% {
    box-shadow: 0 0 20px 2px color-mix(in srgb, var(--success-color) 22%, transparent);
  }
}

.job-detail-run-summary {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 760px;
}

.job-detail-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px 24px;
  align-items: stretch;
}

.job-detail-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  min-height: 100%;
}

.job-detail-col--primary > .job-detail-card--response {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-block-head {
  flex-shrink: 0;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-response-body-json,
.job-detail-col--primary > .job-detail-card--response > .job-detail-card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-response-placeholder-body--centered {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-response-body-json > .job-detail-json--in-card {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-card-body > .job-detail-duotone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-card-body .job-detail-struct-wrap,
.job-detail-col--primary > .job-detail-card--response > .job-detail-card-body .job-detail-json-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.job-detail-col--primary > .job-detail-card--response > .job-detail-card-body .job-detail-json {
  max-height: none;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.job-detail-card {
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  border: 1px solid color-mix(in srgb, var(--border-color) 55%, transparent);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.2s ease;
}

.job-detail-card--execution {
  background: linear-gradient(
    175deg,
    color-mix(in srgb, var(--surface-panel) 94%, var(--info-color)) 0%,
    var(--surface-panel) 48%
  );
}

.job-detail-card--payload {
  background: color-mix(in srgb, var(--surface-panel) 92%, var(--bg-primary));
}

.job-detail-card--response-hero.job-detail-card--response-empty {
  min-height: 228px;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-panel) 92%, var(--success-color)) 0%,
    color-mix(in srgb, var(--surface-inset) 25%, var(--surface-panel)) 100%
  );
}

.job-detail-card--response-hero {
  border-color: color-mix(in srgb, var(--success-color) 22%, var(--border-color));
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-panel) 88%, var(--success-color)) 0%,
    var(--surface-panel) 55%
  );
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--success-color) 14%, transparent),
    0 16px 48px color-mix(in srgb, var(--success-color) 7%, transparent);
}

.job-detail-card--response-tone-failed.job-detail-card--response-hero,
.job-detail-card--response-tone-failed.job-detail-card--response-hero.job-detail-card--response-empty {
  border-color: color-mix(in srgb, var(--danger-color) 22%, var(--border-color));
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-panel) 90%, var(--danger-color)) 0%,
    var(--surface-panel) 70%
  );
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--danger-color) 12%, transparent),
    0 12px 40px color-mix(in srgb, var(--danger-color) 6%, transparent);
}

.job-detail-card--response-tone-active.job-detail-card--response-hero.job-detail-card--response-empty,
.job-detail-card--response-tone-waiting.job-detail-card--response-hero.job-detail-card--response-empty,
.job-detail-card--response-tone-delayed.job-detail-card--response-hero.job-detail-card--response-empty {
  border-color: color-mix(in srgb, var(--info-color) 18%, var(--border-color));
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--surface-panel) 94%, var(--info-color)) 0%,
    var(--surface-panel) 65%
  );
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--info-color) 10%, transparent);
}

.job-detail-response-body-json {
  padding: 0 16px 18px;
  min-height: auto;
}

.job-detail-card--lift:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--border-hover) 75%, var(--border-color));
}

@media (prefers-reduced-motion: reduce) {
  .job-detail-card--lift:hover {
    transform: none;
  }
}

.job-detail-card .job-detail-block-head {
  background: color-mix(in srgb, var(--bg-primary) 28%, transparent);
  border-bottom-color: color-mix(in srgb, var(--border-color) 55%, transparent);
}

.job-detail-card .job-detail-block-head__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 0.98;
}

.job-detail-lifecycle-body {
  padding: 0;
}

.job-detail-lifecycle-body .job-detail-te-foot--card {
  margin-top: 0;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-inset) 30%, transparent) 0%,
    transparent 100%
  );
}

.job-detail-te-mile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-inset);
  border: 2px solid var(--border-color);
  color: var(--text-tertiary);
}

.job-detail-te-mile--done .job-detail-te-mile-icon {
  background: color-mix(in srgb, var(--success-color) 12%, var(--surface-panel));
  border-color: color-mix(in srgb, var(--success-color) 35%, var(--border-color));
  color: var(--success-color);
}

.job-detail-te-mile--fail.job-detail-te-mile--done .job-detail-te-mile-icon {
  background: color-mix(in srgb, var(--danger-color) 12%, var(--surface-panel));
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.job-detail-te-mile-ic {
  display: block;
}

.job-detail-te-mile-time {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: center;
  max-width: 9.5rem;
}

.job-detail-te-mile-emoji {
  display: inline-block;
  margin-right: 5px;
  font-size: 12px;
  line-height: 1;
  opacity: 0.55;
}

.job-detail-te-mile--done .job-detail-te-mile-emoji {
  opacity: 1;
}

.job-detail-te-milestone-row {
  align-items: flex-start;
}

.job-detail-te-milestone-row--timeline {
  width: 100%;
  justify-content: flex-start;
  gap: clamp(8px, 2vw, 20px);
  flex-wrap: nowrap;
}

.job-detail-te-milestone-row--timeline .job-detail-te-mile-conn {
  flex: 1 1 0;
  min-width: 12px;
  margin-top: 16px;
  margin-bottom: 36px;
}

.job-detail-te-milestone-row--timeline .job-detail-te-mile {
  flex: 0 0 auto;
  min-width: 4.5rem;
}

.job-detail-te-mile-conn {
  margin-top: 14px;
  margin-bottom: 28px;
}

.job-detail-json--in-card {
  margin: 0;
  border-radius: var(--radius-sm);
  max-height: min(52vh, 440px);
}

.job-detail-card--response-empty .job-detail-response-placeholder-body {
  padding: 8px 16px 20px;
}

.job-detail-response-placeholder-body--centered {
  min-height: 208px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 36px;
}

.job-detail-response-placeholder-body--centered .job-detail-response-empty-state {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.job-detail-response-placeholder-body--centered .job-detail-response-empty-icon {
  margin-left: auto;
  margin-right: auto;
}

.job-detail-empty-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.job-detail-card-body,
.job-detail-card-body-subtle {
  padding: 14px 16px 18px;
}

.job-detail-card-body-subtle {
  padding-top: 10px;
}

.job-detail-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 12px;
  line-height: 1.4;
}

.job-detail-hint--exec-foot {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.job-detail-duotone.job-detail-show-json ~ .job-detail-hint--exec-foot {
  display: none;
}

.job-detail-kv-row--priority-hint {
  cursor: help;
}

.job-detail-muted {
  color: var(--text-tertiary);
  font-size: 14px;
}

.job-detail-payload-summary {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.job-detail-kv {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.job-detail-kv-row {
  display: grid;
  grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
  gap: 8px 16px;
  padding: 11px 0 10px;
  border-bottom: none;
  align-items: baseline;
}

.job-detail-kv-row + .job-detail-kv-row {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 22%, transparent);
}

@media (min-width: 1040px) {
  .job-detail-kv--exec {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
    row-gap: 2px;
  }

  .job-detail-kv--exec .job-detail-kv-row {
    padding: 9px 0 8px;
  }

  .job-detail-kv--exec .job-detail-kv-row + .job-detail-kv-row {
    margin-top: 0;
    padding-top: 9px;
    border-top: none;
  }
}

.job-detail-kv-k {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  opacity: 0.88;
}

.job-detail-kv-v {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  letter-spacing: -0.01em;
}

.job-detail-duotone .job-detail-json-wrap {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  pointer-events: none;
}

.job-detail-duotone.job-detail-show-json .job-detail-struct-wrap {
  display: none;
}

.job-detail-duotone.job-detail-show-json .job-detail-json-wrap {
  max-height: min(48vh, 420px);
  opacity: 1;
  pointer-events: auto;
}

.job-detail-duotone .job-detail-json {
  min-height: 120px;
  max-height: min(42vh, 360px);
}

.job-detail-json-wrap {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .job-detail-duotone .job-detail-json-wrap {
    transition: none;
  }
}

.btn-ghost {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
  color: var(--text-secondary);
  box-shadow: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.2s ease;
}

.btn-ghost:hover {
  background: var(--surface-inset);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.job-detail-exec-metadata {
  border-top: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
  padding: 14px 16px 16px;
  margin: 0;
  background: color-mix(in srgb, var(--surface-inset) 18%, transparent);
}

.job-detail-exec-metadata-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin: 0 0 12px;
  opacity: 0.9;
}

.job-detail-exec-metadata-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.job-detail-meta-label {
  flex: 0 0 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.job-detail-meta-val {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.job-detail-meta-attempts {
  margin: 0;
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.job-detail-meta-attempts-sep {
  margin: 0 4px;
  opacity: 0.35;
  font-size: 0.65em;
  font-weight: 500;
}

.job-detail-meta-attempts-den {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--text-secondary);
}

.job-detail-copy-chip--ghost {
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
}

.job-detail-copy-chip--ghost:hover {
  background: var(--surface-inset);
  color: var(--text-primary);
}

.job-detail-copy-chip.job-detail-copied::after,
.job-detail-overflow-item.job-detail-copied::after {
  content: " Copied ✓";
  font-size: 11px;
  font-weight: 600;
  color: var(--success-color);
}

.job-state-badge.paused {
  background: color-mix(in srgb, var(--text-tertiary) 18%, var(--surface-inset));
  color: var(--text-secondary);
  border-color: color-mix(in srgb, var(--border-color) 80%, transparent);
}

@media (max-width: 900px) {
  .job-detail-main-grid {
    grid-template-columns: 1fr;
  }

  .job-detail-col--primary {
    order: 1;
  }

  .job-detail-col--secondary {
    order: 2;
  }
}

/* Dashboard login */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg-primary) 88%, #000 12%);
  backdrop-filter: blur(8px);
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 28px 24px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  font-family: "DM Sans", system-ui, sans-serif;
}

.login-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.login-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.login-input:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--primary-color);
}

.login-error {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--danger-color);
}

.login-error[hidden] {
  display: none;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-color);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.login-submit:hover {
  background: var(--primary-hover);
}
