:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #201b2c;
  background: #f5f3f8;
  font-synthesis: none;
  --ink: #201b2c;
  --muted: #625c70;
  --panel: #fff;
  --line: #e5e0eb;
  --brand: #5d3dad;
  --brand-dark: #4b2e91;
  --focus: #7952c9;
  --green: #14654f;
  --red: #9f363c;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
a { color: var(--brand-dark); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); font-weight: 700; letter-spacing: -.04em; }
h2 { font-size: 1.08rem; }
h3 { font-size: .94rem; }
small { font-size: .8rem; }
.shell { display: grid; grid-template-columns: 205px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #211a31; color: #eee9f8; display: flex; flex-direction: column; gap: 35px; padding: 29px 17px 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 1.1rem; font-weight: 700; text-decoration: none; padding: 0 8px; }
.brand small { display: block; color: #c7bdd8; font-weight: 400; margin-top: 3px; }
.brand-mark { position: relative; display: grid; grid-template-columns: repeat(3, 4px); gap: 3px; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: #d5c0ff; flex-shrink: 0; }
.brand-mark i { background: #422870; height: 11px; border-radius: 6px; }
.brand-mark i:nth-child(2) { height: 22px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a, .logout { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: #e0d8ec; text-align: left; font-size: .93rem; }
.sidebar nav a:hover, .logout:hover { background: #322744; color: #fff; }
.sidebar nav a[aria-current="page"] { color: #fff; background: #443360; font-weight: 650; box-shadow: inset 3px 0 #c9adff; }
.logout { margin-top: auto; background: transparent; border: 1px solid #594c6c; cursor: pointer; }
.workspace { width: 100%; max-width: 1560px; margin-inline: auto; padding: 34px clamp(16px, 4vw, 52px) 56px; }
.page-heading, .panel-heading, .heading-actions, .config-controls, .toolbar, .dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-heading { margin-bottom: 24px; align-items: end; }
.heading-actions { justify-content: flex-start; }
#sample-time, .node-label, .muted, .panel-heading p { color: var(--muted); font-size: .87rem; }
.node-label { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #8c8498; }
.status-dot.online { background: #198261; }
.status-dot.offline { background: #b94249; }
.view, .overview-grid { display: grid; gap: 16px; }
.overview-grid { grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); }
.panel, .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.panel { padding: 19px 21px; }
.panel-heading { margin-bottom: 15px; }
.panel-heading p { margin-top: 5px; line-height: 1.55; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px; overflow-wrap: anywhere; }
.stat span { display: block; color: var(--muted); font-size: .87rem; }
.stat strong { display: block; margin-top: 7px; font-size: clamp(1.3rem, 2.5vw, 2rem); line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); display: block; margin-top: 4px; }
.chart-panel canvas { display: block; width: 100%; height: 230px; }
.chart-legend { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); }
.chart-legend span::before { content: ""; display: inline-block; width: 12px; height: 3px; margin: 0 5px 3px 0; background: #7448cc; }
.chart-legend span + span::before { background: #12826a; }
#chart-caption { line-height: 1.55; }
.data-list { margin: 0; }
.data-list div { display: grid; grid-template-columns: minmax(7rem, .7fr) minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.data-list dt { color: var(--muted); }
.data-list dd { margin: 0; overflow-wrap: anywhere; }
.button { min-height: 43px; padding: 7px 13px; border: 1px solid #d8d0e2; border-radius: 8px; cursor: pointer; background: #fff; color: var(--ink); font-weight: 650; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button:hover { background: #f3eefb; }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.button:disabled { opacity: .53; cursor: default; }
.text-action { min-height: 44px; display: inline-flex; align-items: center; padding: 4px 7px; margin: -4px 0; border: 0; background: transparent; border-radius: 5px; color: var(--brand-dark); cursor: pointer; white-space: nowrap; }
.text-action:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
th, td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); line-height: 1.45; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .81rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .muted { display: block; margin-top: 3px; }
.empty { border-top: 1px solid var(--line); padding: 15px 0 2px; color: var(--muted); font-size: .9rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; background: #f0ecf5; color: #554965; padding: 4px 9px; white-space: nowrap; font-size: .8rem; font-weight: 650; }
.badge.good { background: #e2f4ed; color: var(--green); }
.badge.wait { background: #fff1d7; color: #734c10; }
.badge.bad { background: #fcebed; color: var(--red); }
.notice { padding: 12px 14px; margin: 0 0 16px; background: #eee6fb; border-radius: 8px; color: #42276f; overflow-wrap: anywhere; }
.notice.error { background: #fcebed; color: var(--red); }
#pair-detail { scroll-margin-block-start: 12px; }
.pair-endpoints, .diagnostic-grid, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pair-endpoints { margin-bottom: 14px; }
.endpoint { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.endpoint p, .endpoint .badge { margin-top: 7px; }
.endpoint .badge + .badge { margin-left: 6px; }
.endpoint-report { margin-top: 10px; font-size: .88rem; }
.diagnostic-grid { margin-bottom: 14px; }
.diagnostic-grid .stat { background: #faf8fc; }
.config-controls { justify-content: flex-start; margin-top: 14px; }
.customer-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.code-input { width: 100%; padding: 8px; font: inherit; border: 1px solid #cfc6dd; border-radius: 7px; }
summary { cursor: pointer; color: var(--brand-dark); }
details ul { padding-left: 20px; }
label { display: block; font-size: .9rem; font-weight: 650; }
input, select { border: 1px solid #cfc6dd; border-radius: 7px; background: #fff; color: var(--ink); padding: 9px 10px; min-height: 43px; width: 100%; }
label input, label select { margin-top: 5px; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.inline-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-label input, .inline-label select { width: auto; max-width: 100%; margin: 0; }
.checkbox { display: flex; align-items: center; gap: 8px; min-height: 43px; }
.dialog-heading { margin-bottom: 18px; flex-wrap: nowrap; }
dialog { border: 1px solid var(--line); border-radius: 14px; width: min(540px, calc(100% - 24px)); padding: 20px; color: var(--ink); box-shadow: 0 18px 60px #20183145; }
dialog::backdrop { background: #241a36a8; }
.dialog-actions { justify-content: flex-end; margin-top: 17px; }
#dialog-fields { display: grid; gap: 12px; line-height: 1.55; }
.close { font-size: 1.25rem; min-width: 43px; }
.form-error { color: var(--red); margin: 9px 0; overflow-wrap: anywhere; }
.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 16px; background: #eee9f5; }
.login-form { width: min(100%, 380px); display: grid; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-form h1 { font-size: 1.55rem; }
.login-form form { display: grid; gap: 8px; }
.login-form button { margin-top: 4px; }
@media (max-width: 1040px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; }
  .sidebar nav a, .logout { padding-inline: 8px; }
  .logout { grid-column: 2; grid-row: 1; margin: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { padding-top: 19px; }
}
@media (max-width: 425px) {
  .pair-endpoints, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 14px; }
}
