/* ===== Dark theme (default) ===== */
:root {
  --bg: #0e141b;
  --panel: rgba(10, 18, 27, 0.82);
  --panel-strong: #111c28;
  --panel-soft: rgba(33, 50, 68, 0.45);
  --line: rgba(165, 196, 224, 0.16);
  --text: #edf6ff;
  --muted: #8ea7bc;
  --good: #35d399;
  --warn: #f6c453;
  --bad: #f87171;
  --accent: #57c7ff;
  --accent-strong: #1387bf;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(10, 18, 27, 0.88);
}

/* ===== Light theme ===== */
html[data-theme="light"] {
  --bg: #eef3f9;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-soft: rgba(180, 210, 240, 0.45);
  --line: rgba(60, 100, 160, 0.13);
  --text: #0d1c2e;
  --muted: #4e6880;
  --good: #16a974;
  --warn: #c07f00;
  --bad: #d94f4f;
  --accent: #0f7ab8;
  --accent-strong: #0a5c8a;
  --shadow: 0 8px 40px rgba(30, 60, 120, 0.11);
  --nav-bg: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(14, 122, 184, 0.10), transparent 30%),
    radial-gradient(circle at top right, rgba(22, 169, 116, 0.07), transparent 28%),
    linear-gradient(180deg, #d6eaf7, #e8f2fb 48%, #ddeaf7);
}

html[data-theme="light"] #refresh-button {
  color: #ffffff;
}

html[data-theme="light"] pre {
  background: #f0f6ff;
  color: #1a3a5c;
}

