@font-face {
  font-family: "Caprasimo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/caprasimo-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f2f6fa;
  --color-surface: #ffffff;
  --color-text: #0b1b2b;
  --color-muted: #526277;
  --color-accent: #0053a5;
  --color-accent-hover: #004385;
  --color-teal: #0e9f7e;
  --color-divider: #d2dbe6;
  --color-neutral-100: #f7f9fc;
  --color-neutral-200: #edf1f7;
  --color-neutral-300: #dce3ec;
  --color-neutral-400: #bfc9d6;
  --color-neutral-500: #97a4b5;
  --color-neutral-600: #6b7a8d;
  --color-neutral-700: #4c5a6b;
  --color-neutral-800: #2e3947;
  --color-neutral-900: #16202b;
  --color-accent-soft: #e7f0fa;
  --color-teal-soft: #e4f6f1;
  --color-alert: #d93049;
  --color-alert-soft: #fbe3e7;
  --color-alert-text: #7a1224;
  --peer-1: #0053a5;
  --peer-2: #0a7e64;
  --peer-3: #b4530c;
  --peer-4: #5b2bb8;
  --peer-5: #a81456;
  --peer-6: #806000;
  --peer-7: #35e887;
  --peer-8: #55e8fa;
  --peer-9: #2673ff;
  --shadow-panel: 0 3px 10px rgb(22 32 43 / 12%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #081222;
  --color-surface: #0f1d33;
  --color-text: #eaf1fa;
  --color-muted: #aebcce;
  --color-accent: #5aa3f0;
  --color-accent-hover: #8cc0f6;
  --color-teal: #17bf98;
  --color-divider: #34445f;
  --color-neutral-100: #0b1524;
  --color-neutral-200: #16223a;
  --color-neutral-300: #1f2e4a;
  --color-neutral-400: #34445f;
  --color-neutral-500: #4f6280;
  --color-neutral-600: #8496ae;
  --color-neutral-700: #aebcce;
  --color-neutral-800: #d3dde9;
  --color-neutral-900: #edf3f9;
  --color-accent-soft: #0a2440;
  --color-teal-soft: #06231c;
  --color-alert: #ff6b81;
  --color-alert-soft: #3a1020;
  --color-alert-text: #ffd3dc;
  --peer-1: #5aa3f0;
  --peer-2: #17bf98;
  --peer-3: #f98a2b;
  --peer-4: #a78bfa;
  --peer-5: #f0559b;
  --peer-6: #facc15;
  --peer-7: #35e887;
  --peer-8: #55e8fa;
  --peer-9: #2673ff;
  --shadow-panel: 0 3px 10px rgb(0 0 0 / 28%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  transition: background-color 180ms ease-out, color 180ms ease-out;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 50;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--color-text);
  color: var(--color-bg);
  font-weight: 700;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.dashboard-shell {
  width: min(100%, 1760px);
  margin-inline: auto;
  padding: 24px 30px 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--color-neutral-300);
}

.brand-block,
.topbar-actions,
.peer-identity,
.connection-pill,
.source-pill,
.control-button,
.panel-heading--split,
.map-legend,
.chart-legend,
.dashboard-footer {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 17px;
  min-width: 280px;
}

.brand-mark {
  width: 158px;
  height: auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
}

.brand-copy h1,
.panel-heading h2,
.metric strong,
.percentile-list dd {
  font-family: "Caprasimo", "Figtree", system-ui, sans-serif;
  font-weight: 400;
}

.brand-copy h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.brand-copy p,
.panel-heading p {
  margin: 5px 0 0;
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
}

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

.connection-pill,
.source-pill,
.control-button,
.counter,
.status-badge {
  min-height: 36px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.connection-pill,
.source-pill {
  gap: 8px;
  padding: 7px 12px;
  background: var(--color-neutral-200);
}

.source-pill {
  max-width: 260px;
  color: var(--color-muted);
}

.source-pill > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-icon {
  display: grid;
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 10px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-neutral-500);
}

[data-connection="connected"] .connection-dot {
  background: var(--color-teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-teal) 16%, transparent);
}

