:root {
  color-scheme: light;
  --bg: #eef3f7;
  --panel: #ffffff;
  --text: #122033;
  --muted: #66758a;
  --line: #d8e1ea;
  --blue: #1769c2;
  --blue-dark: #0d4385;
  --ok: #087a55;
  --warn: #9b5d00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 34px 0;
}

.publish-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(25, 44, 70, 0.08);
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.status {
  min-width: 132px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f3f6f9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.status.ok {
  color: var(--ok);
}

.status.warn {
  color: var(--warn);
}

.viral-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.enterprise-settings-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eaf2fb;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.enterprise-feishu-settings {
  scroll-margin-top: 18px;
  border-color: #b9d7f5;
  background: #f5faff;
}

.enterprise-settings-heading,
.enterprise-settings-actions,
.enterprise-settings-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.enterprise-settings-heading p:not(.eyebrow),
.enterprise-settings-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.enterprise-settings-nav a {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.enterprise-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.enterprise-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.enterprise-settings-grid input,
.enterprise-settings-grid select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.enterprise-field-map {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.enterprise-field-map summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.enterprise-settings-actions {
  justify-content: flex-start;
  margin-top: 14px;
}

.enterprise-feishu-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.enterprise-feishu-notice[data-state="working"] {
  background: #fff7e6;
  color: var(--warn);
}

.enterprise-feishu-notice[data-state="ok"] {
  background: #eaf8f1;
  color: var(--ok);
}

.enterprise-feishu-notice[data-state="error"] {
  background: #fff0f0;
  color: #a12622;
}

.enterprise-target-card {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #ced9e6;
  border-radius: 10px;
  background: #fff;
}

.enterprise-target-card[data-state="ready"] {
  border-color: #98d4b9;
  background: #f0fbf6;
}

.enterprise-target-card[data-state="warning"] {
  border-color: #f4c26b;
  background: #fff9ec;
}

.enterprise-target-card[data-state="error"] {
  border-color: #ffb8b8;
  background: #fff4f4;
}

.enterprise-target-card h3 {
  margin: 7px 0 4px;
  font-size: 18px;
}

.enterprise-target-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.enterprise-target-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9eef5;
  color: #516176;
  font-size: 11px;
  font-weight: 850;
}

.enterprise-target-card[data-state="ready"] .enterprise-target-badge { background:#d9f5e8; color:#087f5b; }
.enterprise-target-card[data-state="warning"] .enterprise-target-badge { background:#fff0c7; color:#8a5a00; }
.enterprise-target-card[data-state="error"] .enterprise-target-badge { background:#ffe0e0; color:#b42318; }

.enterprise-target-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.enterprise-target-meta span {
  display: block;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(171, 186, 204, .48);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  background: rgba(255,255,255,.75);
}

.enterprise-target-meta strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.enterprise-target-bindings {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.enterprise-target-chip {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e6f6ee;
  color: #087f5b;
  font-size: 11px;
  font-weight: 750;
}

.enterprise-target-chip.missing { background:#fff0d5; color:#8a5a00; }
.enterprise-target-promise { padding-top:10px; border-top:1px dashed #cbd7e6; font-weight:750; }

.worker-status-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid #b9d7f5;
  border-radius: 10px;
  background: #eef7ff;
}

.worker-status-panel h2,
.worker-status-panel p {
  margin-top: 0;
}

.worker-status-panel > div > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.worker-status-meta {
  align-self: center;
  max-width: 48%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.worker-status-panel[data-state="needs_verification"],
.worker-status-panel[data-state="error"],
.worker-status-panel[data-state="offline"] {
  border-color: #e2a0a0;
  background: #fff1f1;
}

.worker-status-panel[data-state="cooldown"] {
  border-color: #ead49d;
  background: #fff9e9;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

label {
  display: block;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
}

textarea {
  resize: vertical;
  min-height: 240px;
}

.video-source-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.source-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.single-select-row {
  margin-top: 14px;
}

.folder-path {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small-primary {
  flex: none;
}

.source-actions .small-primary {
  flex: none;
}

.batch-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.batch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.batch-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.batch-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.batch-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, auto) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.batch-item.active {
  border-color: var(--blue);
  background: #f3f8ff;
}

.batch-item.selected {
  box-shadow: inset 4px 0 0 var(--blue);
}

.batch-item.done {
  border-color: #b8dccf;
  background: #f4fbf8;
}

.batch-item.failed {
  border-color: #e1b4b4;
  background: #fff7f7;
}

.batch-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.batch-check-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-error {
  color: #a33b3b;
}

.batch-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.batch-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.batch-start-one-btn {
  min-width: 88px;
  padding: 9px 12px;
}

.schedule-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.schedule-controls {
  display: grid;
  grid-template-columns: minmax(310px, 0.85fr) minmax(280px, 1.15fr);
  gap: 18px;
  margin-top: 14px;
}

.schedule-controls.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.calendar-card,
.slot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.week-grid,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-grid {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.date-btn {
  min-height: 38px;
  padding: 0;
  border: 1px solid transparent;
  background: #f3f6f9;
  color: var(--text);
}

.date-btn.empty {
  visibility: hidden;
}

.date-btn.today {
  border-color: var(--blue);
}

.date-btn.selected,
.slot-btn.selected {
  background: var(--blue);
  color: #fff;
}

.date-btn:disabled,
.slot-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.slot-btn {
  min-height: 46px;
}

.schedule-summary {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f3f6f9;
  color: var(--blue-dark);
  font-weight: 800;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: #dfeaf6;
  color: var(--blue-dark);
  font-weight: 900;
  cursor: pointer;
}

button.primary {
  flex: 1;
  background: var(--blue);
  color: #fff;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

pre {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #1c2f48;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 24px, 1120px);
    padding: 12px 0;
  }

  .publish-panel {
    padding: 16px;
  }

  header,
  .button-row,
  .form-grid,
  .schedule-controls,
  .output-grid {
    grid-template-columns: 1fr;
  }

  header,
  .button-row {
    display: flex;
    flex-direction: column;
  }

  .batch-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .batch-meta {
    text-align: left;
  }

  button.primary {
    flex: auto;
  }
}

.viral-standalone {
  min-height: calc(100vh - 68px);
}

.viral-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.viral-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.viral-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.viral-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f7;
}

.segmented button {
  min-width: 54px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
}

.segmented button.selected {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 1px 4px rgba(20, 42, 70, 0.12);
}

.viral-count-input {
  width: 72px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.small-primary {
  flex: none;
}

.viral-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.viral-feishu-receipt {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #9bd7b4;
  border-radius: 10px;
  background: #eefbf3;
  color: #17653a;
  line-height: 1.6;
}

.viral-feishu-receipt a {
  color: #0b63ce;
  font-weight: 700;
}

.viral-status-row span {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f6f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.viral-workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.viral-results {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
}

.viral-result,
.viral-empty {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.viral-review-result {
  border-color: #b8c7dc;
  background: #f7f9fc;
}

.viral-result-top,
.viral-result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.viral-result-top {
  margin-bottom: 8px;
}

.viral-priority-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.viral-priority-badge.hot {
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fdba74;
}

.viral-priority-badge.candidate {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

.viral-result-top span,
.viral-result-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.viral-result a {
  color: var(--blue);
  font-weight: 900;
  line-height: 1.45;
  text-decoration: none;
}

.viral-result a:hover {
  text-decoration: underline;
}

.viral-result p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.viral-review-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #b8c7dc;
  border-radius: 8px;
  background: #f7f9fc;
}

.pending-inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pending-inbox-panel > p {
  color: var(--muted);
  margin: 6px 0 14px;
}

.viral-review-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.viral-review-toolbar button {
  grid-row: span 2;
}

.viral-review-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.viral-review-card-actions button {
  padding: 8px 10px;
  font-size: 12px;
}

.viral-review-card-actions button:last-child {
  background: #f7d9d9;
  color: #8d1f1f;
}

.viral-log {
  min-height: 220px;
  max-height: 420px;
}

.viral-issue-modal[hidden] {
  display: none;
}

.viral-issue-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 32, 51, 0.42);
}

.viral-issue-dialog {
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid #f0c36a;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(18, 32, 51, 0.28);
}

.viral-issue-dialog h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.viral-issue-dialog p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.55;
}

.viral-issue-dialog pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  white-space: pre-wrap;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.viral-issue-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.account-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.account-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}

.account-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.account-card-top,
.account-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.account-card-top {
  margin-bottom: 8px;
}

.account-card-top span,
.account-metrics,
.account-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f5ec;
  color: #166534;
}

.account-pill.pending {
  background: #fff7ed;
  color: #9a3412;
}

.account-card small {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
}

.workbench-shell {
  width: min(1580px, calc(100vw - 32px));
}

.workbench-panel {
  padding: 22px;
}

.workbench-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 18px;
}

.workbench-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.workbench-nav a[aria-current="page"] {
  border-color: #9dc2e8;
  background: #eaf4ff;
  color: var(--blue-dark);
}

.workbench-grid,
.workbench-layout {
  display: grid;
  grid-template-columns: minmax(470px, 0.9fr) minmax(660px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.command-center {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #bfd2e5;
  border-radius: 8px;
  background: #f7fbff;
}

.command-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  gap: 16px;
  align-items: end;
}

.command-main h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.command-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.command-controls {
  display: grid;
  grid-template-columns: 116px minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
}

.command-controls .primary {
  min-height: 48px;
  font-size: 15px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.flow-steps div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.flow-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.status-strip div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-strip strong,
.status-strip span {
  display: block;
  min-width: 0;
}

.status-strip strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.status-strip span {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.status-strip .status {
  min-width: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.command-secondary {
  margin: 12px 0 0;
}

.queue-section .links-box {
  min-height: 150px;
}

.editor-section {
  align-self: stretch;
}

.advanced-section {
  margin-top: 16px;
}

.advanced-section summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-weight: 900;
}

.advanced-paths {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.run-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-top: 16px;
}

.task-log {
  min-height: 130px;
  margin-top: 12px;
}

.utility-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.utility-links span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.utility-links a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.viral-control-section {
  margin-bottom: 18px;
}

.viral-control-grid {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.viral-inline-actions {
  margin: 0;
}

.workbench-viral-row {
  margin-top: 12px;
}

.workbench-viral-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  margin-top: 12px;
}

.workbench-viral-result {
  margin: 0;
}

.viral-embedded-log {
  min-height: 120px;
  max-height: 220px;
  margin-top: 12px;
}

.workbench-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.workbench-section + .workbench-section {
  margin-top: 16px;
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.compact-field {
  width: 118px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.compact-field input {
  min-height: 40px;
}

.links-box {
  min-height: 190px;
}

.notes-box {
  min-height: 96px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.two-col > label {
  min-width: 0;
}

.path-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.preview-settings-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.phone-preview {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.phone-stage {
  position: sticky;
  top: 18px;
  width: min(292px, 100%);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 10px solid #202938;
  border-radius: 16px;
  background: #dfe7ed;
  box-shadow: 0 18px 36px rgba(17, 31, 48, 0.14);
}

.phone-stage::before,
.phone-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 0;
}

.phone-stage::before {
  top: 0;
  height: 42%;
  background: #83a9b7;
}

.phone-stage::after {
  bottom: 0;
  height: 48%;
  background: #6f8378;
}

.preview-material {
  position: absolute;
  inset: 7% 9%;
  z-index: 1;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.24)),
    #cbbba2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  transform-origin: center;
  transition: transform 0.12s ease;
}

.preview-digital {
  position: absolute;
  left: calc(50% - 46px);
  bottom: 19%;
  z-index: 3;
  width: 92px;
  height: 202px;
  border-radius: 52px 52px 16px 16px;
  background:
    radial-gradient(circle at 50% 22%, #f3ddc4 0 24%, transparent 25%),
    linear-gradient(180deg, transparent 0 34%, #f7f7f7 35% 100%);
  transform-origin: center bottom;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.preview-subtitle {
  position: absolute;
  left: calc(50% - 78px);
  bottom: 14%;
  z-index: 4;
  width: 156px;
  min-height: 42px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  transform-origin: center;
  transition: transform 0.12s ease;
}

.control-stack {
  min-width: 0;
}

.control-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.control-group h3 {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.3;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text);
}

.range-row {
  display: grid;
  grid-template-columns: 88px minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
  margin-top: 8px;
  color: var(--text);
}

.range-row input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--blue);
}

.range-row span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.workbench-panel input[type="color"] {
  width: 70px;
  height: 42px;
  padding: 5px;
}

.workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.workbench-actions button,
.workbench-item-actions button,
.section-title-row button,
.button-link {
  min-height: 40px;
}

.workbench-actions > .primary:first-child {
  flex: 1 1 360px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: #4a5a70;
  color: #fff;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
}

.workbench-items {
  display: grid;
  gap: 10px;
}

.workbench-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #9fb1c2;
  border-radius: 8px;
  background: #fff;
}

.workbench-item.running {
  border-left-color: var(--blue);
}

.workbench-item.done {
  border-left-color: var(--ok);
}

.workbench-item.failed {
  border-left-color: var(--warn);
}

.workbench-item strong,
.workbench-item p {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.workbench-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workbench-item > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.workbench-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workbench-log {
  min-height: 170px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #dbeafe;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.publish-settings-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.publish-time-row {
  margin-top: 0;
}

.publish-actions {
  margin: 14px 0;
}

.publish-items {
  display: grid;
  gap: 10px;
}

.publish-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.publish-candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #9fb1c2;
  border-radius: 8px;
  background: #fff;
}

.publish-candidate.matched,
.publish-candidate.done {
  border-left-color: var(--ok);
}

.publish-candidate.unmatched,
.publish-candidate.failed,
.publish-candidate.login_required {
  border-left-color: var(--warn);
}

.publish-candidate.running,
.publish-candidate.publishing {
  border-left-color: var(--blue);
}

.publish-candidate-main {
  min-width: 0;
}

.publish-candidate strong,
.publish-candidate p,
.publish-copy-block pre {
  overflow-wrap: anywhere;
}

.publish-candidate p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.publish-candidate details {
  margin-top: 8px;
}

.publish-candidate summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.publish-candidate-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.publish-copy-block {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.publish-copy-block b,
.publish-copy-block span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.publish-copy-block span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.publish-copy-block pre {
  margin: 8px 0 0;
  color: var(--text);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.publish-log {
  min-height: 130px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .viral-head,
  .viral-workspace,
  .account-results {
    grid-template-columns: 1fr;
  }

  .viral-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1180px) {
  .workbench-grid,
  .workbench-layout,
  .preview-settings-grid,
  .publish-settings-grid,
  .viral-control-grid,
  .command-main,
  .run-grid {
    grid-template-columns: 1fr;
  }

  .flow-steps,
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-viral-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phone-stage {
    position: relative;
    top: auto;
    max-width: 320px;
  }
}

@media (max-width: 720px) {
  .workbench-shell {
    width: min(100vw - 18px, 100%);
    padding: 12px 0;
  }

  .workbench-panel {
    padding: 14px;
  }

  .section-title-row,
  .workbench-item,
  .publish-candidate {
    display: block;
  }

  .compact-field,
  .two-col,
  .command-controls,
  .advanced-paths {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .compact-field {
    margin-top: 12px;
  }

  .range-row {
    grid-template-columns: 76px minmax(90px, 1fr) 42px;
  }

  .workbench-viral-results {
    grid-template-columns: 1fr;
  }

  .flow-steps,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .workbench-item > span,
  .workbench-item-actions,
  .publish-candidate-state {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
  }

  .enterprise-settings-grid {
    grid-template-columns: 1fr;
  }

  .enterprise-target-meta {
    grid-template-columns: 1fr;
  }
}

/* Viral Finder workbench refresh — scoped so the other control pages keep
   their existing layout. */
.viral-page {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --text: #142033;
  --muted: #65758b;
  --line: #dce5ef;
  --blue: #1769c2;
  --blue-dark: #154b88;
  background:
    radial-gradient(circle at 12% 0%, rgba(76, 139, 214, 0.10), transparent 28rem),
    linear-gradient(180deg, #f7f9fc 0, #eef3f8 100%);
}

.viral-page .shell {
  width: min(1460px, calc(100vw - 48px));
  padding: 28px 0 40px;
}

.viral-page .viral-standalone {
  min-height: calc(100vh - 68px);
  padding: 28px;
  border: 1px solid rgba(201, 214, 228, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(35, 58, 88, 0.09);
}

.viral-page .viral-standalone > header {
  align-items: center;
  margin-bottom: 22px;
  padding: 2px 2px 20px;
  border-bottom: 1px solid #e8eef5;
}

.viral-page .viral-standalone > header h1 {
  font-size: clamp(25px, 2.2vw, 34px);
  letter-spacing: -0.025em;
}

.viral-page .viral-header-actions .status,
.viral-page .enterprise-settings-link {
  min-height: 40px;
  border: 1px solid #dbe7f4;
  border-radius: 10px;
  background: #f3f7fc;
}

.viral-page .viral-panel,
.viral-page .account-panel,
.viral-page .worker-status-panel {
  border-radius: 16px;
}

.viral-page .viral-panel {
  margin-top: 0;
  padding: 20px;
  background: #f8fafc;
}

.viral-page .viral-head {
  grid-template-columns: minmax(260px, 0.72fr) minmax(620px, 1.28fr);
  gap: 24px;
  align-items: center;
}

.viral-page .viral-actions {
  align-items: center;
  gap: 9px;
}

.viral-page .segmented,
.viral-page .viral-count-input,
.viral-page button,
.viral-page input,
.viral-page select {
  border-radius: 10px;
}

.viral-page button {
  min-height: 40px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.viral-page button:not(:disabled):hover,
.viral-page .enterprise-settings-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(36, 77, 125, 0.12);
}

.viral-page button:focus-visible,
.viral-page input:focus-visible,
.viral-page select:focus-visible,
.viral-page a:focus-visible {
  outline: 3px solid rgba(23, 105, 194, 0.22);
  outline-offset: 2px;
}

.viral-page .viral-status-row span {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #e4ebf3;
  background: #fff;
}

.viral-page #viralOutputPath {
  max-width: min(100%, 680px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viral-page .enterprise-feishu-settings {
  margin-top: 20px;
  padding: 22px;
  border-color: #c9ddf2;
  background: linear-gradient(145deg, #f7fbff 0%, #f3f8fd 100%);
}

.viral-page .enterprise-settings-heading {
  align-items: flex-start;
  padding-bottom: 4px;
}

.viral-page .enterprise-settings-heading h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.viral-page .enterprise-target-card {
  grid-template-columns: minmax(300px, 1fr) minmax(460px, 1.25fr);
  gap: 14px 20px;
  padding: 18px;
  border-radius: 14px;
}

.viral-page .enterprise-target-meta {
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  align-self: start;
}

.viral-page .enterprise-target-bindings,
.viral-page .enterprise-target-promise {
  grid-column: 1 / -1;
}

.viral-page .enterprise-settings-grid {
  gap: 14px 18px;
}

.viral-page .enterprise-settings-grid input,
.viral-page .enterprise-settings-grid select {
  min-height: 46px;
  border-color: #d5e0ec;
}

.viral-page .enterprise-field-map {
  border-radius: 12px;
}

.viral-page .enterprise-settings-actions {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  gap: 12px;
}

.viral-page .enterprise-settings-actions .primary {
  width: 100%;
}

.viral-page .worker-status-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.28fr);
  align-items: center;
  gap: 22px;
  margin: 20px 0;
  padding: 18px 20px;
}

.viral-page .worker-status-panel h2 {
  margin-bottom: 5px;
  font-size: 18px;
}

.viral-page .worker-status-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  max-width: none;
  text-align: left;
}

.viral-page .worker-status-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(133, 166, 201, 0.24);
  border-radius: 999px;
  background: rgba(255,255,255,0.74);
  color: #53667d;
  font-size: 11px;
  white-space: nowrap;
}

.viral-page .viral-workspace {
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 20px;
  margin-top: 20px;
}

.viral-page .viral-workspace > div {
  min-width: 0;
}

.viral-page .viral-workspace > div > h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.viral-page .viral-workspace .viral-results,
.viral-page .viral-log {
  height: 310px;
  min-height: 310px;
  max-height: 310px;
}

.viral-page .viral-log {
  padding: 15px 16px;
  border-radius: 14px;
  background: #f7f9fc;
  font-size: 12px;
  line-height: 1.62;
}

.viral-page .viral-result,
.viral-page .viral-empty {
  padding: 14px 15px;
  border-color: #dce5ef;
  border-radius: 13px;
  box-shadow: 0 2px 6px rgba(34, 60, 91, 0.035);
}

.viral-page .viral-result-top {
  align-items: center;
  margin-bottom: 9px;
}

.viral-page .viral-result a {
  display: block;
  font-size: 15px;
  line-height: 1.55;
}

.viral-page .viral-result-meta {
  justify-content: flex-start;
  gap: 6px 14px;
  margin-top: 8px;
}

.viral-page .viral-result p:empty {
  display: none;
}

.viral-page .pending-inbox-panel {
  margin-top: 22px;
  padding: 22px;
  background: #fbfcfe;
}

.viral-page .pending-inbox-head {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(330px, 0.9fr) minmax(230px, auto);
  align-items: end;
  gap: 14px 20px;
}

.viral-page .pending-inbox-head h2 {
  margin: 0;
  font-size: 19px;
}

.viral-page .pending-inbox-head h2 span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.viral-page .pending-inbox-head label {
  min-width: 0;
  color: #3c4c61;
  font-size: 12px;
}

.viral-page .pending-inbox-head select {
  min-height: 46px;
  margin-top: 7px;
  padding: 10px 12px;
  border-color: #cbd9e8;
  background: #fff;
  font-weight: 800;
}

.viral-page .pending-inbox-head select:disabled {
  opacity: 1;
  color: #174c82;
  background: #edf6ff;
  -webkit-text-fill-color: #174c82;
}

.viral-page #pendingApproveAllBtn {
  flex: none;
  width: 100%;
  min-width: 230px;
  min-height: 46px;
  padding: 10px 15px;
  white-space: normal;
  line-height: 1.35;
}

.viral-page .pending-inbox-panel > p {
  margin: 14px 0;
  padding: 11px 13px;
  border: 1px solid #cce5d9;
  border-radius: 10px;
  background: #f0faf5;
  color: #287153;
  font-size: 12px;
  line-height: 1.5;
}

.viral-page .pending-inbox-panel > .viral-results {
  min-height: 260px;
  max-height: 580px;
  padding-right: 3px;
}

.viral-page .account-panel > h2 span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .viral-page .viral-head,
  .viral-page .worker-status-panel,
  .viral-page .viral-workspace,
  .viral-page .enterprise-target-card {
    grid-template-columns: 1fr;
  }

  .viral-page .worker-status-meta {
    justify-content: flex-start;
  }

  .viral-page .pending-inbox-head {
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr);
  }

  .viral-page #pendingApproveAllBtn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .viral-page .shell {
    width: min(100vw - 18px, 100%);
    padding: 9px 0 20px;
  }

  .viral-page .viral-standalone {
    padding: 15px;
    border-radius: 14px;
  }

  .viral-page .enterprise-settings-actions,
  .viral-page .pending-inbox-head,
  .viral-page .enterprise-target-meta {
    grid-template-columns: 1fr;
  }

  .viral-page #pendingApproveAllBtn {
    grid-column: auto;
    min-width: 0;
  }

  .viral-page .viral-workspace .viral-results,
  .viral-page .viral-log {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }
}
