:root {
  --bg: #eef3f9;
  --panel: #ffffff;
  --text: #0f1f35;
  --muted: #667892;
  --line: #dce5f0;
  --blue: #2f8cff;
  --blue-strong: #176ee8;
  --green: #27a85f;
  --red: #e23a3a;
  --orange: #d98200;
  --nav: #0d1728;
  --nav-active: #17346b;
  --shadow: 0 18px 45px rgba(25, 42, 70, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.demo-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 18px;
  background: var(--nav);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #18b957;
  font-weight: 900;
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-sub {
  margin-top: 2px;
  color: #8bb8ff;
  font-size: 12px;
}

.demo-nav {
  display: grid;
  gap: 8px;
}

.demo-nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  background: transparent;
  color: #d7e4f7;
  text-align: left;
}

.demo-nav button:hover,
.demo-nav button.is-active {
  background: var(--nav-active);
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 6px;
}

.sidebar-card p {
  margin: 0;
  color: #a9bad6;
  font-size: 13px;
  line-height: 1.6;
}

.workspace {
  min-width: 0;
  padding: 28px 32px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.primary-button.is-refreshing {
  background: var(--green);
  border-color: var(--green);
}

.notice {
  margin-bottom: 20px;
  border: 1px solid #cfe0f6;
  border-radius: 8px;
  padding: 14px 16px;
  background: #f7fbff;
  color: #38577a;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 136px;
  padding: 22px 24px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin: 14px 0 8px;
  color: var(--blue);
  font-size: 36px;
  line-height: 1;
}

.stat-card small {
  color: #8293ad;
}

.panel {
  overflow: hidden;
}

.panel + .panel,
.content-grid + .panel {
  margin-top: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.content-grid {
  display: grid;
  gap: 20px;
}

.content-grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.line-chart {
  display: block;
  width: 100%;
  height: auto;
  padding: 18px;
}

.chart-grid,
.grid {
  fill: none;
  stroke: #d8e2ee;
  stroke-width: 1;
}

.chart-line,
.line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line.cpu {
  stroke: #2f8cff;
}

.line.mem {
  stroke: #22b8cf;
}

.chart-area {
  fill: rgba(47, 140, 255, 0.11);
}

.legend {
  display: flex;
  gap: 16px;
  padding: 0 22px 20px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--blue);
}

.dot.blue {
  background: #2f8cff;
}

.dot.cyan {
  background: #22b8cf;
}

.risk-list {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}

.risk-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.risk-item.critical {
  border-left-color: var(--red);
}

.risk-item strong {
  display: block;
  margin-bottom: 6px;
}

.risk-item span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 22px 22px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #7b8ca5;
  font-weight: 900;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.tag {
  background: #eef4fb;
  color: #5f728b;
}

.status.ok {
  background: #eaf8ee;
  color: var(--green);
}

.status.warn {
  background: #fff4df;
  color: var(--orange);
}

.status.bad {
  background: #ffeceb;
  color: var(--red);
}

.template-list,
.metric-list {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}

.template-card,
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fbfdff;
}

.template-card strong,
.metric-row strong {
  display: block;
  margin-bottom: 4px;
}

.template-card span,
.metric-row span {
  color: var(--muted);
  font-size: 13px;
}

.topology-canvas {
  position: relative;
  min-height: 560px;
  margin: 0 22px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fbfdff;
  background-image: radial-gradient(#c9d5e5 1px, transparent 1px);
  background-size: 22px 22px;
}

.topo-node {
  position: absolute;
  z-index: 2;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(24, 43, 72, 0.1);
}

.topo-node strong,
.topo-node span {
  display: block;
}

.topo-node strong {
  margin-bottom: 6px;
}

.topo-node span {
  color: var(--muted);
  font-size: 12px;
}

.topo-node::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--green);
}

.topo-node.offline::before {
  background: var(--red);
}

.topo-link {
  position: absolute;
  z-index: 1;
  height: 3px;
  border-radius: 999px;
  background: #8eb0d9;
  transform-origin: left center;
}

.topo-node.internet {
  left: 8%;
  top: 10%;
}

.topo-node.router {
  left: 29%;
  top: 18%;
}

.topo-node.core {
  left: 47%;
  top: 34%;
}

.topo-node.access {
  left: 64%;
  top: 18%;
}

.topo-node.firewall {
  left: 66%;
  top: 54%;
}

.topo-node.branch {
  left: 34%;
  top: 66%;
}

.link-1 {
  left: 20%;
  top: 18%;
  width: 160px;
  transform: rotate(12deg);
}

.link-2 {
  left: 39%;
  top: 29%;
  width: 165px;
  transform: rotate(28deg);
}

.link-3 {
  left: 58%;
  top: 31%;
  width: 150px;
  transform: rotate(-26deg);
}

.link-4 {
  left: 58%;
  top: 48%;
  width: 160px;
  transform: rotate(28deg);
}

.link-5 {
  left: 43%;
  top: 57%;
  width: 150px;
  transform: rotate(122deg);
  background: #e6a23c;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .demo-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .demo-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 22px 16px 32px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topology-canvas {
    min-height: 680px;
  }

  .topo-node.internet,
  .topo-node.router,
  .topo-node.core,
  .topo-node.access,
  .topo-node.firewall,
  .topo-node.branch {
    left: 50%;
    transform: translateX(-50%);
  }

  .topo-node.internet {
    top: 30px;
  }

  .topo-node.router {
    top: 130px;
  }

  .topo-node.core {
    top: 240px;
  }

  .topo-node.access {
    top: 350px;
  }

  .topo-node.firewall {
    top: 460px;
  }

  .topo-node.branch {
    top: 570px;
  }

  .topo-link {
    left: 50%;
    width: 3px;
    height: 82px;
    transform: none;
  }

  .link-1 {
    top: 88px;
  }

  .link-2 {
    top: 188px;
  }

  .link-3 {
    top: 298px;
  }

  .link-4 {
    top: 408px;
  }

  .link-5 {
    top: 518px;
  }
}
