:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-head: #eceef2;
  --line: #e1e5eb;
  --line-soft: #edf0f4;
  --text: #26313f;
  --muted: #6f7a89;
  --faint: #a5adba;
  --ok: #20b981;
  --warn: #d08a18;
  --bad: #dc3f45;
  --blue: #5878b9;
  --violet: #7b6fb0;
  --amber: #cc8a28;
  --shadow: 0 8px 20px rgba(29, 39, 54, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.page {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

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

h1 {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.1;
  color: #273548;
  font-weight: 800;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.stamp {
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
}

.stamp strong {
  display: block;
  margin-top: 4px;
  color: #293344;
  font-size: 0.9rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.machines {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

section { margin-top: 16px; }

.card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.summary-card {
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--ok);
}

.summary-card.accent-blue::before { background: var(--blue); }
.summary-card.accent-violet::before { background: var(--violet); }
.summary-card.accent-amber::before { background: var(--amber); }

.card-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card h2,
.card h3,
.panel-title h2 {
  margin: 0;
  color: #303a4b;
}

.card h2 {
  margin-top: 6px;
  font-size: 1rem;
}

.card h3 {
  font-size: 1rem;
}

.metric {
  margin: 14px 0 12px;
  color: #1f2937;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  color: #3d4756;
}

.row span {
  color: var(--muted);
}

.row strong {
  text-align: right;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
}

.badge {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.pill {
  padding: 5px 9px;
  font-size: 0.74rem;
}

.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.badge.ok, .pill.ok { background: rgba(32, 185, 129, 0.12); border-color: rgba(32, 185, 129, 0.26); }
.badge.warn, .pill.warn { background: rgba(208, 138, 24, 0.13); border-color: rgba(208, 138, 24, 0.24); }
.badge.bad, .pill.bad { background: rgba(220, 63, 69, 0.12); border-color: rgba(220, 63, 69, 0.22); }

.panel {
  border-radius: 8px;
}

.panel-title,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 14px;
  background: var(--panel-head);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-title h2,
.section-head h3 {
  font-size: 1rem;
}

.panel-title span {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
}

.machine-card {
  padding: 14px;
}

.machine-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.machine-heading {
  min-width: 0;
}

.machine-heading h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.machine-heading span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.sla-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f8f9fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.sla-line span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sla-line strong {
  text-align: right;
  font-size: 0.78rem;
  white-space: nowrap;
}

.sla-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.sla-grid > div {
  min-width: 0;
  padding: 8px 9px;
  background: #f8f9fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.sla-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.sla-grid strong {
  display: block;
  min-width: 0;
  color: #273548;
  font-size: 0.82rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gauges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.gauge {
  --pct: 0;
  min-width: 0;
  min-height: 152px;
  padding: 10px 8px;
  display: grid;
  grid-template-rows: 72px 18px 28px;
  justify-items: center;
  align-items: center;
  row-gap: 7px;
  background: #f2f4f7;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ok);
}

.gauge.warn { color: var(--warn); }
.gauge.bad { color: var(--bad); }

.gauge-ring {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 58%, transparent 59%),
    conic-gradient(currentColor calc(var(--pct) * 1%), #dfe3e8 0);
}

.gauge-ring strong {
  color: #172033;
  font-size: 1rem;
  line-height: 1;
}

.gauge span {
  display: flex;
  align-items: center;
  min-height: 18px;
  color: #4d5a6d;
  font-size: 0.78rem;
  line-height: 1;
  text-align: center;
}

.gauge small {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 28px;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.spec-grid,
.traffic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
}

.spec-item,
.traffic-grid > div {
  min-width: 0;
  padding: 9px 10px;
  background: #f8f9fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.spec-wide {
  grid-column: 1 / -1;
}

.spec-item span,
.traffic-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.spec-item strong,
.traffic-grid strong {
  display: block;
  min-width: 0;
  color: #273548;
  font-size: 0.82rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.traffic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.traffic-grid > div {
  border-left: 3px solid #8cb7c7;
}

.bar {
  height: 7px;
  margin-bottom: 7px;
  overflow: hidden;
  background: #e8ebf0;
  border-radius: 999px;
}

.bar > i {
  display: block;
  width: var(--w);
  height: 100%;
  background: linear-gradient(90deg, #8cb7c7, var(--ok));
}

.latency-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.network-map {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  background: #11181d;
  border: 1px solid #2e3942;
  border-radius: 8px;
  box-shadow: inset 0 0 42px rgba(255, 255, 255, 0.04);
  cursor: grab;
  touch-action: none;
}

.network-map.is-dragging {
  cursor: grabbing;
}

.globe-svg {
  display: block;
  width: 100%;
  height: 620px;
}

.globe-stage {
  transform-box: fill-box;
  transform-origin: center;
}

.globe-ocean {
  fill: url("#globeOcean");
}

.globe-rim {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.4;
}

.graticule path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.land-main,
.land-us,
.land-mexico,
.land-island {
  fill: url("#globeLand");
  opacity: 0.72;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.land-us {
  opacity: 0.62;
}

.land-mexico,
.land-island {
  opacity: 0.48;
}

.lake {
  fill: #182127;
  opacity: 0.9;
}

.region-label,
.ocean-label {
  fill: rgba(255, 255, 255, 0.2);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
}

.ocean-label {
  fill: rgba(255, 255, 255, 0.14);
  font-size: 14px;
}

.map-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 8;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: rgba(15, 23, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.map-toolbar button {
  min-width: 34px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef3f7;
  font: 800 0.82rem "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.map-toolbar button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.latency-path {
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.1;
  stroke-linecap: round;
  opacity: 0.82;
  filter: url("#mapGlow");
  vector-effect: non-scaling-stroke;
}

.latency-path.warn { stroke: #e5a93a; }
.latency-path.bad { stroke: var(--bad); }

.latency-pulse {
  fill: var(--ok);
  filter: url("#mapGlow");
}

.latency-pulse.warn { fill: #e5a93a; }
.latency-pulse.bad { fill: var(--bad); }

.globe-node {
  cursor: pointer;
  outline: none;
}

.globe-node:focus-visible .node-halo,
.globe-node.is-active .node-halo {
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2;
}

.node-hit {
  fill: transparent;
  pointer-events: all;
}

.latency-chip-svg {
  paint-order: stroke;
  stroke: rgba(17, 24, 29, 0.9);
  stroke-width: 5px;
  fill: #77e0bd;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 15px;
  font-weight: 900;
  text-anchor: middle;
  filter: url("#mapGlow");
}

.latency-chip-svg.warn { fill: #ffd26a; }
.latency-chip-svg.bad { fill: #ff8b8f; }

.node-halo {
  fill: rgba(32, 185, 129, 0.18);
  stroke: rgba(32, 185, 129, 0.4);
  stroke-width: 1;
  animation: node-pulse 2.4s ease-in-out infinite;
}

.node-dot {
  fill: var(--ok);
  stroke: #d9fff1;
  stroke-width: 2;
  filter: url("#mapGlow");
}

.node-label {
  opacity: 0;
  pointer-events: none;
  transform-box: fill-box;
  transition: opacity 140ms ease;
}

.globe-node.is-active .node-label {
  opacity: 1;
}

.node-label rect {
  fill: rgba(246, 249, 251, 0.94);
  stroke: rgba(255, 255, 255, 0.35);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22));
}

.node-name {
  fill: #1f2937;
  font-size: 14px;
  font-weight: 900;
}

.node-city {
  fill: #506174;
  font-size: 12px;
  font-weight: 800;
}

.latency-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.latency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.latency-row span {
  min-width: 0;
  color: #3d4756;
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latency-row strong {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  white-space: nowrap;
}

@keyframes node-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.35); }
}

.pill-row {
  margin: 6px 0;
}

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

th,
td {
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line-soft);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #2f3948;
  font-size: 0.86rem;
}

.two-col {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: 14px;
}

.detail-card,
.table-card {
  padding-top: 12px;
}

.muted {
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.5;
}

footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

footer a {
  color: #5878b9;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

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

@media (max-width: 760px) {
  .page {
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
  }

  .topbar,
  .panel-title,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stamp {
    text-align: left;
  }

  .summary-grid,
  .machines,
  .latency-layout,
  .two-col {
    grid-template-columns: 1fr;
  }

  .network-map {
    min-height: 430px;
  }

  .globe-svg {
    height: 430px;
  }

  .latency-list {
    grid-template-columns: 1fr;
  }
}