[data-connection="reconnecting"] .connection-dot,
[data-connection="polling"] .connection-dot {
  background: var(--color-accent);
}

[data-connection="offline"] .connection-dot {
  background: var(--color-alert);
}

.control-button {
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--color-divider);
  background: transparent;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}

.control-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-button:hover {
  border-color: var(--color-neutral-500);
  background: var(--color-neutral-200);
}

.control-button:active {
  transform: translateY(1px);
}

.control-button[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.control-button--accent {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.control-button--accent:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-accent-hover);
}

.control-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  padding-block: 19px;
  border-bottom: 2px solid var(--color-neutral-300);
}

.metric {
  min-width: 0;
  padding: 2px 22px;
  border-right: 1px solid var(--color-divider);
}

.metric:first-child {
  padding-left: 0;
}

.metric:last-child {
  padding-right: 0;
  border-right: 0;
}

.metric-label {
  display: block;
  color: var(--color-muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metric strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 3px;
  font-size: 29px;
  line-height: 1.1;
}

.metric strong small {
  color: var(--color-muted);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.metric-note {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-track {
  display: block;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-neutral-300);
}

.budget-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-teal);
  transition: width 220ms ease-out, background-color 180ms ease-out;
}

.session-clock {
  color: var(--color-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.primary-grid,
.analytics-grid,
.operations-grid,
.footer-grid {
  display: grid;
  align-items: stretch;
  gap: 18px;
  margin-top: 18px;
}

.primary-grid {
  grid-template-columns: minmax(620px, 1.75fr) minmax(330px, 0.75fr);
}

.analytics-grid {
  grid-template-columns: minmax(520px, 1.55fr) repeat(2, minmax(280px, 0.72fr));
}

.operations-grid {
  grid-template-columns: repeat(4, minmax(245px, 1fr));
}

.footer-grid {
  grid-template-columns: minmax(340px, 0.82fr) minmax(560px, 1.55fr);
}

/* Neon data ink needs a dark plotting surface in either application theme. */
.chart-panel, .compact-panel, .peers-panel {
  color-scheme: dark;
  --color-surface: #0b172a;
  --color-text: #eaf1fa;
  --color-muted: #aebcce;
  --color-divider: #34445f;
  --color-neutral-100: #0b1524;
  --color-neutral-200: #16223a;
  --color-neutral-300: #1f2e4a;
  --color-accent: #5aa3f0;
  --color-accent-soft: #0a2440;
  --color-teal: #17bf98;
  --color-teal-soft: #06231c;
  --color-alert: #ff6b81;
  --color-alert-soft: #3a1020;
  --color-alert-text: #ffd3dc;
  color: var(--color-text);
}

.panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.panel-heading {
  padding: 18px 20px 0;
}

.panel-heading--split {
  justify-content: space-between;
  gap: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.counter {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  background: var(--color-neutral-200);
  color: var(--color-muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.route-panel {
  min-height: 610px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
}

.panel-heading.map-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 20px;
}

.map-heading h2 { font-size: 18px; white-space: nowrap; }
.map-context, #map-sample-time { color: var(--color-muted); font-size: 12px; }
#map-sample-time { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

.map-overlay-footer {
  position: absolute;
  z-index: 2;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-width: calc(100% - 24px);
  padding: 4px 12px;
  border-radius: 8px;
  background: #0b182bec;
}

.map-info summary {
  cursor: pointer;
  padding-block: 10px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.map-info-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(380px, 100%);
  padding: 12px 16px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  background: #0b182b;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
}

.map-info-content p { margin: 0; padding: 0; }
.map-info-content p + p { margin-top: 8px; }
.map-info summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.map-legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 11px;
  color: var(--color-muted);
  font-size: 10.5px;
  font-weight: 700;
}

.map-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  width: 17px;
  height: 2px;
  background: var(--color-accent);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
}

.legend-cross {
  color: var(--color-alert);
  font-size: 16px;
  line-height: 1;
}

.map-stage {
  position: relative;
  min-height: 720px;
}

.map-toolbar,
.map-view-switch,
.globe-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.map-toolbar {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  right: 12px;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.map-toolbar > div { pointer-events: auto; }

.map-toolbar button {
  min-height: 40px;
  min-width: 40px;
  padding: 8px 12px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: 700 12px "Figtree", system-ui, sans-serif;
  cursor: pointer;
}

.map-toolbar button:hover:not(:disabled) { background: var(--color-neutral-200); }
.map-toolbar button[aria-pressed="true"] { color: var(--color-accent); border-color: currentColor; background: var(--color-accent-soft); }
.map-toolbar button:disabled { opacity: 0.4; cursor: default; }
.map-view-hint { color: var(--color-muted); font-size: 12px; }

@container (max-width: 720px) {
  .map-toolbar { position: relative; inset: auto; padding: 8px 12px; gap: 8px; }
  .map-toolbar button { min-height: 44px; min-width: 44px; padding: 8px 10px; }
  .map-overlay-footer { position: relative; inset: auto; max-width: none; margin: 0 12px 8px; }
  .map-info-content { width: min(380px, 100%); }
  .panel-heading.map-heading { padding: 12px; gap: 4px 12px; }
  .map-heading .map-context { display: none; }
}

.route-map.is-globe {
  background: #030b17;
  cursor: grab;
  touch-action: pan-y;
  min-height: 0;
}
.map-stage:has(.is-globe) { min-height: 0; }
.route-panel:has(.is-globe) { min-height: 0; }
.route-map.is-globe.is-dragging { cursor: grabbing; }
.route-map.is-globe .governorate { filter: none; }
.route-map.is-globe .country-neon-corona { stroke-width: 10; opacity: .09; }
.route-map.is-globe .country-neon-aura { stroke-width: 6; opacity: .22; }
.route-map.is-globe .country-neon-edge { stroke-width: 2.8; opacity: 1; }
.route-map.is-globe .country-neon-core { stroke-width: .85; }
.route-map.is-globe .route-path { animation-timing-function: steps(42, end); }
.route-map.is-dragging .route-path,
.route-map[data-offscreen="true"] .route-path,
.dashboard-shell[data-hidden="true"] .route-path { animation-play-state: paused; }
.globe-readouts { display: none; }
.globe-stars { fill: #c2d9f0; pointer-events: none; }
.globe-light { pointer-events: none; }
.route-map.is-globe .country { fill: #102236; stroke: #2e455c; stroke-width: 0.5; }
.route-map.is-globe .country.is-illuminated { fill: #123041; stroke: none; }
.route-map.is-globe .map-graticule { stroke: #72a1bc; opacity: 0.16; stroke-width: 0.7; }
.route-map.is-globe .route-casing { stroke: var(--peer-color); stroke-width: 6; opacity: 0.16; }
.route-map.is-globe .route-path { stroke-width: 2.1; }
.route-map.is-globe .route-group.is-selected .route-path { stroke-width: 3; }
.route-map.is-globe .route-label-bg { fill: #0b192c; stroke: #3b536c; }
.route-map.is-globe .route-label-title { fill: #f0f6ff; }
.route-map.is-globe .route-label-value { fill: #bdcee1; }
.route-map {
  display: block;
  width: 100%;
  min-height: 710px;
  background: #091525;
  border-radius: 10px;
  isolation: isolate;
}

.map-loading {
  position: absolute;
  inset: 50% auto auto 50%;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--color-neutral-200);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  transform: translate(-50%, -50%);
}

.map-loading[hidden] {
  display: none;
}

.route-map .map-sphere {
  fill: #091525;
  stroke: #23334a;
  stroke-width: 1.2;
}

.route-map .map-graticule {
  fill: none;
  stroke: #23334a;
  stroke-width: 0.7;
  opacity: 0.45;
}

.route-map .country {
  fill: #142238;
  stroke: #34445c;
  stroke-width: 0.7;
}

.route-map .country.is-illuminated {
  fill: #0b1b2c;
  stroke: none;
}

.country-neon-layer {
  pointer-events: none;
}

.governorate {
  fill: transparent;
  stroke: #75f6ff;
  stroke-width: 0.65;
  stroke-linejoin: round;
}

.governorate.is-basra {
  fill: #00e6dc;
  fill-opacity: 0.9;
  stroke: #cffff9;
  stroke-width: 1.4;
}

.governorate-border,
.governorate-border-glow {
  fill: none;
  stroke: #75f6ff;
  stroke-width: 0.85;
  stroke-linejoin: round;
  pointer-events: none;
}

.governorate-border-glow {
  stroke: #00cde5;
  stroke-width: 2.4;
  opacity: 0.7;
  filter: url(#country-bloom);
}

.legend-basra {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #00e6dc;
  border: 1px solid #087f86;
}

.map-attribution {
  margin: 0;
  padding: 10px 20px 14px;
  color: var(--color-muted);
  font-size: 11px;
  line-height: 1.45;
}

.country-neon path {
  fill: none;
  stroke: var(--country-neon);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.country-neon-halo {
  stroke-width: 8;
  opacity: 0.6;
  filter: url(#country-halo);
}

.country-neon-bloom {
  stroke-width: 4.5;
  opacity: 0.85;
  filter: url(#country-bloom);
}

.country-neon-edge {
  stroke-width: 2.6;
}

.country-neon .country-neon-core {
  stroke: #ecffff;
  stroke-width: 0.9;
}

/* The map retains a dark plotting surface in both dashboard themes. */
.route-map .route-group {
  --peer-1: #5aa3f0;
  --peer-2: #17bf98;
  --peer-3: #f98a2b;
  --peer-4: #a78bfa;
  --peer-5: #f0559b;
  --peer-6: #facc15;
}

.route-map .hub-label-title,
.route-map .hub-label-subtitle {
  fill: #eaf1fa;
  paint-order: stroke;
  stroke: #091525;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.route-path {
  fill: none;
  stroke: var(--peer-color);
  stroke-linecap: round;
  stroke-width: 2.5;
  opacity: 0.95;
  animation: route-flow 3.5s linear infinite;
  cursor: pointer;
}

.route-group.is-selected .route-path {
  stroke-width: 4;
  opacity: 1;
}

.route-casing,
.route-hit-area {
  fill: none;
  stroke: #091525;
  stroke-width: 7;
  pointer-events: none;
}

.route-hit-area {
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}

.route-group[data-probe="dropped"] .route-path {
  animation-play-state: paused;
  opacity: 0.5;
}

.route-group:focus-visible .route-label-bg {
  stroke: #eaf1fa;
  stroke-width: 2;
}

/* Keep keyboard focus on the label, not the entire curved route's bounds. */
.route-group:focus {
  outline: none;
}

.planned-map-node {
  fill: #091525;
  stroke: #aabbd4;
  stroke-width: 2;
  stroke-dasharray: 3 3;
}

.planned-map-leader {
  stroke: #aabbd4;
  stroke-width: 1;
}

.legend-planned {
  width: 10px;
  height: 10px;
  border: 1px dashed currentColor;
  border-radius: 50%;
}

.planned-location-row {
  display: grid;
  gap: 5px;
  padding: 16px 20px;
  color: var(--color-muted);
  border-top: 1px solid var(--color-divider);
  font-size: 12px;
}

.planned-location-row strong {
  color: var(--color-text);
}

.route-marker-hit { fill: transparent; stroke: none; pointer-events: all; cursor: pointer; }
.map-stage:has([data-view="flat"]) .globe-controls { display: none; }

@container (min-width: 721px) {
  .map-stage {
    flex: 1 0 auto;
    aspect-ratio: 9 / 8;
    min-height: 720px;
  }
  .map-stage:has(.is-globe) { aspect-ratio: 9 / 5; }
  .route-map, .route-map.is-globe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }
}

.route-label-bg {
  fill: var(--color-surface);
  stroke: var(--color-divider);
  stroke-width: 1;
}

.route-label-leader {
  stroke: var(--peer-color);
  stroke-width: 1.2;
  pointer-events: none;
}

.route-label-title,
.route-label-value,
.hub-label-title,
.hub-label-subtitle {
  fill: var(--color-text);
  font-family: "Figtree", system-ui, sans-serif;
}

.route-label-title {
  font-size: 12px;
  font-weight: 800;
}

.route-label-value {
  fill: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
}

.hub-label-title {
  font-size: 13px;
  font-weight: 800;
}

.hub-label-subtitle {
  fill: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
}

.peers-panel {
  min-height: 610px;
}

.peer-list {
  padding: 10px 14px 14px;
}

/* Balance the five country cards against the taller flat map without
   adding blank filler or changing the compact stacked/mobile layout. */
@media (min-width: 981px) {
  .primary-grid:has([data-view="flat"]) .peers-panel {
    display: flex;
    flex-direction: column;
  }
  .primary-grid:has([data-view="flat"]) .peer-list {
    flex: 1;
    display: grid;
    grid-auto-rows: 1fr;
  }
  .primary-grid:has([data-view="flat"]) .peer-row {
    align-content: center;
  }
}

.peer-row {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) 100px;
  gap: 8px 12px;
  width: 100%;
  padding: 13px 11px;
  border: 0;
  border-top: 2px solid var(--color-neutral-300);
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease-out;
}

.peer-row:first-child {
  border-top-color: transparent;
}

.peer-row:hover {
  background: var(--color-neutral-100);
}

.peer-row.is-selected {
  background: var(--color-accent-soft);
}

.peer-identity {
  gap: 9px;
  min-width: 0;
}

.peer-swatch {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--peer-color);
}

.peer-identity strong,
.peer-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-identity strong {
  font-size: 14px;
}

.peer-identity small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.peer-spark {
  align-self: center;
  height: 30px;
}

.peer-spark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.peer-values {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.peer-values small,
.peer-values strong {
  display: block;
}

.peer-values small {
  color: var(--color-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.peer-values strong {
  margin-top: 2px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-flex;
  grid-column: 1 / -1;
  justify-self: start;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  background: var(--color-teal-soft);
  color: var(--color-teal);
  font-size: 9.5px;
}

.peer-row[data-status="elevated"] .status-badge {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.peer-row[data-status="degraded"] .status-badge {
  background: var(--color-alert-soft);
  color: var(--color-alert-text);
}

.chart-panel,
.compact-panel {
  padding-bottom: 18px;
}

.chart-svg {
  display: block;
  width: calc(100% - 24px);
  height: auto;
  margin: 10px 12px 0;
  overflow: visible;
}

.chart-svg--compact {
  margin-top: 4px;
}

.chart-grid-line {
  stroke: var(--color-neutral-300);
  stroke-width: 1;
}

.chart-axis-label,
.chart-point-label {
  fill: var(--color-muted);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.chart-threshold {
  stroke: var(--color-alert);
  stroke-dasharray: 5 6;
  stroke-width: 1.2;
  opacity: 0.7;
}

.rtt-line {
  fill: none;
  stroke: var(--peer-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0.95;
}

.rtt-line.is-selected {
  stroke-width: 3.2;
  opacity: 1;
}

.rtt-head {
  fill: var(--peer-color);
  stroke: var(--color-surface);
  stroke-width: 2;
}

.chart-legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 10px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
}

.chart-legend i {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--peer-color);
}

.heatmap,
.throughput-list,
.traceroute-list,
.event-list,
.ranking-list,
.availability-list {
  margin: 12px 0 0;
  padding: 0 18px;
  list-style: none;
}

.probe-delivery-chart {
  padding: 4px 0 0;
}

.delivery-target {
  cursor: pointer;
}

.delivery-target.is-selected text {
  fill: var(--color-text);
  font-weight: 800;
}

.delivery-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 2px 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.delivery-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--color-teal);
}

.delivery-legend .delivery-lost::before {
  background: var(--color-alert);
}
.delivery-legend .delivery-received::before { background: var(--color-text); }
.chart-legend i[data-pattern="alternate"] { background: transparent; border: 2px dashed var(--peer-color); }

.node-chart-note {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--color-muted);
}

.node-latency-line {
  fill: none;
  stroke: var(--peer-color);
  stroke-width: 2;
  stroke-linejoin: round;
}

.node-threshold {
  stroke: var(--color-alert);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  opacity: 0.65;
}

.node-loss-marker {
  fill: none;
  stroke: var(--color-alert);
  stroke-width: 2;
}

.node-latency-stats,
.node-probe-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px 18px;
}

.node-probe-totals {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--color-divider);
}

.node-latency-stats dt,
.node-probe-totals dt,
.node-diagnostics dt {
  color: var(--color-muted);
  font-size: 10.5px;
}

.node-latency-stats dd,
.node-probe-totals dd {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.node-details {
  padding: 10px 18px 16px;
  border-top: 1px solid var(--color-divider);
}

.node-details summary {
  cursor: pointer;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
}

.node-diagnostics {
  margin: 12px 0 0;
}

.node-diagnostics > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.node-diagnostics dd {
  margin: 0;
  font-size: 11px;
  text-align: right;
  overflow-wrap: anywhere;
}

.heat-row,
.availability-row {
  display: grid;
  grid-template-columns: 108px minmax(70px, 1fr) 48px;
  align-items: center;
  gap: 9px;
  min-height: 37px;
  border-top: 1px solid var(--color-divider);
}

.heat-row:first-child,
.availability-row:first-child {
  border-top: 0;
}

.heat-label,
.availability-label {
  font-size: 10.5px;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
}

.heat-cells,
.availability-cells {
  display: flex;
  gap: 2px;
  min-width: 0;
}

.heat-cell,
.availability-cell {
  flex: 1 1 0;
  min-width: 2px;
  height: 17px;
  border-radius: 3px;
  background: var(--peer-color);
}

.heat-value,
.availability-value {
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.availability-cell[data-probe="up"] {
  background: var(--peer-color);
}

.availability-cell[data-probe="slow"] {
  background: var(--peer-color);
  box-shadow: inset 0 0 0 2px #fbbf24;
}

.availability-cell[data-probe="dropped"] {
  background: var(--color-alert);
}

.heat-cell[data-probe="dropped"] {
  background: var(--color-alert);
}

.scatter-bubble {
  fill: var(--peer-color);
  stroke: var(--color-surface);
  stroke-width: 2;
  opacity: 0.95;
}

.scatter-bubble.is-selected {
  stroke: var(--color-text);
  stroke-width: 2.5;
  opacity: 1;
}

.throughput-row,
.traceroute-item,
.event-item,
.ranking-item {
  border-top: 1px solid var(--color-divider);
}

.throughput-row:first-child,
.traceroute-item:first-child,
.event-item:first-child,
.ranking-item:first-child {
  border-top: 0;
}

.throughput-row {
  padding: 9px 0;
}

.panel-empty {
  display: grid;
  min-height: 148px;
  place-items: center;
  padding: 20px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.throughput-meta,
.ranking-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.throughput-meta strong,
.ranking-meta strong {
  font-size: 11px;
}

.throughput-meta span,
.ranking-meta span {
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.throughput-bars {
  display: grid;
  gap: 3px;
}

.throughput-track,
.ranking-track,
.hop-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-neutral-300);
}

.throughput-bar,
.ranking-bar,
.hop-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--peer-color);
  transition: width 220ms ease-out;
}

.throughput-bar.is-outbound {
  opacity: 0.43;
}

.traceroute-list {
  counter-reset: hop;
}

.traceroute-item {
  display: grid;
  grid-template-columns: 22px minmax(90px, 1fr) 62px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 10.5px;
}

.hop-number {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-neutral-200);
  color: var(--color-muted);
  font-size: 9px;
  font-weight: 800;
}

.hop-main {
  min-width: 0;
}

.hop-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hop-track {
  margin-top: 4px;
  height: 4px;
}

.hop-time {
  color: var(--color-muted);
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.percentile-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 3px 18px 0;
}

.percentile-list div {
  min-width: 0;
}

.percentile-list dt {
  color: var(--color-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.percentile-list dd {
  margin: 2px 0 0;
  font-size: 16px;
}

.event-item {
  display: grid;
  grid-template-columns: 56px 62px minmax(100px, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
}

.event-time {
  color: var(--color-muted);
  font-size: 9.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.event-kind {
  display: inline-flex;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--color-neutral-200);
  color: var(--color-muted);
  font-size: 8.5px;
  font-weight: 800;
  text-transform: capitalize;
}

.event-item[data-kind="alert"] .event-kind,
.event-item[data-kind="loss"] .event-kind {
  background: var(--color-alert-soft);
  color: var(--color-alert-text);
}

.event-item[data-kind="recovery"] .event-kind {
  background: var(--color-teal-soft);
  color: var(--color-teal);
}

.event-message {
  font-size: 10.5px;
  font-weight: 650;
}

.ranking-item {
  display: grid;
  grid-template-columns: 28px 92px minmax(100px, 1fr) 40px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}

.rank-number {
  color: var(--color-muted);
  font-family: "Caprasimo", "Figtree", system-ui, sans-serif;
  font-size: 17px;
}

.rank-name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  font-family: "Caprasimo", "Figtree", system-ui, sans-serif;
  font-size: 15px;
  text-align: right;
}

.availability-panel {
  min-width: 0;
}

.dashboard-footer {
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 11px 2px 0;
  color: var(--color-muted);
  font-size: 10.5px;
  font-weight: 600;
}

[data-paused="true"] .route-path {
  animation-play-state: paused;
}

@keyframes route-flow {
  to {
    stroke-dashoffset: -64;
  }
}

@media (max-width: 1320px) {
  .primary-grid {
    grid-template-columns: minmax(560px, 1.55fr) minmax(315px, 0.8fr);
  }

  .analytics-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }

  .chart-panel--wide {
    grid-column: 1 / -1;
  }

  .operations-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-shell {
    padding-inline: 20px;
  }

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

  .brand-mark {
    width: 130px;
  }

  .topbar-actions {
    max-width: 390px;
  }

  .metric-strip {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 16px;
  }

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric:nth-child(4) {
    padding-left: 0;
  }

  .primary-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .peers-panel,
  .route-panel {
    min-height: auto;
  }

  .peer-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 8px;
  }

  .peer-row,
  .peer-row:first-child {
    border-top-color: var(--color-divider);
  }
}

@media (max-width: 720px) {
  .dashboard-shell {
    padding: 15px 13px 28px;
  }

  .topbar,
  .brand-block {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .brand-block {
    width: 100%;
  }

  .brand-mark {
    width: 110px;
  }

  .brand-copy h1 {
    font-size: 23px;
  }

  .topbar-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .source-pill {
    order: 5;
    max-width: 100%;
  }

  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric,
  .metric:first-child,
  .metric:nth-child(4) {
    padding-inline: 12px;
  }

  .metric:nth-child(even) {
    border-right: 0;
  }

  .metric:nth-child(odd) {
    padding-left: 0;
  }

  .metric:last-child {
    grid-column: 1 / -1;
    padding-right: 0;
  }

  .panel-heading--split {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-legend,
  .chart-legend {
    justify-content: flex-start;
  }

  .map-stage {
    min-height: 400px;
    overflow-x: auto;
  }

  .route-map {
    width: 680px;
    min-height: 400px;
  }

  .map-stage:has(.is-globe) { min-height: 0; overflow: hidden; }
  .route-map.is-globe { width: 100%; min-height: 0; }
  .route-map.is-globe .globe-route-label,
  .route-map.is-globe .route-label-leader { display: none; }
  .globe-readouts:not(:empty) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
  .globe-readouts button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; min-height: 62px; border: 1px solid var(--color-divider); border-left: 3px solid var(--peer-color); border-radius: 8px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 14px; cursor: pointer; }
  .globe-readouts button span { color: var(--color-muted); font-variant-numeric: tabular-nums; }
  .globe-readouts button[aria-pressed="true"] { background: var(--color-accent-soft); }
  .map-toolbar { padding-inline: 12px; gap: 8px; }
  .map-toolbar button { min-height: 44px; min-width: 44px; }
  .map-view-hint { padding-inline: 12px; line-height: 1.5; }

  .peer-list,
  .analytics-grid,
  .operations-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel--wide {
    grid-column: auto;
  }

  .heat-row,
  .availability-row {
    grid-template-columns: 108px minmax(70px, 1fr) 48px;
  }

  .event-item {
    grid-template-columns: 50px 56px minmax(90px, 1fr);
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
