:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  --ink: #222c30;
  --muted: #526167;
  --line: #dce4e3;
  --surface: #fff;
  --green: #196148;
  --green-fill: #2a8563;
  --offline: #b48547;
  --unknown: #dce4e6;
  background: #f3f6f5;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
button, input { font: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, main { width: min(100% - 44px, 1060px); margin-inline: auto; }
.topbar-inner { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 750 22px/1 ui-monospace, Consolas, monospace; text-decoration: none; color: var(--ink); letter-spacing: -.07em; }
.brand-icon { width: 28px; height: 28px; border-radius: 8px; background: #213b35; display: grid; place-items: center; }
.brand-icon::before { content: ""; background: #a9e3c6; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 3px #a9e3c642; }
.capture { color: var(--muted); font-size: 12px; }
.capture::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; vertical-align: 1px; border-radius: 50%; background: #8d9aa0; }
.capture[data-state="online"]::before { background: var(--green-fill); }
main { padding-top: 36px; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.25; font-weight: 750; letter-spacing: -.035em; margin-bottom: 17px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 12px; }
.status-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 15px 18px; }
.status-card h2 { font-size: 14px; color: var(--muted); font-weight: 650; }
.status-card .value { margin-top: 3px; font-size: clamp(23px, 3.6vw, 33px); font-weight: 750; letter-spacing: -.04em; color: var(--muted); }
.status-card[data-state="online"] .value { color: var(--green); }
.status-card[data-state="not_detected"] .value { color: #805b28; }
.status-card.overall[data-state="online"] { background: #ebf7ee; border-color: #c7decc; }
.status-card.overall[data-state="not_detected"] { background: #fbf6ec; border-color: #e8d9bf; }
.hint { font-size: 12px; color: var(--muted); }
.history { margin-top: 29px; }
.history-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-header h2 { font-size: 21px; line-height: 1.35; letter-spacing: -.025em; }
.date-nav { display: flex; gap: 5px; max-width: 100%; }
.date-nav button, .date-nav input { min-height: 34px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.date-nav button { min-width: 33px; font-size: 19px; cursor: pointer; line-height: 1; }
.date-nav button.today { font-size: 12px; padding-inline: 8px; }
.date-nav button:hover:not(:disabled) { border-color: #80a799; color: var(--green); }
.date-nav button:disabled, .date-nav input:disabled { opacity: .52; cursor: default; }
.date-nav input { min-width: 0; padding-inline: 6px; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 15px; margin: 8px 0 11px; color: var(--muted); font-size: 12px; }
.legend span { white-space: nowrap; }
.swatch { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 3px; }
.swatch.online { background: var(--green-fill); }
.swatch.not_detected { background: var(--offline); }
.swatch.unknown { background: repeating-linear-gradient(135deg, #c9d3d6 0 2px, #e8edef 2px 5px); }
.history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.history-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.history-card h3 { padding: 13px 15px 6px; font-size: 16px; }
.chart { margin: 0 15px 12px; }
canvas { width: 100%; height: 34px; display: block; }
.ticks { display: flex; justify-content: space-between; margin-top: 3px; font: 11px/1.5 ui-monospace, Consolas, monospace; color: var(--muted); }
.interval-scroll { max-height: 320px; overflow: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; color: var(--muted); background: #f2f5f4; font-size: 12px; font-weight: 650; }
th, td { padding: 7px 13px; border-top: 1px solid #e8edec; }
th:last-child, td:last-child { white-space: nowrap; }
td[data-state="online"] { color: var(--green); }
td[data-state="not_detected"] { color: #805b28; }
td[data-state="unknown"], td[colspan] { color: var(--muted); }
.load-error { margin: 0 0 9px; color: #8c3029; font-size: 13px; }
footer { margin: 19px 0; font-size: 12px; color: var(--muted); }

@media (max-width: 660px) {
  .topbar-inner, main { width: calc(100% - 28px); }
  main { padding-top: 23px; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .status-card { padding: 11px 13px; }
  .status-card.overall { grid-column: 1 / -1; }
  .history { margin-top: 22px; }
  .history-grid { grid-template-columns: 1fr; }
}
