:root {
  color-scheme: light dark;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #61707b;
  --line: #d8e0e5;
  --accent: #0b6bcb;
  --good: #137a3a;
  --warn: #a26000;
  --bad: #a12828;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --panel: #161c21;
    --text: #eef3f6;
    --muted: #a1adb6;
    --line: #2a343c;
    --accent: #65a9ff;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 34px 18px;
  border-bottom: 1px solid var(--line);
}

.top-actions, .section-title, .card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  margin-bottom: 14px;
}

main {
  padding: 24px 34px 34px;
  display: grid;
  gap: 20px;
}

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

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

.step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.step span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent), transparent 86%);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.step p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

select, textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: transparent;
  font: inherit;
}

textarea {
  min-height: 132px;
  margin: 12px 0;
  resize: vertical;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 12px;
}

.section-title {
  justify-content: space-between;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

button, .secondary {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 11px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

button:disabled {
  cursor: default;
  opacity: .65;
}

.segmented button.active, .primary {
  background: var(--accent);
  color: #fff;
}

.primary, .secondary {
  border-radius: 6px;
}

.secondary {
  border: 1px solid var(--line);
}

.hint {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  vertical-align: 1px;
}

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

.batch-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 1fr 130px 90px 180px;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
}

.batch-row.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 93%);
}

.batch-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.empty-row {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 18px;
}

.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.lab-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.lab-card h3 {
  margin: 0;
  font-size: 16px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag, .status-pill, .status {
  border-radius: 999px;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--accent), transparent 86%);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill {
  color: var(--good);
  background: color-mix(in srgb, var(--good), transparent 88%);
}

.status-draft {
  color: var(--muted);
}

.status-sent {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn), transparent 88%);
}

.status-review {
  color: var(--good);
  background: color-mix(in srgb, var(--good), transparent 88%);
}

.muted {
  color: var(--muted);
}

.endpoint, .work-order, .results-table {
  min-height: 96px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.work-order, .results-table {
  min-height: 280px;
  max-height: 420px;
}

.results-empty {
  min-height: 280px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

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

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

.pass {
  color: var(--good);
}

.fail {
  color: var(--bad);
}

.timeline {
  margin-bottom: 0;
}

.timeline li {
  margin-bottom: 8px;
}

.timeline span {
  display: inline-block;
  min-width: 170px;
  color: var(--muted);
  font-size: 12px;
}

footer {
  padding: 0 34px 28px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .workflow, .two-column, .lab-grid {
    grid-template-columns: 1fr;
  }

  .batch-row {
    grid-template-columns: 1fr;
  }
}
