:root {
  color-scheme: dark;
  --bg: #12171f;
  --sidebar: #0c222b;
  --sidebar-deep: #0a1920;
  --panel: #171d26;
  --panel-2: #1b222d;
  --panel-3: #112e31;
  --line: #3a4654;
  --line-soft: rgba(98, 113, 130, 0.35);
  --text: #d6dee8;
  --bright: #f4f8fb;
  --muted: #8f98a5;
  --muted-2: #65717f;
  --teal: #17d8bd;
  --cyan: #1bc7e8;
  --blue: #536dfe;
  --pink: #ca54d8;
  --red: #e85b62;
  --green: #19d8a0;
  --yellow: #f0bd4d;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(rgba(23, 216, 189, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 216, 189, 0.025) 1px, transparent 1px),
    linear-gradient(135deg, rgba(18, 23, 31, 0.92), rgba(16, 22, 30, 0.98));
  background-size: 38px 38px, 38px 38px, auto;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(27, 199, 232, 0.09), transparent 28%),
    linear-gradient(295deg, rgba(23, 216, 189, 0.08), transparent 42%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 5px);
  opacity: 0.78;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(12, 34, 43, 0.98), rgba(8, 20, 27, 0.98)),
    var(--sidebar);
  border-right: 1px solid rgba(46, 188, 204, 0.16);
  box-shadow: 24px 0 70px rgba(0, 0, 0, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 14px 22px;
  border-bottom: 1px solid rgba(30, 216, 227, 0.14);
}

.logo strong {
  color: white;
  font-size: 22px;
  font-weight: 850;
}

.logo-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
}

.logo-bars i {
  width: 4px;
  border-radius: 99px;
  background: #2cdcf0;
  box-shadow: 0 0 16px rgba(44, 220, 240, 0.55);
  animation: equalize 1.7s ease-in-out infinite;
}

.logo-bars i:nth-child(1) { height: 14px; animation-delay: 0s; }
.logo-bars i:nth-child(2) { height: 24px; animation-delay: 0.12s; }
.logo-bars i:nth-child(3) { height: 32px; animation-delay: 0.24s; }
.logo-bars i:nth-child(4) { height: 20px; animation-delay: 0.36s; }
.logo-bars i:nth-child(5) { height: 28px; animation-delay: 0.48s; }

@keyframes equalize {
  0%, 100% { transform: scaleY(0.72); opacity: 0.75; }
  50% { transform: scaleY(1); opacity: 1; }
}

.menu-section {
  padding: 18px 8px 14px;
  border-bottom: 1px dashed rgba(44, 220, 240, 0.18);
}

.menu-section > span {
  display: block;
  margin: 0 0 12px 18px;
  color: #7f8c99;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu-section a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  color: #c5ced8;
  text-decoration: none;
  font-size: 15px;
}

.menu-section a b {
  color: #d9e5ee;
  font-weight: 500;
}

.menu-section a.active,
.menu-section a:hover {
  color: white;
  background: linear-gradient(90deg, rgba(27, 199, 232, 0.13), transparent);
  box-shadow: inset 3px 0 0 #26d9ee;
}

