:root {
  color-scheme: light;
  --paper: #f6f3ea;
  --panel: #fffdf7;
  --ink: #1d2824;
  --muted: #68736d;
  --line: #d8d0bf;
  --field: #ece6d9;
  --teal: #2f8176;
  --blue: #345f8e;
  --amber: #ba7427;
  --red: #b7463f;
  --plum: #6f4e7a;
  --shadow: 0 18px 45px rgba(40, 50, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 129, 118, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(186, 116, 39, 0.08) 0 1px, transparent 1px 100%),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: "Aptos", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
table {
  font: inherit;
}

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

.topbar,
.blocker-band,
.metric-grid,
.experiment-grid,
.tables,
.search-terms {
  margin-bottom: 16px;
}

.topbar {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0 10px;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

h1 {
  font-family: "Aptos Display", "Arial Narrow", "Aptos", sans-serif;
  font-size: clamp(2rem, 5vw, 4.8rem);
  font-weight: 900;
  line-height: 0.95;
  margin-bottom: 0;
}

h2 {
  font-size: 1.08rem;
  line-height: 1.2;
  margin-bottom: 0;
}

.topbar__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button {
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: #fffdf7;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

.button:focus-visible {
  outline: 3px solid rgba(52, 95, 142, 0.35);
  outline-offset: 2px;
}

.chip,
.pill {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 30px;
  padding: 0 10px;
  text-transform: uppercase;
}

.chip--ok {
  background: rgba(47, 129, 118, 0.12);
  border-color: rgba(47, 129, 118, 0.34);
  color: #15574e;
}

.chip--warn {
  background: rgba(186, 116, 39, 0.14);
  border-color: rgba(186, 116, 39, 0.34);
  color: #835019;
}

.chip--bad {
  background: rgba(183, 70, 63, 0.13);
  border-color: rgba(183, 70, 63, 0.35);
  color: #8d302b;
}

.chip--idle {
  background: var(--field);
  color: var(--muted);
}

.blocker-band {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 8px solid var(--amber);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1.3fr);
  padding: 18px;
}

.blocker-band.is-critical {
  border-left-color: var(--red);
}

.blocker-band.is-clear {
  border-left-color: var(--teal);
}

.blocker-band p:last-child {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0;
}

.metric-grid,
.experiment-grid,
.tables {
  display: grid;
  gap: 12px;
}

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

.metric-card,
.experiment-card,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(40, 50, 44, 0.08);
}

.metric-card {
  min-height: 122px;
  padding: 16px;
}

.metric-card strong {
  display: block;
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  line-height: 1;
  margin-bottom: 10px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.experiment-card {
  display: grid;
  gap: 16px;
  grid-template-columns: 10px minmax(0, 1fr);
  min-height: 260px;
  overflow: hidden;
}

.experiment-rail {
  background: linear-gradient(180deg, var(--blue), var(--teal) 58%, var(--amber));
}

.experiment-card[data-status*="blocked"] .experiment-rail,
.experiment-card[data-status*="intervention"] .experiment-rail {
  background: linear-gradient(180deg, var(--red), var(--amber));
}

.experiment-body {
  padding: 18px 18px 18px 4px;
}

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

.experiment-title {
  margin-bottom: 5px;
}

.experiment-status {
  flex: 0 0 auto;
}

.scoreline {
  background: var(--field);
  border-radius: 999px;
  height: 12px;
  margin: 10px 0 14px;
  overflow: hidden;
}

.scoreline > span {
  background: linear-gradient(90deg, var(--red), var(--amber), var(--teal));
  display: block;
  height: 100%;
  min-width: 2%;
  transition: width 240ms ease;
}

.experiment-copy {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin-bottom: 14px;
}

.next-action {
  background: rgba(52, 95, 142, 0.08);
  border: 1px solid rgba(52, 95, 142, 0.18);
  border-radius: 8px;
  color: #274d78;
  font-size: 0.92rem;
  line-height: 1.4;
  margin: 0;
  padding: 12px;
}

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

.table-panel {
  overflow: hidden;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

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

table {
  border-collapse: collapse;
  min-width: 640px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid rgba(216, 208, 191, 0.72);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(236, 230, 217, 0.55);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
  line-height: 1.35;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  color: #2d3733;
  font-family: "SF Mono", "Roboto Mono", ui-monospace, monospace;
  font-size: 0.82rem;
}

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

.tag {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  text-transform: uppercase;
}

.tag--bad {
  border-color: rgba(183, 70, 63, 0.28);
  color: var(--red);
}

.tag--warn {
  border-color: rgba(186, 116, 39, 0.28);
  color: var(--amber);
}

.tag--good {
  border-color: rgba(47, 129, 118, 0.3);
  color: var(--teal);
}

@media (max-width: 980px) {
  .topbar,
  .blocker-band {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar__actions {
    justify-content: start;
  }

  .metric-grid,
  .experiment-grid,
  .tables {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 12px;
  }

  .metric-card {
    min-height: 104px;
  }

  .blocker-band,
  .panel-heading {
    padding: 14px;
  }

  .experiment-body {
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
