:root {
  --bg: #0b1115;
  --panel: rgba(20, 29, 36, 0.9);
  --panel-2: rgba(16, 23, 29, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --text: #ebf2f7;
  --muted: #9fb1be;
  --accent: #14c38e;
  --accent-2: #2ea8ff;
  --danger: #ff5d5d;
  --input-bg: rgba(122, 135, 148, 0.34);
  --input-bg-focus: rgba(138, 151, 165, 0.44);
  --input-border: rgba(219, 230, 241, 0.5);
  --input-text: #f4f9ff;
  --input-placeholder: rgba(228, 237, 246, 0.84);
  --radius: 16px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% -10%, #173349, transparent 45%),
              radial-gradient(circle at 90% 0%, #253522, transparent 45%),
              linear-gradient(180deg, #070b0e, #0b1115 40%, #080c10);
  color: var(--text);
}

body.app-busy,
body.app-busy * {
  cursor: progress !important;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 20%, black 45%, transparent 90%);
}

.shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 16px;
  margin-bottom: 16px;
  animation: rise .35s ease-out;
}

.eyebrow {
  color: var(--accent-2);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 12px;
  margin: 0 0 10px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2.3rem);
  line-height: 1.08;
}

.subtitle {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 70ch;
}

.hero-card {
  background: linear-gradient(180deg, rgba(26, 37, 46, .95), rgba(13, 18, 24, .95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.hero-kpi { display: grid; gap: 4px; }
.hero-kpi .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.hero-kpi strong { font-size: 14px; }
.quality-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quality-switch label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}
.quality-switch input {
  width: auto;
  margin: 0;
}
.muted { color: var(--muted); font-weight: 600; }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  animation: rise .3s ease-out;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 1rem; }
.section-subhead {
  margin: 2px 0 10px;
  font-size: .88rem;
  letter-spacing: .01em;
  color: #a9d4ff;
}

.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(46, 168, 255, 0.3);
  background: rgba(46, 168, 255, 0.12);
  color: #cae8ff;
  font-size: 12px;
}
.badge-soft {
  border-color: rgba(255,255,255,.09);
  background: rgba(255,255,255,.04);
  color: var(--muted);
}

.grid-form {
  display: grid;
  grid-template-columns: 2fr 1fr repeat(2, minmax(140px, 180px));
  gap: 10px;
  align-items: end;
}

.history-tools {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 180px)) auto;
  gap: 10px;
  align-items: end;
}
.history-tools-title {
  grid-column: 1 / -1;
  font-size: .88rem;
  letter-spacing: .01em;
  color: #8ad1bf;
  margin-top: 2px;
}

.enqueue-draft {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  background: rgba(6, 20, 34, 0.45);
}
.enqueue-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.enqueue-draft-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.enqueue-draft-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 360px;
  min-width: 240px;
}
.enqueue-draft-search input {
  min-width: 0;
}
.enqueue-draft-wrap {
  max-height: 220px;
}
#enqueueDraftTable {
  min-width: 0;
  table-layout: fixed;
}
#enqueueDraftTable col.enqueue-draft-col-check {
  width: 44px;
}
#enqueueDraftTable col.enqueue-draft-col-date {
  width: 180px;
}
#enqueueDraftTable col.enqueue-draft-col-status {
  width: 130px;
}
#enqueueDraftTable col.enqueue-draft-col-action {
  width: 130px;
}
#enqueueDraftTable th,
#enqueueDraftTable td {
  overflow-wrap: anywhere;
}
#enqueueDraftTable .filter-row th input,
#enqueueDraftTable .filter-row th select {
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input, select, button, textarea { font: inherit; }
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-text);
  border-radius: 10px;
  padding: 10px 12px;
}
input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="email"],
input[type="password"] {
  background: var(--input-bg) !important;
}
.date-input,
input[type="date"] {
  padding-right: 12px;
  background-image: none;
}
.date-input-wrap {
  position: relative;
  width: 100%;
}
.date-input-wrap > .date-input {
  padding-right: 40px;
}
.date-picker-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  opacity: 0.9;
  padding: 0;
}
.date-picker-btn:hover {
  opacity: 1;
}
.date-picker-btn:focus-visible {
  outline: 2px solid rgba(46, 168, 255, 0.5);
}
.date-picker-btn::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23e6f2fb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3Ccircle cx='8.5' cy='14.5' r='1' fill='%23e6f2fb'/%3E%3Ccircle cx='12' cy='14.5' r='1' fill='%23e6f2fb'/%3E%3Ccircle cx='15.5' cy='14.5' r='1' fill='%23e6f2fb'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}
.date-picker-proxy {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
  margin: 0;
}
select {
  color-scheme: dark;
}
select option,
select optgroup {
  background: #0f161d;
  color: var(--text);
}
select option:disabled {
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(46, 168, 255, 0.25);
  border-color: rgba(46, 168, 255, 0.5);
  background: var(--input-bg-focus);
}
input::placeholder,
textarea::placeholder {
  color: var(--input-placeholder);
}
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--input-text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  caret-color: var(--input-text);
  border: 1px solid var(--input-border) !important;
  transition: background-color 9999s ease-out 0s;
}

