:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --text: #18212a;
  --muted: #667483;
  --line: rgba(47, 67, 82, 0.16);
  --surface-rgb: 255, 255, 255;
  --surface-strong: rgba(255, 255, 255, 0.96);
  --card-alpha: 0.88;
  --glass-alpha: 0.62;
  --focus-ring: rgba(16, 137, 123, 0.8);
  --accent: #10897b;
  --accent-strong: #0b6f63;
  --accent-soft: rgba(16, 137, 123, 0.12);
  --blue: #2563eb;
  --amber: #d97706;
  --danger: #dc2626;
  --shadow: 0 18px 48px rgba(38, 52, 67, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111513;
  --text: #eef3ef;
  --muted: #a3ada8;
  --line: rgba(221, 230, 224, 0.14);
  --surface-rgb: 23, 29, 27;
  --surface-strong: rgba(23, 29, 27, 0.96);
  --glass-alpha: 0.56;
  --focus-ring: rgba(109, 215, 197, 0.88);
  --accent: #3fc0aa;
  --accent-strong: #6dd7c5;
  --accent-soft: rgba(63, 192, 170, 0.16);
  --blue: #71a7ff;
  --amber: #f0b35a;
  --danger: #ff746d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.ambient-background,
.media-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ambient-background {
  background:
    linear-gradient(180deg, rgba(16, 137, 123, 0.08), transparent 32%),
    var(--bg);
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading-cat {
  position: relative;
  width: 36px;
  height: 36px;
  animation: catBounce 1s ease-in-out infinite;
}

.loading-cat::before {
  content: '';
  display: block;
  width: 28px;
  height: 20px;
  margin: 0 auto;
  background: #e8a84c;
  border-radius: 50% 50% 40% 40%;
  position: relative;
}

.loading-cat::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: -5px;
  box-shadow: 10px 0 0 #fff;
}

@keyframes catBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-5deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-6px) rotate(5deg); }
}

.media-background video,
.background-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-image {
  background-size: cover;
  background-position: center;
}

.background-filter {
  position: absolute;
  inset: 0;
  background: rgba(244, 247, 246, 0.2);
  backdrop-filter: saturate(1.05);
}

:root[data-theme='dark'] .background-filter {
  background: rgba(12, 16, 15, 0.34);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin-bottom: 22px;
}

.brand,
.icon-button,
.text-button,
.primary-button,
.chart-tools button,
.segmented button,
.ping-legend button,
.upload-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), var(--glass-alpha));
  box-shadow: none;
  backdrop-filter: blur(16px) saturate(1.15);
  cursor: pointer;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  text-align: left;
}

.brand-bare {
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  color: white;
  background: var(--accent);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  max-width: 42vw;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-entry,
.settings-entry {
  gap: 6px;
  padding: 8px 12px;
  text-decoration: none;
}

.admin-entry {
  color: var(--accent-strong);
}

@media (max-width: 480px) {
  .admin-entry-text {
    display: none;
  }
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.circle-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(var(--surface-rgb), var(--glass-alpha));
  backdrop-filter: blur(16px) saturate(1.15);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.circle-button:hover {
  transform: scale(1.06);
  border-color: rgba(16, 137, 123, 0.46);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), var(--glass-alpha));
  backdrop-filter: blur(16px) saturate(1.15);
}

.theme-toggle-btn {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.theme-toggle-btn:hover {
  color: var(--text);
}

.theme-toggle-btn.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.icon-button:hover,
.text-button:hover,
.primary-button:hover,
.chart-tools button:hover,
.segmented button:hover,
.ping-legend button:hover,
.node-card:hover,
.brand:hover,
.upload-button:hover {
  border-color: rgba(16, 137, 123, 0.46);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), var(--glass-alpha));
  color: var(--muted);
  backdrop-filter: blur(16px) saturate(1.15);
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.online-dot {
  background: #18a56f;
  box-shadow: 0 0 0 4px rgba(24, 165, 111, 0.14);
}

.offline-dot {
  background: #d14a42;
  box-shadow: 0 0 0 4px rgba(209, 74, 66, 0.12);
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.overview-tile,
.node-collection.list-mode,
.node-card,
.detail-hero,
.info-item,
.chart-section,
.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), var(--card-alpha));
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur, 18px)) saturate(var(--glass-saturate, 1.18));
}

