:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-subtle: #f7f7f8;
  --text: #171717;
  --muted: #666666;
  --faint: #8a8a8a;
  --line: #eaeaea;
  --line-strong: #d9d9d9;
  --blue: #0a72ef;
  --cyan: #0891b2;
  --green: #16a34a;
  --amber: #b45309;
  --red: #dc2626;
  --ring: 0 0 0 1px rgba(0, 0, 0, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.metric-label,
.panel-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

h1, h2, p { margin: 0; }
h1 {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.12;
  font-weight: 650;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.muted { color: var(--muted); font-size: 13px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  box-shadow: var(--ring);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.status i { width: 7px; height: 7px; border-radius: 999px; background: var(--faint); }
.status.ok i { background: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.status.delayed i { background: var(--amber); box-shadow: 0 0 0 3px rgba(180, 83, 9, .12); }
.status.stale i { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

.runtime {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--ring);
  background: var(--surface);
}
.runtime div {
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}
.runtime div:last-child { border-right: 0; }
.runtime span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.runtime strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.metric,
.panel {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--ring), var(--shadow);
}
.metric {
  min-width: 0;
  padding: 14px;
}
.metric.primary { background: linear-gradient(180deg, #ffffff, #fbfdff); }
.metric-value {
  margin-top: 7px;
  font-size: 29px;
  line-height: 1;
  font-weight: 680;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.panel { padding: 16px; }
.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.panel-title.compact { margin-bottom: 10px; }
.panel-title h2 {
  margin-top: 3px;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 650;
}
.panel-meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.chart {
  position: relative;
  padding: 8px 0 0;
}
.chart::before,
.chart::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.chart::before { top: 16px; }
.chart::after { top: 82px; }
.avg-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(22px + var(--avg));
  border-top: 1px dashed #a3a3a3;
  z-index: 0;
}
.bars {
  position: relative;
  z-index: 1;
  height: 142px;
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  padding: 0 1px 18px;
}
.bar {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  overflow: hidden;
  border-radius: 3px 3px 0 0;
  background: #f0f0f0;
}
.bar i { display: block; width: 100%; min-height: 0; }
.bar .down { background: var(--blue); }
.bar .up { background: var(--cyan); }
.bar.today { outline: 2px solid rgba(10, 114, 239, .2); outline-offset: 2px; }
.bar.issue { box-shadow: inset 0 0 0 1px rgba(180, 83, 9, .55); }
.axis {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 11px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.dot.down { background: var(--blue); }
.dot.up { background: var(--cyan); }
.dash { width: 12px; height: 0; border-top: 1px dashed #a3a3a3; display: inline-block; }

.days-panel { margin-top: 10px; }
.table {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(5, minmax(90px, 1fr));
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.row:last-child { border-bottom: 0; }
.row.head {
  min-height: 36px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.row strong { font-weight: 650; }
.row.warn { background: #fffaf2; }
.row span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more summary {
  list-style: none;
  cursor: pointer;
  margin-top: 10px;
  color: var(--blue);
  font-weight: 500;
}
.more summary::-webkit-details-marker { display: none; }
.older { margin-top: 10px; }

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.footer span {
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: var(--ring);
  background: var(--surface);
}
.footnote {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

@media (max-width: 700px) {
  .page { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .header-side { width: 100%; justify-content: space-between; }
  .metrics { grid-template-columns: 1fr; }
  .metric { padding: 13px 14px; }
  .metric-value { font-size: 28px; }
  .bars { height: 120px; gap: 3px; }
  .table { overflow-x: auto; }
  .row { min-width: 720px; }
}

@media (max-width: 420px) {
  .page { width: min(100% - 16px, 1180px); }
  h1 { font-size: 24px; }
  .runtime div { padding: 9px 12px; }
}