input:not([type="checkbox"]):not([type="radio"]):disabled,
select:disabled,
textarea:disabled {
  opacity: 0.72;
  color: rgba(220, 230, 240, 0.9);
}

.actions-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(180deg, rgba(46,168,255,.22), rgba(46,168,255,.1));
  border-color: rgba(46,168,255,.45);
}
.btn-accent {
  background: linear-gradient(180deg, rgba(20,195,142,.25), rgba(20,195,142,.1));
  border-color: rgba(20,195,142,.5);
}
.btn-danger {
  background: linear-gradient(180deg, rgba(255,93,93,.25), rgba(255,93,93,.1));
  border-color: rgba(255,93,93,.5);
}
.btn-ghost { background: transparent; }
.btn.is-busy {
  cursor: progress;
  opacity: .92;
  padding-right: 34px;
  position: relative;
}
.btn.is-busy::after {
  content: "⏳";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  animation: busyPulse 1.05s ease-in-out infinite;
}
.btn.is-auto-busy {
  cursor: progress;
  opacity: .92;
  padding-right: 34px;
  position: relative;
}
.btn.is-auto-busy::after {
  content: "⏳";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  animation: busyPulse 1.05s ease-in-out infinite;
}
button.is-auto-busy:not(.btn)::after {
  content: " ⏳";
  font-size: 11px;
}

.status-inline { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }

.coverage-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.coverage-progress-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.coverage-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(46,168,255,.95), rgba(20,195,142,.95));
  transition: width .35s ease;
}
.coverage-progress-pct {
  min-width: 46px;
  text-align: right;
  color: #dff3ff;
  font-size: 12px;
  font-weight: 700;
}
.coverage-progress-detail {
  grid-column: 1 / 3;
  color: #cfe4f2;
  font-size: 12px;
}
.coverage-progress .btn {
  grid-row: 1 / span 2;
  justify-self: end;
  padding: 8px 12px;
  font-size: 12px;
}

.catalog-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.catalog-controls { display: grid; gap: 12px; margin-bottom: 12px; }
.filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 10px;
}
.mass-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.queue-config {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) repeat(3, auto);
  gap: 10px;
  align-items: end;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  color: var(--text);
}
.check input { width: auto; margin: 0; }

