  .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin: 0 2px;
  }
  .badge-yes { background: #e8f5e9; color: #2e7d32; }
  .badge-no { background: #ffebee; color: #c62828; }
  .badge-source { background: #e3f2fd; color: #1565c0; }
  .badge-video { background: #f3e5f5; color: #7b1fa2; }
/* --- Live Ops overlay (Real-Time Ops Dashboard Session 7) --- */
  .lo-btn {
    background: #0f9d58;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .lo-btn:hover { background: #0b8043; }
  .lo-btn-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
    animation: lo-pulse 1.8s infinite;
  }
  @keyframes lo-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
    70% { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  }
  /* Jobs panel button (Scraper Background Job Manager plan, toolbar
     integration): translation_worker / ai_enhancement_worker /
     reclassify_listing_types at a glance. */
  .jobs-btn {
    background: #6d28d9;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }
  .jobs-btn:hover { background: #5b21b6; }
  .jobs-btn-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.5);
  }
  .jobs-btn.has-running .jobs-btn-dot {
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52,211,153,0.7);
    animation: lo-pulse 1.8s infinite;
  }
  .jobs-count-badge {
    background: rgba(255,255,255,0.22);
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; font-size: 11px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .jobs-btn.has-running .jobs-count-badge { background: #34d399; color: #063; }
  /* Overlay scrim — z-index 9200: above City Stats 9100, below the
     lightbox 10000 (previews enlarge into the shared lightbox). */
  .lo-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.55);
    z-index: 9200;
    justify-content: center;
    align-items: center;
  }
  .lo-scrim.active { display: flex; }
  .lo-modal {
    position: relative;
    width: 98vw;
    height: 97vh;
    max-width: 2000px;
    background: #f0f2f5;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .lo-header {
    background: linear-gradient(135deg, #0f9d58 0%, #0b8043 100%);
    color: #fff;
    padding: 14px 28px;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .lo-conn { font-size: 13px; font-weight: 600; }
  .lo-conn-live { color: #d7ffe6; }
  .lo-conn-wait { color: #fff3cd; }
  .lo-conn-off { color: #ffd6d6; }
  .lo-close {
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 20;
    width: 36px;
    height: 36px;
    font-size: 26px;
    line-height: 1;
    background: #fff;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
  }
  .lo-close:hover { background: #f5f5f5; color: #c62828; }
  .lo-body { flex: 1; overflow: auto; padding: 16px 24px; }
  .lo-degraded {
    display: none;
    background: #fff8e1;
    border: 1px solid #ffe0a3;
    border-left: 4px solid #f57f17;
    border-radius: 8px;
    padding: 12px 16px;
    color: #8a5700;
    font-size: 13px;
    margin-bottom: 16px;
  }
  /* Metrics strip */
  .lo-metrics {
    display: flex;
    gap: 16px;
    align-items: stretch;
    flex-wrap: wrap;
    margin-bottom: 18px;
  }
  .lo-tiles { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
  .lo-tile {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 18px;
    min-width: 96px;
    text-align: center;
  }
  .lo-tile .lo-tile-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; }
  .lo-tile .lo-tile-value { font-size: 26px; font-weight: 700; color: #1a1a2e; margin-top: 2px; }
  .lo-tile-active .lo-tile-value { color: #0f9d58; }
  .lo-tile-err .lo-tile-value { color: #c62828; }
  .lo-spark {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .lo-spark-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
  .lo-spark canvas { display: block; }
  /* Card grid */
  .lo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }
  .lo-empty { padding: 48px; text-align: center; color: #999; font-size: 14px; }
  .lo-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #9e9e9e;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s;
    overflow: hidden;
    min-width: 0;
  }
  .lo-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.14); }
  .lo-card-active { border-left-color: #0f9d58; }
  .lo-card-idle { border-left-color: #f9a825; }
  .lo-card-offline { border-left-color: #9e9e9e; opacity: 0.7; }
  .lo-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .lo-chip-worker { background: #ede7f6; color: #5e35b1; }
  .lo-city { font-size: 12px; color: #666; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lo-queue { display: flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: 11px; color: #555; }
  .lo-queue-pg { font-weight: 600; color: #1565c0; }
  .lo-queue-count { font-variant-numeric: tabular-nums; }
  .lo-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: #9e9e9e; }
  .lo-dot-active { background: #0f9d58; box-shadow: 0 0 0 3px rgba(15,157,88,0.18); }
  .lo-dot-idle { background: #f9a825; box-shadow: 0 0 0 3px rgba(249,168,37,0.18); }
  .lo-dot-offline { background: #9e9e9e; }
  .lo-identity { font-size: 15px; font-weight: 700; color: #1a1a2e; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lo-op { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; margin-bottom: 6px; min-width: 0; min-height: 22px; }
  .lo-op-icon { font-size: 15px; line-height: 1; flex-shrink: 0; }
  .lo-op-label { font-weight: 600; flex-shrink: 0; }
  .lo-op-detail { color: #888; font-size: 12px; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lo-progress {
    position: relative;
    height: 16px;
    background: #eceff1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
  }
  .lo-progress-bar { height: 100%; background: linear-gradient(90deg, #1a73e8, #4a90d9); border-radius: 8px; transition: width 0.3s; }
  .lo-progress-text {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #333; font-weight: 600;
  }
  /* Reserves the progress bar's space when no progress is active so the
     card height stays constant (visibility:hidden keeps the box). */
  .lo-progress-hidden { visibility: hidden; }
  .lo-preview {
    position: relative;
    width: 128px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin: 0 auto 8px;
  }
  .lo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .lo-preview-cap {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lo-ago { font-size: 11px; color: #999; }
  /* Drill-down pop-up — z-index 9300: above the Live Ops overlay 9200,
     below the lightbox 10000. */
  .lo-drill-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9300;
    justify-content: center;
    align-items: center;
  }
  .lo-drill-scrim.active { display: flex; }
  .lo-drill-modal {
    position: relative;
    width: 78vw;
    height: 82vh;
    max-width: 1100px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .lo-drill-header {
    background: #263238;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .lo-drill-body { flex: 1; overflow: hidden; display: flex; }
  .lo-drill-state { width: 45%; overflow-y: auto; padding: 16px 20px; border-right: 1px solid #eee; }
  .lo-drill-logs { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .lo-drill-logs-head { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #666; padding: 12px 16px 6px; flex-shrink: 0; }
  .lo-log {
    flex: 1;
    overflow-y: auto;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 14px;
  }
  .lo-log-line { white-space: pre-wrap; word-break: break-word; }
  .lo-log-ts { color: #6e7681; margin-right: 8px; }
  .lo-log-warn .lo-log-msg { color: #f0b429; }
  .lo-log-error .lo-log-msg { color: #ff7b72; }
  .lo-log-empty { color: #6e7681; padding: 8px 0; }
  .lo-kv { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f2f2f2; font-size: 13px; }
  .lo-kv-key { color: #888; min-width: 120px; flex-shrink: 0; }
  .lo-kv-val { color: #1a1a2e; word-break: break-word; }
  .lo-drill-op { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
  .lo-drill-op .lo-op-icon { font-size: 22px; }

  /* --- Scraper Metrics panel (90vw/90vh popup, main-grid styling) ---
     z-index 9150: above City Stats 9100, below Live Ops 9200 and the
     lightbox 10000. Close via X/Esc/scrim-click. Uses the same light
     theme + table styling as the main dashboard grid. */
  .sm-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9150;
    justify-content: center;
    align-items: center;
  }
  .sm-scrim.active { display: flex; }
  .sm-modal {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1800px;
    background: #f0f2f5;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .sm-header {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    padding: 14px 28px;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 2px solid #1557b0;
  }
  .sm-header-sub {
    font-size: 13px;
    font-weight: 600;
    color: #cfe0ff;
  }
  .sm-close {
    position: absolute;
    top: 10px; right: 16px;
    z-index: 20;
    width: 36px; height: 36px;
    font-size: 26px; line-height: 1;
    background: #fff; color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
  }
  .sm-close:hover { background: #f5f5f5; color: #c62828; }
  /* Toolbar row (Scraper Panel Toolbar plan): Start All / Stop All /
     Config All, between .sm-header and .sm-body. Now shared by the Jobs
     panel too (Start All / Stop All scoped to kind="worker"). */
  .sm-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
  }
  .sm-toolbar-msg { font-size: 12px; color: #666; }

  /* --- Add Site modal (ONE_CLICK_ADD_SITE Session 8) ---
     Reuses .sm-scrim/.sm-modal chrome; .as-modal only narrows the
     width. z-index 9170: above Scraper Metrics 9150, below Live Ops
     9200 and the lightbox 10000. */
  .as-modal { width: 600px; max-width: 92vw; height: 80vh; max-height: 700px; }
  .as-body { flex: 1; overflow: auto; padding: 20px 24px; }
  .as-form { display: flex; gap: 10px; margin-bottom: 16px; }
  .as-url-input {
    flex: 1; padding: 9px 12px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 14px; background: #fff; color: #1a1a2e;
  }
  .as-url-input:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,0.2); }
  .as-progress-wrap { margin-bottom: 16px; }
  .as-progress-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #555; margin-bottom: 6px;
  }
  .as-progress-pct { font-weight: 700; color: #1a73e8; }
  .as-progress {
    height: 10px; background: #e0e0e0; border-radius: 5px; overflow: hidden;
  }
  .as-progress-bar {
    height: 100%; width: 0%; border-radius: 5px;
    background: linear-gradient(90deg, #1a73e8 0%, #1557b0 100%);
    transition: width 0.4s ease;
  }
  .as-steps { list-style: none; margin: 0; padding: 0; }
  .as-step {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
  }
  .as-step:last-child { border-bottom: none; }
  .as-step-icon {
    flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; line-height: 1;
    margin-top: 1px;
  }
  .as-step.done .as-step-icon { background: #1e8e3e; color: #fff; }
  .as-step.active .as-step-icon { background: #1a73e8; color: #fff; }
  .as-step.failed .as-step-icon { background: #e53935; color: #fff; }
  .as-step.skipped .as-step-icon { background: #bbb; color: #fff; }
  .as-step.pending .as-step-icon { background: #e0e0e0; color: #999; }
  .as-step-label { flex: 1; color: #1a1a2e; }
  .as-step.pending .as-step-label { color: #999; }
  .as-step.skipped .as-step-label { color: #999; text-decoration: line-through; }
  .as-step-sub { color: #888; font-size: 12px; white-space: nowrap; }
  .as-spinner {
    width: 14px; height: 14px; border: 2px solid #cfe0ff;
    border-top-color: #1a73e8; border-radius: 50%;
    animation: as-spin 0.8s linear infinite;
  }
  @keyframes as-spin { to { transform: rotate(360deg); } }
  .as-status {
    font-size: 13px; color: #555; margin-bottom: 12px; min-height: 18px;
    display: flex; align-items: center; gap: 8px;
  }
  .as-status .as-spinner { width: 12px; height: 12px; }
  .as-banner {
    padding: 14px 16px; border-radius: 8px; margin-bottom: 12px;
    font-size: 14px; line-height: 1.5;
  }
  .as-banner-success { background: #e6f4ea; border: 1px solid #1e8e3e; color: #1e6b3a; }
  .as-banner-fail { background: #fce8e6; border: 1px solid #e53935; color: #c62828; }
  .as-banner-info { background: #e8f0fe; border: 1px solid #1a73e8; color: #1557b0; }
  .as-banner-title { font-weight: 700; margin-bottom: 4px; }
  .as-banner-detail { font-size: 12px; color: #666; }
  .as-actions { display: flex; gap: 10px; margin-top: 12px; }
  .as-log-section {
    margin-top: 12px; border: 1px solid #e0e0e0; border-radius: 6px;
    overflow: hidden; display: flex; flex-direction: column;
  }
  .as-log-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #e0e0e0;
    font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase;
    letter-spacing: 0.5px; flex-shrink: 0;
  }
  .as-log-close {
    border: none; background: none; font-size: 18px; cursor: pointer;
    color: #999; padding: 0 4px; line-height: 1;
  }
  .as-log-close:hover { color: #c62828; }
  .as-log-content {
    margin: 0; padding: 12px; max-height: 300px; overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace; font-size: 12px;
    line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    color: #333; background: #fafafa;
  }
  .as-log-empty { padding: 16px; text-align: center; color: #999; font-size: 13px; }
  .as-scorecard { font-size: 12px; color: #666; margin-top: 8px; }
  .as-scorecard-row { display: flex; justify-content: space-between; padding: 2px 0; }
  .as-empty { color: #999; font-size: 14px; padding: 24px 0; text-align: center; }

  .sm-body {
    flex: 1;
    overflow: auto;
    padding: 16px 24px;
  }
  /* Metrics table — reuses the main grid's table/th/td styling. */
  .sm-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    /* overflow:visible so the sticky thead th sticks to .sm-body (the
       real scroll container), not the table's own non-scrolling overflow
       box — same pattern as #listingTable in the main dashboard grid. */
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .sm-table thead { background: #f8f9fa; }
  .sm-table th {
    padding: 12px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
  }
  .sm-table th.sortable { cursor: pointer; user-select: none; }
  .sm-table th.sortable:hover { color: #1a73e8; }
  .sm-table th.sort-asc::after { content: ' \25B2'; color: #1a73e8; font-size: 9px; }
  .sm-table th.sort-desc::after { content: ' \25BC'; color: #1a73e8; font-size: 9px; }
  .sm-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    vertical-align: middle;
    white-space: nowrap;
  }
  .sm-table tr:hover td { background: #f5f7fa; }
  .sm-table tr.sm-disabled td { opacity: 0.5; }
  /* First column: scraper name + status dot + recent image thumbnail */
  .sm-name-cell { min-width: 160px; }
  .sm-name-content { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sm-name-info { min-width: 0; }
  .sm-name-row { display: flex; align-items: center; gap: 8px; }
  .sm-name-text { font-weight: 700; color: #1a1a2e; }
  .sm-name-link { color: #1a73e8; text-decoration: none; cursor: pointer; }
  .sm-name-link:hover { text-decoration: underline; color: #1557b0; }
  .sm-name-base { font-size: 11px; color: #999; margin-top: 2px; }
  .sm-delete-btn {
    flex-shrink: 0; padding: 2px 8px; border: 1px solid #e0e0e0;
    border-radius: 4px; background: #fff; color: #c62828;
    font-size: 11px; cursor: pointer; line-height: 1.4;
    transition: background 0.15s, border-color 0.15s;
  }
  .sm-delete-btn:hover { background: #fef0f0; border-color: #c62828; }
  .sm-delete-btn:disabled { color: #ccc; cursor: not-allowed; }
  .sm-recent-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
  }
  .sm-recent-thumb-blank {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #e8e8e8;
    flex-shrink: 0;
  }
  .sm-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #ccc;
  }
  .sm-status-dot.sm-running {
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
    animation: smPulse 1.6s ease-out infinite;
  }
  .sm-status-dot.sm-idle {
    background: #f9a825;
    box-shadow: 0 0 0 3px rgba(249,168,37,0.18);
  }
  @keyframes smPulse {
    0%   { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
    100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
  }
  .sm-status-detail {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    margin-left: 18px;
  }
  .sm-status-detail.sm-running-detail {
    color: #1b5e20;
    font-weight: 600;
  }
  /* Numeric cells */
  .sm-num { font-variant-numeric: tabular-nums; text-align: right; }
  .sm-num-zero { color: #ccc; }
  /* Time cells */
  .sm-time { color: #666; font-size: 13px; }
  .sm-time-abs { color: #999; font-size: 12px; }
  /* Badge for enabled/disabled */
  .sm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .sm-badge-on { background: #e8f5e9; color: #2e7d32; }
  .sm-badge-off { background: #ffebee; color: #c62828; }

  /* --- Config All grid (Scraper Panel Toolbar plan): a Handsontable
     spreadsheet of every kind="scraper" job's persisted CLI options,
     opened from the Scraper Metrics toolbar. Stacks on top of Scraper
     Metrics (which stays open behind it, same drill-in pattern as Job
     Control) rather than replacing it.
     z-index 9152: above Scraper Metrics 9150, below Job Control 9155. --- */
  .cg-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.55);
    z-index: 9152;
    justify-content: center;
    align-items: center;
  }
  .cg-scrim.active { display: flex; }
  .cg-modal {
    position: relative;
    width: 95vw;
    height: 90vh;
    max-width: 2200px;
    background: #f0f2f5;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .cg-body {
    flex: 1;
    overflow: hidden;
    padding: 12px 20px 16px;
    display: flex;
    flex-direction: column;
  }
  .cg-hint { font-size: 12px; color: #777; margin-bottom: 8px; flex-shrink: 0; }
  .cg-grid-container {
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
  }
  .cg-name-cell .sm-status-dot { display: inline-block; vertical-align: middle; margin-right: 6px; }
  .cg-name-cell .cg-name-label { vertical-align: middle; }
  #configGridScrim td.cg-cell-na { background: #f7f7f7; color: #bbb; text-align: center; }
  #configGridScrim td.cg-cell-locked { background: #fffde7; }

  /* --- Job Control modal (Scraper Background Job Manager plan):
     per-job start/stop + persisted CLI-option defaults + full command
     line, opened via a scraper name link in Scraper Metrics.
     z-index 9155: above Scraper Metrics 9150, below Live Ops 9200. --- */
  .jc-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9155;
    justify-content: center;
    align-items: center;
  }
  .jc-scrim.active { display: flex; }
  .jc-modal {
    position: relative;
    width: 560px;
    max-width: 92vw;
    max-height: 88vh;
    background: #f0f2f5;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .jc-header {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    padding: 14px 44px 14px 20px;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #1557b0;
  }
  .jc-close {
    position: absolute;
    top: 10px; right: 16px;
    z-index: 20;
    width: 32px; height: 32px;
    font-size: 22px; line-height: 1;
    background: #fff; color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
  }
  .jc-close:hover { background: #f5f5f5; color: #c62828; }
  .jc-body { flex: 1; overflow: auto; padding: 16px 20px; }
  .jc-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
  .jc-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .jc-btn:hover { background: #f5f5f5; }
  .jc-btn:disabled { opacity: 0.5; cursor: default; }
  .jc-btn-primary { background: #1a73e8; color: #fff; border-color: #1557b0; }
  .jc-btn-primary:hover { background: #1557b0; }
  .jc-btn-danger { background: #e53935; color: #fff; border-color: #c62828; }
  .jc-btn-danger:hover { background: #c62828; }
  .jc-status-badge {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255,255,255,0.2);
  }
  .jc-status-badge.jc-status-running { background: #34d399; color: #063; }
  .jc-status-badge.jc-status-stopping { background: #f9a825; color: #542; }
  .jc-status-badge.jc-status-stopped { background: rgba(255,255,255,0.25); }
  .jc-info { font-size: 12px; color: #666; margin-bottom: 10px; min-height: 16px; }
  .jc-cmdline {
    background: #1a1a2e;
    color: #9fe8a0;
    font-family: Consolas, monospace;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0 0 14px;
  }
  .jc-options-form { display: flex; flex-direction: column; gap: 10px; }
  .jc-field { display: flex; flex-direction: column; gap: 3px; }
  .jc-field label { font-size: 12px; font-weight: 600; color: #444; }
  .jc-field-checkbox label { flex-direction: row; display: flex; align-items: center; gap: 6px; font-weight: 500; }
  .jc-field input[type="text"], .jc-field input[type="number"], .jc-field select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
  }
  .jc-field input:disabled, .jc-field select:disabled { background: #eee; color: #888; }
  .jc-field-help { font-size: 11px; color: #999; }

  /* --- Job Log popup (raw stdout/stderr tail, opened from Job Control).
     z-index 9158: above Job Control 9155. --- */
  .jl-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 9158;
    justify-content: center;
    align-items: center;
  }
  .jl-scrim.active { display: flex; }
  .jl-modal {
    position: relative;
    width: 80vw;
    height: 70vh;
    max-width: 1200px;
    background: #1a1a2e;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .jl-header {
    background: #12121f;
    color: #fff;
    padding: 12px 44px 12px 20px;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #333;
  }
  .jl-autoscroll { font-size: 12px; font-weight: 500; color: #ccc; display: flex; align-items: center; gap: 4px; }
  .jl-close {
    position: absolute;
    top: 8px; right: 16px;
    z-index: 20;
    width: 32px; height: 32px;
    font-size: 22px; line-height: 1;
    background: #2a2a40; color: #ccc;
    border: 1px solid #444;
    border-radius: 50%;
    cursor: pointer;
  }
  .jl-close:hover { background: #3a3a55; color: #fff; }
  .jl-content {
    flex: 1;
    margin: 0;
    padding: 14px 18px;
    overflow: auto;
    color: #b8f5b8;
    font-family: Consolas, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
  }

  /* --- Jobs panel (Scraper Background Job Manager plan): lists the
     background/worker jobs (translation_worker, ai_enhancement_worker,
     reclassify_listing_types) that auto-start with the server. Reuses
     the Scraper Metrics panel's .sm-* chrome verbatim (scrim/header/
     close/body/table/status-dot) for a consistent look; .jp-modal only
     overrides the size, since 3 rows don't need 90vw/90vh. Same z-index
     tier as Scraper Metrics (9150, mutually exclusive panels). */
  .sm-modal.jp-modal {
    width: 90vw;
    height: auto;
    max-height: 75vh;
    max-width: 92vw;
  }
  .jp-empty { text-align: center; padding: 24px; color: #999; }
  /* Per-job live log tail (last 2 lines) shown at the full panel width.
     The log sits in its own <tr> below each job's 3-column row so the
     existing Job/Started/Ended columns stay unchanged; a colspan=3 cell
     lets the log text span the whole panel width. */
  .sm-table tr.jp-log-row > td {
    padding: 2px 12px 10px 28px;
    background: #fafbfc;
    vertical-align: top;
  }
  .jp-log-lines {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    color: #444;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-height: 1.45em;
  }
  .jp-log-lines.jp-log-empty { color: #b0b0b0; font-style: italic; }

  /* --- AI panel (Real-Time Ops Dashboard Session 8) --- */
  .lo-ai-panel {
    margin-top: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 18px;
  }
  .lo-ai-head {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f2f5;
  }
  .lo-ai-cols { display: flex; gap: 20px; margin-bottom: 18px; }
  .lo-ai-col { flex: 1; min-width: 0; }
  .lo-ai-subhead {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
  }
  /* Translation animation card */
  .lo-ai-trans-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: box-shadow 0.15s;
  }
  .lo-ai-trans-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
  .lo-ai-trans-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f2f5;
    display: block;
  }
  .lo-ai-trans-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }
  .lo-ai-trans-profile {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }
  .lo-ai-trans-field {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e8eaf6;
    padding: 1px 6px;
    border-radius: 3px;
  }
  .lo-ai-trans-text {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 6px;
    transition: opacity 0.5s ease;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .lo-ai-trans-input { color: #666; }
  .lo-ai-trans-output { color: #1a1a2e; font-weight: 500; opacity: 0; }
  .lo-ai-trans-output.lo-ai-trans-show { opacity: 1; }
  .lo-ai-trans-input.lo-ai-trans-dim { opacity: 0.45; }
  .lo-ai-trans-label {
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    margin-right: 4px;
  }
  .lo-ai-trans-queue {
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
  }
  /* V2 pipeline card */
  .lo-ai-v2-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #7b1fa2;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s;
  }
  .lo-ai-v2-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
  .lo-ai-v2-card.lo-ai-v2-complete { border-left-color: #0f9d58; }
  .lo-ai-v2-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
  .lo-ai-v2-worker {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }
  .lo-ai-v2-listing { font-size: 12px; color: #666; margin-bottom: 4px; }
  .lo-ai-v2-stage { font-size: 12px; font-weight: 600; color: #7b1fa2; margin-bottom: 4px; }
  .lo-ai-v2-stage.lo-ai-v2-stage-done { color: #0f9d58; }
  .lo-ai-v2-output {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* V2 per-image progress bar (reuses .lo-progress shell) */
  .lo-ai-v2-card .lo-progress { margin-bottom: 0; }
  .lo-ai-v2-thumb {
    width: 50%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 6px;
    margin: 0 auto 6px;
    display: block;
    background: #f0f2f5;
  }
  /* Charts grid */
  .lo-ai-charts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .lo-ai-chart {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
  }
  .lo-ai-chart-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
  }
  .lo-ai-chart canvas { display: block; }
