:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --line: #d8dee6;
  --text: #1f2933;
  --muted: #697586;
  --accent: #136f63;
  --accent-weak: #e5f4f1;
  --bad: #b42318;
  --bad-weak: #fee4e2;
  --warn: #a15c07;
  --warn-weak: #fff2cc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button {
  min-height: 34px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  background: #0f5f55;
  border-color: #0f5f55;
  box-shadow: 0 6px 16px rgba(19, 111, 99, 0.22);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(19, 111, 99, 0.18);
}

button:focus-visible {
  outline: 3px solid rgba(19, 111, 99, 0.24);
  outline-offset: 2px;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: var(--accent-weak);
  color: #0f5f55;
}

button:disabled {
  border-color: var(--line);
  background: #eef1f4;
  color: var(--muted);
  cursor: not-allowed;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  background: #111827;
  color: #fff;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 650;
}

.topbar p {
  margin: 0;
  color: #cbd5e1;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(560px, 1fr) 430px;
  gap: 16px;
  padding: 16px;
}

.sidebar,
.main-panel,
.run-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.remote-executor-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #a7c7bd;
  border-radius: 8px;
  background: #f3faf8;
}

.remote-status {
  margin: 8px 0 12px;
  color: var(--muted);
}

.remote-products {
  background: #fff;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading.compact {
  align-items: center;
}

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

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

h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
}

.section-title {
  margin: 14px 0 8px;
  color: var(--muted);
  font-weight: 650;
}

.status-list {
  margin: 0;
}

.path-editor {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.path-editor label {
  color: var(--muted);
  font-weight: 650;
}

.path-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.path-row input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  color: var(--text);
}

.path-row input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(19, 111, 99, 0.14);
}

.status-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.status-list dt,
.status-list dd {
  margin: 0;
}

.status-list dd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tiny-button {
  min-height: 28px;
  padding: 0 9px;
  border-color: #b7ded7;
  background: #fff;
  color: var(--accent);
  font-size: 12px;
}

.tiny-button:hover:not(:disabled) {
  background: var(--accent-weak);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(19, 111, 99, 0.18);
}

.setup-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0 2px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.setup-panel.needs-attention {
  border-color: #fdb022;
  background: #fffbeb;
}

.setup-copy {
  display: grid;
  gap: 4px;
  line-height: 1.4;
}

.setup-copy span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.setup-button {
  width: 100%;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

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

.path-text {
  max-width: 470px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.product-cell strong,
.value-strong {
  font-weight: 700;
}

.price-cell {
  min-width: 126px;
}

.price-cell div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.6;
}

.price-label {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.image-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(56px, 1fr));
  gap: 8px;
  min-width: 150px;
}

.metric {
  display: inline-flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.metric b {
  color: var(--text);
  font-size: 15px;
}

.run-button {
  min-width: 92px;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip.ok {
  background: var(--accent-weak);
  color: var(--accent);
}

.chip.bad {
  background: var(--bad-weak);
  color: var(--bad);
}

.chip.warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.run-summary {
  min-height: 118px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.batch-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.5;
}

.batch-items {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.batch-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.batch-item span:first-child {
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
}

.timeline li.done {
  color: var(--accent);
  background: var(--accent-weak);
  border-color: #b7ded7;
}

.timeline li.active {
  color: #1849a9;
  background: #e8f1ff;
  border-color: #b2ccff;
}

.timeline li.blocked {
  color: var(--bad);
  background: var(--bad-weak);
  border-color: #fda29b;
}

.timeline em {
  font-style: normal;
  font-size: 12px;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid currentColor;
  font-size: 12px;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.summary-message {
  margin-top: 8px;
  line-height: 1.5;
}

.events-log {
  min-height: 340px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #dbeafe;
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.update-panel {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
