/* 共享颜色与间距，让列表、表单和日志在同一套视觉层级中保持可读。 */
:root {
  color-scheme: dark;
  --paper: #1c1c1c;
  --soft: #242424;
  --ink: #ededed;
  --muted: #b1b1ba;
  --line: #353535;
  --accent: #3ecf8e;
  --danger: #f28b82;
  --warning: #e5b85c;
  --text: #d4d4d8;
  --radius-input: 6px;
  --radius-panel: 8px;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font:
    14px Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'PingFang SC',
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  padding: 7px 13px;
  min-height: 36px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  font-size: 13px;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
button:hover,
.button:hover {
  background: #2d2d2d;
  border-color: #505050;
  text-decoration: none;
}
button:active,
.button:active {
  background: #303030;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  background: var(--accent);
  color: #171717;
  border-color: var(--accent);
  font-weight: 600;
}
.primary:hover {
  background: #49dda0;
  border-color: #49dda0;
}
a {
  color: var(--ink);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #777780;
  border-radius: var(--radius-input);
  padding: 9px 12px;
  background: #181818;
  color: var(--ink);
  min-height: 38px;
  transition: border-color 0.15s;
}
/* 固定箭头与边框的距离，避免系统默认样式把箭头贴到右边缘。 */
select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
textarea {
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
label {
  display: block;
  font-weight: 500;
  font-size: 13px;
  margin: 18px 0 8px;
}
.sidebar {
  width: 216px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #181818;
  border-right: 1px solid var(--line);
  padding: 24px 12px 16px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 0 12px;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  color: var(--accent);
  font:
    600 24px/32px ui-monospace,
    SFMono-Regular,
    monospace;
  width: 26px;
  letter-spacing: -2px;
}
.sidebar nav {
  margin-top: 36px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition:
    background 0.15s,
    color 0.15s;
}
.sidebar nav a:hover {
  background: var(--soft);
  color: var(--ink);
  text-decoration: none;
}
.sidebar nav a.active {
  background: #2a2a2a;
  color: var(--ink);
  box-shadow: inset 2px 0 var(--accent);
}
.nav-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 16px;
}
.breadcrumb-divider {
  color: #666;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
}
.workspace {
  margin-left: 216px;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #1a1a1a;
  font-size: 12px;
  color: var(--muted);
}
.topbar > div {
  display: flex;
  align-items: center;
  gap: 14px;
}
.icon-button {
  border: 1px solid transparent;
  background: transparent;
  font-size: 21px;
  padding: 0;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
}
main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}
h1 {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  font-weight: 500;
  color: var(--ink);
}
h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 500;
  color: var(--ink);
}
h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin: 16px 0 8px;
}
.page {
  animation: enter 0.2s ease-out;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.control-strip > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.control-strip > strong + button {
  margin-right: auto;
}
.control-strip > .helper {
  margin: 0;
}
.control-strip .status-dot {
  margin-right: 0;
}
.control-strip button {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 13px;
}
/* 用一行指标和两个阅读区域呈现总览，避免把工作台再复制一遍。 */
.overview-metrics {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 28px;
  padding: 32px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.overview-metric + .overview-metric {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}
.overview-metric h2 {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.metric-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0;
}
.metric-value strong {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.metric-value span,
.overview-metric > p,
.overview-metric > a,
.overview-metric > button,
.goal-label {
  font-size: 12px;
  color: var(--muted);
}
.overview-metric > a,
.overview-metric > button {
  color: var(--accent);
}
.overview-metric > p {
  margin: 0;
}
.metric-throughput .metric-value strong {
  color: var(--accent);
}
.goal-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
#daily-progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--soft);
  margin-top: 10px;
}
#daily-progress::-webkit-progress-bar {
  background: var(--soft);
}
#daily-progress::-webkit-progress-value {
  background: var(--accent);
}
#daily-progress::-moz-progress-bar {
  background: var(--accent);
}
.overview-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 48px;
  margin-top: 12px;
}
#page-overview .section-heading a {
  font-size: 12px;
}
.overview-task {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.overview-task > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.overview-task .text-button {
  justify-content: flex-start;
  min-width: 0;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}
.overview-task .text-button:hover {
  color: var(--accent);
  background: transparent;
}
.overview-task .text-button > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.overview-task .text-button > strong,
.overview-task .badge {
  flex: none;
}
.overview-task .helper {
  margin: 8px 0 0;
}
.execution-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.execution-row strong {
  font-size: 14px;
  font-weight: 500;
}
.execution-row p {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
}
.execution-row > button {
  font-size: 12px;
  flex: none;
}
.overview-products {
  margin: 16px 0;
  gap: 6px;
}
.active-worker {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.active-worker p {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}
.next-action {
  display: block;
  color: var(--accent);
  font-size: 12px;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.workspace-heading > .primary {
  margin-bottom: 12px;
}
.page-count {
  color: var(--muted);
  padding-bottom: 12px;
}
.tabs button:hover {
  color: var(--ink);
}
.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 32px;
}
.detail-drawer.form-drawer {
  width: min(560px, 100vw);
}
.settings-section + .settings-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.settings-section h3 {
  margin: 0;
}
.settings-row > button {
  grid-column: 1 / -1;
  justify-self: end;
}
#ip51-interval-field {
  grid-column: 1 / -1;
}
#settings-notice {
  margin: 16px 24px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
#settings-notice.error {
  color: var(--danger);
  background: #322322;
}
input::placeholder,
textarea::placeholder {
  color: #a1a1aa;
}
tbody > tr:last-child > td {
  border-bottom: 0;
}
.product-title {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  justify-content: flex-start;
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}
.badge.success {
  color: #79deb0;
  background: #1e3028;
  border-color: #2d5241;
}
.badge.warning {
  color: var(--warning);
  background: #302a1d;
  border-color: #55452b;
}
.task-composer {
  padding: 0;
}
.helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  margin: 6px 0 10px;
}
.composer-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.composer-fields label {
  margin: 24px 0 8px;
}
.composer-fields textarea {
  display: block;
}
.pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 24px;
  background: #202020;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  gap: 24px;
}
.stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  font-size: 13px;
  color: var(--muted);
}
.stage + .stage {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.stage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-basis: 100%;
}
.stage-title > span {
  font-size: 12px;
}
.stage-title strong {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
}
.stage b {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-right: 4px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 24px 0 16px;
}
.section-heading > span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 640px;
  min-width: 0;
}
.search input {
  min-width: 100px;
  border-radius: 6px;
  background: #181818;
  min-height: 36px;
}
.task-toolbar > select {
  max-width: 170px;
}
.table-wrap {
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1b1b1b;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  table-layout: fixed;
  min-width: 820px;
}
th {
  background: #232323;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 12px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
td > strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
td > small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
tbody > tr:hover {
  background: #222;
}
.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tasks-table th:nth-child(1) {
  width: 26%;
}
.tasks-table th:nth-child(2) {
  width: 12%;
}
.tasks-table th:nth-child(3) {
  width: 20%;
}
.tasks-table th:nth-child(4) {
  width: 13%;
  text-align: right;
}
.tasks-table th:nth-child(5) {
  width: 13%;
}
.tasks-table th:nth-child(6) {
  width: 16%;
}
.task-row {
  cursor: pointer;
}
.task-row.selected {
  background: var(--soft);
}
.task-open {
  padding: 0;
  border: 0;
  border-radius: 0;
  min-height: 24px;
  justify-content: flex-start;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  max-width: 100%;
  background: transparent;
  text-align: left;
}
.task-open > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.task-open .chevron {
  margin-left: auto;
  flex: none;
}
.task-open:hover {
  background: transparent;
  color: var(--accent);
}
.task-open strong {
  font-weight: 600;
  margin-right: 3px;
}
.chevron {
  font-size: 19px;
  width: 20px;
  flex: none;
}
.row-actions {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
}
.row-actions button {
  font-size: 14px;
  min-height: 40px;
  padding: 5px 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 400;
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}
.badge.running {
  background: #1e3028;
  border-color: #2d5241;
  color: #79deb0;
}
.badge.failed {
  background: #322322;
  border-color: #613533;
  color: var(--danger);
}
.badge.pending {
  background: #242424;
  color: var(--muted);
}
.muted {
  color: var(--muted);
  font-weight: 400;
}
.error-text {
  color: var(--danger) !important;
}
.empty {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.empty strong {
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.detail-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 20px 0;
}
.detail-stages > div {
  border-left: 2px solid var(--line);
  padding-left: 12px;
}
.detail-stages > div > span:first-child {
  font-size: 12px;
  margin-right: 8px;
}
.detail-stages small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.detail-error {
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 16px;
}
.product-record {
  border-top: 1px solid var(--line);
}
.product-record:last-child {
  border-bottom: 1px solid var(--line);
}
.product-record > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  font-size: 12px;
}
.product-record > summary > strong {
  flex: 1;
  font-weight: 500;
}
.product-record > summary > span:not(.disclosure-arrow) {
  color: var(--muted);
}
.record-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}
.record-actions button {
  min-height: 40px;
  font-size: 14px;
  padding: 4px 10px;
}
.product-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 20px 0;
}
.product-fields dt {
  font-size: 12px;
  color: var(--muted);
}
.product-fields dd {
  font-size: 14px;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
summary::-webkit-details-marker {
  display: none;
}
.disclosure-arrow {
  margin-left: auto;
  font-size: 20px;
  transition: transform 0.18s;
}
details[open] > summary > .disclosure-arrow {
  transform: rotate(180deg);
}
.results-content {
  padding: 0 0 20px;
  animation: enter 0.2s ease-out;
}
.products-table {
  min-width: 920px;
}
.products-table th:first-child {
  width: 37%;
}
.products-table th:nth-child(2) {
  width: 17%;
}
.products-table th:nth-child(3) {
  width: 9%;
  text-align: right;
}
.products-table th:nth-child(4) {
  width: 12%;
  text-align: right;
}
.products-table th:nth-child(5) {
  width: 10%;
  text-align: right;
}
.products-table th:nth-child(6) {
  width: 15%;
  text-align: right;
}
.pagination,
.pagination > div,
.pagination form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination {
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pagination button {
  font-size: 12px;
  padding: 6px 10px;
  min-height: 34px;
}
.pagination select {
  width: 112px;
  min-height: 34px;
  font-size: 12px;
}
.pagination input {
  width: 54px;
  min-height: 34px;
  font-size: 12px;
  padding: 6px;
}
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 0;
  margin: 24px 0;
}
.tabs button {
  min-height: 44px;
  font-size: 13px;
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.tabs button[aria-selected='true'] {
  color: var(--ink);
  background: transparent;
  border-bottom-color: var(--accent);
}
.tabs button span {
  font-size: 12px;
  color: var(--muted);
  margin-left: 10px;
}
.worker-setup {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin: 20px 0;
}
.setup-guide {
  flex-basis: 100%;
  min-width: 0;
}
.setup-guide > summary {
  list-style: none;
  cursor: pointer;
  color: var(--accent);
  padding: 7px 0;
  font-size: 12px;
}
.setup-guide > summary::before {
  content: '›';
  display: inline-block;
  margin-right: 6px;
}
.setup-guide[open] > summary::before {
  content: '⌄';
}
.steps {
  font-size: 12px;
  padding-left: 19px;
  margin: 8px 0 12px;
  line-height: 1.9;
  color: var(--muted);
}
.steps li {
  padding-left: 4px;
  margin-bottom: 4px;
}
code {
  background: var(--soft);
  font:
    12px ui-monospace,
    SFMono-Regular,
    monospace;
  padding: 2px 5px;
  border-radius: 4px;
}
.connection-panel {
  background: transparent;
  padding: 0;
}
.copy-field {
  display: flex;
  gap: 7px;
  align-items: center;
}
.copy-field input,
.copy-field textarea {
  min-width: 0;
  font-size: 12px;
}
.copy-field button {
  padding: 8px 12px;
  min-height: 40px;
  font-size: 14px;
}
#codex-command {
  font-family: ui-monospace, SFMono-Regular, monospace;
  line-height: 1.7;
}
.settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding: 8px 0 0;
  margin-top: 24px;
}
.settings-row > div {
  width: auto;
}
.settings-row label {
  margin-top: 12px;
}
.settings-row > .helper {
  grid-column: 1 / -1;
  margin: 0;
}
.workers-table {
  min-width: 940px;
}
.workers-table th:nth-child(1) {
  width: 20%;
}
.workers-table th:nth-child(2) {
  width: 15%;
}
.workers-table th:nth-child(3) {
  width: 20%;
}
.workers-table th:nth-child(4) {
  width: 21%;
}
.workers-table th:nth-child(5) {
  width: 12%;
}
.workers-table th:nth-child(6) {
  width: 12%;
}
.workers-table td > .badge {
  margin-top: 7px;
}
.workers-table .worker-id {
  display: flex;
  align-items: center;
  gap: 6px;
}
.worker-id > span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.worker-id button {
  flex: none;
}
.worker-context > a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.worker-context > .error-text {
  white-space: normal;
  overflow-wrap: anywhere;
}
.copy-mini,
.text-button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 0;
  min-height: 24px;
  min-width: 24px;
  font-size: 12px;
  color: var(--ink);
}
.product-title:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.copy-mini {
  font-size: 12px;
  margin-left: 4px;
}
.workers-table td:last-child button {
  padding: 3px 6px;
  min-height: 28px;
  font-size: 12px;
  margin-bottom: 4px;
}
#notice,
#task-error,
#login-error,
#bulk-rejected {
  background: var(--soft);
  border-radius: var(--radius-panel);
  padding: 20px 24px;
  font-size: 12px;
  margin: 0 0 18px;
}
#notice.error,
#task-error,
#login-error,
#bulk-rejected {
  color: var(--danger);
  background: #322322;
}
#task-error,
#bulk-rejected {
  margin: 14px 0 0;
}
#bulk-rejected ul {
  padding-left: 20px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}
