:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #57606a;
  --line: #d8dee4;
  --accent: #1f6feb;
  --accent-soft: #eaf2ff;
  --success: #1a7f37;
  --warning: #9a6700;
  --danger: #cf222e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

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

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

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

.file-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.file-item svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary {
  border-color: rgba(31, 111, 235, 0.35);
  background: var(--accent);
  color: #fff;
}

.ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

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

.step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-left: 2px solid var(--line);
  background: #fafbfc;
  color: var(--muted);
}

.step.running {
  border-left-color: var(--accent);
  color: var(--text);
}

.step.done {
  border-left-color: var(--success);
  color: var(--text);
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.step-title {
  font-weight: 600;
}

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

.results {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  min-height: 30px;
  padding: 0 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.tab.active {
  border-color: rgba(31, 111, 235, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.tab-body {
  flex: 1;
  min-height: 0;
}

.chat {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.message {
  display: grid;
  gap: 4px;
  max-width: 92%;
}

.message.user {
  justify-self: end;
}

.message.agent {
  justify-self: start;
}

.role {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bubble {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  font-size: 13px;
}

.message.user .bubble {
  border-color: rgba(31, 111, 235, 0.25);
  background: var(--accent-soft);
}

.bubble ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.sheets {
  min-height: 320px;
}

.sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f3f5f7;
  color: var(--muted);
  font-weight: 700;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.state-pass {
  color: var(--success);
  font-weight: 700;
}

.state-warn {
  color: var(--warning);
  font-weight: 700;
}

.state-fail {
  color: var(--danger);
  font-weight: 700;
}

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

.detail {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.detail ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .workbench,
  .details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 28px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
