:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #69758a;
  --line: #dfe5ee;
  --surface: #ffffff;
  --page: #f3f6fa;
  --navy: #173763;
  --blue: #2e64c5;
  --green: #16794b;
  --red: #bb3f43;
  --amber: #a5630b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 1120px; background: var(--page); color: var(--ink); font-family: Inter, "Microsoft YaHei", Arial, sans-serif; letter-spacing: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { font-size: 24px; font-weight: 800; letter-spacing: 4px; color: #101828; }
.brand-divider { width: 1px; height: 32px; background: var(--line); }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 16px; }
.brand div span { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-right: 8px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.connection.online i { background: #24a264; }
.connection.error i { background: var(--red); }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line); text-decoration: none; cursor: pointer; font-weight: 650; font-size: 13px; }
.button.primary { background: var(--navy); border-color: var(--navy); color: white; }
.button.secondary { background: white; color: var(--ink); }
.button.danger { background: white; color: var(--red); border-color: #efc8ca; }
.button[hidden] { display: none; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 650; cursor: pointer; }

.workspace { padding: 18px 22px 30px; }
.metrics { height: 82px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.metric { display: flex; flex-direction: column; justify-content: center; padding: 0 22px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { font-size: 25px; line-height: 1; }
.metric span { margin-top: 8px; color: var(--muted); font-size: 12px; }

.columns { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.sidebar, .content { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: calc(100vh - 184px); }
.sidebar { overflow: hidden; }
.section-head { min-height: 62px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: 15px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.runs-head { margin-top: 8px; border-top: 1px solid var(--line); }
.case-list, .run-list { padding: 8px; display: grid; gap: 5px; }
.case-row { min-height: 62px; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border: 1px solid transparent; border-radius: 6px; }
.case-row:hover { background: #f8fafc; }
.case-row input { margin-top: 4px; width: 16px; height: 16px; }
.case-row strong { display: block; font-size: 13px; line-height: 1.4; }
.case-row span { color: var(--muted); font-size: 11px; }
.run-row { width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.run-row:hover, .run-row.active { background: #eef4ff; border-color: #d2dff5; }
.run-row strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.run-row div { margin-top: 6px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

.content { padding: 0 18px 20px; overflow: hidden; }
.empty-state { min-height: 520px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.run-header { min-height: 104px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.run-header h1 { margin: 5px 0 6px; font-size: 22px; }
.run-header p, .eyebrow { margin: 0; color: var(--muted); font-size: 12px; }
.run-actions { display: flex; align-items: center; gap: 9px; }
.status, .mini-status { display: inline-flex; align-items: center; justify-content: center; min-width: 62px; height: 26px; padding: 0 9px; border-radius: 14px; background: #eef2f7; color: #526175; font-size: 11px; font-weight: 700; }
.status.passed, .mini-status.passed { background: #e7f6ee; color: var(--green); }
.status.failed, .mini-status.failed { background: #fdeced; color: var(--red); }
.status.running, .mini-status.running, .mini-status.claimed { background: #e9f0ff; color: var(--blue); }
.mini-status.blocked, .mini-status.error { background: #fff2dc; color: var(--amber); }

.result-band { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; }
.result-band div { padding: 14px 18px; border-right: 1px solid var(--line); }
.result-band div:last-child { border-right: 0; }
.result-band strong { display: block; font-size: 22px; }
.result-band span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.good { color: var(--green); }.bad { color: var(--red); }
.detail-section { border: 1px solid var(--line); border-radius: 8px; margin-top: 14px; overflow: hidden; }
.detail-section .section-head { min-height: 56px; }
.results-table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.results-table th { color: var(--muted); font-weight: 650; text-align: left; background: #f8fafc; }
.results-table th, .results-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.results-table tr:last-child td { border-bottom: 0; }
.results-table th:first-child { width: 31%; }
.result-title { font-weight: 650; line-height: 1.45; }
.result-reason { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.evidence-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.evidence-item { min-height: 64px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe; }
.evidence-item strong { display: block; font-size: 12px; }
.evidence-item a { display: inline-block; margin-top: 7px; color: var(--blue); font-size: 12px; }
.log-list { max-height: 360px; overflow: auto; font-family: Consolas, monospace; font-size: 11px; }
.log-row { display: grid; grid-template-columns: 155px 130px minmax(0, 1fr); gap: 10px; padding: 9px 13px; border-bottom: 1px solid #edf0f5; }
.log-row:last-child { border-bottom: 0; }
.log-row time, .log-event { color: var(--muted); }
.log-row.error .log-message { color: var(--red); }

dialog { width: 560px; padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 70px rgba(26, 39, 64, .24); }
dialog::backdrop { background: rgba(17, 27, 46, .45); }
dialog form { padding: 18px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head button { border: 0; background: transparent; font-size: 24px; cursor: pointer; }
dialog label { display: grid; gap: 6px; margin: 12px 0; font-size: 12px; font-weight: 650; }
dialog input[type="text"], dialog select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.test-impact-warning { margin: 12px 0; padding: 12px 14px; border: 1px solid #f2d08a; border-radius: 6px; background: #fff8e7; color: #7a4b00; font-size: 12px; line-height: 1.55; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 14px 0; padding: 10px; }
legend { padding: 0 5px; font-size: 12px; font-weight: 650; }
.dialog-case-list { max-height: 260px; overflow: auto; display: grid; gap: 4px; }
.dialog-case-list label { grid-template-columns: 20px 1fr; align-items: center; margin: 0; padding: 7px; font-weight: 500; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; right: 22px; bottom: 22px; min-width: 240px; max-width: 420px; padding: 12px 15px; background: #182235; color: white; border-radius: 6px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; font-size: 13px; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1280px) {
  .columns { grid-template-columns: 290px minmax(0, 1fr); }
  .evidence-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