.overview-tile {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
}

.overview-tile.clickable {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.overview-tile.clickable:hover {
  transform: translateY(-2px);
}

.tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.tile-head span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-soft);
}

.overview-tile strong {
  display: block;
  margin-top: 14px;
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.tile-meter {
  height: 6px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.2);
}

.tile-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #31c48d, #f87171);
}

.tile-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.overview-tile em {
  position: absolute;
  right: 12px;
  bottom: 10px;
  max-width: 44%;
  color: var(--accent-strong);
  font-size: 13px;
  font-style: normal;
  overflow-wrap: anywhere;
  text-align: right;
}

.region-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  min-height: 54px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), var(--card-alpha));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.18);
}

.region-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.region-strip strong {
  color: var(--text);
}

.flag-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.flag-img {
  display: block;
  width: 16px;
  height: 11px;
  border-radius: 2px;
  object-fit: cover;
  object-position: center;
}

.flag-fallback {
  display: inline-grid;
  min-width: 22px;
  height: 15px;
  place-items: center;
  padding: 0 3px;
  border-radius: 2px;
  background: rgba(102, 116, 131, 0.16);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  vertical-align: middle;
}

.os-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  vertical-align: middle;
}

.region-strip small,
.tag-row small {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.1);
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.section-heading h1,
.detail-hero h1,
.settings-header h2,
.chart-header h2,
.settings-group h3 {
  margin: 0;
  line-height: 1.15;
}

.section-heading h1,
.detail-hero h1 {
  font-size: 28px;
}

.section-heading p,
.detail-hero p,
.settings-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.node-view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 36px);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.52);
  backdrop-filter: blur(14px) saturate(1.12);
}

.node-view-switch button {
  display: grid;
  width: 36px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.node-view-switch button:hover {
  color: var(--text);
  background: rgba(var(--surface-rgb), 0.55);
}

.node-view-switch button.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(16, 137, 123, 0.14);
}

.node-collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(278px, 1fr));
  gap: 14px;
}

.node-collection.list-mode {
  display: block;
  overflow: hidden;
  gap: 0;
}

.node-list-head,
.node-list-row {
  display: grid;
  grid-template-columns:
    minmax(130px, 1.55fr)
    minmax(72px, 0.86fr)
    minmax(72px, 0.9fr)
    minmax(72px, 0.9fr)
    minmax(82px, 0.94fr)
    minmax(82px, 0.94fr)
    minmax(82px, 0.9fr);
  align-items: center;
  width: 100%;
  min-width: 0;
}

.node-list-head {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--surface-rgb), 0.3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.node-list-head > span,
.node-list-row > :not(.node-list-open) {
  min-width: 0;
  padding-right: clamp(5px, 0.8vw, 12px);
}

.node-list-row {
  position: relative;
  min-height: 76px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(102, 116, 131, 0.1);
  transition: background-color 160ms ease, opacity 160ms ease;
}

.node-list-row:last-child {
  border-bottom: 0;
}

.node-list-row:hover {
  background: rgba(var(--surface-rgb), 0.34);
}

.node-list-row.is-offline {
  opacity: 0.68;
}