dialog {
  width: min(480px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 18px 80px #0005;
}
dialog::backdrop {
  background: #0008;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* 两类 Worker 共用配对信息，切换执行类型时仍可直接复制。 */
.shared-connection {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 20px 0 0;
}
.shared-connection label {
  display: block;
  margin: 0 0 8px;
}
.row-actions small {
  font-size: 12px;
  color: var(--muted);
}
.error-text {
  font-size: 12px;
  white-space: normal;
}
.pagination input[type='number'] {
  width: 64px;
}
/* 抽屉独立滚动，列表和筛选位置不会被长详情推走。 */
html {
  scrollbar-gutter: stable;
}
body:has(dialog[open]) {
  overflow: hidden;
}
.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(800px, calc(100vw - 40px));
  height: 100dvh;
  max-height: none;
  max-width: none;
  padding: 0;
  border-radius: 0;
  border-width: 0 0 0 1px;
  background: #1c1c1c;
  color: var(--text);
  box-shadow: -12px 0 48px #0004;
}
.detail-drawer[open] {
  display: flex;
  flex-direction: column;
  animation: drawer-enter 0.2s ease-out;
}
.detail-drawer::backdrop {
  background: #0006;
}
@keyframes drawer-enter {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: #202020;
}
.drawer-header > div {
  min-width: 0;
}
.drawer-header .icon-button {
  flex: none;
  background: transparent;
  color: var(--muted);
  font-size: 23px;
}
.drawer-kicker {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}
.drawer-header h2 {
  font-size: 20px;
  line-height: 1.45;
  font-weight: 500;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px 24px 40px;
}
.drawer-body > .product-record {
  border-top: 0;
}
.drawer-body table {
  min-width: 0;
}
.drawer-body th,
.drawer-body td {
  padding: 12px 8px;
}
.drawer-body .product-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.drawer-body .product-record > summary {
  flex-wrap: wrap;
}
.drawer-body .product-record > summary > strong {
  flex-basis: 65%;
  line-height: 1.6;
}
.drawer-body .product-record .helper {
  overflow-wrap: anywhere;
}
.task-summary > div {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}
.task-summary > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.drawer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.drawer-section {
  margin-top: 32px;
}
.drawer-section h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 500;
}
.drawer-section .detail-stages {
  margin: 0;
  background: #202020;
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 6px;
}
.detail-alert {
  padding: 16px 20px;
  background: #322322;
  color: var(--danger);
  border-radius: var(--radius-panel);
  line-height: 1.7;
  font-size: 13px;
  margin: 16px 0 0;
}
.item-result {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.item-heading,
.job-record > div {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.item-heading > strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
.item-heading > .numeric {
  flex: none;
  padding-top: 3px;
}
.item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.brand-evidence {
  margin-top: 12px;
}
.brand-evidence > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}
.item-result > small {
  font-size: 12px;
}
.item-result .error-text {
  margin-bottom: 0;
}
.processing-records {
  border-top: 1px solid var(--line);
  margin-top: 32px;
}
.processing-records > summary {
  list-style: none;
  padding: 20px 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.processing-records > summary::after {
  content: '＋';
  float: right;
  color: var(--muted);
}
.processing-records[open] > summary::after {
  content: '−';
}
.job-record {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.job-record p {
  margin: 10px 0 0;
}
#drawer-notice {
  margin: 16px 28px 0;
  padding: 12px 16px;
  border-radius: var(--radius-input);
  background: var(--soft);
  font-size: 13px;
}
#drawer-notice.error {
  background: #322322;
  color: var(--danger);
}
.task-row.selected td:first-child {
  box-shadow: inset 3px 0 var(--accent);
}
.log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  font-size: 12px;
}
.log-row {
  border-left: 2px solid var(--line);
  padding: 0 0 20px 16px;
  margin: 0 0 4px;
  font-size: 13px;
}
.log-heading {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.log-row p {
  margin: 8px 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.log-row small {
  display: block;
  overflow-wrap: anywhere;
}
.log-error {
  border-color: var(--danger);
}
.log-warn {
  border-color: var(--warning);
}
.log-error .log-level {
  color: var(--danger);
}
.log-warn .log-level {
  color: var(--warning);
}
.log-data {
  margin-top: 10px;
}
.log-data summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.log-data pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--soft);
  padding: 12px;
  border-radius: var(--radius-input);
  font-size: 12px;
  line-height: 1.6;
}
@media (max-width: 1150px) {
  .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }
  .overview-metric:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }
  .overview-columns {
    gap: 28px;
  }
  main {
    padding: 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .pipeline {
    padding: 16px;
    gap: 14px;
  }
  .stage + .stage {
    padding-left: 14px;
  }
  .worker-setup {
    gap: 24px;
  }
}
@media (max-width: 900px) {
  .shared-connection {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media (max-width: 760px) {
  .overview-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .overview-metrics {
    gap: 24px 16px;
  }
  .overview-metric + .overview-metric {
    padding-left: 16px;
  }
  .overview-metric:nth-child(3) {
    padding-left: 0;
  }
  .metric-value strong {
    font-size: 30px;
  }
  #page-overview .pipeline {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  #page-overview .stage + .stage {
    padding: 20px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .sidebar {
    position: static;
    width: 100%;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: #181818;
  }
  .brand {
    padding: 0;
    font-size: 15px;
  }
  .sidebar nav {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }
  .sidebar nav a {
    margin: 0;
    font-size: 12px;
    padding: 10px 8px;
    border: 0;
    white-space: nowrap;
  }
  .sidebar .nav-icon {
    display: none;
  }
  .workspace {
    margin-left: 0;
  }
  .topbar {
    height: 56px;
    padding: 0 20px;
    font-size: 12px;
  }
  .topbar #updated {
    font-size: 12px;
  }
  main {
    padding: 20px 16px 32px;
  }
  h1 {
    font-size: 14px;
  }
  .control-strip {
    flex-wrap: wrap;
    gap: 12px;
  }
  .composer-fields {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .pipeline {
    gap: 12px;
    border-radius: var(--radius-panel);
  }
  .stage {
    gap: 6px;
    font-size: 12px;
  }
  .stage-title {
    gap: 5px;
  }
  .stage-title strong {
    font-size: 12px;
  }
  .stage-title > span {
    display: none;
  }
  .stage + .stage {
    padding-left: 12px;
  }
  .stage b {
    font-size: 14px;
  }
  .section-heading > span {
    font-size: 12px;
    max-width: 180px;
  }
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search {
    flex-basis: 100%;
    max-width: 100%;
  }
  .search button {
    font-size: 14px;
    padding: 8px 13px;
  }
  .task-toolbar > select {
    flex: 1;
    max-width: none;
  }
  .pagination > div {
    flex-wrap: wrap;
  }
  .pagination {
    gap: 14px;
  }
  .worker-setup {
    flex-wrap: wrap;
    gap: 10px;
  }
  .connection-panel {
    padding: 16px;
  }
  .settings-row > div {
    flex: 1;
    min-width: 140px;
  }
  .settings-row > button {
    margin-top: 6px;
  }
  .tabs {
    gap: 8px;
  }
  .tabs button {
    font-size: 14px;
    padding: 9px 14px;
  }
  .detail-drawer {
    width: 100vw;
    border-radius: 0;
  }
  .drawer-header {
    padding: 20px;
  }
  .drawer-body {
    padding: 20px 20px 32px;
  }
  .drawer-section .detail-stages {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .drawer-body .product-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #drawer-notice {
    margin: 12px 20px 0;
  }
  .breadcrumb > span:first-child,
  .breadcrumb-divider {
    display: none;
  }
  .workspace-heading {
    gap: 8px;
  }
  .workspace-heading > .primary {
    padding: 7px 10px;
  }
  .control-strip > .helper {
    display: none;
  }
  .settings-row {
    grid-template-columns: 1fr;
  }
  .detail-drawer.form-drawer {
    width: 100vw;
  }
}
@media (max-width: 420px) {
  .composer-fields {
    grid-template-columns: 1fr;
  }
  .pipeline {
    padding: 12px;
    gap: 8px;
  }
  .stage + .stage {
    padding-left: 8px;
  }
  .stage-title strong {
    font-size: 12px;
  }
  .section-heading {
    align-items: flex-start;
  }
  .section-heading > span {
    max-width: 130px;
  }
  .topbar > div {
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 触屏上的操作面积扩大，避免小按钮相邻时误触。 */
@media (pointer: coarse) {
  button,
  .button,
  .sidebar nav a {
    min-height: 44px;
  }
  .icon-button {
    width: 44px;
    height: 44px;
  }
}

.worker-batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 0 20px;
}
.worker-select {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  cursor: pointer;
}
.worker-select input {
  width: 15px;
  height: 15px;
  min-height: 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
}
.worker-name {
  align-items: flex-start;
}
.worker-name input {
  margin-top: 3px;
}
.worker-config-form {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}
.worker-sync-status {
  color: var(--ink);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
#worker-config-context {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
