@font-face {
  font-family: 'Geist';
  src: url('./fonts/geist.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('./fonts/geist-mono.woff2') format('woff2');
  font-weight: 400 650;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('./fonts/noto-sc.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
  --bg: #0b1015;
  --panel: #10171e;
  --panel-up: #151d25;
  --stroke: #27313c;
  --line: #222d37;
  --text: #e9eff3;
  --sub: #b7c2cd;
  --muted: #92a1b1;
  --mint: #75e4c2;
  --violet: #b4a0ef;
  --blue: #8bb6f8;
  --amber: #f2b56b;
  --neutral: #8a96a5;
  --rose: #ed93ac;
  --header: #0d1319;
  --border-strong: #3c4d5b;
  --surface-tint: #19232c;
  --card-top: #19232c;
  --hover: #1b2830;
  --selected: #23313b;
  --canvas: #0d141b;
  --canvas-dot: rgb(255 255 255 / 0.1);
  --canvas-lift: #15212b;
  /* Dark lines are as bright as their packets, so the packet core is lifted toward white. */
  --packet-fill: color-mix(in srgb, currentColor 45%, #fff);
  --inactive: #35414b;
  --quota-lightness: 59%;
  --glow: #17272a;
  --label-bg: #0e151cda;
  --shadow: #0003;
  --backdrop: #05090e75;
  --selected-tip: #1c2935;
  --chart-grid: #2b3945;
  /* On the dark canvas, map cards sit one step lighter with a firmer edge; shadows do not show there. */
  --map-card: #1b2530;
  --map-card-edge: #3c4d5b;
  --map-card-rule: #2c3945;
  --font: 'Geist', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'Geist Mono', 'Noto Sans SC', 'SFMono-Regular', Consolas, monospace;
  /* Large readings use proportional Geist with tabular figures instead of tightly tracked mono. */
  --num: 'Geist', 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-family: var(--font);
  font-size: 16px;
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #e9eef1;
  --panel: #fff;
  --panel-up: #f7fafb;
  --stroke: #c9d6db;
  --line: #dce5e9;
  --text: #162c35;
  --sub: #344e5d;
  --muted: #506773;
  --mint: #08745e;
  --violet: #704ba4;
  --blue: #275faa;
  --amber: #97510a;
  --neutral: #5f7280;
  --rose: #a84562;
  --header: #fff;
  --border-strong: #9aaeb9;
  --surface-tint: #edf3f5;
  --card-top: #fff;
  --hover: #e5eff0;
  --selected: #dce9ea;
  --canvas: #f0f4f6;
  --canvas-dot: rgb(20 48 60 / 0.16);
  --canvas-lift: #fbfdfe;
  --packet-fill: currentColor;
  --inactive: #c5d0d6;
  --quota-lightness: 44%;
  --glow: #dbece7;
  --label-bg: #f4f8f9ed;
  --shadow: #1d394412;
  --backdrop: #24374447;
  --selected-tip: #fff;
  --chart-grid: #cfdbdf;
  --map-card: #fff;
  --map-card-edge: #c9d6db;
  --map-card-rule: #dce5e9;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(ellipse at 28% -30%, var(--glow) 0, transparent 52%), var(--bg);
  min-height: 100vh;
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button {
  background: none;
  border: 0;
}
button,
a,
select {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
:root[data-focus-mode='pointer'] :focus {
  outline: none;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button svg,
a svg,
i svg {
  display: block;
}
i[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-style: normal;
}
svg.icon {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
button:disabled {
  opacity: 0.5;
}
[hidden] {
  display: none !important;
}
button.phone-only {
  display: none;
}
.mint {
  --accent: var(--mint);
}
.violet {
  --accent: var(--violet);
}
.blue {
  --accent: var(--blue);
}
.amber {
  --accent: var(--amber);
}
.rose {
  --accent: var(--rose);
}
.neutral {
  --accent: var(--neutral);
}

.head-actions {
  display: flex;
  align-items: center;
}

.control,
.icon-button,
.select-control,
.segment button {
  border: 1px solid var(--stroke);
  border-radius: 7px;
  background: var(--panel-up);
}
.control,
.icon-button,
.select-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sub);
  min-height: 34px;
}
.control {
  padding: 0 11px;
  gap: 8px;
  font-size: 13px;
}
.control:hover,
.icon-button:hover,
.select-control:hover,
.segment button:hover {
  background: var(--hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.live-control {
  gap: 8px;
}
.live-control .playback-icon {
  padding-left: 8px;
  border-left: 1px solid var(--stroke);
  margin-left: 2px;
}
.live-dot,
.status-dot {
  display: inline-block;
  border-radius: 50%;
  width: 7px;
  height: 7px;
  background: var(--mint);
  flex: none;
}
.live-dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 12%, transparent);
}
.live-control[aria-pressed='false'] .live-dot {
  background: var(--neutral);
  box-shadow: none;
}
.icon-button {
  width: 34px;
  padding: 0;
}
.icon-button .icon {
  width: 16px;
  height: 16px;
}
.select-control {
  position: relative;
  gap: 6px;
  padding: 0 9px;
  color: var(--sub);
  font-size: 13px;
}
.select-control > .icon:first-child,
.select-control > i:first-child {
  pointer-events: none;
}
.select-control select {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 13px;
  padding: 7px 25px 7px 29px;
  margin: 0 -22px 0 -30px;
  z-index: 1;
  border-radius: 5px;
  height: 34px;
  min-width: 106px;
}
.select-control .icon {
  width: 15px;
  height: 15px;
  pointer-events: none;
}
.select-control select:focus-visible {
  outline-offset: 0;
}
select option {
  background: var(--panel-up);
  color: var(--text);
}

.map-stage > svg,
.map-stage > #map-nodes,
.map-stage > #map-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.map-stage > #map-nodes,
.map-stage > #map-labels {
  pointer-events: none;
}
.map-stage #map-labels {
  z-index: 2;
}
.map-stage #map-nodes {
  z-index: 3;
}
.edge-group {
  color: var(--accent);
  transition: opacity 0.18s;
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
  pointer-events: stroke;
}
.edge-line {
  stroke: currentColor;
  stroke-width: var(--flow-width);
  fill: none;
  opacity: 0.72;
  pointer-events: none;
}
.edge-group.amber .edge-line,
.edge-group.rose .edge-line {
  stroke-dasharray: 5 4;
  opacity: 0.9;
}
.edge-group.is-selected .edge-line {
  opacity: 1;
  stroke-width: calc(var(--flow-width) + 1.5px);
}
.edge-group.neutral .edge-line {
  stroke-dasharray: 3 5;
  opacity: 0.55;
}
.edge-group .port {
  fill: currentColor;
  opacity: 0.95;
}
/* A packet is always wider than its line and wears a canvas ring, so it stays visible in both themes. */
.packet {
  r: calc(var(--flow-width) / 2 + 1.75px);
  fill: var(--packet-fill);
  stroke: var(--canvas);
  stroke-width: 1.5px;
  paint-order: stroke;
  filter: drop-shadow(0 0 3px currentColor);
  pointer-events: none;
}
.edge-group:hover .edge-line {
  opacity: 1;
}
.edge-label {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 2;
  padding: 0;
  font: 12px var(--mono);
  color: var(--accent);
  transition: opacity 0.18s;
  white-space: nowrap;
}
.edge-loss {
  display: block;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  color: var(--sub);
  font:
    500 11.5px/1.1 var(--mono),
    var(--font);
  letter-spacing: 0.025em;
  background: var(--label-bg);
  padding: 0 3px;
  border-radius: 3px;
}
.edge-label.amber .edge-loss {
  color: var(--amber);
}
.edge-rtt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
  padding: 4px 6px;
  background: var(--panel-up);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--stroke));
  border-radius: 5px;
  font-weight: 600;
  box-shadow: 0 1px 3px var(--shadow);
}
.edge-rtt em {
  font-style: normal;
  font-size: 11px;
  opacity: 0.8;
  font-weight: 450;
}
.edge-rtt .icon {
  width: 12px;
  height: 12px;
}
.edge-label:hover .edge-rtt,
:where([data-focus-mode='keyboard']) .edge-label:focus-visible .edge-rtt {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent);
}
.edge-label.is-selected .edge-rtt {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.edge-label.amber .edge-loss,
.edge-label.rose .edge-loss {
  color: var(--accent);
  font-weight: 600;
}
.edge-bridge {
  fill: none;
  stroke: var(--canvas);
  stroke-width: calc(var(--flow-width) + 4px);
  pointer-events: none;
}
.edge-group.dimmed .edge-bridge {
  display: none;
}
.reference-label .edge-rtt {
  font-size: 11px;
  gap: 4px;
  padding: 4px;
  white-space: nowrap;
}
.reference-label small {
  font: 500 10px/1 var(--font);
  color: var(--sub);
}
@media (max-width: 1100px) {
  .reference-label .edge-rtt {
    padding-inline: 2px;
    gap: 2px;
  }
}
.mobile-reference-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px;
  width: min(100%, 398px);
  padding: 6px 4px 0 14px;
}
.mobile-reference-pair .mobile-node {
  display: block;
  width: 100%;
}
.mobile-reference-pair .mobile-node .card-vitals {
  flex-direction: row;
  justify-content: space-between;
  padding: 4px 8px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 7px 7px;
}
.mobile-reference-pair .mobile-edge {
  width: 100%;
  justify-content: center;
  margin: 0;
  padding-inline: 0;
}
.mobile-edge .edge-loss {
  position: static;
  transform: none;
  background: transparent;
  white-space: nowrap;
}

