:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-muted: #edf1f2;
  --ink: #172126;
  --muted: #647178;
  --line: #d6dde0;
  --line-strong: #b7c2c7;
  --teal: #087f78;
  --teal-soft: #d9efec;
  --coral: #d45d45;
  --coral-soft: #f7e2dd;
  --green: #247a45;
  --green-soft: #dcf0e3;
  --amber: #a46708;
  --amber-soft: #f6e9cc;
  --red: #b33232;
  --red-soft: #f5dddd;
  --blue: #3269a8;
  --shadow: 0 1px 2px rgb(18 32 38 / 5%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 56px);
  background: #182328;
  color: #f7fafb;
  border-bottom: 1px solid #314047;
}
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: #dff2ef; color: #106d68; border-radius: 6px; flex: 0 0 auto; }
.brand-mark svg { width: 21px; }
.brand-block h1 { font-size: 18px; line-height: 1.2; margin-bottom: 3px; font-weight: 690; letter-spacing: 0; }
.brand-block p { margin: 0; color: #acbac0; font-size: 12px; letter-spacing: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.freshness { display: flex; align-items: center; gap: 8px; color: #c6d0d4; font-size: 12px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7f8e94; box-shadow: 0 0 0 3px rgb(127 142 148 / 15%); }
.freshness.live .status-dot { background: #5bc381; box-shadow: 0 0 0 3px rgb(91 195 129 / 16%); }
.freshness.stale .status-dot { background: #efb34f; box-shadow: 0 0 0 3px rgb(239 179 79 / 16%); }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #435159; background: #233138; color: #e3e9eb; border-radius: 6px; }
.icon-button:hover { background: #2b3b43; }
.icon-button svg { width: 17px; }
.icon-button.loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; min-height: 43px; overflow-x: auto; padding: 0 clamp(18px, 4vw, 56px); background: rgb(255 255 255 / 96%); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.section-nav a { color: #506067; text-decoration: none; font-size: 13px; white-space: nowrap; line-height: 42px; border-bottom: 2px solid transparent; }
.section-nav a:hover { color: var(--ink); border-bottom-color: var(--teal); }

.section-band { padding: 34px clamp(18px, 4vw, 56px) 42px; border-bottom: 1px solid var(--line); background: var(--surface); }
.overview-band { background: var(--bg); padding-top: 30px; }
.muted-band { background: var(--surface-muted); }
.config-band { background: #202c31; color: #eef3f4; border: 0; }
.section-inner { width: min(1480px, 100%); margin: 0 auto; }
.overview-heading, .section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin-bottom: 7px; color: var(--teal); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0; }
.config-band .eyebrow { color: #83cec7; }
h2 { margin-bottom: 7px; font-size: 22px; line-height: 1.25; letter-spacing: 0; }
.section-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 0; }

.segmented { display: inline-grid; grid-template-columns: repeat(3, minmax(92px, auto)); border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); flex: 0 0 auto; }
.segmented button { min-height: 36px; padding: 7px 12px; border: 0; border-right: 1px solid var(--line); background: transparent; color: #58666c; font-size: 12px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: #213138; color: #fff; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-card { min-height: 126px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.kpi-label svg { width: 17px; color: #829198; }
.kpi-value { margin: 17px 0 5px; font-size: clamp(24px, 3vw, 34px); line-height: 1; font-weight: 720; font-variant-numeric: tabular-nums; }
.kpi-detail { color: var(--muted); font-size: 12px; margin: 0; }
.category-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.category-item { padding: 14px 16px 15px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.category-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.category-name { display: flex; gap: 8px; align-items: center; font-weight: 650; }
.category-swatch { width: 9px; height: 9px; border-radius: 2px; background: var(--teal); }
.category-item.without .category-swatch { background: var(--coral); }
.progress-track { width: 100%; height: 7px; overflow: hidden; border-radius: 3px; background: #e5eaec; }
.progress-fill { height: 100%; min-width: 0; background: var(--teal); }
.category-item.without .progress-fill { background: var(--coral); }
.category-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }

.health-layout { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 1.6fr); gap: 12px; margin-top: 12px; }
.health-summary { padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.health-score-line { display: flex; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.score-badge { min-width: 53px; height: 38px; display: grid; place-items: center; padding: 0 10px; border-radius: 5px; font-size: 17px; font-weight: 730; font-variant-numeric: tabular-nums; background: var(--red-soft); color: var(--red); }
.score-badge.warning { background: var(--amber-soft); color: var(--amber); }
.score-badge.healthy { background: var(--green-soft); color: var(--green); }
.health-score-line strong { font-size: 14px; display: block; margin-bottom: 3px; }
.health-score-line small { color: var(--muted); font-size: 11px; }
.finding-list { display: grid; gap: 9px; margin-top: 13px; }
.finding { display: grid; grid-template-columns: 8px 1fr; gap: 9px; color: #4f5d63; font-size: 12px; line-height: 1.45; }
.finding-mark { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.finding.critical .finding-mark { background: var(--red); }
.finding.warning .finding-mark { background: var(--amber); }
.finding.action .finding-mark { background: var(--teal); }

.table-shell { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; text-align: left; color: #68777d; background: #f3f6f7; border-bottom: 1px solid var(--line); font-weight: 650; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #e6ebed; color: #39474d; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfc; }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 125px; }
.mini-progress .progress-track { width: 70px; height: 5px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 4px; background: #e6ebed; color: #56656b; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-pill.scored { background: var(--green-soft); color: var(--green); }
.status-pill.error, .status-pill.agent_error, .status-pill.environment_error { background: var(--red-soft); color: var(--red); }
.status-pill.running { background: var(--teal-soft); color: var(--teal); }

.chart-grid { display: grid; gap: 12px; }
.chart-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.chart-panel { min-width: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chart-heading h3 { font-size: 14px; margin-bottom: 3px; letter-spacing: 0; }
.chart-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.chart-heading svg { width: 18px; color: #7a898f; }
.chart-wrap { position: relative; height: 230px; }
.chart-wrap-large { height: 270px; }

.coverage-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; }
.coverage-badge.healthy { background: var(--green-soft); color: var(--green); }
.coverage-note { margin: 10px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.metric-strong { color: var(--ink); font-weight: 700; }
.endpoint-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.endpoint { display: flex; align-items: center; gap: 7px; padding: 6px 9px; background: rgb(255 255 255 / 72%); border: 1px solid var(--line); border-radius: 5px; color: #506067; font-size: 11px; }
.endpoint-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.endpoint.unhealthy .endpoint-dot { background: var(--red); }

.stats-table { margin-bottom: 12px; }
.filters { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.search-field { position: relative; width: min(420px, 100%); }
.search-field svg { position: absolute; left: 11px; top: 9px; width: 16px; color: #7c8a90; }
.search-field input, .filters select { height: 36px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--ink); font-size: 12px; outline: none; }
.search-field input { width: 100%; padding: 7px 10px 7px 34px; }
.filters select { padding: 6px 28px 6px 10px; }
.search-field input:focus, .filters select:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgb(8 127 120 / 12%); }
.trajectory-table { max-height: 620px; overflow: auto; }
.trajectory-table th { position: sticky; top: 0; z-index: 2; }
.task-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 550; }
.type-label { display: inline-flex; align-items: center; gap: 6px; }
.type-label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--teal); }
.type-label.without_binary::before { background: var(--coral); }
.reward-high { color: var(--green); font-weight: 700; }
.reward-low { color: var(--red); font-weight: 700; }
.table-count { margin: 9px 2px 0; color: var(--muted); font-size: 11px; }

.config-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.config-group { min-width: 0; }
.config-group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.config-group h3::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: #62bfb8; }
.config-group.without h3::before { background: #e6846f; }
.config-detail { margin-bottom: 8px; border: 1px solid #425158; border-radius: 6px; overflow: hidden; background: #192328; }
.config-detail summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; color: #e2e9eb; font-size: 12px; list-style: none; }
.config-detail summary::-webkit-details-marker { display: none; }
.config-detail summary::after { content: "+"; color: #91a1a7; font-size: 18px; line-height: 1; }
.config-detail[open] summary::after { content: "−"; }
.config-detail summary span { color: #91a1a7; font-size: 10px; }
.config-detail pre { max-height: 620px; overflow: auto; margin: 0; padding: 14px; border-top: 1px solid #35444a; background: #111a1e; color: #bcd2d7; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: 0; }

.error-banner { position: fixed; right: 18px; bottom: 18px; z-index: 50; max-width: 460px; padding: 12px 14px; background: #8f2929; color: #fff; border-radius: 6px; box-shadow: 0 8px 28px rgb(0 0 0 / 20%); font-size: 12px; }
.empty-row { text-align: center; padding: 30px; color: var(--muted); }

@media (max-width: 1100px) {
  .kpi-grid, .chart-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid-three { grid-template-columns: 1fr; }
  .health-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { padding: 11px 15px; }
  .brand-block h1 { font-size: 15px; }
  .brand-block p { display: none; }
  .freshness span:last-child { display: none; }
  .section-nav { padding: 0 15px; gap: 20px; }
  .section-band { padding: 27px 15px 34px; }
  .overview-heading, .section-title-row { align-items: stretch; flex-direction: column; gap: 14px; }
  .segmented { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .segmented button { padding-inline: 5px; }
  .kpi-grid, .category-strip, .chart-grid-two, .config-columns { grid-template-columns: 1fr; }
  .kpi-card { min-height: 108px; }
  .filters { align-items: stretch; flex-direction: column; }
  .search-field, .filters select { width: 100%; }
  .chart-wrap { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
