:root {
  color-scheme: light;
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --ink: #17202a;
  --muted: #697586;
  --line: #d8dee8;
  --accent: #0f8f7f;
  --accent-strong: #0b7569;
  --accent-soft: #dff5f1;
  --warn: #b76e00;
  --danger: #c2413f;
  --ok: #16794f;
  --shadow: 0 18px 50px rgba(28, 39, 58, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.workflow-topbar {
  min-width: 0;
  max-width: 1540px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(420px, 560px) minmax(210px, 1fr);
  align-items: center;
  gap: 16px;
  margin: 0 auto 18px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workflow-brand {
  min-width: 0;
}

.workflow-brand p,
.workflow-brand h1 {
  margin: 0;
  letter-spacing: 0;
}

.workflow-brand p {
  color: var(--muted);
  font-size: 12px;
}

.workflow-brand h1 {
  margin-top: 3px;
  font-size: 23px;
}

.workflow-topbar .workflow-steps {
  margin-top: 0;
}

.workflow-topbar .header-tools {
  min-width: 0;
  justify-content: flex-end;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1540px;
  margin: 0 auto;
}

.control-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  min-width: 0;
  align-self: start;
  padding: 22px;
  position: sticky;
  top: 20px;
}

.result-panel {
  min-width: 0;
  min-height: calc(100vh - 40px);
  padding: 22px;
}

.result-requirement-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -4px 0 12px;
}

.result-requirement-tab {
  min-width: 0;
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.result-requirement-tab:hover {
  border-color: #aab5c4;
}

.result-requirement-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.result-requirement-tab strong,
.result-requirement-tab small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-requirement-tab strong {
  font-size: 15px;
}

.result-requirement-tab small {
  color: var(--muted);
  font-size: 12px;
}

.job-tabs {
  display: none;
  gap: 8px;
  margin: 0 0 16px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.job-tabs:empty {
  display: none;
}

.job-tab {
  flex: 0 0 auto;
  min-width: 138px;
  max-width: 210px;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.job-tab:hover {
  border-color: #aab5c4;
}

.job-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.job-tab-name {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.job-tab-name strong,
.job-tab-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-tab-name strong {
  font-size: 13px;
}

.job-tab-name small {
  color: var(--muted);
  font-size: 11px;
}

.job-tab-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a2b3;
}

.job-tab-status.running,
.job-tab-status.queued {
  background: var(--warn);
}

.job-tab-status.completed {
  background: var(--ok);
}

.job-tab-status.partial,
.job-tab-status.failed {
  background: var(--danger);
}

.brand-row,
.result-header,
.action-row,
.progress-meta,
.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workflow-steps {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.workflow-steps > a,
.workflow-steps > span {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.workflow-steps > a:hover {
  color: var(--ink);
  background: #fff;
}

.workflow-steps > a.active {
  border-color: #b9d8d2;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.workflow-steps > a > span,
.workflow-steps > span > span {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.result-header-tools,
.progress-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.result-title-copy {
  min-width: 0;
}

.result-header-tools {
  flex: 0 0 auto;
}

.result-refresh-button {
  width: 36px;
  height: 36px;
}

.result-refresh-button.is-loading svg {
  animation: result-refresh-spin 0.8s linear infinite;
}

@keyframes result-refresh-spin {
  to { transform: rotate(360deg); }
}

.result-action-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(205px, 0.9fr) minmax(300px, 1.35fr) minmax(96px, auto);
  margin: 14px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.result-action-group {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px 14px;
}

.result-action-group + .result-action-group {
  border-left: 1px solid var(--line);
}

.result-action-group[hidden] {
  display: none;
}

.result-action-bar [hidden] {
  display: none;
}

.result-action-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.result-selection-controls,
.result-flow-buttons {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.result-select-all,
.result-selection-count {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #263445;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.result-select-all {
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.result-select-all:hover {
  border-color: #aab5c4;
}

.result-select-all.active {
  border-color: #b9d8d2;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.result-select-all:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.result-select-all input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: inherit;
}

.result-selection-count {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.result-selection-count.has-selection {
  color: var(--accent-strong);
}

.result-action-bar .ghost-button,
.result-action-bar .download-button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 13px;
}

.result-action-bar .result-retry-button {
  border-color: #efd29b;
  background: #fff8e8;
  color: #744a05;
}

.result-action-bar .result-retry-button:hover:not(:disabled) {
  border-color: #d9b56e;
  background: #fff3d3;
}

.result-action-bar .result-cancel-button {
  border-color: #efc1be;
  background: #fff4f2;
  color: #a62f28;
}

.result-action-bar .result-cancel-button:hover:not(:disabled) {
  border-color: #df9d98;
  background: #ffe9e6;
}

.result-flow-button.is-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.result-flow-button.is-primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.result-file-actions {
  min-width: 96px;
}

.result-file-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.result-file-buttons .download-button,
.result-file-buttons .ghost-button {
  width: 100%;
}

.progress-side {
  flex: 0 0 auto;
  color: var(--muted);
}

#lastRefreshText {
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

.status-pill,
.item-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--ok);
  background: #e7f6ee;
  border-color: #bfe7d3;
}

.status-pill.warn {
  color: var(--warn);
  background: #fff4dd;
  border-color: #f0d49d;
}

.status-pill.danger {
  color: var(--danger);
  background: #fff0ef;
  border-color: #efc2c0;
}

.job-form {
  min-width: 0;
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #344054;
  cursor: pointer;
}

.icon-button:hover {
  border-color: #aab5c4;
  background: var(--panel-strong);
}

.task-picker {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.requirement-segment,
.channel-segment,
.source-segment {
  display: grid;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.requirement-segment {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.source-segment.has-preprocess {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.requirement-segment label,
.channel-segment label,
.source-segment label {
  position: relative;
  min-width: 0;
}

.requirement-segment input,
.channel-segment input,
.source-segment input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.requirement-segment span,
.channel-segment span,
.source-segment span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.requirement-segment input:checked + span,
.channel-segment input:checked + span,
.source-segment input:checked + span {
  border-color: #b9d8d2;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.requirement-segment input:focus-visible + span,
.channel-segment input:focus-visible + span,
.source-segment input:focus-visible + span {
  outline: 2px solid rgba(15, 143, 127, 0.24);
}

.channel-choice-row,
.source-choice-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.channel-choice-row[hidden],
.source-choice-row[hidden] {
  display: none;
}

.channel-choice-row > span,
.source-choice-row > span {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.source-segment label.disabled span {
  color: #98a2b3;
  background: #f3f5f8;
  cursor: not-allowed;
}

.source-choice-hint {
  display: block;
  margin-top: -5px;
  padding-left: 1px;
}

.current-task-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  line-height: 1.4;
}

.current-task-summary.ok {
  border-color: #bfe7d3;
  color: var(--ok);
  background: #f0fbf5;
}

.current-task-summary.warn {
  border-color: #f0d49d;
  color: var(--warn);
  background: #fff9eb;
}

.gateway-boundary-notice {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #f0d49d;
  border-radius: 6px;
  background: #fff9eb;
  color: #7a4a00;
}

.gateway-boundary-notice[hidden] {
  display: none;
}

.gateway-boundary-notice strong {
  font-size: 13px;
}

.gateway-boundary-notice span {
  font-size: 12px;
  line-height: 1.5;
}

.gateway-boundary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.gateway-boundary-actions small {
  color: inherit;
  font-size: 11px;
  line-height: 1.4;
}

.continuation-source {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #b9d8d2;
  border-radius: 8px;
  background: var(--accent-soft);
}

.continuation-source[hidden],
.toggle-row[hidden] {
  display: none;
}

.continuation-source > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.continuation-actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 8px;
}

.continuation-source strong,
.continuation-source small {
  overflow-wrap: anywhere;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: #344054;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.toggle-row input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.settings-dialog {
  width: min(780px, calc(100vw - 32px));
  max-width: none;
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(28, 39, 58, 0.24);
}

.settings-dialog::backdrop {
  background: rgba(23, 32, 42, 0.42);
}

.settings-dialog-shell {
  min-height: 0;
  max-height: min(860px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.settings-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.settings-dialog-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.settings-tab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.settings-tab-list.gateway-only {
  grid-template-columns: minmax(0, 1fr);
}

.settings-tab {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.settings-tab.active {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.settings-dialog-body {
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow-y: auto;
  padding: 16px 18px 18px;
}

.settings-dialog label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.settings-dialog label > span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.gateway-settings-panel {
  gap: 14px;
}

.gateway-fields {
  display: grid;
  gap: 10px;
}

.gateway-fields > small,
.gateway-status-head small,
.gateway-task-heading small {
  color: var(--muted);
  line-height: 1.5;
}

.gateway-status-head,
.gateway-task-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gateway-status-head > div {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 6px;
}

.gateway-account-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
}

.gateway-account-summary[hidden] {
  display: none;
}

.gateway-account-summary > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-right: 1px solid var(--line);
}

.gateway-account-summary > div:last-child {
  border-right: 0;
}

.gateway-account-summary dt,
.gateway-account-summary dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gateway-account-summary dt {
  color: var(--muted);
  font-size: 11px;
}

.gateway-account-summary dd {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.gateway-pricing-line {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.gateway-pricing-line span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  text-align: right;
}

.gateway-task-section,
.gateway-task-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.gateway-task-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.gateway-task-item > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.gateway-task-item strong,
.gateway-task-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gateway-task-item strong {
  font-size: 12px;
}

.gateway-task-item small,
.gateway-task-empty {
  color: var(--muted);
  font-size: 11px;
}

.gateway-task-item > .gateway-task-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.gateway-task-artifacts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gateway-artifact {
  display: grid;
  gap: 3px;
  width: 112px;
  color: var(--ink);
  text-decoration: none;
}

.gateway-artifact img,
.gateway-artifact video {
  display: block;
  width: 112px;
  height: 80px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f4f5f6;
}

.gateway-artifact small,
.gateway-artifact-file,
.gateway-artifacts-pending {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gateway-artifact-file {
  grid-column: 1 / -1;
}

.gateway-artifacts-pending {
  grid-column: 1 / -1;
}

.gateway-scope-note {
  padding: 10px 12px;
  border-left: 3px solid var(--warn);
  background: #fff9eb;
  color: #6f4b12;
  font-size: 12px;
  line-height: 1.6;
}

.engine-panel {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.engine-panel-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.engine-panel-head span {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.engine-panel-head small {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.engine-segment label {
  position: relative;
  min-width: 0;
}

.engine-segment input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.engine-segment span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.engine-segment input:checked + span {
  border-color: #b9d8d2;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.engine-segment input:focus-visible + span {
  outline: 2px solid rgba(15, 143, 127, 0.24);
}

.stage-route-list,
.stage-prompt-grid {
  display: grid;
  gap: 8px;
}

.stage-route-list label {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(130px, 1.15fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
}

.stage-route-list label > span,
.stage-prompt-grid label > span {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.stage-route-list select {
  min-width: 0;
}

.stage-prompt-grid label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.stage-prompt-grid textarea {
  min-height: 92px;
  resize: vertical;
}

.flow-section {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.flow-section[hidden] {
  display: none;
}

.field-label,
.settings-panel label > span,
.options-grid span {
  font-size: 13px;
  font-weight: 700;
}

.drop-zone,
.reference-add-zone {
  max-width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  min-height: 154px;
  padding: 20px;
  border: 1.5px dashed #aab5c4;
  border-radius: 8px;
  background: var(--panel-strong);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone.dragging,
.reference-picker.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

input[type="file"] {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.drop-icon,
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drop-zone svg,
.reference-add-zone svg,
.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 10px;
}

.drop-zone strong,
.reference-add-zone strong {
  display: block;
  margin-bottom: 5px;
}

small {
  color: var(--muted);
  line-height: 1.4;
}

.file-list {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 6px;
}

.file-chip {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 6px 8px;
  background: #f3f6fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
}

.file-chip svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex: 0 0 auto;
}

.file-thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #eef1f5;
}

.file-thumb svg {
  width: 19px;
  height: 19px;
}

.file-chip-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-remove-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  cursor: pointer;
}

.file-remove-button:hover {
  border-color: #f0b8b5;
  background: #fff0ef;
}

.file-remove-button svg {
  width: 14px;
  height: 14px;
}

.reference-picker {
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1.5px dashed #aab5c4;
  border-radius: 8px;
  background: var(--panel-strong);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.reference-add-zone {
  min-height: 108px;
  padding: 12px;
  border: 0;
  background: transparent;
}

.reference-preview {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.reference-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.reference-chip {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.reference-token-button {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.reference-token-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.reference-token-button span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  background: rgba(23, 32, 42, 0.68);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.reference-remove-button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(194, 65, 63, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--danger);
  cursor: pointer;
}

.reference-remove-button svg {
  width: 14px;
  height: 14px;
}

.reference-video-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.reference-video-card video {
  width: 74px;
  height: 52px;
  object-fit: cover;
  border-radius: 5px;
  background: #eef1f5;
}

.reference-video-name {
  min-width: 0;
  overflow: hidden;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

textarea,
input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 148px;
  padding: 11px 12px;
  line-height: 1.55;
}

.prompt-field {
  position: relative;
  min-width: 0;
}

.mention-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  z-index: 20;
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(28, 39, 58, 0.16);
}

.mention-menu[hidden] {
  display: none;
}

.mention-option {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: #263445;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.mention-option.active,
.mention-option:hover {
  border-color: #b9d8d2;
  background: var(--accent-soft);
}

.mention-thumb {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6fa;
}

.mention-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

select {
  height: 40px;
  padding: 0 10px;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"] {
  height: 40px;
  padding: 0 10px;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus {
  outline: 2px solid rgba(15, 143, 127, 0.22);
  border-color: var(--accent);
}

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

.options-grid label {
  display: grid;
  gap: 6px;
}

.prompt-library-panel,
.settings-panel,
.naming-panel {
  display: grid;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.prompt-library-panel[hidden] {
  display: none;
}

.collapsible-panel {
  gap: 0;
}

.collapsible-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.panel-title {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.section-toggle-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.section-toggle-button svg {
  width: 16px;
  height: 16px;
  transition: transform 0.16s ease;
}

.collapsible-panel[open] .section-toggle-button svg {
  transform: rotate(180deg);
}

.collapsible-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.prompt-library-panel label,
.settings-panel label {
  display: grid;
  gap: 6px;
}

.prompt-library-panel label span,
.settings-panel label span {
  color: #344054;
}

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

.model-manager {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.model-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.model-manager small {
  color: var(--muted);
}

.model-option-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.model-option-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.model-option-item.selected {
  border-color: #b9d8d2;
  background: var(--accent-soft);
}

.model-option-use,
.model-option-default,
.model-option-delete {
  border: 0;
  background: transparent;
  color: #263445;
  cursor: pointer;
}

.model-option-use {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  text-align: left;
}

.model-option-use:hover,
.model-option-default:hover,
.model-option-delete:hover {
  background: #f8fafc;
}

.model-option-name,
.model-option-tags {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option-name {
  font-size: 13px;
  font-weight: 800;
}

.model-option-tags {
  display: inline-flex;
  gap: 6px;
}

.model-tag {
  width: fit-content;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.model-tag.default {
  color: var(--accent-strong);
  border-color: #b9d8d2;
  background: var(--accent-soft);
}

.model-option-default {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 82px;
  padding: 0 8px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.model-option-default:disabled {
  color: var(--muted);
  cursor: default;
}

.model-option-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line);
  color: var(--muted);
}

.model-option-delete:hover {
  color: var(--danger);
  background: #fff4f3;
}

.channel-settings {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.channel-settings summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  cursor: pointer;
  list-style: none;
}

.channel-settings summary::-webkit-details-marker {
  display: none;
}

.channel-settings summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.channel-settings[open] summary {
  border-bottom: 1px solid var(--line);
}

.channel-settings[open] summary::after {
  content: "-";
}

.channel-settings summary span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.channel-settings summary small {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-settings-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.channel-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.channel-group-title {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.runninghub-workflow-fields[hidden] {
  display: none;
}

.node-lines textarea {
  min-height: 72px;
  font-size: 12px;
}

.config-checklist {
  display: grid;
  gap: 8px;
}

.config-check-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(86px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.config-check-item strong,
.config-check-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-check-item strong {
  color: #344054;
  font-size: 12px;
}

.config-check-item span {
  color: var(--muted);
  font-size: 12px;
}

.config-check-item.ok {
  border-color: #bfe7d3;
  background: #f0fbf5;
}

.config-check-item.ok span {
  color: var(--ok);
}

.config-check-item.warn {
  border-color: #f0d49d;
  background: #fff9eb;
}

.config-check-item.warn span {
  color: var(--warn);
}

.settings-save-strip {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.prompt-library-save {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.prompt-library-hint {
  color: var(--muted);
}

.prompt-preset-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.prompt-preset-empty {
  display: block;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
}

.prompt-preset-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.prompt-preset-use {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: #263445;
  cursor: pointer;
  text-align: left;
}

.prompt-preset-use:hover {
  background: var(--accent-soft);
}

.prompt-preset-title,
.prompt-preset-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-preset-title {
  font-size: 13px;
  font-weight: 800;
}

.prompt-preset-preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.prompt-preset-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.prompt-preset-delete:hover {
  color: var(--danger);
  background: #fff4f3;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #263445;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mini-button:hover {
  border-color: #aab5c4;
}

.mini-button.danger {
  color: var(--danger);
}

.mini-button svg {
  width: 15px;
  height: 15px;
}

.naming-panel label {
  display: grid;
  gap: 6px;
}

.naming-panel label span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

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

.primary-button,
.ghost-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

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

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.download-button {
  background: #fff;
  color: #263445;
  border-color: var(--line);
}

.ghost-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: #b9d8d2;
}

.ghost-button.danger {
  color: var(--danger);
}

#downloadLink {
  flex: 0 0 auto;
  width: auto;
}

#cleanupJobButton {
  flex: 0 0 auto;
  width: auto;
}

.download-button.disabled,
.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button svg,
.download-button svg {
  width: 17px;
  height: 17px;
}

.progress-wrap {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.progress-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5ee;
}

.queue-hint {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #efd29b;
  border-radius: 6px;
  background: #fff8e8;
  color: #744a05;
  font-size: 12px;
  line-height: 1.45;
}

.queue-hint[hidden] {
  display: none;
}

.queue-hint > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-hint .mini-button {
  flex: 0 0 auto;
  min-height: 30px;
  background: #fff;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.merge-panel {
  min-width: 0;
  margin: 0 0 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.merge-panel[hidden] {
  display: none;
}

.result-panel #mergePanel {
  display: none !important;
}

.merge-panel-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.merge-panel-main > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.merge-panel-main strong {
  font-size: 15px;
}

.merge-panel-main small {
  color: var(--muted);
  line-height: 1.45;
}

.merge-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.merge-panel video {
  width: min(100%, 420px);
  max-height: 320px;
  display: block;
  margin-top: 12px;
  background: #0f172a;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 39, 58, 0.3);
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog-card {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(28, 39, 58, 0.2);
}

.dialog-card h3,
.dialog-card p {
  margin: 0;
}

.dialog-card h3 {
  color: #263445;
  font-size: 16px;
}

.dialog-card p {
  color: var(--muted);
  font-size: 13px;
}

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

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

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

.result-card.is-background-job {
  border-color: #e1e6ee;
}

.job-card-meta {
  margin: 8px 0 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-task-meta {
  margin-top: 3px;
  color: #475467;
  font-variant-numeric: tabular-nums;
}

.result-card.is-regenerating {
  border-color: #f0d49d;
  background: #fffdf8;
}

.file-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cleanup-select {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.cleanup-select:hover {
  border-color: #efb7b4;
  background: #fff7f6;
}

.cleanup-select input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cleanup-select span {
  width: 14px;
  height: 14px;
  border: 1.5px solid #8b97a8;
  border-radius: 3px;
  background: #fff;
}

.cleanup-select input:checked + span {
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: inset 0 0 0 3px #fff;
}

.cleanup-select:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.45;
}

.output-name {
  margin: 8px 0 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.item-regenerate-button {
  min-height: 32px;
  font-size: 12px;
}

.regenerating-note {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border: 1px solid #f0d49d;
  border-radius: 999px;
  background: #fff8e8;
  color: var(--warn);
  font-size: 12px;
  font-weight: 800;
}

.item-status.done {
  color: var(--ok);
  background: #e7f6ee;
  border-color: #bfe7d3;
}

.item-status.done.downloaded,
.item-status.downloaded {
  color: #475467;
  background: #f2f4f7;
  border-color: #d0d5dd;
  font-weight: 800;
}

.item-status.error {
  color: var(--danger);
  background: #fff0ef;
  border-color: #f5c0be;
}

.item-status.editing,
.item-status.extracting,
.item-status.remote-running {
  color: var(--warn);
  background: #fff4dd;
  border-color: #f0d49d;
}

.item-status.queued {
  color: var(--muted);
  background: #eef2f7;
  border-color: #d7dee8;
}

.item-status.remote-queued,
.item-status.remote-submitted {
  color: #2563a8;
  background: #edf5ff;
  border-color: #bfd7f2;
}

.item-status.remote-failed,
.item-status.remote-timeout {
  color: var(--danger);
  background: #fff0ef;
  border-color: #f5c0be;
}

.item-status.pending_confirmation,
.item-status.remote-pending_confirmation {
  color: #8a5a00;
  background: #fff8e6;
  border-color: #efd18a;
}

.item-status.cancelled,
.item-status.remote-cancelled {
  color: #475467;
  background: #f2f4f7;
  border-color: #d0d5dd;
}

.image-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

figure {
  margin: 0;
}

.image-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f2f5f8;
  color: var(--muted);
  font-size: 13px;
}

.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.output-thumbs {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
  padding: 6px;
}

.output-thumbs a {
  min-width: 0;
  min-height: 0;
  display: block;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.output-thumb {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 4px;
}

.output-thumb > a {
  width: 100%;
  height: 100%;
}

.output-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.output-thumbs video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #0f172a;
}

figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.item-error {
  display: none;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.item-error.visible {
  display: block;
}

.item-error.warning {
  color: var(--warn);
}

.item-error-summary {
  max-width: 100%;
}

.item-error-details {
  margin-top: 6px;
  color: #8a3030;
}

.item-error.warning .item-error-details {
  color: #7a5200;
}

.item-error-details summary {
  width: fit-content;
  cursor: pointer;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.item-error-details pre {
  max-height: 140px;
  margin: 6px 0 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid #f1c7c7;
  border-radius: 6px;
  background: #fff7f7;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.item-error.warning .item-error-details pre {
  border-color: #f0d49d;
  background: #fff9eb;
}

@media (max-width: 1240px) {
  .result-action-bar {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  }

  .result-continuation-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line);
    border-left: 0 !important;
  }

  .result-file-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .workflow-topbar {
    display: flex;
    flex-wrap: wrap;
  }

  .workflow-brand,
  .workflow-topbar .header-tools {
    flex: 1 1 200px;
  }

  .workflow-topbar .workflow-steps {
    order: 3;
    width: 100%;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .control-panel,
  .result-panel,
  .task-picker,
  .requirement-segment,
  .channel-segment,
  .source-segment {
    min-width: 0;
  }

  .control-panel {
    position: static;
  }

  .result-panel {
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .workflow-topbar {
    align-items: stretch;
  }

  .workflow-brand,
  .workflow-topbar .header-tools {
    flex-basis: 100%;
  }

  .workflow-topbar .header-tools {
    align-self: auto;
    justify-content: space-between;
  }

  .action-row,
  .engine-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .engine-panel-head small {
    text-align: left;
    white-space: normal;
  }

  .progress-meta,
  .progress-side,
  .queue-hint {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-hint .mini-button {
    width: 100%;
  }

  .brand-row {
    align-items: flex-start;
  }

  .header-tools {
    align-self: flex-start;
  }

  .channel-choice-row,
  .source-choice-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .continuation-source {
    align-items: stretch;
    flex-direction: column;
  }

  .continuation-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-action-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-action-group,
  .result-continuation-actions,
  .result-file-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .result-action-group + .result-action-group,
  .result-continuation-actions {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .result-selection-controls,
  .result-flow-buttons {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .result-select-all,
  .result-selection-count {
    width: 100%;
  }

  .result-file-buttons {
    width: min(100%, 180px);
  }

  .merge-panel-main {
    align-items: stretch;
    flex-direction: column;
  }

  .merge-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .settings-dialog-shell {
    max-height: calc(100vh - 16px);
  }

  .settings-dialog-header,
  .settings-dialog-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .settings-tab-list {
    padding-left: 12px;
    padding-right: 12px;
  }

  .gateway-status-head,
  .gateway-task-heading,
  .gateway-pricing-line {
    align-items: stretch;
    flex-direction: column;
  }

  .gateway-pricing-line span {
    text-align: left;
  }

  .gateway-account-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gateway-account-summary > div:nth-child(2) {
    border-right: 0;
  }

  .gateway-account-summary > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .options-grid,
  .settings-grid,
  .settings-actions,
  .engine-segment,
  .config-check-item,
  .model-save-row,
    .prompt-library-save,
    .naming-grid,
    .stage-route-list label,
    .image-pair {
    grid-template-columns: 1fr;
  }

  .download-button,
  .primary-button,
  .ghost-button {
    width: 100%;
  }

}
