/*
 * MLE Explore stylesheet.
 * Shared by the dashboard and the generated trajectory page, which copies this
 * file as dashboard.css (scripts/visualize_all_code_trajectories.py).
 * Trajectory-only rules live in scripts/code_trajectory_page.css.
 */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --ink: #23332d;
  --text-2: #657267;
  --muted: #78847c;
  --line: #e1e6df;
  --surface: #fff;
  --surface-2: #eef1eb;
  --surface-3: #f7f8f5;
  --brand: #244e41;
  --link: #426d61;
  --focus: #238a79;
  --control-line: #d8e0d5;
  --control-ink: #4b6150;

  /* Series colors carry one meaning everywhere. */
  --train: #238a79;
  --test: #b77145;
  --test-faint: #b9a99b;
  --selected: #59439b;
  --selected-control: #6657a8;

  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

/* Base ------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px var(--sans);
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -1px;
}
h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.3px;
}
p {
  line-height: 1.6;
}
summary {
  padding: 18px 20px;
  font-size: 17px;
  cursor: pointer;
}
button {
  padding: 9px 13px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--control-ink);
  font-family: inherit;
  cursor: pointer;
}
button:hover {
  background: #eaf0e7;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th,
td {
  padding: 13px 16px;
  text-align: right;
}
th {
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
  color: var(--text-2);
  font: 400 12px var(--mono);
}
td {
  border-bottom: 1px solid var(--surface-2);
  color: #65765e;
  font: 13px var(--mono);
}
th:first-child,
td:first-child {
  text-align: left;
}
td:first-child {
  color: #314b35;
  font-family: "DM Sans", sans-serif;
}

/* Page frame ------------------------------------------------------------- */
aside {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: 232px;
  padding: 32px 20px;
  overflow-y: auto;
  background: var(--surface-2);
}
main {
  max-width: 1800px;
  margin-left: 232px;
  padding: 0 40px 25px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
  color: #899389;
  font-size: 14px;
}
footer {
  max-width: 1050px;
  padding-top: 10px;
  color: #899580;
  font-size: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-family: serif;
  font-size: 26px;
}
.aside-label {
  margin: 33px 10px 15px;
  color: #7f8d7f;
  font: 12px var(--mono);
  letter-spacing: 1px;
}
/* Sidebar links between the site's views; shared with the model trajectory page. */
.site-nav {
  display: block;
  padding: 12px 10px;
  font-size: 13px;
  color: #677469;
  text-decoration: none;
}
.site-nav.active {
  background: #dde7dc;
  border-radius: 6px;
  color: #264d3e;
}
/* The key-gated researcher server serves only this page, not the other views. */
[data-private] .public-only {
  display: none;
}
.breadcrumb strong {
  margin-left: 4px;
  color: #526251;
  font-weight: 500;
}
.freshness {
  font: 12px var(--mono);
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 16px;
}
.intro button {
  flex: none;
  padding: 6px 10px;
  white-space: nowrap;
}
.title-with-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.chart-note {
  margin: 8px 0 20px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}
.empty {
  padding: 50px;
  color: #8b9785;
  font-size: 12px;
  text-align: center;
}
#dataStatus {
  padding-top: 8px;
  color: var(--text-2);
  font: 13px var(--mono);
}

/* Filters ---------------------------------------------------------------- */
.env-button {
  display: block;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: #677469;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.env-button.active {
  background: #e4eae1;
  color: #264d3e;
}
.env-button:disabled {
  opacity: 0.4;
  cursor: default;
}
.env-button b {
  float: right;
  font: 12px var(--mono);
}
.filter-group {
  margin-top: 22px;
}
.filter-group h2 {
  margin: 0 10px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}
.filter-group .env-button {
  padding: 9px 10px;
  font-size: 13px;
}

.filter-disclosure > summary {
  display: none;
}

/* Run status ------------------------------------------------------------- */
.agent-activity {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-2);
  font-size: 13px;
}
.agent-activity > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.agent-activity strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #929b96;
}
.status-running {
  background: #4e80bd;
  animation: status-breathe 2.8s ease-in-out infinite;
}
.status-completed {
  background: #329465;
}
.status-queued {
  background: #a0a7a2;
}
.status-interrupted,
.status-timed_out {
  background: #c49349;
}
.status-failed {
  background: #bd625b;
}
@keyframes status-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}
.badge {
  padding: 4px 7px;
  border-radius: 4px;
  background: #e3eee5;
  color: #3a7952;
  font: 12px var(--mono);
  letter-spacing: 0.2px;
}
.badge.control {
  background: #ece9df;
  color: #887749;
}
.badge.warn {
  background: #f7eadb;
  color: #a57537;
}

