﻿:root {
  --sans: "HarmonyOS Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "HarmonyOS Sans", ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #fffdfc;
  --bg-soft: #f8f4f1;
  --bg-elev: #fffefd;
  --line: #ece3dd;
  --text: #17171a;
  --text-2: #55545c;
  --faint: #8a8890;
  --accent: #b3402c;
  --accent-2: #e0795f;
  --accent-soft: rgba(179, 64, 44, 0.09);
  --hair: #ddc6bb;
  --green: #3f7d5a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 6px 24px rgba(0, 0, 0, 0.05);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.bg-grid {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 560px at 18% -12%, rgba(179, 64, 44, 0.055), transparent 62%),
    radial-gradient(900px 520px at 92% -6%, rgba(179, 64, 44, 0.04), transparent 58%);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 30px 40px 20px;
  max-width: 1420px;
  margin: 0 auto;
}

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

.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--hair);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.22px;
  line-height: 1.25;
}

.brand .sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.2px;
}

.hostinfo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--faint);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.pill.ok { color: var(--text-2); border-color: var(--hair); }
.pill.ok .dot { background: var(--green); }

.pill.bad { color: var(--accent); border-color: var(--hair); }
.pill.bad .dot { background: var(--accent); }

main {
  position: relative;
  z-index: 1;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0 40px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.speed-panel .metrics { margin-top: auto; padding-top: 20px; }

.conn-panel .conn-grid {
  flex: 1 1 auto;
  grid-auto-rows: auto;
  align-content: space-evenly;
}

.conn-panel .conn-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 9px 12px;
  min-height: 0;
}

.conn-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conn-line-2 {
  gap: 6px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 1.25px;
  color: var(--faint);
}

.meta { font-size: 12px; color: var(--faint); }

.src-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--faint);
}

.src-row select,
.src-row input {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.src-row input { min-width: 250px; }
.src-row select:focus,
.src-row input:focus { border-color: var(--hair); background: var(--bg-elev); }

.conn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 16px;
}

.conn-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.conn-label { font-size: 10.5px; color: var(--faint); letter-spacing: 0.4px; }

.conn-value {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.gauge-wrap {
  display: block;
}

.gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.speed-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px;
  gap: 16px;
  margin-top: 14px;
  align-items: start;
}

.live-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 12px 14px 10px;
  min-width: 0;
}

.live-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.live-head b {
  margin-left: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.live-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
}

.live-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.live-legend i + span { margin-right: 4px; }

.live-legend em {
  font-style: normal;
  color: #b0aaa3;
  margin-left: 4px;
}

.dot-down { background: #b3402c; }
.dot-up { background: #b58468; }

#live-chart { width: 100%; height: 150px; display: block; }

.gauge-card {
  text-align: center;
  min-width: 0;
  padding-top: 2px;
}

.gauge-label {
  font-size: 12px;
  letter-spacing: 1.4px;
  color: var(--faint);
  margin-bottom: 2px;
  transition: color 0.2s;
}

.gauge-label span {
  font-size: 9px;
  letter-spacing: 1px;
  color: #bdb6af;
  margin-left: 6px;
}

.gauge { width: 100%; max-width: 270px; display: block; margin: 0 auto; }

.gauge .track {
  fill: none;
  stroke: #f2eae4;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 386.4 515.2;
  transform: rotate(135deg);
  transform-origin: 110px 110px;
}

.gauge .progress {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 515.2;
  stroke-dashoffset: 515.2;
  transform: rotate(135deg);
  transform-origin: 110px 110px;
  transition: stroke-dashoffset 0.2s linear;
}

.gauge .marker {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2.4;
  transition: transform 0.18s linear;
}

#card-up .gauge .marker { stroke: #b58468; }

.gauge-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.8px;
  fill: var(--text);
  font-variant-numeric: tabular-nums;
}

.gauge-unit { font-size: 10.5px; fill: var(--faint); letter-spacing: 2px; }
.gauge-max, .gauge-min { font-size: 9.5px; fill: #b9b2ab; font-family: var(--mono); }

.gauge-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.gauge-card.done .gauge-label { color: var(--accent); }

.phase {
  font-size: 13px;
  color: var(--text-2);
  min-height: 18px;
}

.btn-primary {
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(179, 64, 44, 0.24);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(179, 64, 44, 0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.hint { font-size: 11.5px; color: var(--faint); line-height: 1.7; }

.rating {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}

.rating-label { font-size: 11.5px; color: var(--faint); }
.rating-value { font-size: 15px; font-weight: 600; color: var(--accent); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.metric {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label { font-size: 11.5px; color: var(--faint); letter-spacing: 0.4px; }

.metric-value {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.metric-unit { font-size: 10.5px; color: #b9b2ab; letter-spacing: 1px; }

.latency-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--faint);
}

.latency-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--bg-elev);
}

.latency-list b { color: var(--text-2); font-weight: 600; }

.log {
  margin-top: 12px;
  font-size: 11.5px;
  color: #a29d97;
  min-height: 16px;
  font-family: var(--mono);
}

/* ------------------------------ 应用速率 ------------------------------ */

.conn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  align-content: start;
}

.conn-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 10px 12px;
  line-height: 1.35;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}

.conn-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--app-color, var(--accent));
  opacity: 0.65;
}

