:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --blue: #2563eb;
  --green: #12805c;
  --amber: #a15c07;
  --red: #b42318;
  --teal: #0f766e;
  --shadow: 0 14px 36px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar,
.workspace,
.summary-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.nav-link:hover {
  border-color: var(--blue);
}

.nav-link.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.dev-gate {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #9bd7c7;
  border-radius: 8px;
  background: #f1fbf8;
  color: var(--text);
}

.dev-gate strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.dev-gate p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.dev-gate.locked {
  border-color: var(--line);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.icon-button:hover {
  border-color: var(--blue);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 82px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-panel,
.detail-panel,
.overview-panel {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-panel {
  padding: 14px;
}

.overview-panel {
  min-height: auto;
  margin-bottom: 16px;
  padding: 14px;
}

.detail-panel {
  padding: 18px;
}

.panel-heading,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.overview-stats div {
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.overview-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.overview-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

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

.table-tile {
  min-height: 110px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.table-tile.connected {
  border-color: #9bd7c7;
  background: #f1fbf8;
}

.table-tile strong,
.table-tile span,
.table-tile p {
  display: block;
}

.table-tile strong {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.table-tile span {
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

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

.task-card {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.task-card:hover,
.task-card.active {
  border-color: var(--blue);
  background: #eff6ff;
}

.task-card strong,
.task-card span {
  display: block;
}

.task-card strong {
  margin-bottom: 6px;
  font-size: 15px;
}

.task-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #edf7f3;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.status-badge.review_required {
  background: #fff6e8;
  color: var(--amber);
}

.status-badge.failed {
  background: #fff1f0;
  color: var(--red);
}

.empty-state {
  display: grid;
  min-height: 520px;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--text);
}

.hidden {
  display: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.data-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.data-block.full {
  width: 100%;
}

pre {
  overflow: auto;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.row-list {
  display: grid;
  gap: 8px;
}

.row-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.row-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.row-item p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.error-title {
  color: var(--red);
}

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

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

  .task-panel,
  .detail-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .overview-stats,
  .table-overview {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

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

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
