:root {
  color-scheme: light;
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --text: #17211d;
  --muted: #60706a;
  --border: #d7e1dd;
  --accent: #0f7b6c;
  --accent-2: #174ea6;
  --danger: #b42318;
  --warning: #946200;
  --ok: #087443;
  --shadow: 0 14px 36px rgba(22, 32, 29, 0.09);
}

* {
  box-sizing: border-box;
}

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

button,
select,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.2;
}

p,
.hint,
td,
th {
  font-size: 14px;
}

.topbar p,
.panel-header p,
.hint {
  color: var(--muted);
  margin-top: 6px;
}

.status-pill {
  min-width: 112px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

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

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

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}

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

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.controls {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
}

.dropzone {
  position: relative;
  min-height: 156px;
  display: grid;
  place-items: center;
  border: 1px dashed #86a49b;
  border-radius: 8px;
  background: var(--surface-2);
  padding: 16px;
  text-align: center;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: #e7f4f1;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-title {
  font-weight: 800;
}

.drop-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.run-picker,
.section-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.run-picker select,
.section-row select {
  width: auto;
  min-width: 160px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.badge.done,
.badge.completed {
  background: #e7f6ee;
  color: var(--ok);
}

.badge.error,
.badge.completed_with_errors {
  background: #fdecec;
  color: var(--danger);
}

.badge.running,
.badge.processing,
.badge.queued {
  background: #edf4ff;
  color: var(--accent-2);
}

.artifact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.artifact-bar a {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  padding: 7px 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.events-panel {
  margin-top: 12px;
}

.review-grid {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.2fr 1.2fr;
  gap: 12px;
}

.simemp-card {
  grid-column: 1 / -1;
}

.visual-card {
  grid-column: 1 / -1;
}

.evidence-card {
  grid-column: 1 / -1;
}

.baseline-card {
  grid-column: 1 / -1;
}

.simemp-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.visual-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.visual-page {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  min-height: 150px;
}

.visual-page img {
  width: 120px;
  height: 150px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

.visual-page strong,
.visual-page span,
.visual-page p {
  overflow-wrap: anywhere;
}

.summary-list,
.review-list {
  display: grid;
  gap: 8px;
}

.summary-item,
.review-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.summary-item span,
.review-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-item strong,
.review-item strong {
  display: block;
  margin-top: 4px;
}

.review-item p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

pre {
  min-height: 180px;
  max-height: 300px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101816;
  color: #d9f5ec;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .topbar,
  .panel-header {
    flex-direction: column;
  }

  .metrics-grid,
  .workspace,
  .review-grid,
  .simemp-actions,
  .visual-gallery,
  .visual-page {
    grid-template-columns: 1fr;
  }

  .visual-page img {
    width: 100%;
    height: auto;
    max-height: 260px;
  }
}