.node-icon {
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 13%, var(--panel-up));
  color: var(--accent);
}
.node-icon .icon {
  width: 19px;
  height: 19px;
}

.status-dot.ingress,
.status-dot.reference,
.status-dot.shared,
.status-dot.ping {
  border: 1px solid var(--muted);
  background: transparent;
}
.status-dot.offline {
  background: var(--neutral);
}
.dimmed {
  opacity: 0.19;
}
.edge-label.dimmed:hover {
  opacity: 0.8;
}
.mobile-routes {
  display: none;
}

/* Two-line event rows: what changed and when, then its latest state and how often it flipped. */
.event-row {
  width: 100%;
  display: grid;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  grid-template-areas:
    'icon title time'
    'icon state count';
  align-items: center;
  column-gap: 9px;
  row-gap: 1px;
  padding: 8px 4px;
  text-align: left;
  border-top: 1px solid var(--line);
  color: var(--sub);
  font-size: 13px;
}
.event-row:first-child {
  border-top: 0;
}
button.event-row:not(:disabled):hover .event-title {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.event-symbol {
  grid-area: icon;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  width: 21px;
  height: 21px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 5px;
  flex: none;
}
.event-symbol .icon {
  width: 13px;
  height: 13px;
}
.event-title {
  grid-area: title;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
  color: var(--text);
}
.event-state {
  grid-area: state;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}
.event-count {
  grid-area: count;
  justify-self: end;
  color: var(--muted);
  font: 500 11px var(--mono);
}
.event-row time {
  grid-area: time;
  justify-self: end;
  color: var(--muted);
  font: 12px var(--mono);
  white-space: nowrap;
}

.segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  background: var(--canvas);
}
.segment button {
  font-size: 13px;
  color: var(--muted);
  border: 0;
  padding: 5px 9px;
  border-radius: 4px;
  background: transparent;
  white-space: nowrap;
}
.segment button.active {
  color: var(--text);
  background: var(--selected);
}