.probe-card {
  margin: 4px 8px 0;
  padding: 14px;
  border: 1px solid rgba(32, 217, 200, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(130deg, rgba(23, 216, 189, 0.13), transparent 52%),
    rgba(7, 21, 27, 0.7);
}

.probe-card small,
.probe-card em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.probe-card strong {
  display: block;
  margin: 7px 0 4px;
  color: white;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 8px 22px 28px 18px;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-button,
.action {
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #cdd6e1;
  background: rgba(26, 32, 42, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.close-button {
  width: 36px;
  height: 36px;
  font-size: 38px;
  line-height: 30px;
  border: 0;
  background: transparent;
  cursor: default;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.action {
  min-width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0 13px;
  color: #16d7f4;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.action.danger {
  color: #ff4e5c;
  border-color: rgba(255, 78, 92, 0.55);
}

.action.version {
  color: #20e6d4;
  border-color: rgba(32, 230, 212, 0.58);
}

.action.refresh {
  cursor: pointer;
}

.action.refresh:disabled {
  opacity: 0.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 6px 0 16px;
}

.stat-card {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(23, 29, 38, 0.88);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: sweep 5s linear infinite;
}

.stat-card:nth-child(2)::after { animation-delay: 0.8s; }
.stat-card:nth-child(3)::after { animation-delay: 1.6s; }
.stat-card:nth-child(4)::after { animation-delay: 2.4s; }

@keyframes sweep {
  0% { transform: translateX(-120%); }
  38%, 100% { transform: translateX(120%); }
}

.stat-icon,
.title-icon,
.pulse-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(25, 216, 188, 0.42);
  background: rgba(23, 216, 189, 0.12);
  color: #27e7d3;
}

.stat-icon {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.stat-card.red .stat-icon {
  color: #ff6872;
  border-color: rgba(255, 104, 114, 0.48);
  background: rgba(255, 104, 114, 0.11);
}

.stat-card.blue .stat-icon {
  color: #66d7ff;
  border-color: rgba(102, 215, 255, 0.42);
  background: rgba(102, 215, 255, 0.1);
}

.stat-card small {
  display: block;
  color: #8c95a2;
  font-size: 15px;
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  color: #cfd8e3;
  font-size: 21px;
  font-weight: 850;
}

.nodes-panel,
.events-panel {
  border: 1px solid rgba(69, 82, 98, 0.85);
  border-radius: 8px;
  background: rgba(23, 29, 38, 0.82);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.panel-title {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid rgba(69, 82, 98, 0.72);
}

.panel-title.compact {
  min-height: 66px;
}

.title-icon {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  color: #d7dfe9;
}

h1 {
  font-size: 21px;
}

h2 {
  font-size: 18px;
}

.panel-title p {
  margin-top: 4px;
  color: #7d8795;
  font-size: 13px;
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  width: 270px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #161d27;
}

.search span {
  color: #cbd5e1;
  font-size: 22px;
}

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

.segments {
  display: flex;
  height: 42px;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #151c26;
}

.segments button {
  border: 0;
  border-radius: 7px;
  padding: 0 11px;
  color: #8d98a6;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.segments button.active {
  color: #2cebd8;
  background: rgba(23, 216, 189, 0.12);
}

.node-list {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.node-row {
  --mx: 50%;
  --my: 50%;
  min-height: 80px;
  display: grid;
  grid-template-columns: minmax(300px, 1.2fr) minmax(190px, 0.7fr) minmax(260px, 1fr) 120px 78px;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(23, 216, 189, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(23, 216, 189, 0.17), transparent 34%, rgba(27, 199, 232, 0.08), transparent 72%),
    linear-gradient(90deg, rgba(23, 216, 189, 0.11), rgba(15, 48, 51, 0.58));
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.node-row::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-101%);
  background: linear-gradient(90deg, transparent, rgba(44, 220, 240, 0.16), transparent);
  animation: row-scan 4.8s ease-in-out infinite;
}

.node-row:nth-child(2n)::before {
  animation-delay: 1.3s;
}

@keyframes row-scan {
  0%, 45% { transform: translateX(-101%); }
  70%, 100% { transform: translateX(101%); }
}

.node-row:hover {
  transform: translateY(-1px);
  border-color: rgba(28, 236, 216, 0.85);
}

.node-row.danger,
.node-row.error {
  border-color: rgba(255, 91, 98, 0.55);
  background:
    linear-gradient(115deg, rgba(255, 91, 98, 0.16), transparent 36%, rgba(255, 190, 120, 0.06), transparent 74%),
    linear-gradient(90deg, rgba(255, 91, 98, 0.12), rgba(53, 27, 32, 0.66));
}

.node-row.warning {
  border-color: rgba(240, 189, 77, 0.58);
}

.node-row.offline {
  border-color: rgba(155, 166, 183, 0.48);
}

.row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.pulse-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  animation: pulse-border 2.6s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 rgba(23, 216, 189, 0); }
  50% { box-shadow: 0 0 22px rgba(23, 216, 189, 0.38); }
}

.online-pill {
  min-width: 68px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #18e8cf;
  border-radius: 8px;
  color: #25ead5;
  background: rgba(23, 216, 189, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.node-row.danger .online-pill,
.node-row.error .online-pill {
  color: #ff8088;
  border-color: #ff6872;
  background: rgba(255, 104, 114, 0.1);
}

.online-pill.offline {
  color: #ff8088;
  border-color: #ff6872;
  background: rgba(255, 104, 114, 0.12);
}

.country-flag {
  width: 32px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  font-size: 18px;
  line-height: 1;
}

.node-name {
  min-width: 0;
}

.node-name strong {
  display: block;
  color: #d5dee9;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-line {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-line small {
  color: #8994a2;
  font-size: 12px;
}

.microbar {
  width: 154px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.microbar em {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #13d3b2, #26f2d9);
}

.node-ip,
.node-evidence,
.node-time,
.node-history {
  position: relative;
  z-index: 1;
}

.node-ip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9ba6b5;
}

.node-ip code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: #aeb9c7;
  font-size: 14px;
}

.node-evidence strong,
.node-time strong {
  display: block;
  color: #aeb8c6;
  font-size: 14px;
}

.node-evidence span,
.node-time span {
  display: block;
  margin-top: 5px;
  color: #808b99;
  font-size: 12px;
  line-height: 1.35;
}

.node-history {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.node-history i,
.event > span {
  width: 4px;
  height: 4px;
  border-radius: 99px;
  background: #6f7a88;
}

.node-history .ok,
.event.ok > span {
  background: var(--green);
}

.node-history .danger,
.node-history .error,
.event.danger > span,
.event.error > span {
  background: var(--red);
}

.node-history .warning,
.event.warning > span {
  background: var(--yellow);
}

.events-panel {
  margin-top: 14px;
}

.events {
  padding: 4px 16px 14px;
}

.event {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(69, 82, 98, 0.62);
}

.event:last-child {
  border-bottom: 0;
}

.event strong {
  display: block;
  color: #d5dee8;
  font-size: 13px;
}

.event small {
  display: block;
  margin-top: 3px;
  color: #7e8896;
  font-size: 12px;
}

.empty {
  padding: 22px;
  color: #8994a1;
}

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

  .node-row {
    grid-template-columns: 1fr;
  }

  .node-history {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace {
    padding: 12px;
  }

  .panel-title,
  .tools {
    align-items: stretch;
    flex-direction: column;
  }

  .tools,
  .search {
    width: 100%;
  }
}