.node-list-open {
  position: absolute;
  z-index: 1;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.nl-node {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.nl-name,
.nl-pair,
.nl-pair span {
  display: inline-flex;
  align-items: center;
}

.nl-name {
  gap: 6px;
  min-width: 0;
}

.nl-name strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-name .os-icon {
  width: 15px;
  height: 15px;
  margin-left: 1px;
}

.nl-ping-btn {
  position: relative;
  z-index: 2;
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nl-ping-btn:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.nl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.nl-meta small {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.1);
  color: var(--muted);
  line-height: 1.5;
}

.nl-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.nl-metric-label {
  display: none;
  color: var(--muted);
  font-size: 11px;
}

.nl-metric-value {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
}

.nl-metric-value small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-metric strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-metric .seg-bar {
  width: 100%;
  max-width: 112px;
}

.nl-pair {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.nl-pair-label {
  display: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.nl-pair span {
  max-width: 100%;
  gap: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nl-price strong,
.nl-price span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nl-price strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.nl-price span {
  color: var(--muted);
  font-size: 11px;
}

.node-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.node-card-open {
  position: absolute;
  z-index: 1;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.node-card:hover {
  transform: translateY(-2px);
}

.node-card.is-offline {
  opacity: 0.68;
}

/* ── Header ── */
.nc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nc-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.nc-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nc-os {
  display: inline-flex;
  color: var(--muted);
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.nc-ping-btn {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 120ms ease;
}

.nc-ping-btn:hover {
  color: var(--accent);
}

.ping-modal {
  width: min(90vw, 1200px);
  background: transparent;
  padding: 0;
  overflow: visible;
}

.ping-modal .chart-section {
  background: rgba(var(--surface-rgb), var(--card-alpha));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.ping-seg-center {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.ping-modal-close {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(var(--surface-rgb), var(--glass-alpha));
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

.ping-modal-close:hover {
  background: rgba(var(--surface-rgb), 0.8);
}

/* ── Tags ── */
.nc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
}

.nc-tags small {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.1);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ── 2×2 Metrics ── */
.nc-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.metric-item {
  min-width: 0;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.34);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.metric-head .metric-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.metric-val {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

/* ── Segmented bar ── */
.seg-bar {
  display: flex;
  gap: 2px;
  height: 7px;
}

.seg-bar span {
  flex: 1;
  min-width: 4px;
  border-radius: 1px;
  background: rgba(102, 116, 131, 0.14);
}

.seg-bar span.filled {
  background: var(--accent);
}

:root[data-theme='dark'] .seg-bar span.filled {
  background: var(--accent-strong);
}

/* ── Data row: speed | traffic | expiry+price ── */
.nc-data-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: start;
  min-height: 34px;
  padding: 5px 0;
  border-top: 1px solid rgba(102, 116, 131, 0.1);
  border-bottom: 1px solid rgba(102, 116, 131, 0.1);
  font-size: 11px;
}

.nc-data-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nc-data-right {
  text-align: right;
}

.nc-dv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
}

.nc-dv-sub {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 15px;
  color: var(--muted);
  font-size: 10px;
}

.nc-expiry-text {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* ── Traffic ── */
.nc-uptime-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(102, 116, 131, 0.1);
  font-size: 11px;
}

.nc-uptime-row span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.nc-uptime-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.nc-traffic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.nc-traffic-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.nc-traffic-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.nc-traffic-right span:last-child {
  color: var(--text);
  font-weight: 600;
}

.nc-traffic-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.12);
}

.nc-traffic-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
}

.detail-page {
  gap: 12px;
}

.chart-tabs {
  margin-bottom: 12px;
}

.chart-tabs .segmented {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.chart-tabs .segmented button {
  flex: 1;
  text-align: center;
}

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.node-switcher {
  position: relative;
}

.node-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.node-switcher-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  max-height: 320px;
  overflow: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.node-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.node-switcher-item:hover {
  background: var(--accent-soft);
}

.node-switcher-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.node-switcher-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.text-button,
.primary-button,
.chart-tools button,
.upload-button {
  gap: 7px;
  min-height: 38px;
  padding: 8px 11px;
  text-decoration: none;
}

.text-button {
  width: fit-content;
}

.primary-button {
  border-color: transparent;
  color: white;
  background: var(--accent);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: end;
  padding: 18px 20px;
}

.detail-hero h1 {
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-metrics .metric-cell {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.34);
}

.hero-metrics .metric-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.hero-metrics .metric-cell strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.detail-panel {
  min-width: 0;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), var(--card-alpha));
}

.detail-panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

.detail-panel h2 svg {
  color: var(--accent);
}

.detail-line {
  display: grid;
  grid-template-columns: minmax(64px, 0.55fr) minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 5px 0;
  border-bottom: 1px solid rgba(102, 116, 131, 0.14);
  font-size: 13px;
}

.detail-line:last-child {
  border-bottom: 0;
}

.detail-line span {
  color: var(--muted);
}

.detail-line strong {
  min-width: 0;
  text-align: right;
  word-break: break-word;
}

.detail-line.is-stack {
  display: block;
}

.detail-line.is-stack > span:first-child {
  display: block;
  margin-bottom: 4px;
}

.detail-traffic {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-traffic-value {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.detail-traffic-note {
  color: var(--muted);
  font-size: 11px;
}

.detail-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 116, 131, 0.14);
}

.detail-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
}

.info-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-areas: 'icon label' 'icon value';
  gap: 2px 8px;
  min-height: 72px;
  padding: 12px;
}

.info-item > span {
  grid-area: icon;
  color: var(--accent);
}

.info-item small {
  grid-area: label;
}

.info-item strong {
  grid-area: value;
}

.chart-section {
  padding: 16px;
}

.app-shell .metric-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.app-shell .metric-chart-card {
  min-width: 0;
  min-height: 250px;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
}

.app-shell .metric-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.app-shell .metric-chart-head span {
  color: var(--muted);
  font-weight: 650;
}

.app-shell .mini-chart {
  width: 100%;
  height: 190px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-header h2,
.settings-group h3 {
  font-size: 18px;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1); }
}

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.switch-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.segmented button,
.chart-tools button,
.ping-legend button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(var(--surface-rgb), 0.72);
}