.muted {
  color: var(--muted);
}
.state-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}
.state-label:before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.state-label.online,
.state-label.normal {
  color: var(--mint);
}
.state-label.degraded {
  color: var(--amber);
}
.state-label.critical {
  color: var(--rose);
}
.state-label.ingress:before,
.state-label.shared:before,
.state-label.ping:before,
.state-label.unmeasured:before {
  background: none;
  border: 1px solid currentColor;
}

.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(462px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  box-shadow: -18px 0 70px var(--shadow);
  overflow: auto;
}
.sheet::backdrop {
  background: var(--backdrop);
}
.sheet[open] {
  animation: sheet-in 0.16s ease-out;
}
body:has(.sheet:modal) {
  overflow: hidden;
}
@keyframes sheet-in {
  from {
    opacity: 0.4;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--header);
  border-bottom: 1px solid var(--stroke);
}
.sheet-head [tabindex='-1']:focus {
  outline: none;
}
.sheet-kind {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  font-weight: 550;
  color: var(--sub);
}
.sheet-kind .icon {
  color: var(--mint);
}
.sheet-body {
  padding: 23px 20px 30px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 12px;
}
.identity .node-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
}
.identity .node-icon .icon {
  width: 25px;
  height: 25px;
}
.identity h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.4;
}
.identity small {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.identity > .state-label {
  margin-left: auto;
}
.link-title {
  font-size: 21px !important;
}
.link-direction,
.detail-direction {
  color: var(--muted);
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 21px 0 17px;
}
/* Detail cards share one surface: the sheet's own background with a hairline, in both themes. */
.detail-stat {
  padding: 12px 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}
.detail-stat small,
.data-line > span:first-child {
  color: var(--muted);
  font-size: 12px;
}
.detail-stat b {
  display: block;
  margin-top: 8px;
  font: 600 20px/1.2 var(--num);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.detail-stat b em {
  font: 12px var(--font);
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 3px;
}
.detail-section {
  margin-top: 23px;
}
.detail-section > h3,
.detail-section-head h3 {
  font-size: 15px;
  font-weight: 600;
}
.data-line {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.data-line > span:last-child {
  color: var(--sub);
}
.endpoint:hover {
  background: var(--hover);
}
.reference-picker {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}
.endpoint {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.endpoint small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.detail-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 0;
  color: var(--mint);
  font-size: 12px;
}
.detail-link .icon {
  width: 13px;
  height: 13px;
}
@media (min-width: 1550px) {
  .node-icon {
    width: 34px;
    height: 34px;
  }
}
@media (max-width: 1050px) {
  .event-row {
    gap: 6px;
  }
}
@media (max-width: 900px) {
  .mobile-routes {
    display: block;
    padding: 9px 12px;
  }

  .mobile-route {
    border-bottom: 1px solid var(--line);
  }
  .mobile-route:last-child {
    border-bottom: 0;
  }
  .mobile-route summary {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    cursor: pointer;
    padding: 11px 3px;
    color: var(--text);
    font-size: 14px;
    font-weight: 580;
  }
  .mobile-route summary::-webkit-details-marker {
    display: none;
  }
  .route-line-marker {
    width: 15px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }
  .mobile-route summary small {
    margin-left: auto;
    color: var(--muted);
    font-weight: 400;
    font-size: 12px;
  }
  .mobile-route summary .icon {
    color: var(--muted);
    width: 13px;
  }
  .mobile-route[open] summary .icon {
    transform: rotate(180deg);
  }
  .mobile-steps {
    padding: 2px 0 12px 15px;
  }

  .mobile-edge {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: 17px;
    min-height: 27px;
    border-left: var(--flow-width) solid var(--accent);
    padding: 3px 0 3px 11px;
    border-radius: 0;
    color: var(--accent);
    font:
      12px var(--mono),
      var(--font);
  }
  .mobile-edge.amber,
  .mobile-edge.neutral {
    border-left-style: dashed;
  }
  :where([data-focus-mode='keyboard']) .mobile-edge:focus-visible {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
  }
}
@media (max-width: 590px) {
  .sheet {
    inset: auto 0 0;
    width: 100%;
    height: min(88dvh, 820px);
    max-height: 94dvh;
    border: 1px solid var(--border-strong);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
  }
  .sheet-head {
    padding: 10px 15px;
  }
  .sheet-body {
    padding: 17px 14px 24px;
  }
  .identity h2,
  .link-title {
    font-size: 19px !important;
  }
  .identity {
    gap: 8px;
  }
  .detail-stats {
    gap: 6px;
  }
  .detail-stat {
    padding: 10px 8px;
  }
  .detail-stat b {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .packet {
    display: none;
  }
}
.detail-status {
  display: flex;
  align-items: center;
  min-height: 24px;
  letter-spacing: 0;
}
.detail-status .state-label {
  font-family: var(--font);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sheet.node-sheet {
  width: min(530px, 100vw);
}
.sheet.sheet-wide {
  width: min(1060px, 100vw);
}
.head-actions {
  gap: 8px;
}
.head-actions :is(.control, .icon-button):not(:hover) {
  background: var(--panel);
  border-color: var(--line);
}
.head-actions .control {
  font-size: 13px;
}
.head-actions .control .icon {
  width: 15px;
  height: 15px;
}
.node-sheet .sheet-body {
  padding: 22px;
}
.stat-note {
  display: block;
  font: 12px/1.5 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.detail-stat b + .stat-note {
  margin-top: 8px;
}
.node-facts {
  display: grid;
  gap: 14px;
  align-items: start;
}
.fact-block {
  padding: 13px 14px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.fact-block h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 600;
}
.fact-block h3 .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.fact-block .data-line:last-child {
  border-bottom: 0;
}
.fact-block .data-line > span:last-child {
  text-align: right;
  overflow-wrap: anywhere;
}
.mobile-loss {
  color: var(--muted);
}
.mobile-edge.amber .mobile-loss {
  color: var(--amber);
}
.mobile-loss::after {
  content: '·';
  padding-left: 6px;
  color: var(--muted);
}
@media (min-width: 850px) {
  .sheet-wide .sheet-body {
    padding: 24px 28px;
  }
  .sheet-wide .fact-block {
    padding: 14px 16px 5px;
  }
}

@media (max-width: 620px) {
  .node-sheet .sheet-body {
    padding: 16px 13px 24px;
  }
  .sheet.node-sheet {
    width: 100vw;
  }
  .sheet.sheet-wide {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .stat-note {
    font-size: 11.5px;
  }
}
.flow-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.access-switch .icon {
  width: 15px;
  height: 15px;
}
.state-label.connected {
  color: var(--mint);
}
.access-notice:not(:empty) {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 7px;
  box-shadow: 0 3px 12px var(--shadow);
  color: var(--text);
  font-size: 13px;
}
.chart-empty {
  gap: 10px;
  flex-direction: column;
}
.node-head {
  padding: 19px 22px;
  gap: 12px;
}
.name-line {
  display: flex;
  align-items: center;
  gap: 9px;
}
.node-head .identity {
  min-width: 0;
}
.node-head .head-actions {
  flex: none;
}
.node-identity small {
  overflow-wrap: anywhere;
}
.name-line .state-label {
  font-size: 12px;
}
.node-identity .node-icon {
  width: 40px;
  height: 40px;
}
.node-facts .fact-block {
  min-width: 0;
}
.neighbor-dir {
  flex: none;
  font-size: 11px;
  color: var(--muted);
}
.node-facts .data-line {
  padding-block: 11px;
}
@media (min-width: 850px) {
  .sheet-wide .node-head {
    padding: 20px 28px;
  }
}
@media (max-width: 900px) {
  .mobile-edge {
    flex-wrap: wrap;
    column-gap: 6px;
  }
}
@media (max-width: 620px) {
  .node-head {
    padding: 13px;
  }
  .node-head .identity {
    gap: 7px;
  }
  .node-head .node-icon {
    width: 32px;
    height: 32px;
  }
  .node-head .name-line {
    gap: 5px;
    flex-wrap: wrap;
  }
  .node-head .name-line h2 {
    font-size: 17px !important;
  }
  .node-head .identity small {
    font-size: 12px;
  }
  .head-actions {
    gap: 5px;
  }
  .access-switch {
    font-size: 12px;
    padding: 0 6px;
    gap: 3px;
  }
  .access-switch .icon {
    width: 13px;
    height: 13px;
  }
}
@media (max-width: 380px) {
  .access-switch .icon {
    display: none;
  }
}

/* The board is the single overview surface: header metrics, map, and a rail for routes and events. */
.workspace {
  --gutter: clamp(12px, 1.3vw, 26px);
  max-width: 2200px;
  margin-inline: auto;
  padding: var(--gutter);
}
.topology-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - var(--gutter) * 2);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 14px 44px -28px var(--border-strong);
}
.board-head {
  display: flex;
  align-items: center;
  flex: none;
  gap: clamp(14px, 1.5vw, 26px);
  padding: 12px clamp(16px, 1.6vw, 26px);
  border-bottom: 1px solid var(--line);
}
.brand,
.board-actions,
.board-meta,
.theme-switch,
.map-tools {
  display: flex;
  align-items: center;
}
.brand {
  gap: 9px;
  color: var(--text);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.035em;
}
.brand img {
  display: block;
}
.board-identity h1 {
  font-size: clamp(19px, 1.45vw, 24px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.board-meta {
  margin-top: 4px;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.feed-status::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--border-strong);
}
.feed-status[data-level='warn'] {
  color: var(--amber);
}
.board-actions {
  gap: 10px;
  margin-left: auto;
}
.board-clock {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  font: 500 14px var(--mono);
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.board-clock small {
  color: var(--muted);
  font-size: 11px;
}
.theme-switch,
.map-tools {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--stroke);
  background: var(--surface-tint);
  border-radius: 9px;
}
.theme-switch button,
.map-tools .icon-button {
  display: grid;
  place-items: center;
  padding: 0;
  width: 30px;
  height: 27px;
  min-height: 27px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.theme-switch button[aria-pressed='true'],
.map-tools .icon-button[aria-pressed='true'] {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 3px var(--shadow);
}
.map-tools .icon-button:hover {
  color: var(--text);
  background: var(--panel);
}
.theme-switch .icon,
.map-tools .icon {
  width: 16px;
  height: 16px;
}

.telemetry {
  display: grid;
  grid-template-columns: repeat(4, auto);
  margin: 0;
  padding: 11px 0;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: 0 2px 6px var(--shadow);
}
.telemetry > div {
  padding: 0 clamp(13px, 1.5vw, 24px);
}
.telemetry > div + div {
  border-left: 1px solid var(--line);
}
.telemetry dt,
.telemetry dd {
  display: flex;
  align-items: center;
  gap: 6px;
}
.telemetry dt {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.telemetry dt .icon {
  width: 13px;
  height: 13px;
  color: var(--accent, var(--muted));
}
.telemetry dd {
  align-items: baseline;
  margin: 3px 0 0;
  font: 600 clamp(20px, 1.5vw, 25px) / 1.15 var(--num);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.telemetry dd b {
  font-weight: inherit;
}
.telemetry :is([data-summary='download'], [data-summary='upload']) {
  min-inline-size: 4ch;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.summary-trend {
  display: none;
  width: 42px;
  height: 16px;
  align-self: center;
  margin-left: 3px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (min-width: 1120px) {
  .telemetry {
    --trend-column: 45px;
  }
  .summary-trend {
    display: block;
  }
}
.telemetry dd small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
  letter-spacing: 0;
}
.fault-reading.has-faults {
  --accent: var(--amber);
}
.fault-reading.has-faults dd b {
  color: var(--amber);
}
.metric-block {
  min-width: 0;
  max-width: 100%;
}
.metric-scope {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 6px;
  padding-inline: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.metric-scope strong {
  color: var(--sub);
  font-weight: 600;
}
.metric-scope button {
  font: inherit;
  padding: 0;
  color: var(--mint);
}

/* Map canvas and its rail. */
.topology-canvas {
  --rail-w: clamp(280px, 21vw, 350px);
  position: relative;
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(var(--plot-min, 340px), 1fr) auto;
  isolation: isolate;
  /* A soft light behind the topology, and faint dots that fade out towards the edges. */
  --canvas-focus: 50% 46%;
  background: radial-gradient(60% 75% at var(--canvas-focus), var(--canvas-lift), transparent 82%), var(--canvas);
}
.topology-canvas::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(circle, var(--canvas-dot) 0.9px, transparent 1.3px);
  background-size: 26px 26px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 55% 70% at var(--canvas-focus), #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse 55% 70% at var(--canvas-focus), #000 25%, transparent 100%);
  pointer-events: none;
}
.topology-canvas.with-direct {
  --plot-min: 404px;
}
.map-stage {
  grid-area: 1 / 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
  overflow: hidden;
}
.map-stage.is-wide {
  overflow-x: auto;
}
.board-rail {
  grid-area: 2 / 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}
.rail-section {
  min-width: 0;
  padding: 14px clamp(12px, 1.1vw, 18px) 12px;
}
.rail-section + .rail-section {
  border-top: 1px solid var(--line);
}
.rail-section h2 {
  margin: 0 0 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.rail-list {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.rail-empty {
  padding: 6px 4px;
  color: var(--muted);
  font-size: 13px;
}
[data-health='good'] {
  --health: var(--mint);
}
[data-health='warn'] {
  --health: var(--amber);
}
[data-health='bad'] {
  --health: var(--rose);
}
[data-health='idle'] {
  --health: var(--inactive);
}
.rail-route,
.rail-node {
  position: relative;
  border-radius: 9px;
}
.rail-route::before,
.rail-node::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--health, var(--rim));
}
.rail-route.is-selected {
  background: var(--selected);
}
.rail-route-main,
.rail-node {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 7px 8px 7px 13px;
  border-radius: 9px;
  text-align: left;
  color: var(--text);
}
.rail-route-main:hover,
.rail-node:hover {
  background: var(--hover);
}
.rail-route.is-selected .rail-route-main:hover {
  background: transparent;
}
.rail-flag .node-icon,
.rail-node > .node-icon {
  width: 26px;
  height: 22px;
  border-radius: 5px;
}
.rail-flag .flag-tile .country-flag,
.rail-node .country-flag {
  width: 24px;
  height: 18px;
}
.rail-copy,
.rail-copy strong,
.rail-copy small {
  display: block;
  min-width: 0;
}
.rail-copy strong,
.rail-node .node-copy strong {
  font-size: 14px;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.rail-copy small {
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rail-reading {
  text-align: right;
  white-space: nowrap;
  font: 600 15px/1.25 var(--num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.rail-reading small {
  margin-left: 2px;
  color: var(--muted);
  font: 500 11px var(--font);
}
.rail-reading b {
  font-weight: inherit;
}
.rail-reading em {
  display: block;
  color: var(--health);
  font: 550 11px var(--font);
  font-style: normal;
}
.rail-route-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 0 10px 9px 49px;
}
.rail-route-tools .segment button {
  padding: 3px 9px;
  font-size: 12px;
}
.rail-route-tools .segment button[aria-pressed='true'] {
  color: var(--text);
  background: var(--panel);
}
.rail-node .card-vitals {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
}
.rail-node[data-state='offline']::before,
.rail-node[data-state='waiting']::before {
  background: repeating-linear-gradient(var(--rim) 0 3px, transparent 3px 6px);
}
.rail-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail-events .rail-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  align-content: start;
  gap: 0;
}

/* Nodes on the map: neutral frame, status on the leading edge. */
#map-nodes .node-card {
  --panel: var(--map-card);
  --stroke: var(--map-card-edge);
  --line: var(--map-card-rule);
}
.node-card {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0;
  text-align: left;
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--rim, var(--stroke));
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  overflow: hidden;
  box-shadow:
    0 1px 2px var(--shadow),
    0 8px 18px -12px var(--border-strong);
  pointer-events: auto;
  transition:
    border-color 0.16s,
    box-shadow 0.16s,
    opacity 0.18s;
}
.node-card:hover,
:where([data-focus-mode='keyboard']) .node-card:focus-visible {
  border-color: var(--border-strong);
  border-left-color: var(--rim, var(--border-strong));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--border-strong) 22%, transparent),
    0 6px 14px -6px var(--shadow);
}
.node-card.is-selected {
  border-color: color-mix(in srgb, var(--text) 55%, var(--stroke));
  border-left-color: var(--rim, var(--border-strong));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--text) 16%, transparent),
    0 10px 22px -10px var(--border-strong);
}
#map-nodes .map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  container-type: inline-size;
}
.card-identity {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px 9px 9px;
}
.card-identity .node-icon {
  width: 29px;
  height: 30px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent);
}
.card-identity .node-icon .icon {
  width: 17px;
  height: 17px;
}
.card-identity .status-dot {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 5px;
  height: 5px;
}
#map-nodes .card-identity .status-dot {
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.node-copy {
  display: block;
  min-width: 0;
}
.node-copy strong,
.node-copy small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-copy strong {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.025em;
}
.node-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.card-vitals {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  padding: 5px 10px 6px 9px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-tint) 43%, var(--panel));
}
.card-vitals:has(.quota-meter) {
  flex-wrap: nowrap;
  align-items: center;
}
.card-reading {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.35;
}
.card-reading:has(+ .card-reading) {
  min-width: 0;
}
.card-reading b {
  overflow: hidden;
  text-overflow: ellipsis;
  font: 550 13px/1.25 var(--mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.card-reading small,
.card-reading em {
  font-size: 12px;
  font-style: normal;
  color: var(--muted);
}
.card-reading em {
  margin-left: 1px;
}
.card-reading .up-mark {
  color: var(--muted);
}
.card-reading [data-unit]:empty {
  display: none;
}
.offline-note {
  align-items: center;
}
.offline-note .icon {
  width: 13px;
  height: 13px;
}
.node-card:has(.status-dot.offline) {
  border-style: dashed;
  box-shadow: none;
}
.status-dot.waiting {
  background: var(--muted);
}
.quota-reading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.quota-meter {
  display: inline-grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  width: 56px;
  min-width: 32px;
  height: 16px;
}
.quota-meter i {
  --fill: clamp(0%, calc((var(--quota-level, 0) - var(--slot)) * 100%), 100%);
  --color: hsl(calc(146 - var(--slot) * 10) 55% var(--quota-lightness));
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--color) var(--fill), var(--inactive) var(--fill));
}
.quota-meter[data-unknown] i {
  background: transparent;
  border: 1px solid var(--border-strong);
}
.quota-pct {
  color: var(--muted);
  font: 500 11px var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: none;
}
.quota-pct.unlimited {
  color: var(--sub);
  font: 600 14px/1 var(--font);
}
.quota-pct.low {
  color: var(--amber);
  font-weight: 650;
}
.quota-pct:empty {
  display: none;
}
@container (max-width: 168px) {
  .quota-pct:not(.low, .unlimited) {
    display: none;
  }
  .quota-meter {
    width: 48px;
  }
}

#detail-events {
  margin-top: 12px;
}
.node-facts #detail-events {
  margin: 0;
  grid-column: 1 / -1;
}
#detail-events .event-list {
  margin: 0;
}
body.map-expanded {
  overflow: hidden;
}
.map-expanded .topology-panel {
  position: fixed;
  z-index: 8;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
.map-expanded .topology-canvas {
  overflow: auto;
}
#history:not(:has(svg)) {
  min-height: 100px;
  display: grid;
  place-content: center;
  color: var(--muted);
}
#empty-map:not([hidden]) {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}
#empty-map a {
  color: var(--mint);
}
.admin-link {
  text-decoration: none;
}