.table-wrap {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  overflow: auto;
  max-height: 520px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1240px;
}
th, td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: rgba(13, 18, 24, 0.95);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.catalog-sort-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.catalog-sort-btn .sort-indicator {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  line-height: 1;
}
.catalog-sort-btn.is-active .sort-indicator {
  color: #cae8ff;
}
.filter-row th {
  top: 38px;
  background: rgba(11, 16, 21, 0.98);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.filter-row th input,
.filter-row th select {
  width: 100%;
  min-width: 110px;
  padding: 7px 8px;
  font-size: 11px;
}
.enqueue-draft-filter-row th {
  top: 38px;
}
.enqueue-draft-row.is-search-target td {
  background: rgba(138, 209, 191, 0.12);
}
.enqueue-draft-channel {
  min-width: 0;
}
.enqueue-draft-title {
  min-width: 0;
}
.duration-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.date-range-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.col-check { width: 44px; }
.empty-row { text-align: center; color: var(--muted); padding: 24px 10px; }
.cell-title { font-weight: 700; margin: 0 0 4px; }
.cell-sub { color: var(--muted); font-size: 12px; }
.cell-desc {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}
.cell-desc-summary {
  display: inline-block;
  cursor: help;
  border-bottom: 1px dotted rgba(255,255,255,.18);
}
.cell-desc-summary.is-pending {
  opacity: .8;
}
.hover-tooltip {
  position: fixed;
  z-index: 2000;
  max-width: min(520px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(6, 14, 24, .96);
  color: #edf6ff;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  line-height: 1.45;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .12s ease, transform .12s ease;
  white-space: normal;
}
.hover-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.hover-tooltip.hidden {
  display: none;
}
.cell-tags {
  max-width: 260px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 12px;
}
.video-pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.video-pill.done {
  border-color: rgba(38,208,124,.35);
  background: rgba(38,208,124,.12);
  color: #baf7d5;
}
.video-pill.pending {
  border-color: rgba(240,180,41,.35);
  background: rgba(240,180,41,.10);
  color: #ffe4aa;
}
.video-pill.live {
  border-color: rgba(255,93,93,.45);
  background: rgba(255,93,93,.12);
  color: #ffd1d1;
}
.video-pill.replay {
  border-color: rgba(46,168,255,.4);
  background: rgba(46,168,255,.1);
  color: #cae8ff;
}
.video-pill.upcoming {
  border-color: rgba(168,125,255,.45);
  background: rgba(168,125,255,.1);
  color: #dfd5ff;
}
.video-pill.offline {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: #d8e3ea;
}

.queue-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.queue-bulk-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.queue-list-tools {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.queue-view-switch {
  display: flex;
  align-items: end;
  gap: 6px;
}
.queue-view-switch .btn.is-active {
  border-color: rgba(46, 168, 255, 0.5);
  background: rgba(46, 168, 255, 0.14);
  color: #cfeaff;
}
.queue-select-all-wrap {
  padding: 6px 10px;
}
.summary-card {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
}
.summary-card .k {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.summary-card .v {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.queue-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.lane {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  background: rgba(255,255,255,.015);
  min-height: 180px;
  display: grid;
  grid-template-rows: auto 1fr;
}
.lane h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.lane-items {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
  max-height: 420px;
  overflow: auto;
}
.lane-items.table-mode {
  display: block;
}
.queue-lane-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}
.queue-lane-table th,
.queue-lane-table td {
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 11px;
}
.queue-lane-table th {
  position: static;
  background: rgba(255,255,255,.04);
  text-transform: none;
  letter-spacing: 0;
}
.lane-empty {
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.job-card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(12, 17, 22, .7);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.job-head { display: flex; justify-content: space-between; gap: 8px; }
.job-head-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.job-select-wrap {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
}
.job-select-wrap input {
  width: 14px;
  height: 14px;
  margin: 0;
}
.job-title-wrap { min-width: 0; }
.job-channel {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.job-title {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.2;
}
.job-status {
  align-self: start;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.12);
}
.job-status.processing { color: #c9ebff; border-color: rgba(46,168,255,.4); background: rgba(46,168,255,.1); }
.job-status.queued { color: #ffe4aa; border-color: rgba(240,180,41,.4); background: rgba(240,180,41,.08); }
.job-status.paused { color: #dfd5ff; border-color: rgba(168,125,255,.4); background: rgba(168,125,255,.08); }
.job-status.success { color: #b8ffd9; border-color: rgba(38,208,124,.4); background: rgba(38,208,124,.08); }
.job-status.deleted { color: #ffd8ad; border-color: rgba(255,166,66,.45); background: rgba(255,166,66,.12); }
.job-status.error { color: #ffd1d1; border-color: rgba(255,93,93,.4); background: rgba(255,93,93,.08); }
.job-status.cancelled { color: #d0d7de; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.04); }
.job-status.live { box-shadow: inset 0 0 0 1px rgba(255,93,93,.25); }

.job-meta { margin: 0; color: var(--muted); font-size: 12px; }
.job-recovery-banner {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 93, 93, 0.42);
  background: rgba(255, 93, 93, 0.12);
  color: #ffd6d6;
  font-size: 11px;
  line-height: 1.3;
}
.job-recovery-banner.unrecoverable {
  border-color: rgba(255, 93, 93, 0.48);
  background: rgba(255, 93, 93, 0.14);
}
.progress-wrap { display: grid; gap: 6px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .25s ease;
}
.progress-text { color: var(--muted); font-size: 11px; }

.job-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.job-actions button {
  font-size: 11px;
  padding: 6px 8px;
  min-width: 108px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.job-tools {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.job-tools .job-transcript-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}
.job-tools .job-open-video-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}
.job-tools .job-comment-watcher-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}
.job-tools .video-description-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}
.job-tools .job-commenter-dashboard-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}
.job-tools .btn {
  min-width: 108px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.catalog-transcript-btn {
  font-size: 11px;
  padding: 6px 8px;
  white-space: nowrap;
}

.job-tools .job-details {
  flex: 1 1 100%;
  min-width: 0;
}

.job-details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.job-details pre {
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
  color: #dce7ef;
  font-size: 11px;
  line-height: 1.35;
  overflow: auto;
}

.queue-note {
  color: var(--muted);
  font-size: 12px;
  margin: 12px 2px 2px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 8, .68);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-width: min(900px, 100%);
  max-height: min(92vh, 1040px);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: linear-gradient(180deg, rgba(16,23,29,.98), rgba(10,15,20,.98));
  box-shadow: 0 22px 60px rgba(0,0,0,.45);
  padding: 14px;
  resize: both;
  overflow: auto;
}

#commentsModal .modal-card {
  display: flex;
  flex-direction: column;
  overflow: auto;
  resize: both;
  gap: 10px;
  width: min(1180px, 100%);
  min-width: min(640px, 96vw);
  min-height: min(420px, 88vh);
  max-width: min(98vw, 1600px);
}

#commentsModal .modal-card.is-wide {
  width: min(1520px, 98vw);
}

#commentsModal .modal-card > :not(.comments-scroll) {
  flex: 0 0 auto;
}

#commentsModal .entity-panel {
  margin-top: 0;
}

#commentsModal .comments-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

#descriptionModal .modal-card {
  width: min(980px, 100%);
  min-width: min(640px, 96vw);
  max-width: min(96vw, 1200px);
  max-height: min(88vh, 960px);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-head .eyebrow {
  margin-bottom: 6px;
}

.modal-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  padding: 8px 10px;
  overflow: auto;
  min-height: 52px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#commentsMeta {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 112px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
  padding: 8px 10px;
}

.modal-meta .meta-line {
  display: block;
  line-height: 1.4;
  margin-bottom: 3px;
}

.modal-meta .meta-line:last-child {
  margin-bottom: 0;
}

.modal-search {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-search label {
  flex: 1 1 360px;
  min-width: 220px;
}

.transcript-scroll {
  min-height: 240px;
  max-height: none;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}

.transcript-text {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dce7ef;
  line-height: 1.45;
  font-size: 12px;
  font-family: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
}

.description-text {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dce7ef;
  line-height: 1.55;
  font-size: 13px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.transcript-text mark {
  background: rgba(240, 180, 41, .22);
  color: #fff2c8;
  border-radius: 4px;
  padding: 0 2px;
}

.comments-scroll {
  min-height: 280px;
}

.comments-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.comment-item {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(12,17,22,.48);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.comment-author {
  color: #e8f3fb;
  font-weight: 600;
  font-size: 12px;
}

.comment-meta {
  color: var(--muted);
  font-size: 11px;
}

.comment-body {
  color: #dce7ef;
  font-size: 12px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

.entity-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}

.entity-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.entity-panel-head h4 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .02em;
}

.entity-panel-head .muted-sm {
  flex: 1 1 360px;
  min-width: 240px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.entity-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

#commentsHashtagList {
  min-height: 140px;
}

#commentsCommenterList {
  min-height: 220px;
  max-height: none;
  overflow: visible;
}

#commentsSectionsList {
  max-height: none;
  overflow: visible;
}

.sections-table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: auto;
  background: rgba(12, 17, 22, 0.45);
}

.sections-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.sections-table th,
.sections-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px;
  font-size: 12px;
  vertical-align: top;
}

.sections-table th {
  position: static;
  text-transform: none;
  letter-spacing: 0;
  color: #d4e9f8;
  background: rgba(255, 255, 255, 0.04);
}

.sections-table td:first-child {
  white-space: nowrap;
  width: 100px;
  color: #d7ecff;
}

.commenter-table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: auto;
  max-height: 420px;
  scrollbar-gutter: stable both-edges;
  background: rgba(12, 17, 22, 0.45);
}