.segmented button.active,
.chart-tools button.active,
.ping-legend button.active {
  color: var(--accent-strong);
  border-color: rgba(16, 137, 123, 0.46);
  background: var(--accent-soft);
}

.ping-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
  gap: 12px;
  margin-bottom: 16px;
  justify-content: center;
}

.ping-task-card {
  position: relative;
  min-width: 0;
  overflow: visible;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), var(--card-alpha));
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, opacity 160ms ease;
}

.ping-task-card.muted {
  opacity: 0.48;
}

.ping-task-card:hover,
.ping-task-card:focus-visible {
  border-color: var(--accent);
  opacity: 1;
}

.ping-task-bar {
  width: 5px;
  height: 32px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ping-task-body {
  flex: 1;
  min-width: 0;
}

.ping-task-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ping-task-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.ping-task-info {
  cursor: help;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity 160ms ease;
}

.ping-task-info::before {
  content: 'i';
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-style: normal;
}

.ping-task-info:hover {
  opacity: 1;
}

.ping-task-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: help;
}

.ping-task-metrics {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 6px;
  font-size: 13px;
  flex-wrap: wrap;
  row-gap: 4px;
  color: var(--muted);
}

.ping-task-metrics span {
  white-space: nowrap;
}

.ping-task-val {
  font-weight: 600;
  color: var(--text);
}

.ping-task-sep {
  opacity: 0.6;
  margin: 0 10px;
}

.ping-task-loss {
  font-weight: 500;
}

.ping-task-vol {
  color: var(--muted);
  font-weight: 500;
}

.ping-task-tip {
  position: fixed;
  z-index: 60;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  color: var(--text);
  line-height: 2;
  pointer-events: none;
}

.ping-task-tip-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 16px;
}

.ping-task-tip-label {
  color: var(--muted);
}

.ping-task-tip-val {
  font-weight: 600;
}

.muted-button {
  opacity: 0.48;
}

.app-shell .chart,
.app-shell .empty-chart {
  width: 100%;
  height: 340px;
}