.conn-card.state-ok { border-color: #d9e7dd; background: var(--bg-elev); }
.conn-card.state-warn { border-color: #ecdcbe; }
.conn-card.state-fail { border-color: #eccbc4; }

.app-badge {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--app-color, var(--accent));
  opacity: 0.9;
}

.app-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sub {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  color: var(--faint);
  margin-top: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-state {
  flex: 0 0 auto;
  font-size: 9px;
  line-height: 1.6;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--faint);
  background: var(--bg-elev);
  white-space: nowrap;
}

.app-state.on {
  color: var(--green);
  border-color: #cfe0d6;
  background: #f2f8f4;
}

.app-state.warn {
  color: #a2711f;
  border-color: #ecd9b6;
  background: #fbf4e8;
}

.app-state.fail {
  color: var(--accent);
  border-color: #eccbc4;
  background: #fbf0ec;
}

.app-rate {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.app-rate small { font-size: 11px; color: var(--faint); margin-left: 4px; font-weight: 400; }

.app-bar {
  height: 3px;
  border-radius: 999px;
  background: #ece4de;
  margin-top: 9px;
  overflow: hidden;
}

.app-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--app-color, var(--accent));
  opacity: 0.8;
  transition: width 0.35s ease;
}

.conn-summary {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.total-item { display: flex; flex-direction: column; gap: 2px; }

.total-label { font-size: 11px; color: var(--faint); letter-spacing: 0.4px; }

.total-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.total-value.small { font-size: 11.5px; color: var(--faint); font-weight: 400; }

.btn-ghost {
  margin-left: auto;
  border: 1px solid var(--hair);
  background: var(--bg-elev);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost:disabled { opacity: 0.5; cursor: default; }

.conn-lat {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.sig {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  padding-bottom: 4px;
  color: #c9c2ba;
}

.sig i {
  width: 3px;
  border-radius: 1px;
  background: #e2dcd5;
}

.sig i:nth-child(1) { height: 5px; }
.sig i:nth-child(2) { height: 8px; }
.sig i:nth-child(3) { height: 11px; }
.sig i:nth-child(4) { height: 14px; }

.sig i.on { background: currentColor; }

.sig em {
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  margin-left: 2px;
  color: currentColor;
  white-space: nowrap;
}

.sig.q-good { color: #3f8f5f; }
.sig.q-mid { color: #bd8628; }
.sig.q-bad { color: #c0523c; }

.conn-latency {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 0;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.conn-latency small { font-size: 9px; color: var(--faint); font-weight: 400; }

.conn-detail {
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--faint);
  font-family: var(--mono);
}

.footnote {
  margin: 6px 0 0;
  font-size: 10.5px;
  color: #a8a6ae;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .topbar, main { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 860px) {
  .speed-bottom {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .gauge-side { order: 1; }
  .live-card { order: 2; }
  #live-chart { height: 132px; }
}

@media (max-width: 720px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-grid { grid-template-columns: minmax(0, 1fr); }
  .conn-grid { grid-template-columns: minmax(0, 1fr); }
  .speed-bottom { grid-template-columns: minmax(0, 1fr); }
  .gauge { width: 100%; }
  .src-row input { min-width: 100%; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
