:root {
  --bg: #eff4ea;
  --surface: #f9fbf6;
  --surface-strong: #ffffff;
  --ink: #15261d;
  --muted: #597060;
  --line: #d5dfd1;
  --brand: #1f6f55;
  --brand-soft: #dff1e7;
  --warn: #9a4b1a;
  --warn-soft: #fff0e4;
  --good: #1a7a43;
  --danger: #9e2f39;
  --shadow: 0 18px 36px rgba(27, 46, 37, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 111, 85, 0.12), transparent 32%),
    linear-gradient(180deg, #f6fbf3 0%, var(--bg) 100%);
}

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero,
.panel,
.metric-card,
.node-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 28px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 0.96;
}

.subhead {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-meta {
  display: grid;
  gap: 12px;
  min-width: 240px;
}

.pill {
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.pill span,
.metric-label,
.panel-head p,
.node-role,
.node-facts dt,
th {
  color: var(--muted);
}

.pill strong,
.metric-value {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.metric-card,
.panel,
.node-card {
  border-radius: 24px;
}

.metric-card {
  padding: 20px;
}

.metric-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  margin-top: 16px;
  padding: 22px;
}

.layout-grid .panel {
  margin-top: 0;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 24px;
}

.panel-head p {
  margin: 0;
  font-size: 14px;
}

#topology {
  width: 100%;
  height: min(70vh, 720px);
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(31, 111, 85, 0.08), rgba(255, 255, 255, 0.2));
  border-radius: 20px;
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#topology.is-panning {
  cursor: grabbing;
}

.topology-canvas-wrap {
  overflow: hidden;
  border-radius: 20px;
}

.topology-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: -4px 0 10px;
}

.topology-control {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 38, 48, 0.08);
}

.topology-control:hover {
  border-color: #9bb8c8;
  background: #f6fbff;
}

.topology-control-wide {
  min-width: 64px;
  font-size: 13px;
}

.node-inspector {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  min-height: 82px;
}

.node-inspector-empty {
  color: var(--muted);
}

.warnings-compact {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.warnings-compact summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.warnings-compact summary strong {
  color: #7a4a22;
  font-size: 12px;
}

.warnings-compact .warning-list {
  margin-top: 10px;
}

.node-inspector-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.node-inspector-head h3 {
  margin: 0;
  font-size: 22px;
}

.node-inspector-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.node-inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
}

.node-inspector-grid div {
  min-width: 0;
}

