:root {
  --paper: #f2f5f3;
  --white: #fff;
  --ink: #20342e;
  --muted: #53655e;
  --pine: #153c35;
  --accent: #006859;
  --line: #d3ded8;
  --soft: #e8f2ed;
  --danger: #972c3e;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: var(--ink);
  background: var(--paper);
  font: 400 15px/1.55 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.13rem; }
h3 { font-size: .96rem; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  color: var(--white);
  background: var(--pine);
}

.topbar-content {
  max-width: 1420px;
  min-height: 62px;
  margin: auto;
  padding: 10px clamp(16px, 4vw, 54px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.03rem;
  font-weight: 650;
  letter-spacing: .015em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  position: relative;
  display: inline-block;
  border: 1px solid #a6d5c2;
  border-radius: 5px;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 4px 5px 5px;
  border: solid #b6ead5;
  border-width: 0 0 2px 2px;
  transform: skewY(-19deg);
}

.page {
  max-width: 1420px;
  margin: auto;
  padding: clamp(26px, 5vw, 62px) clamp(16px, 4vw, 54px) 54px;
}

.page-intro { margin-bottom: 28px; }

.page-intro h1 {
  color: var(--pine);
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  font-weight: 710;
  letter-spacing: -.03em;
  line-height: 1.19;
  margin-bottom: 8px;
}

.page-intro p,
.panel-heading p,
.muted { color: var(--muted); }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 9px;
  min-width: 0;
}

.panel-heading {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p { margin-top: 4px; font-size: .875rem; }
.unlock-panel { max-width: 430px; }
.unlock-form, #run-form { padding: 18px 20px 20px; }
.unlock-form .button { min-width: 100px; margin-top: 16px; }

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

.field + .field { margin-top: 20px; }
.field-label, legend { font-size: .93rem; font-weight: 650; }
.field-label { display: block; margin-bottom: 7px; }

input[type="password"], select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #aabbb3;
  border-radius: 5px;
}

input:disabled, select:disabled { background: var(--paper); }

.target-note {
  padding: 8px 10px;
  margin-top: 9px;
  border-left: 3px solid #76ad94;
  background: var(--soft);
  color: #254b3d;
  font-size: .83rem;
}

.target-note[data-mode="live"] {
  border-color: #be8b3e;
  background: #fbf2df;
  color: #664715;
}

.muted { font-size: .82rem; }
.field > .muted { margin-top: 6px; }
.models { border: 0; padding: 0; margin: 0; min-width: 0; }
.models legend { padding: 0; }

.selection-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 37px;
}

.text-button {
  border: 0;
  padding: 2px 1px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
}

.text-button:not(:disabled):hover { text-decoration: underline; }

.model-list {
  border: 1px solid var(--line);
  border-radius: 5px;
  max-height: 260px;
  overflow: auto;
}

.model-option {
  display: flex;
  align-items: start;
  gap: 9px;
  padding: 10px;
  cursor: pointer;
}

.model-option + .model-option { border-top: 1px solid var(--line); }
.model-option:focus-within { background: var(--soft); }
.model-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.model-option-text { min-width: 0; }
.model-id { font: .82rem/1.55 var(--mono); overflow-wrap: anywhere; }
.model-capability { display: block; color: var(--muted); font-size: .76rem; }

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

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: .87rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.primary { background: var(--accent); color: var(--white); }
.primary:hover:not(:disabled) { background: #005347; }
.secondary { background: var(--white); color: var(--pine); border-color: #afc0b7; }
.secondary:hover:not(:disabled) { background: var(--soft); }

.session-button {
  background: transparent;
  color: var(--white);
  border-color: #86a99c;
}

.session-button:hover:not(:disabled) { background: #285548; }
.session-button:focus-visible { outline-color: #b6ead5; }
button:disabled { opacity: .56; cursor: default; }

.result-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.result-target { overflow-wrap: anywhere; }
.run-summary { padding: 14px 20px; background: #f9fbfa; }
.run-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }

.run-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .85rem;
  font-weight: 620;
}

.run-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7c8b84;
}

.run-state[data-state="running"]::before,
.run-state[data-state="completed"]::before { background: var(--accent); }
.run-state[data-state="error"]::before { background: var(--danger); }
.progress-count { color: var(--muted); font-size: .81rem; font-variant-numeric: tabular-nums; }

progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 5px;
  margin-top: 9px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  accent-color: var(--accent);
}

progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.notice {
  margin-top: 10px;
  padding: 7px 9px;
  border-left: 3px solid currentColor;
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.error { color: var(--danger); background: #fbecf0; }
.matrix-scroll { overflow: auto; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.matrix-scroll:focus-visible { outline-offset: -3px; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: .84rem;
}

th, td {
  min-width: 90px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

thead th { background: #edf3ef; color: #354e44; vertical-align: bottom; white-space: nowrap; }

th:first-child {
  min-width: 160px;
  max-width: 200px;
  position: sticky;
  left: 0;
  z-index: 1;
  padding-left: 20px;
}

tbody th { background: var(--white); font-weight: 600; }
tr > :last-child { border-right: 0; }
tbody tr:last-child > * { border-bottom: 0; }
.empty-matrix { color: var(--muted); padding: 20px; }

.check-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  min-height: 31px;
  padding: 3px 7px;
  background: #edf1ef;
  color: #4d5c55;
  font-size: .79rem;
  font-weight: 580;
  white-space: nowrap;
}

button.check-status { cursor: pointer; }
button.check-status:hover { border-color: currentColor; }
.status-pass { background: #e5f4ec; color: #15543a; }
.status-fail, .status-error { background: #fae8ec; color: #8a2635; }
.status-warn { background: #faf0d7; color: #74500b; }
.status-skip { background: #edf0f3; color: #445562; }

dialog {
  color: var(--ink);
  width: min(610px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  box-shadow: 0 14px 58px #152d2852;
}

dialog::backdrop { background: #152d2878; }

.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-heading .model-id { margin-top: 4px; color: var(--muted); }
.detail-body { padding: 17px 20px 21px; overflow-wrap: anywhere; }
.detail-body > * + * { margin-top: 12px; }
.detail-status { display: flex; }
pre {
  margin: 7px 0 0;
  padding: 10px 12px;
  max-height: 42dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  font: .8rem/1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .page-intro { margin-bottom: 20px; }
  .panel-heading, .unlock-form, #run-form, .run-summary { padding-left: 15px; padding-right: 15px; }
  th:first-child { min-width: 130px; max-width: 155px; padding-left: 15px; }
}