.empty-chart {
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.notice {
  padding: 14px 16px;
  color: var(--muted);
}

.notice.danger {
  color: var(--danger);
}

.boot-error {
  width: min(680px, calc(100% - 32px));
  margin: 72px auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

.boot-error h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.boot-error p {
  margin: 0;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.footer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(14, 19, 18, 0.46);
  backdrop-filter: blur(8px);
}

.settings-panel {
  display: flex;
  width: min(960px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.settings-header,
.settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.settings-footer span {
  min-width: 0;
  flex: 1;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ── Asset modal ── */
.asset-panel {
  display: flex;
  width: min(1020px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.asset-header,
.asset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.asset-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.asset-header h2,
.asset-header p {
  margin: 0;
}

.asset-header p {
  color: var(--muted);
}

.asset-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.asset-summary > div {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.54);
}

.asset-summary small {
  color: var(--muted);
  font-size: 13px;
}

.asset-summary strong {
  font-size: 22px;
}

.asset-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 16px;
}

.asset-grid {
  min-width: 520px;
}

.asset-grid-head,
.asset-grid-row {
  display: grid;
  grid-template-columns: 35% 23% 23% 19%;
  align-items: center;
  padding: 12px 10px;
}

.asset-grid-head span,
.asset-grid-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-grid-head span:last-child,
.asset-grid-row span:last-child {
  text-align: right;
  justify-self: end;
}

.asset-grid-head {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.asset-grid-row {
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.asset-grid-row:last-child {
  border-bottom: none;
}

.asset-node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.settings-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.54);
}

.settings-fields {
  display: grid;
  gap: 10px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wide-field {
  grid-template-columns: minmax(110px, 0.36fr) minmax(0, 1fr);
}

.field-row > span,
.field-title,
.field-help {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--text);
}

input,
select {
  min-height: 36px;
  padding: 6px 9px;
}

textarea {
  resize: vertical;
  padding: 8px 9px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

input[type='range'] {
  padding: 0;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
}

.switch-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.background-fields {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.upload-button {
  width: fit-content;
  color: var(--accent-strong);
}

.upload-button input {
  display: none;
}

@media (max-width: 1120px) {
  .overview-grid,
  .info-grid,
  .detail-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-shell .metric-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .detail-hero,
  .detail-panels,
  .app-shell .metric-chart-grid,
  .settings-content {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 720px) {
  .overview-tile,
  .node-collection.list-mode,
  .node-list-row,
  .node-card,
  .detail-hero,
  .info-item,
  .chart-section,
  .notice {
    backdrop-filter: blur(min(var(--glass-blur, 18px), 10px)) saturate(var(--glass-saturate, 1.18));
  }

  .app-shell {
    width: min(100% - 22px, 640px);
    padding-top: 12px;
  }

  .topbar {
    align-items: stretch;
  }

  .status-pill {
    display: none;
  }

  .overview-grid,
  .node-collection,
  .node-collection.list-mode,
  .info-grid,
  .detail-panels,
  .app-shell .metric-chart-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .overview-tile {
    min-height: 72px;
    padding: 8px 10px;
  }

  .overview-tile strong {
    margin-top: 4px;
    font-size: 17px;
  }

  .tile-head span {
    width: 22px;
    height: 22px;
  }

  .tile-head .tile-label,
  .tile-head small {
    font-size: 11px;
  }

  .tile-rows {
    margin-top: 4px;
    font-size: 10px;
    gap: 2px 8px;
  }

  .tile-meter {
    margin-top: 6px;
    height: 4px;
  }

  .overview-tile em {
    display: none;
  }

  .asset-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .asset-summary strong {
    font-size: 18px;
  }

  .section-heading h1 {
    font-size: 24px;
  }

  .node-card {
    min-width: 0;
  }

  .node-collection.list-mode {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .node-list-head {
    display: none;
  }

  .node-list-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      'node node'
      'cpu memory'
      'disk price'
      'network traffic';
    min-width: 0;
    gap: 10px 12px;
    min-height: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(var(--surface-rgb), var(--card-alpha));
    box-shadow: 0 8px 24px rgba(38, 52, 67, 0.09);
  }

  .node-list-row > :not(.node-list-open) {
    padding-right: 0;
  }

  .nl-node {
    grid-area: node;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(102, 116, 131, 0.12);
  }

  .nl-cpu {
    grid-area: cpu;
  }

  .nl-memory {
    grid-area: memory;
  }

  .nl-disk {
    grid-area: disk;
  }

  .nl-price {
    grid-area: price;
    justify-content: center;
    padding: 5px 0;
  }

  .nl-network {
    grid-area: network;
  }

  .nl-traffic-total {
    grid-area: traffic;
  }

  .nl-metric {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 5px 0;
  }

  .nl-metric-label,
  .nl-pair-label {
    display: block;
  }

  .nl-metric-value {
    min-height: 18px;
  }

  .nl-metric .seg-bar {
    width: 100%;
    max-width: none;
  }

  .nl-pair {
    gap: 2px;
    padding-top: 8px;
    border-top: 1px solid rgba(102, 116, 131, 0.12);
  }

  .ping-task-tip {
    padding: 8px 11px;
    line-height: 1.55;
  }

  .ping-task-tip-grid {
    gap: 1px 12px;
  }

  .chart-section {
    padding: 14px;
  }

  .chart,
  .empty-chart {
    height: 300px;
  }

  .field-row,
  .wide-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .settings-footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-delay: 0ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