.node-inspector-grid strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.node-inspector-grid span {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.node-inspector-geo {
  grid-column: 1 / -1;
}

.metric-charts {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.metric-charts .panel-head {
  margin: 0 0 10px;
}

.metric-charts .panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.metric-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.metric-chart {
  min-width: 0;
  border: 1px solid #d5e3ed;
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.metric-chart-head,
.metric-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.metric-chart-head strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-chart-head span {
  font-weight: 800;
}

.metric-chart svg {
  display: block;
  width: 100%;
  height: 74px;
  margin-top: 8px;
  overflow: visible;
}

.metric-chart-axis,
.metric-chart-baseline {
  fill: none;
  stroke: #dbe8f1;
  stroke-width: 1;
}

.metric-chart-baseline {
  stroke-dasharray: 4 4;
}

.metric-chart-line {
  fill: none;
  stroke: #2d6f72;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-chart-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.warning-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.warning-list li,
.events-list li {
  background: var(--warn-soft);
  color: #5f3417;
  border: 1px solid #f1d1bf;
  border-radius: 18px;
  padding: 14px 16px;
}

.events-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.events-list li {
  background: #eef6ff;
  color: #274058;
  border-color: #c8dced;
}

.inspector-geo-form {
  display: grid;
  gap: 10px;
}

.inspector-geo-input {
  width: 100%;
  border: 1px solid #c8dced;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fbfdff;
}

.inspector-geo-input:focus {
  outline: 2px solid rgba(32, 76, 115, 0.18);
  border-color: #93b7d6;
}

.inspector-geo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.inspector-geo-status {
  color: var(--muted);
  font-size: 13px;
}

.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.node-card {
  padding: 18px;
}

.node-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.node-role {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
}

.node-name {
  margin: 0;
  font-size: 28px;
}

.status-badge {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.status-online {
  color: var(--good);
  background: #e2f6ea;
}

.status-warning {
  color: var(--warn);
  background: var(--warn-soft);
}

.identity-unconfirmed {
  border: 1px solid #e7b18f;
}

.identity-confirmed {
  border: 1px solid #9cd6b3;
}

.node-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin: 18px 0;
}

.node-facts dd {
  margin: 0;
  font-weight: 600;
}

.ssid-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ssid-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.node-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.node-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 999px;
  background: #eef6ff;
  color: #204c73;
  border: 1px solid #c8dced;
  font-size: 12px;
  font-weight: 700;
}

.node-link:hover {
  background: #e2f0ff;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

td {
  font-weight: 600;
}

.signal-good {
  color: var(--good);
}

.signal-fair {
  color: #8b6410;
}

.signal-poor {
  color: var(--danger);
}

.topology-link {
  stroke-linecap: round;
  fill: none;
}

.topology-link-label {
  font-size: 11px;
  fill: var(--muted);
  text-anchor: middle;
}

.topology-link-info {
  cursor: pointer;
}

.topology-link-info circle {
  fill: rgba(255, 255, 255, 0.95);
  stroke: var(--line);
  stroke-width: 1.5;
}

.topology-link-info text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.topology-link-info.is-selected circle {
  stroke: #15261d;
  stroke-width: 2;
}

.topology-link-good {
  fill: #1f6f55;
}

.topology-link-fair {
  fill: #8b6410;
}

.topology-link-poor {
  fill: #9e2f39;
}

.topology-node circle {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 4;
  cursor: pointer;
}

.topology-node text {
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.topology-subtext {
  font-size: 12px;
  fill: var(--muted);
}

.topology-node.is-selected circle {
  stroke: #15261d;
  stroke-width: 5;
}

.topology-subtext-link {
  fill: #204c73;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: all;
}

.topology-node text.topology-subtext-link {
  pointer-events: all;
}

.topology-client {
  cursor: pointer;
}

.topology-client line {
  stroke: var(--node-color, rgba(66, 84, 100, 0.24));
  stroke-width: 1;
  stroke-dasharray: 2 5;
  opacity: 0.38;
  pointer-events: none;
}

.topology-client.is-estimated line {
  stroke-width: 1.4;
  opacity: 0.5;
}

.topology-client > circle {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2.5;
}

.topology-client.is-selected > circle {
  stroke: #15261d;
  stroke-width: 4;
}

.topology-client-icon {
  pointer-events: visiblePainted;
}

.topology-client-hit {
  fill: transparent;
  stroke: none;
}

.topology-client-landroid-shell {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.topology-client-landroid-detail,
.topology-client-landroid-wheel {
  stroke: none;
}

.topology-client.is-selected .topology-client-landroid-shell {
  stroke: #15261d;
  stroke-width: 1.8;
}

.topology-client-camera-shell,
.topology-client-camera-lens,
.topology-client-person-shell,
.topology-client-laptop-shell {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.topology-client-camera-detail,
.topology-client-person-detail,
.topology-client-laptop-detail {
  stroke: none;
}

.topology-client.is-selected .topology-client-camera-shell,
.topology-client.is-selected .topology-client-camera-lens,
.topology-client.is-selected .topology-client-person-shell,
.topology-client.is-selected .topology-client-laptop-shell {
  stroke: #15261d;
  stroke-width: 1.8;
}

.topology-external-link {
  stroke: var(--node-color, #6f7f8f);
  stroke-width: 2;
  stroke-dasharray: 6 6;
  opacity: 0.7;
  pointer-events: stroke;
}

.topology-external-link-hit {
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
}

.topology-external-link-hit:hover + .topology-external-link,
.topology-external-link:hover {
  opacity: 0.95;
  stroke-width: 3;
}

.topology-external-link.is-low-confidence {
  opacity: 0.4;
}

.topology-external-sector {
  fill: rgba(111, 127, 143, 0.12);
  stroke: rgba(111, 127, 143, 0.35);
  stroke-width: 2;
  stroke-dasharray: 10 8;
}

.topology-landmark polygon,
.topology-landmark circle {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3;
  cursor: pointer;
}

.topology-landmark text {
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.topology-landmark.is-selected polygon,
.topology-landmark.is-selected circle {
  stroke: #15261d;
  stroke-width: 4;
}

.topology-landmark-cluster {
  cursor: pointer;
}

.topology-landmark-cluster circle {
  fill: #2d6f72;
  opacity: 0.92;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2.5;
}

.topology-landmark-cluster text {
  fill: #ffffff;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
  text-anchor: middle;
}

.topology-landmark-cluster:hover circle {
  fill: #214f52;
}

.topology-landmark-label {
  font-size: 11px;
  fill: #425464;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.topology-landmark-label-guide {
  stroke: rgba(66, 84, 100, 0.36);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  pointer-events: none;
}

.topology-motion {
  pointer-events: none;
}

.topology-motion-path {
  fill: none;
  stroke: var(--motion-color, rgba(204, 90, 113, 0.72));
  stroke-width: 2;
  stroke-dasharray: 5 7;
  opacity: 0.58;
}

.topology-motion-glow {
  fill: var(--motion-color, #cc5a71);
  opacity: 0.11;
  transform-box: fill-box;
  transform-origin: center;
}

.topology-motion-dot {
  fill: var(--motion-color, #cc5a71);
  opacity: 0.42;
  stroke: #ffffff;
  stroke-width: 1.4;
}

.topology-motion-end-glow {
  fill: var(--motion-color, #cc5a71);
  opacity: 0.18;
  transform-box: fill-box;
  transform-origin: center;
}

.topology-motion-end-dot {
  fill: var(--motion-color, #cc5a71);
  opacity: 0.92;
  stroke: #ffffff;
  stroke-width: 1.8;
}

.topology-motion-age {
  fill: #425464;
  font-size: 10px;
  font-weight: 700;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-linejoin: round;
  stroke-width: 3px;
}

.topology-motion.is-client .topology-motion-dot,
.topology-motion.is-client .topology-motion-end-dot {
  cursor: pointer;
  pointer-events: visiblePainted;
}

.topology-motion.is-current .topology-motion-path {
  opacity: 0.84;
}

.topology-motion.is-current .topology-motion-end-glow {
  animation: motion-pulse 1.8s ease-in-out infinite;
  opacity: 0.28;
}

.topology-motion.is-client .topology-motion-path {
  stroke-dasharray: 3 6;
}

@keyframes motion-pulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.25);
  }
}

@media (max-width: 900px) {
  .hero,
  .panel-head {
    flex-direction: column;
  }

  .overview-grid,
  .layout-grid {
    grid-template-columns: 1fr;
  }
}
