:root {
  --bg: #e4e8ea;
  --panel: #f7f9f9;
  --ink: #0f1518;
  --muted: #6e7c83;
  --line: rgba(15, 21, 24, 0.14);
  --line-strong: rgba(15, 21, 24, 0.28);
  --accent: #cf3a1b;
  --accent-ink: #ffffff;
  --danger: #c42b1c;
  --f-display: "Newsreader", Georgia, serif;
  --f-ui: "Instrument Sans", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--f-ui);
  color: var(--ink);
  background: var(--bg);
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brandLockup {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brandGlyph {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #0f1518;
  color: var(--accent);
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.topbar h1 {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1;
  margin: 0;
}

.navLinks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.navLinks a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-size: 14px;
}

.navLinks a.active,
.navLinks a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--panel);
}

.appRoot {
  display: grid;
  gap: 18px;
}

.statsGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.statsGrid.compact .statCard strong {
  font-size: 1.5rem;
}

.statCard {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 6px;
}

.statCard strong {
  font-family: var(--f-display);
  font-size: 2rem;
  line-height: 1;
}

.statCard span {
  color: var(--muted);
  font-size: 13px;
}

.splitGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.configureLayout {
  margin-top: 0;
}

.runTableWrap {
  overflow: auto;
}

.dataTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dataTable th,
.dataTable td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.dataTable th {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.tableLink {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.tableLink:hover {
  color: var(--accent);
}

.mono {
  font-family: var(--f-mono);
  font-size: 12px;
}

.metaGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metaLabel {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.leaderList,
.scoreGrid {
  display: grid;
  gap: 12px;
}

.leaderCard,
.scoreCard {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
}

.leaderRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.scoreBar {
  height: 8px;
  background: #edf0f1;
  margin-top: 8px;
}

.scoreBar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.outputBlock {
  min-height: 320px;
  max-height: 640px;
  overflow: auto;
  background: #0f1518;
  color: #e4e8ea;
  padding: 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.crumb {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.crumb:hover {
  color: var(--accent);
}

.primaryLink {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.statusOk {
  color: #0f7b0f;
  font-family: var(--f-mono);
  text-transform: uppercase;
  font-size: 11px;
}

.statusBad {
  color: var(--danger);
  font-family: var(--f-mono);
  text-transform: uppercase;
  font-size: 11px;
}

.emptyState h2 {
  font-family: var(--f-display);
  margin-bottom: 10px;
}

.filters input,
.filters select {
  min-width: 180px;
}

.eyebrow {
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-family: var(--f-display);
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1;
  margin-bottom: 14px;
  font-weight: 600;
}

.lede {
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.55;
}

.heroCard, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(15, 21, 24, 0.04);
}

.heroCard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px;
  align-content: center;
}

.heroCard div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.heroCard div:last-child { border-bottom: 0; padding-bottom: 0; }
.heroCard strong { font-size: 2rem; font-family: var(--f-display); }
.heroCard span { color: var(--muted); text-transform: lowercase; }

.layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  grid-column: span 6;
  padding: 18px;
}

.fullWidth { grid-column: 1 / -1; }

.panelHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panelHeader h2 {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.panelMeta {
  font-size: 13px;
  color: var(--muted);
}

.formGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.formGrid .full { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
}

button {
  border: 1px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

button.primary {
  background: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 7px 12px;
  background: #edf0f1;
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chip.active {
  background: rgba(207, 58, 27, 0.09);
  border-color: var(--accent);
  color: var(--accent);
}

.harnessGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.harnessCard, .caseCard, .presetCard, .historyCard {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 14px;
  background: #ffffff;
}

.harnessTitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.harnessActions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.smallButton {
  padding: 6px 10px;
  font-size: 12px;
}

.mutedText { color: var(--muted); font-size: 13px; line-height: 1.45; }

.modelList, .modeList {
  display: grid;
  gap: 8px;
}

.modelRow, .modeRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.caseList, .presetList, .historyList {
  display: grid;
  gap: 12px;
}

.caseCard header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.caseMeta, .tagList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: 0;
  background: #edf0f1;
  color: var(--muted);
  padding: 5px 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.statusBox {
  min-height: 120px;
  background: #0f1518;
  color: #e4e8ea;
  border-radius: 0;
  padding: 14px;
  overflow: auto;
  font-family: var(--f-mono);
  font-size: 12px;
}

.linkList {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

a.buttonLink {
  display: inline-flex;
  align-items: center;
  border-radius: 0;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}

.danger { color: var(--danger); }

@media (max-width: 1100px) {
  .statsGrid,
  .splitGrid,
  .metaGrid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .panel { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .formGrid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1315;
    --panel: #111819;
    --ink: #e4e8ea;
    --muted: #9aa8af;
    --line: rgba(228, 232, 234, 0.12);
    --line-strong: rgba(228, 232, 234, 0.24);
  }

  input, textarea, select,
  .harnessCard, .caseCard, .presetCard, .historyCard {
    background: #151c1e;
    color: var(--ink);
  }

  .chip { background: #151c1e; }
  .tag { background: #151c1e; }
}