.commenter-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.commenter-table th,
.commenter-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.commenter-table th {
  background: rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 2;
}

.commenter-table .col-name {
  min-width: 240px;
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}

.commenter-total-row td {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
}

.commenter-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0;
}

.commenter-sort-btn .sort-indicator {
  opacity: 0.8;
}

.entity-item {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 8px;
  background: rgba(12,17,22,.45);
  display: grid;
  gap: 6px;
}

.entity-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}

.entity-title {
  font-weight: 600;
  color: #eaf4fb;
}

.entity-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.entity-uri {
  font-family: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  color: #b7d7ec;
  word-break: break-all;
}

.entity-empty {
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 10px;
}

.control-form {
  display: grid;
  grid-template-columns: 2fr 1fr repeat(3, minmax(120px, 160px)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.control-card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(12,17,22,.55);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.control-card h4 {
  margin: 0;
  font-size: 13px;
}

.control-card .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.tag.good { border-color: rgba(38,208,124,.35); color: #baf7d5; background: rgba(38,208,124,.08); }
.tag.warn { border-color: rgba(240,180,41,.35); color: #ffe4aa; background: rgba(240,180,41,.08); }
.tag.bad { border-color: rgba(255,93,93,.35); color: #ffd1d1; background: rgba(255,93,93,.08); }
.tag.info { border-color: rgba(46,168,255,.35); color: #cae8ff; background: rgba(46,168,255,.08); }

.mono {
  font-family: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.muted-sm {
  color: var(--muted);
  font-size: 12px;
}

#commenterDashboardSummary,
#globalCommentersSummary {
  display: block;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  margin-bottom: 8px;
}

.control-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.control-actions button {
  font-size: 11px;
  padding: 6px 8px;
}

.popup-link {
  color: #bde3ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes busyPulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .history-tools { grid-template-columns: 1fr 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .queue-config { grid-template-columns: repeat(2, 1fr); }
  .queue-list-tools { grid-template-columns: repeat(3, 1fr); }
  .control-form { grid-template-columns: 1fr 1fr; }
  .queue-summary { grid-template-columns: repeat(3, 1fr); }
  .queue-lanes { grid-template-columns: 1fr 1fr; }
  .modal-card {
    min-width: 0;
    resize: none;
  }
}

@media (max-width: 760px) {
  .shell { padding: 12px 10px 28px; }
  .grid-form, .history-tools, .filter-grid, .queue-config, .queue-summary, .queue-lanes, .control-form {
    grid-template-columns: 1fr;
  }
  .queue-list-tools {
    grid-template-columns: 1fr;
  }
  .coverage-progress {
    grid-template-columns: 1fr auto;
  }
  .coverage-progress-detail {
    grid-column: 1 / -1;
  }
  .coverage-progress .btn {
    grid-row: auto;
    grid-column: 2;
  }
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .job-tools {
    flex-direction: column;
    align-items: stretch;
  }
  .modal {
    padding: 8px;
  }
  .modal-card {
    max-height: 94vh;
  }
  .transcript-scroll {
    max-height: 50vh;
  }
}
