:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --border: #d9e1ea;
  --text: #17202a;
  --muted: #667789;
  --accent: #0b6bcb;
  --accent-strong: #064f9c;
  --green: #0f8a5f;
  --amber: #b7791f;
  --red: #c2413b;
  --shadow: 0 18px 44px rgb(22 35 49 / 0.10);
}

* {
  box-sizing: border-box;
}

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

button,
select {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 24px;
  background: #111821;
  color: #f8fafc;
  border-right: 1px solid rgb(255 255 255 / 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e8f2ff;
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: #98a7b8;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  color: #b7c4d3;
  font-size: 13px;
}

select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 8px;
  background: #1b2633;
  color: #f8fafc;
  outline: none;
}

select:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgb(11 107 203 / 0.25);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

button,
.export-link {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 8px;
  background: #243345;
  color: #f8fafc;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.export-link:hover {
  background: #2c3c50;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  border-color: #5aa3ee;
  background: var(--accent);
}

button.primary:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.export-link {
  margin-top: 10px;
  width: 100%;
  font-size: 14px;
}

.status-block {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 12px;
  margin-top: 28px;
  padding: 14px;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.04);
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--amber);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

.status-block strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.status-block p {
  margin: 0;
  color: #a8b6c6;
  font-size: 13px;
  line-height: 1.45;
}

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

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

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.coverage {
  min-width: 250px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.coverage span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.coverage strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.coverage small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 18px;
  font-size: 24px;
  line-height: 1.1;
  word-break: break-word;
}

.kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel h3 {
  font-size: 17px;
}

.panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
}

.chart-panel {
  margin-bottom: 16px;
}

.chart-wrap {
  position: relative;
  height: 372px;
  padding: 12px 16px 16px;
}

canvas {
  width: 100%;
  height: 100%;
}

.empty-state {
  position: absolute;
  inset: 12px 16px 16px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--text);
}

.empty-state.visible {
  display: flex;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td:last-child,
th:last-child {
  text-align: right;
}

.run-list {
  display: grid;
  gap: 0;
}

.run {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.run:last-child {
  border-bottom: none;
}

.run strong {
  font-size: 14px;
}

.run span,
.run small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf7f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.badge.error {
  background: #fff1f0;
  color: var(--red);
}

.badge.running {
  background: #fff8e6;
  color: var(--amber);
}

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

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

  .kpi-grid,
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .topbar {
    display: grid;
  }

  .coverage {
    min-width: 0;
  }

  .kpi-grid,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 300px;
  }

  .topbar h2 {
    font-size: 23px;
  }
}