/* Shared controls -------------------------------------------------------- */
.range-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 6px;
  background: var(--surface-2);
}
.range-toggle label {
  position: relative;
  cursor: pointer;
}
.range-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.range-toggle span {
  display: block;
  padding: 5px 10px;
  border-radius: 4px;
  color: var(--text-2);
  line-height: 1.2;
}
.range-toggle input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px #23332d18;
}
.range-toggle input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.repeat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.repeat-toggle input {
  accent-color: var(--selected-control);
}

/* Panels ----------------------------------------------------------------- */
.panel {
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0 10px;
}
.panel-top p {
  margin: 5px 0 0;
  color: var(--text-2);
  font-size: 14px;
}
.table-scroll {
  overflow: auto;
}

/* Overview --------------------------------------------------------------- */
.overview-panel {
  margin-top: 0;
  margin-bottom: 24px;
}
.overview-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.overview-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
}
.overview-heading h2 {
  font-size: 16px;
}
#overviewCount {
  color: var(--text-2);
  font-size: 13px;
}
.trend-key {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-2);
  font-size: 12px;
}
.trend-test {
  color: var(--test-faint);
}
.trend-selected {
  color: var(--selected-control);
}
.trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}
.trend-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  text-align: left;
  cursor: default;
}
.trend-card:nth-child(3n + 1) {
  border-left: 0;
}
.trend-card:nth-child(-n + 3) {
  border-top: 0;
}
.trend-card svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 170px;
  margin: 8px 0 4px;
}
.trend-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.trend-card-heading strong {
  color: #37502f;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.trend-card-heading small {
  flex: none;
  color: #586b50;
  font: 12px var(--mono);
  white-space: nowrap;
}
.trend-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 2px;
  color: var(--text-2);
  font-size: 12px;
}
.run-lifecycle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.view-run {
  display: inline-block;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 12px;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.view-run:hover {
  background: none;
  color: var(--ink);
  text-decoration: underline;
}
.trend-tick {
  fill: #67765e;
  font: 10px var(--mono);
}
.test-curve {
  stroke-opacity: 0.28;
  stroke-width: 1.2;
}
.test-point {
  fill-opacity: 0.28;
}
.selection-curve {
  stroke: var(--selected);
  stroke-width: 2.8;
}
.selection-marker {
  stroke: var(--selected);
  stroke-width: 1.6;
}
.offscale-point {
  cursor: help;
}

/* Per-task comparison ---------------------------------------------------- */
.home-comparison-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 12px;
  font-size: 13px;
}
.home-comparison-controls select {
  margin-left: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
.home-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.compare-group {
  min-width: 0;
  padding: 20px;
  border-top: 1px solid var(--line);
}
.compare-group:nth-child(even) {
  border-left: 1px solid var(--line);
}
.compare-group h2 {
  font-size: 17px;
}
.compare-condition {
  margin: 6px 0;
  color: var(--text-2);
  font-size: 12px;
}
.compare-group svg {
  display: block;
  width: 100%;
  margin: 10px 0 0;
}
.compare-group svg text {
  fill: var(--text-2);
  font: 11px var(--mono);
}
.compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 18px;
  margin: 12px 0;
  font-size: 12px;
}
.compare-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.compare-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Environment support ---------------------------------------------------- */
.support-panel {
  margin-top: 32px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}
.support-panel summary {
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}
#supportBody {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  padding-top: 24px;
}
.support-chart {
  display: grid;
  flex: none;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
}
.support-chart > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--surface);
}
.support-chart strong {
  font-size: 26px;
}
.support-chart span {
  font-size: 14px;
}
.support-counts {
  display: grid;
  gap: 10px;
  width: 230px;
  font-size: 14px;
}
.support-counts > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.support-counts i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 50%;
}
.support-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
}
.support-links a {
  color: var(--link);
}

