* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --bg: #f4f7f8; --surface: #ffffff; --line: #d7e1e7;
  --text: #183043; --muted: #506779; --signal: #057c6e; --error: #b84729;
  --blue: #3668b1; --purple: #8358a6; --hover: #e8f1f3; --selected: #dff1ee;
  --primary-text: #fff;
}
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: .55rem .85rem; }
button:hover { background: var(--hover); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
[hidden] { display: none !important; }
.dashboard { max-width: 1190px; margin: 0 auto; padding: 38px clamp(16px, 4vw, 42px) 48px; }
.top, .controls, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top { border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 660; letter-spacing: -.045em; }
h2 { font-size: 1.02rem; }
.host { color: var(--signal); display: flex; align-items: center; gap: 8px; margin-bottom: .45rem; font-size: .9rem; }
.mark { display: inline-block; width: 11px; height: 11px; border: 2px solid var(--signal); border-radius: 3px; transform: rotate(45deg); }
.controls { flex-wrap: wrap; }
.ranges { display: flex; gap: 5px; }
.ranges button[aria-pressed="true"], .segmented button[aria-pressed="true"] { color: var(--signal); background: var(--selected); border-color: var(--signal); }
#updated, .coverage, .details, .chart-note { color: var(--muted); font-size: .83rem; }
.coverage { margin: .65rem 0 1rem; }
.metrics, .secondary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-width: 0; padding: 15px 14px 13px; border-right: 1px solid var(--line); }
.metric:first-child { padding-left: 0; }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: .83rem; }
.metric strong { display: block; margin-top: 4px; font-size: clamp(1.25rem, 3.3vw, 2rem); font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#requests { color: var(--signal); }
#errors { color: var(--error); }
.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin: 18px 0; }
.section-head { padding: 14px 16px; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: .78rem; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; background: var(--signal); }
.legend { flex-wrap: wrap; padding: 0 16px 7px; }
.legend span[data-color="error"]::before { background: var(--error); }
.legend span[data-color="blue"]::before { background: var(--blue); }
.legend span[data-color="purple"]::before { background: var(--purple); }
.chart { position: relative; padding: 0 12px; }
.chart canvas { width: 100%; height: 225px; display: block; }
#chart-empty { position: absolute; top: 44%; left: 0; width: 100%; text-align: center; color: var(--muted); font-size: .9rem; pointer-events: none; }
.chart-note { min-height: 38px; padding: 4px 16px 12px; }
.details { margin-top: 12px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; white-space: nowrap; }
th, td { text-align: right; padding: 10px 14px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 550; }
th:first-child, td:first-child { text-align: left; }
td:first-child { font-family: "IBM Plex Mono", ui-monospace, monospace; }
#number-of-routes, details { color: var(--muted); font-size: .85rem; }
details { line-height: 1.6; }
details p { margin: .45rem 0; max-width: 78ch; }
summary { cursor: pointer; }
.notice { color: var(--error); margin: .9rem 0; }
.login { width: min(440px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: clamp(32px, 14vh, 140px) auto; padding: clamp(20px, 6vw, 36px); }
.login > .mark { margin-bottom: 16px; }
.login > p:not(.host) { margin-top: 12px; color: var(--muted); line-height: 1.55; }
.login form { margin-top: 24px; display: grid; gap: 9px; }
.login input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: .7rem; }
.primary { background: var(--signal); color: var(--primary-text); border-color: var(--signal); font-weight: 700; margin-top: 6px; }
.primary:hover { background: var(--signal); filter: brightness(.92); }
@media (max-width: 660px) {
  .metrics, .secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric, .metric:first-child { padding: 11px 8px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(even) { border-right: 0; }
  .metrics .metric:nth-last-child(1), .secondary .metric:nth-last-child(-n + 2) { border-bottom: 0; }
  .chart canvas { height: 175px; }
  th, td { padding: 9px 10px; }
}


:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101a24; --surface: #16242f; --line: #2c414f;
  --text: #edf4f5; --muted: #9ab0ba; --signal: #72ded0; --error: #ffb179;
  --blue: #90b9fc; --purple: #cbb3f5; --hover: #243947; --selected: #1d3b40;
  --primary-text: #102324;
}
.actions, .segmented { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.segmented button { padding: .38rem .62rem; font-size: .83rem; }
.resource-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; }
.resource-grid .summary { margin: 16px 0 0; min-width: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.summary-grid .metric { padding: 12px 16px; }
.summary-grid .metric:nth-child(n+3) { border-top: 1px solid var(--line); border-bottom: 0; }
.summary-grid .metric:nth-child(even) { border-right: 0; }
.summary-grid .metric strong { font-size: clamp(1rem, 3vw, 1.45rem); }
.codes { padding: 0 16px 12px; }
.codes p, #status-samples { color: var(--muted); font-size: .8rem; }
.code { display: grid; align-items: center; gap: 12px; grid-template-columns: 32px minmax(24px, 1fr) minmax(48px, auto); padding: .24rem 0; --code-color: var(--signal); }
.code span { text-align: right; font-size: .86rem; font-variant-numeric: tabular-nums; }
.code strong { color: var(--code-color); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.code-3 { --code-color: var(--blue); }
.code-4, .code-5 { --code-color: var(--error); }
meter { width: 100%; height: 8px; }
meter::-webkit-meter-bar { background: var(--hover); border: 0; border-radius: 5px; }
meter::-webkit-meter-optimum-value { background: var(--code-color); border-radius: 5px; }
meter::-moz-meter-bar { background: var(--code-color); border-radius: 5px; }
.login { position: relative; }
.login #theme { position: absolute; top: 16px; right: 16px; }
@media (max-width: 660px) {
  .resource-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .actions { flex: 0 0 auto; }
  .actions button { font-size: .82rem; padding: .43rem .5rem; }
}
