:root {
  color-scheme: dark;
  --bg: #080b0d;
  --sidebar: #0d1115;
  --panel: #12171b;
  --panel-soft: #171d22;
  --line: #26313a;
  --line-strong: #35444d;
  --text: #f4f7f5;
  --muted: #9ba8a3;
  --teal: #38d6c2;
  --green: #8ed76d;
  --amber: #f2b544;
  --rose: #f06d8a;
  --blue: #7ba7ff;
  --ink: #06110f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input,
select {
  font: inherit;
}

.product-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--teal);
  font-weight: 900;
}

.brand strong,
.brand span,
.module-item strong,
.module-item span {
  display: block;
}

.brand span,
.module-item span,
.sidebar-block small {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-list a:hover,
.nav-list .active {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel);
}

.sidebar-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.block-label,
.eyebrow {
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-block input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-soft);
  padding: 0 10px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.app-header h1 {
  max-width: 920px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 0;
  color: var(--ink);
  background: var(--teal);
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-soft);
}

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

.kpi-grid,
.workbench-grid,
.chart-grid,
.table-grid,
.evidence-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workbench-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
}

.chart-grid,
.table-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evidence-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.kpi {
  min-height: 132px;
  padding: 18px;
}

.kpi span,
.kpi small {
  color: var(--muted);
}

.kpi strong {
  display: block;
  margin: 14px 0 8px;
  font-size: clamp(1.35rem, 2.7vw, 2.2rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-head h2 {
  margin: 5px 0 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.panel-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.run-form label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.run-form select,
.run-form input[type="range"] {
  grid-column: 1 / -1;
}

.run-form select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-soft);
  padding: 0 10px;
}

.run-form input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.run-form output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.run-form .secondary-button {
  align-self: end;
}

.api-output {
  min-height: 118px;
  max-height: 250px;
  margin: 14px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #0b0f12;
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.module-list,
.artifact-links {
  display: grid;
  gap: 10px;
}

.module-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.module-item:last-child {
  border-bottom: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--text);
  font-weight: 800;
}

canvas,
.artifact-image {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1316;
}

canvas {
  height: auto;
  aspect-ratio: 2 / 1;
}

.artifact-links {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.artifact-links a {
  min-height: 54px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-soft);
  text-decoration: none;
}

.artifact-links a:hover {
  border-color: var(--teal);
}

.product-note {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.product-note h2 {
  margin: 6px 0 0;
  font-size: 1.6rem;
}

.product-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.pass-pill,
.watch-pill,
.fail-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.pass-pill {
  color: #d8ffd4;
  background: #17351d;
}

.watch-pill {
  color: #ffe6ad;
  background: #392d13;
}

.fail-pill {
  color: #ffd0d8;
  background: #3b1620;
}

.success-text {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .product-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .kpi-grid,
  .workbench-grid,
  .chart-grid,
  .table-grid,
  .evidence-grid,
  .artifact-links,
  .product-note {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .app-header,
  .panel-head,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .run-form {
    grid-template-columns: 1fr;
  }
}