html[data-theme="light"] .status-online   { color: #0a5c3a; background: rgba(22, 169, 116, 0.14); }
html[data-theme="light"] .status-warning  { color: #6b4a00; background: rgba(192, 127, 0, 0.13); }
html[data-theme="light"] .status-critical { color: #7a1a1a; background: rgba(217, 79, 79, 0.13); }
html[data-theme="light"] .status-offline  { color: #4e6880; background: rgba(60, 100, 160, 0.09); }

/* ===== Suppress transitions on load ===== */
html.no-transition *, html.no-transition *::before, html.no-transition *::after {
  transition: none !important;
}

/* ===== Smooth theme transitions ===== */
body, .topnav, .hero-panel, .hero-stat, .summary-grid article,
.table-card, .api-card, pre, .notif-panel, .icon-btn, .server-card,
.filter-bar, .tab-btn, .view-btn, .search-wrap input {
  transition: background-color 0.25s ease, border-color 0.25s ease,
              box-shadow 0.25s ease, color 0.2s ease;
}

/* ===== Reset ===== */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(87, 199, 255, 0.25), transparent 30%),
    radial-gradient(circle at top right, rgba(53, 211, 153, 0.18), transparent 28%),
    linear-gradient(180deg, #091018, #0f1722 48%, #0c131b);
}

/* ===== Top Navigation ===== */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.brand-icon { color: var(--accent); flex-shrink: 0; }

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  user-select: none;
}

.refresh-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover { background: var(--panel-strong); color: var(--text); }

/* ===== Notification ===== */
.notif-wrap { position: relative; }

.notif-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex;
  align-items: center; justify-content: center;
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px; max-height: 440px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}

.text-btn {
  background: none; border: none;
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}

.text-btn:hover { background: var(--panel-soft); }

.notif-list { overflow-y: auto; flex: 1; padding: 8px; }

.notif-empty {
  padding: 24px; text-align: center;
  color: var(--muted); font-size: 13px; margin: 0;
}

.notif-item {
  display: flex; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.notif-item.unread { background: var(--panel-soft); }

.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}

.notif-dot.critical { background: var(--bad); }
.notif-dot.warning  { background: var(--warn); }
.notif-dot.recovery { background: var(--good); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-msg   { font-size: 12px; color: var(--muted); line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ===== Page shell ===== */
.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0 56px;
}

/* ===== Hero ===== */
.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

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

h1, h2, p { margin-top: 0; }

h1 {
  font-size: clamp(26px, 3.5vw, 46px);
  line-height: 1.08;
  margin-bottom: 16px;
}

.hero-copy, .api-card p { color: var(--muted); line-height: 1.6; }

.hero-panel, .summary-grid article, .table-card, .api-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero-panel { padding: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.hero-stat {
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(19, 135, 191, 0.18), rgba(17, 28, 40, 0.35));
  border: 1px solid rgba(87, 199, 255, 0.15);
}

html[data-theme="light"] .hero-stat {
  background: linear-gradient(180deg, rgba(14, 122, 184, 0.08), rgba(230, 242, 252, 0.6));
  border-color: rgba(14, 122, 184, 0.15);
}

.hero-stat span, .metric-label, .status-label, th { color: var(--muted); font-size: 13px; }
.hero-stat strong { display: block; margin-top: 6px; font-size: 20px; }

/* ===== Summary grid ===== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.summary-grid article { padding: 20px; }
.summary-grid strong { display: block; font-size: 28px; margin: 10px 0 6px; }

/* ===== List header ===== */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.list-header h2 { margin-bottom: 0; }

/* ===== Filter bar ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 20px;
  backdrop-filter: blur(18px);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  min-width: 0;
}

.search-wrap input::placeholder { color: var(--muted); }

.status-tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-soft);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.tab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--panel-soft);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.view-btn.active { background: var(--panel-strong); color: var(--text); }

/* ===== Server sections ===== */
.server-section { margin-bottom: 28px; }

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title-row h3 { margin: 0; font-size: 17px; }
.section-title-row p  { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.server-count {
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

/* ===== Node management section ===== */
.nodes-section {
  margin-bottom: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(18px);
}

.nodes-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.nodes-section-header h2 { margin: 0; font-size: 17px; }
.nodes-section-header .muted { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.btn-add-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #8be4ff);
  color: #03111a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

html[data-theme="light"] .btn-add-node { background: linear-gradient(135deg, var(--accent), #3aa8e8); color: #fff; }

.nodes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.node-status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.node-status-dot.online   { background: var(--good); box-shadow: 0 0 6px var(--good); }
.node-status-dot.warning  { background: var(--warn); }
.node-status-dot.critical { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.node-status-dot.offline  { background: var(--muted); }
.node-status-dot.pending  { background: var(--muted); border: 2px dashed var(--muted); width: 7px; height: 7px; }

.node-info { flex: 1; min-width: 0; }
.node-info strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

.node-actions { display: flex; gap: 6px; flex-shrink: 0; }

.node-action-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.node-action-btn:hover { color: var(--text); }
.node-action-btn.danger:hover { color: var(--bad); border-color: var(--bad); }

.nodes-empty {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { margin: 0; font-size: 16px; }

.modal-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.modal-close-btn:hover { background: var(--line); color: var(--text); }

.modal-body { padding: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.form-group label .required { color: var(--bad); }

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(87, 199, 255, 0.15);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.radio-group { display: flex; gap: 10px; }

.radio-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(87, 199, 255, 0.07);
}

.radio-option input { display: none; }
.radio-label { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.radio-desc { font-size: 11px; color: var(--muted); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.btn-cancel {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #8be4ff);
  color: #03111a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="light"] .btn-primary { background: linear-gradient(135deg, var(--accent), #3aa8e8); color: #fff; }

.result-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(53, 211, 153, 0.12);
  color: var(--good);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}

.result-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.install-cmd-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0a121a;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

html[data-theme="light"] .install-cmd-box { background: #f0f6ff; }

.install-cmd-box code {
  flex: 1;
  font-size: 13px;
  color: #57c7ff;
  word-break: break-all;
  font-family: 'Menlo', 'Consolas', monospace;
}

html[data-theme="light"] .install-cmd-box code { color: #0a5c8a; }

.copy-btn {
  display: flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover { color: var(--text); }
.copy-btn.copied { color: var(--good); border-color: var(--good); }

.result-note { font-size: 12px; color: var(--muted); margin: 0; }

.login-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--bad);
  font-size: 13px;
  margin-top: 4px;
}

.topnav .icon-btn.authed { color: var(--good); }

/* ===== Cards grid ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

/* ===== Server card ===== */
.server-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
              background-color 0.25s ease, border-color 0.25s ease;
}

.server-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

html[data-theme="light"] .server-card:hover {
  box-shadow: 0 12px 48px rgba(30,60,120,0.16);
}

.server-card.sev-critical {
  border-left-color: var(--bad);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.07) 0%, var(--panel) 60%);
}

.server-card.sev-warning {
  border-left-color: var(--warn);
  background: linear-gradient(135deg, rgba(246, 196, 83, 0.06) 0%, var(--panel) 60%);
}

.server-card.sev-online {
  border-left-color: var(--good);
}

.server-card.sev-offline {
  border-left-color: var(--muted);
  opacity: 0.65;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.card-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.card-name strong {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(87, 199, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(87, 199, 255, 0.25);
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Card metrics */
.card-metrics { margin-bottom: 12px; }

.card-metric-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.metric-name {
  width: 30px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.card-metric-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--panel-soft);
  overflow: hidden;
  position: relative;
}

.card-metric-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.metric-pct {
  width: 34px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

/* Card stats */
.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card-stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.card-stat strong {
  font-size: 13px;
  font-weight: 700;
}

/* ===== Status badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-online   { color: #d8fff0; background: rgba(53, 211, 153, 0.16); }
.status-warning  { color: #fff3d4; background: rgba(246, 196, 83, 0.16); }
.status-critical { color: #ffe0e0; background: rgba(248, 113, 113, 0.16); }
.status-offline  { color: var(--muted); background: var(--panel-soft); }

/* ===== Empty state ===== */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* ===== Table card (for table view) ===== */
.table-card { padding: 18px; overflow-x: auto; }

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

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

tbody tr:hover { background: rgba(87, 199, 255, 0.05); }

.server-cell strong { display: block; margin-bottom: 3px; }
.server-cell span, .stacked-subtext { color: var(--muted); font-size: 13px; }

/* Table metric bars */
.metric-bar {
  position: relative;
  width: 100px; height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-soft);
  margin-bottom: 5px;
}

.metric-bar span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }

/* ===== Buttons ===== */
button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  color: #03111a;
  background: linear-gradient(135deg, var(--accent), #8be4ff);
  cursor: pointer;
}

html[data-theme="light"] button { background: linear-gradient(135deg, var(--accent), #3aa8e8); }
html[data-theme="light"] #refresh-button { color: #ffffff; }

/* ===== API card ===== */
.api-card { margin-top: 8px; }

pre {
  margin: 0; padding: 18px;
  overflow: auto;
  border-radius: 18px;
  background: #0a121a;
  border: 1px solid var(--line);
  color: #cde7ff;
  font-size: 13px;
  line-height: 1.6;
}

/* ===== Admin Layout ===== */
.admin-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Login Gate */
.login-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(87, 199, 255, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(53, 211, 153, 0.12), transparent 28%),
    var(--bg);
}

.login-gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
}

.login-gate-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(87, 199, 255, 0.18), rgba(53, 211, 153, 0.12));
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 20px;
}

.login-gate-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.login-gate-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.gate-back-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.gate-back-link:hover { color: var(--text); }

/* Admin shell: sidebar + content */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel-strong);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover { background: var(--panel-soft); color: var(--text); }
.sidebar-link.active { background: rgba(87, 199, 255, 0.12); color: var(--accent); font-weight: 600; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-link-back { color: var(--muted); }

/* Admin content area */
.admin-content {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  gap: 16px;
}

.admin-section-title { margin: 0; font-size: 20px; }
.admin-section-desc  { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.admin-main { padding: 28px 32px; flex: 1; }

.admin-section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* Admin nodes list — full-width rows */
.nodes-list-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-item-admin {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(12px);
}

.node-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.node-item-mid {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.node-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.node-status-tag.online   { background: rgba(53, 211, 153, 0.15); color: var(--good); }
.node-status-tag.warning  { background: rgba(246, 196, 83, 0.15); color: var(--warn); }
.node-status-tag.critical { background: rgba(248, 113, 113, 0.15); color: var(--bad); }
.node-status-tag.offline,
.node-status-tag.pending  { background: var(--panel-soft); color: var(--muted); }

.node-token-label {
  font-size: 12px;
  color: var(--muted);
}

.node-token-label code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 11px;
  color: var(--accent);
}

html[data-theme="light"] .admin-body {
  background: #eef3f9;
}

html[data-theme="light"] .login-gate {
  background:
    radial-gradient(circle at top left, rgba(14, 122, 184, 0.10), transparent 30%),
    radial-gradient(circle at bottom right, rgba(22, 169, 116, 0.07), transparent 28%),
    #ddeaf7;
}

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .summary-grid { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: repeat(2, 1fr); }
  .list-header { align-items: flex-start; flex-direction: column; }
  .topnav-brand span { display: none; }
  .notif-panel { right: -60px; width: 300px; }
  .filter-bar { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: 1fr; }
  .status-tabs .tab-btn span:not(.tab-dot) { display: none; }
}