/* Desktop header: brand, live metrics, status and controls on one line. */
@media (min-width: 901px) {
  .board-head {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .brand {
    align-self: stretch;
    flex: none;
    padding-right: clamp(14px, 1.5vw, 26px);
    border-right: 1px solid var(--line);
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .metric-block {
    order: 1;
    flex: 1 1 auto;
  }
  .board-identity {
    order: 2;
    flex: none;
  }
  .board-identity h1,
  #topo-count {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .board-meta {
    margin: 0;
  }
  .feed-status::before {
    display: none;
  }
  .board-actions {
    order: 3;
    margin-left: 0;
  }
  .metric-scope {
    display: none !important;
  }
  .telemetry {
    grid-template-columns: repeat(4, max-content);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .telemetry > div {
    padding: 0 clamp(14px, 1.5vw, 26px);
  }
  .telemetry > div:first-child {
    padding-left: 0;
  }
  .telemetry :is([data-kpi='download'], [data-kpi='upload']) dd {
    display: grid;
    grid-template-columns: max-content 32px var(--trend-column, 0px);
  }
}
/* app.js raises data-fit one step at a time until the header fits on one line, so the steps follow the
   real header content: the sign-out button, the selected route's labels and the width of each reading. */
@media (min-width: 901px) {
  :where(.board-head:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4'], [data-fit='5'])) .board-clock small {
    display: none;
  }
  :where(.board-head:is([data-fit='2'], [data-fit='3'], [data-fit='4'], [data-fit='5'])) .brand span {
    display: none;
  }
  :where(.board-head:is([data-fit='3'], [data-fit='4'], [data-fit='5'])) .live-control #live-label {
    display: none;
  }
  :where(.board-head:is([data-fit='3'], [data-fit='4'], [data-fit='5'])) .telemetry > div {
    padding-inline: 12px;
  }
  :where(.board-head:is([data-fit='4'], [data-fit='5'])) .board-clock {
    display: none;
  }
  .board-head[data-fit='5'] {
    column-gap: 10px;
  }
  .board-head[data-fit='5'] .brand {
    padding-right: 10px;
  }
  .board-head[data-fit='5'] .board-actions {
    gap: 6px;
  }
  :where(.board-head[data-fit='5']) .telemetry > div {
    padding-inline: 8px;
  }
}

/* Mid-size screens: routes, hosts and events sit in columns under the map. */
@media (min-width: 901px) and (max-width: 1179px) {
  .board-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    border-top: 1px solid var(--line);
  }
  .rail-section + .rail-section {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .rail-events .rail-list {
    max-height: 300px;
  }
  .card-identity {
    gap: 6px;
    padding-left: 7px;
  }
  .card-identity .node-icon {
    width: 24px;
    height: 26px;
  }
  .node-copy strong {
    font-size: 14px;
  }
  .card-vitals {
    padding-inline: 7px;
  }
}

/* Wide screens: the rail sits beside the map and details dock in its place. */
@media (min-width: 1180px) {
  .topology-canvas {
    --canvas-focus: 40% 46%;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    grid-template-rows: minmax(var(--plot-min, 340px), 1fr);
  }
  .board-rail {
    grid-area: 1 / 2;
    display: block;
    contain: size;
    overflow-y: auto;
    border-left: 1px solid var(--line);
  }
  .topology-canvas.detail-open {
    --rail-w: clamp(410px, 31vw, 520px);
  }
  .topology-canvas.detail-open[data-detail='wide'] {
    --rail-w: min(1000px, max(480px, calc(100% - 760px)));
  }
  .topology-canvas.detail-open .board-rail {
    visibility: hidden;
  }
  .topology-canvas .sheet:not(:modal) {
    position: absolute;
    inset: 0 0 0 auto;
    z-index: 6;
    width: var(--rail-w);
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: -18px 0 36px -30px var(--border-strong);
    overflow: auto;
  }
}

@media (max-width: 900px) {
  .workspace {
    --gutter: 12px;
  }
  .topology-panel {
    height: auto;
    min-height: 0;
  }
  .board-head {
    padding: 14px 16px;
    gap: 14px;
  }
  .brand {
    font-size: 20px;
    gap: 7px;
  }
  .brand img {
    width: 31px;
    height: 31px;
  }
  .board-actions {
    gap: 8px;
  }
  .board-clock,
  .board-rail {
    display: none;
  }
  .topology-canvas {
    display: flex;
    flex-direction: column;
  }
  .map-stage {
    display: none;
  }
  .mobile-routes {
    order: 2;
  }
  .mobile-steps {
    padding: 2px 4px 12px 14px;
  }
  .mobile-node {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    width: min(100%, 380px);
    border-radius: 8px;
  }
  .mobile-node .card-identity {
    padding: 6px 14px 6px 8px;
    gap: 8px;
  }
  .mobile-node .card-vitals {
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
    padding: 5px 8px;
    border-top: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 7px 7px 0;
    min-width: 77px;
  }
  .mobile-node .node-copy strong {
    font-size: 14px;
  }
  .map-expanded .topology-canvas {
    overflow: auto;
  }
  .map-expanded .topology-canvas > * {
    flex-shrink: 0;
  }
}
@media (max-width: 650px) {
  .feed-status::before {
    margin-right: 5px;
  }
  .metric-block {
    width: 100%;
  }
}

.version-label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: var(--sub);
  font-size: 13px;
}
.version-label select {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: var(--panel-up);
  color: var(--text);
}