/* Run detail ------------------------------------------------------------- */
.session-page .intro {
  margin-bottom: 8px;
}
#backOverview {
  margin-bottom: 20px;
  padding: 5px 0;
  border: 0;
  background: none;
  font-size: 13px;
}
.session-identity {
  margin: 8px 0 18px;
  color: var(--muted);
  font: 11px var(--mono);
  overflow-wrap: anywhere;
}
.toolbar {
  display: flex;
  align-items: end;
  gap: 16px;
  margin: 0 0 16px;
}
.toolbar > div:first-child {
  flex: 1;
  min-width: 0;
  max-width: 620px;
}
.toolbar label {
  display: block;
  margin-bottom: 6px;
  color: #849080;
  font-size: 13px;
}
.toolbar select {
  width: 100%;
  max-width: 100%;
  padding: 10px 32px 10px 10px;
  border: 1px solid #dce3d8;
  border-radius: 6px;
  background: var(--surface);
  color: #384e3d;
  font: 13px "DM Sans", sans-serif;
}
.toolbar .toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  color: #6f7870;
  white-space: nowrap;
}
.toggle input {
  accent-color: var(--test);
}
.session-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #809080;
  font: 13px / 1.8 var(--mono);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: 12px 0;
}
.stat-label {
  color: var(--text-2);
  font: 12px var(--mono);
}
.stat-value {
  margin: 9px 0 4px;
  font-size: 29px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.stat-value em {
  margin-left: 5px;
  color: #8b9787;
  font: 11px var(--mono);
  font-style: normal;
}
.stat-sub {
  max-width: 260px;
  color: var(--text-2);
  font: 12px / 1.5 "DM Sans", sans-serif;
}
#detailView > .panel {
  margin-top: 28px;
}
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.charts .panel {
  min-width: 0;
  margin-bottom: 0;
}
.legend {
  display: flex;
  gap: 12px;
  padding-top: 3px;
  font-size: 13px;
  white-space: nowrap;
}
.legend span:before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
}
.legend .train:before {
  background: var(--train);
}
.legend .test:before {
  background: var(--test);
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  overflow: visible;
}
.chart .tick,
.chart .axis-label {
  fill: var(--text-2);
  font: 12px var(--mono);
}
.chart .hit {
  cursor: crosshair;
}
.hover-readout {
  min-height: 20px;
  margin: 8px 0;
  color: #71836c;
  font: 13px var(--mono);
}
.hover-readout:empty,
.detail:empty {
  display: none;
}
.ledger {
  max-height: 440px;
}
.ledger tr {
  cursor: pointer;
}
.ledger tr:hover,
.ledger tr.active {
  background: #f2f6ee;
}
.ledger th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-3);
}
.detail {
  margin-top: 12px;
  padding: 17px 20px;
  border-radius: 6px;
  background: #f8faf5;
  color: #647a5c;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.detail code {
  color: var(--text-2);
  font: 13px var(--mono);
}
#detailView details.panel {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
#detailView details.panel summary {
  padding: 0 0 12px;
  font-size: 15px;
}

/* Responsive ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .status-running {
    animation: none;
  }
}
@media (min-width: 1800px) {
  .home-comparison-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .compare-group:nth-child(n) {
    border-left: 1px solid var(--line);
  }
  .compare-group:nth-child(3n + 1) {
    border-left: 0;
  }
}
@media (max-width: 1200px) {
  main {
    padding: 0 24px 25px;
  }
  .legend {
    gap: 7px;
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-wrap: wrap;
  }
}
@media (max-width: 1150px) {
  .trend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .trend-card:nth-child(3n + 1) {
    border-left: 1px solid var(--line);
  }
  .trend-card:nth-child(-n + 3) {
    border-top: 1px solid var(--line);
  }
  .trend-card:nth-child(2n + 1) {
    border-left: 0;
  }
  .trend-card:nth-child(-n + 2) {
    border-top: 0;
  }
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
  }
}
@media (max-width: 900px) {
  .home-comparison-grid {
    grid-template-columns: 1fr;
  }
  .compare-group:nth-child(n) {
    padding: 20px 0;
    border-left: 0;
  }
}
@media (max-width: 800px) {
  aside {
    position: static;
    display: block;
    width: auto;
    padding: 16px;
  }
  main {
    margin-left: 0;
    padding: 0 16px;
  }
  .aside-label {
    display: none;
  }
  .filter-disclosure > summary {
    display: list-item;
    margin-top: 12px;
    padding: 4px 0;
    color: var(--control-ink);
    font-size: 14px;
  }
  #environments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin-top: 12px;
  }
  .filter-reset {
    grid-column: 1 / -1;
  }
  .filter-group {
    margin: 0;
  }
  .session-page aside {
    padding: 12px 16px;
  }
  .session-page .filter-disclosure {
    display: none;
  }
  .freshness {
    font-size: 11px;
  }
  .breadcrumb {
    font-size: 12px;
  }
  .panel-top {
    flex-wrap: wrap;
    padding-bottom: 15px;
  }
  .toolbar > div:first-child {
    flex-basis: 100%;
  }
  .stat-label {
    font-size: 11px;
  }
  .stat-value {
    font-size: 26px;
  }
}
@media (max-width: 650px) {
  header {
    height: 34px;
  }
  .intro {
    margin: 6px 0 14px;
  }
  h1 {
    font-size: 25px;
  }
  .title-with-status {
    gap: 8px 16px;
  }
  .agent-activity {
    gap: 12px;
    font-size: 12px;
  }
  .overview-toolbar {
    gap: 8px;
  }
  .overview-heading {
    gap: 10px;
  }
  .trend-grid {
    grid-template-columns: 1fr;
  }
  .trend-card:nth-child(n) {
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .trend-card:first-child {
    border-top: 0;
  }
  .session-info {
    gap: 8px;
  }
  .stat-label {
    font-size: 10px;
  }
  .stat-value {
    font-size: 25px;
  }
  .stat-sub {
    font-size: 11px;
  }
}