/* Node details: one page of vitals, adjacent links and facts. */
.node-sheet .sheet-body {
  padding-top: 18px;
}
.vitals {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.vital {
  display: block;
  grid-column: span 2;
  min-width: 0;
  padding: 11px clamp(8px, 2.5cqi, 14px);
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.vital small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.vital b {
  display: block;
  margin-top: 4px;
  white-space: nowrap;
  font: 600 18px/1.2 var(--num);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.vital b em {
  margin-left: 2px;
  color: var(--muted);
  font: 11px var(--font);
  font-style: normal;
}
.vital .stat-note {
  display: block;
  overflow: hidden;
  font: 11px/1.5 var(--num);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.vital-speed {
  grid-column: span 3;
  padding-block: 9px 8px;
}
.speed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 8px;
}
.vital-speed small i {
  color: var(--accent);
  margin-right: 4px;
  font-style: normal;
}
.speed-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.speed-value b {
  margin: 0;
  font-size: 16px;
}
.speed-value em {
  color: var(--muted);
  font: 11px var(--font);
}
.node-body .node-facts {
  margin-top: 18px;
}
.data-line em {
  font-style: normal;
  color: var(--muted);
}
/* Details read at a glance: every row carries its own last day and nothing switches. */
.node-main,
.detail-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.node-main {
  gap: 22px;
}
.history-block {
  margin: 18px 0 6px;
}
.history-block .strip-axis + .history-figures + .block-head {
  margin-top: 10px;
}
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.block-head h3 {
  margin: 0;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}
.block-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.history-rows {
  display: grid;
  gap: 2px;
  margin-inline: -8px;
}
.history-row {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 8px;
  border-radius: 7px;
  text-align: left;
  color: var(--sub);
  font-size: 13px;
}
button.history-row:hover {
  background: var(--hover);
}
.row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-value {
  color: var(--accent);
  font: 12px var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row-value em {
  color: var(--muted);
  font-style: normal;
}
.row-head > .icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.route-breakdown .row-head .seg-dot {
  margin-right: 0;
}
/* Healthy cells stay quiet so amber and rose stand out. A missing half hour is a flat track. */
.strip {
  position: relative;
  display: flex;
  gap: 2px;
  height: 12px;
}
.strip-main {
  height: 16px;
}
.strip i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--mint) 38%, var(--panel));
}
.strip i.amber {
  background: var(--amber);
}
.strip i.rose {
  background: var(--rose);
}
.strip i.gap {
  align-self: center;
  height: 3px;
  background: var(--chart-grid);
}
.strip i.on {
  box-shadow: 0 0 0 1.5px var(--text);
}
.strip-note {
  color: var(--muted);
  font-size: 12px;
}
.strip-axis {
  position: relative;
  display: block;
  height: 14px;
  color: var(--muted);
  font: 10px/14px var(--mono);
}
.strip-axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.strip-axis .axis-end {
  right: 0;
  transform: none;
}
.history-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: 4px;
}
.history-figures div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: start;
}
.history-figures small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11.5px;
}
.history-figures b {
  font: 600 16px var(--num);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.history-figures em {
  margin-left: 3px;
  color: var(--muted);
  font: 11px var(--font);
}
.history-figures .warn b {
  color: var(--amber);
}
.hour-bars {
  position: relative;
  min-height: 150px;
  color: var(--muted);
  font-size: 12px;
}
.hour-bars svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.hour-bars svg text {
  font: 10px var(--mono);
  fill: var(--muted);
}
.hour-bars .bar {
  fill: color-mix(in srgb, var(--mint) 38%, var(--panel));
}
.hour-bars .bar.on {
  fill: var(--mint);
}
.hour-bars .bar.amber {
  fill: var(--amber);
}
.hour-bars .bar.rose {
  fill: var(--rose);
}
.hour-bars .bar.gap {
  fill: var(--chart-grid);
}
.hour-bars.inspecting .bar:not(.on) {
  opacity: 0.5;
}
.spark {
  position: relative;
  display: block;
  height: 24px;
  margin: 6px 0 4px;
  color: var(--accent);
}
.spark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.spark-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.spark-area {
  fill: currentColor;
  opacity: 0.12;
}
.vital-speed .spark {
  margin-bottom: 0;
}
.detail-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  z-index: 3;
  pointer-events: none;
  color: var(--text);
  background: var(--selected-tip);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 5px 7px;
  font: 11px/1.5 var(--mono);
  white-space: pre;
  box-shadow: 0 2px 5px var(--shadow);
}
.hour-bars > .detail-tip {
  top: 0;
  bottom: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .hour-bars .bar {
    transition: opacity 0.12s;
  }
}
/* The node layout follows the panel's own width, docked or modal. */
.node-sheet .sheet-body {
  container-type: inline-size;
}
@container (min-width: 700px) {
  .node-body {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: start;
  }
  .node-body .node-facts {
    margin-top: 0;
  }
}

/* Route details: per-hop share of the summed latency. */
.route-breakdown {
  margin: 4px 0 6px;
}
.seg-bar {
  display: flex;
  gap: 3px;
  height: 8px;
  margin: 10px 0 6px;
}
.seg-bar i {
  flex: 1 1 0;
  min-width: 6px;
  border-radius: 3px;
  background: var(--accent);
  transition: flex-grow 0.4s;
}
.seg-bar i.pending {
  flex: 0 0 16px;
  background: repeating-linear-gradient(135deg, var(--inactive) 0 3px, transparent 3px 6px);
}
.seg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--accent);
}
.seg-line > span:first-child {
  color: var(--sub);
}

.node-icon.flag-tile {
  background: transparent;
}
.country-flag {
  display: block;
  width: 28px;
  height: 21px;
  flex-shrink: 0;
  border-radius: 3px;
  background-image: url('/flags.webp');
  box-shadow: 0 0 0 1px var(--stroke);
}
.node-identity .country-flag {
  width: 36px;
  height: 27px;
}
