:root {
  color-scheme: dark;
  font-family: "Open Sans", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: #e9edf1;
  background: #101317;
  font-synthesis: none;
  --surface: #181c21;
  --surface-strong: #20252b;
  --surface-muted: #14181d;
  --border: #30363d;
  --border-soft: #282e35;
  --text: #eef2f5;
  --muted: #8f9aa5;
  --blue: #4e8fc9;
  --blue-strong: #3a79b3;
  --green: #42b983;
  --red: #da6c67;
  --amber: #d4a74d;
  --numeric-font: "Open Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101317;
}

button,
input,
select {
  font: inherit;
}

button,
a,
summary,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(78, 143, 201, .7);
  outline-offset: 2px;
}

.admin-login {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 24px;
  background: #0d1115;
}

body.is-admin-locked .admin-login { display: grid; }
body.is-admin-locked .admin-app { visibility: hidden; }

.admin-login__panel {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid #33414c;
  border-radius: 6px;
  background: #171c21;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .46), inset 0 1px rgba(255, 255, 255, .025);
}

.admin-login__mark {
  display: block;
  margin: 0 auto 24px;
}

.admin-login__heading { margin-bottom: 26px; text-align: center; }
.admin-login__heading p { margin: 0 0 7px; color: #5ea5d9; font-size: 10px; font-weight: 700; }
.admin-login__heading h1 { margin: 0; color: var(--text); font-size: 22px; font-weight: 700; }
.admin-login__heading span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-login__panel > label { display: block; margin-bottom: 8px; color: #b7c0c8; font-size: 12px; font-weight: 600; }

.admin-login__input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.admin-login__input-row input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #3b4650;
  border-radius: 4px;
  color: var(--text);
  background: #10151a;
}
.admin-login__input-row button {
  height: 44px;
  padding: 0 18px;
  border: 1px solid #377fb9;
  border-radius: 4px;
  color: #fff;
  background: #2e73aa;
  cursor: pointer;
  font-weight: 700;
}
.admin-login__input-row button:hover { background: #377fba; }
.admin-login__error { min-height: 18px; margin: 8px 0 0; color: #e67a75; font-size: 11px; }
.admin-login__panel > small { display: block; margin-top: 14px; color: #68737d; text-align: center; font-size: 10px; }
.admin-app {
  height: 100%;
  display: grid;
  grid-template: 68px minmax(0, 1fr) / 264px minmax(0, 1fr);
}

.admin-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: #171b20;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .18);
  z-index: 20;
}

.admin-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  text-decoration: none;
}

.admin-brand__mark {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 13px 21px 13px 21px;
  transform: rotate(45deg);
  background: linear-gradient(145deg, #28d4ff 0 43%, #1678eb 44% 100%);
  box-shadow: 0 0 16px rgba(35, 172, 255, .32);
}

.admin-brand__mark::before,
.admin-brand__mark::after,
.admin-brand__mark i::before,
.admin-brand__mark i::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  background: #171b20;
}

.admin-brand__mark::before { left: -2px; top: -2px; }
.admin-brand__mark::after { right: -2px; bottom: -2px; transform: rotate(180deg); }
.admin-brand__mark i::before { right: -2px; top: -2px; transform: rotate(90deg); }
.admin-brand__mark i::after { left: -2px; bottom: -2px; transform: rotate(-90deg); }

.admin-brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-brand__text strong {
  overflow: hidden;
  color: #f5f7f9;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-brand__text small {
  overflow: hidden;
  color: #6f9fc8;
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #aeb8c1;
  font-size: 13px;
  white-space: nowrap;
}

.system-health i,
.live-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(66, 185, 131, .55);
}

.topbar-button,
.account-button,
.secondary-button,
.primary-button,
.icon-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #dbe2e8;
  background: #20252b;
  text-decoration: none;
  cursor: pointer;
}

.topbar-button {
  padding: 0 13px;
  font-size: 13px;
}

.topbar-button:hover,
.account-button:hover,
.secondary-button:hover,
.icon-button:hover {
  border-color: #47515b;
  background: #272d34;
}

.account-button {
  padding: 0 11px 0 6px;
  border-color: transparent;
  background: transparent;
}

.account-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #3f78ad;
  font-size: 12px;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 18px;
}

.sidebar-toggle {
  display: none;
  margin-right: 12px;
}

.admin-sidebar {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #171b20;
  z-index: 15;
}

.sidebar-health {
  flex: 0 0 auto;
  margin: 16px 15px 12px;
  padding: 14px;
  border: 1px solid #2c343c;
  border-radius: 6px;
  background: #1d2228;
}

.sidebar-health > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.sidebar-health span,
.sidebar-health small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-health strong {
  color: var(--green);
  font-size: 20px;
}

.sidebar-health__track {
  height: 5px;
  margin: 10px 0 8px;
  overflow: hidden;
  background: #333941;
}

.sidebar-health__track i {
  display: block;
  height: 100%;
  background: var(--green);
}

.admin-nav {
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 18px;
  scrollbar-width: thin;
  scrollbar-color: #3a424b transparent;
}

.nav-link,
.nav-group summary {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 4px;
  color: #b7c0c9;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-link {
  gap: 10px;
  padding: 0 14px;
  font-size: 14px;
}

.nav-link:hover,
.nav-group summary:hover {
  color: #f0f3f6;
  background: #22282e;
}

.nav-link.is-active {
  color: #ffffff;
  background: #3f78ad;
  box-shadow: inset 3px 0 0 #8dc9ff;
}

.nav-symbol {
  width: 18px;
  color: #76abd6;
  text-align: center;
}

.nav-link.is-active .nav-symbol { color: #ffffff; }

.nav-group {
  margin: 3px 0;
}

.nav-group summary {
  justify-content: space-between;
  padding: 0 14px;
  color: #e2e7eb;
  font-size: 14px;
  font-weight: 600;
  list-style: none;
}

.nav-group summary::-webkit-details-marker { display: none; }

.nav-group summary i {
  color: #71808d;
  font-size: 12px;
  font-style: normal;
  transform: rotate(180deg);
}

.nav-group[open] summary i { transform: rotate(0); }

.nav-group__items {
  padding: 2px 0 5px 12px;
  border-left: 1px solid #303840;
}

.nav-group__items .nav-link {
  min-height: 38px;
  padding-left: 18px;
  font-size: 13px;
}

.sidebar-scrim {
  display: none;
}

.admin-main {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background:
    linear-gradient(rgba(65, 72, 80, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 72, 80, .045) 1px, transparent 1px),
    #111419;
  background-size: 32px 32px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.breadcrumb {
  margin: 0 0 8px;
  color: #788491;
  font-size: 12px;
}

.page-header h1 {
  margin: 0;
  color: #f4f6f8;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: 0;
}

.page-header > div:first-child > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-actions,
.table-actions,
.module-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
}

.secondary-button,
.primary-button {
  padding: 0 14px;
  font-size: 13px;
}

.primary-button {
  border-color: #4c8ac0;
  color: #ffffff;
  background: #3f78ad;
}

.primary-button:hover { background: #4b87bd; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.summary-card {
  position: relative;
  min-width: 0;
  height: 112px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-items: end;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.summary-card:hover {
  border-color: #434b54;
  background: #1d2228;
}

.summary-card span {
  align-self: start;
  color: #aeb7c0;
  font-size: 13px;
}

.summary-card strong {
  align-self: end;
  color: var(--card-color);
  font-family: var(--numeric-font);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-card small {
  align-self: end;
  color: #7e8994;
  font-size: 12px;
  text-align: right;
}

.summary-card--neutral { --card-color: #73a5cf; }
.summary-card--online { --card-color: var(--green); }
.summary-card--offline { --card-color: var(--red); }
.summary-card--warning { --card-color: var(--amber); }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(310px, .8fr) minmax(440px, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.content-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.health-panel,
.activity-panel {
  min-height: 244px;
  padding: 18px 20px;
}

.panel-title-row,
.terminal-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.panel-title-row h2,
.terminal-panel__header h2 {
  margin: 0;
  color: #eef2f5;
  font-size: 16px;
  font-weight: 600;
}

.panel-title-row p,
.terminal-panel__header p {
  margin: 5px 0 0;
  color: #7f8a94;
  font-size: 12px;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #90a09a;
  font-size: 12px;
}

.last-sync,
.module-count {
  color: #7f8a94;
  font-size: 12px;
  white-space: nowrap;
}

.health-content {
  height: 164px;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 24px;
}

.health-ring {
  width: 130px;
  height: 130px;
  flex: 0 0 130px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 94.3%, var(--red) 94.3% 100%);
}

.health-ring::before {
  content: "";
  grid-area: 1 / 1;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #181c21;
}

.health-ring > div {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.health-ring strong {
  font-family: var(--numeric-font);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.health-ring span {
  margin-top: 3px;
  color: #89949e;
  font-size: 11px;
}

.health-breakdown {
  width: min(190px, 45%);
  margin: 0;
}

.health-breakdown > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.health-breakdown > div:last-child { border-bottom: 0; }

.health-breakdown dt {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9ca6af;
  font-size: 12px;
}

.health-breakdown dd {
  margin: 0;
  color: #e4e8eb;
  font-family: var(--numeric-font);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot--online { background: var(--green); }
.legend-dot--offline { background: var(--red); }
.legend-dot--warning { background: var(--amber); }

.activity-chart {
  height: 137px;
  display: grid;
  grid-template-columns: repeat(12, minmax(8px, 1fr));
  align-items: end;
  gap: 8px;
  margin-top: 18px;
  padding: 0 8px 9px;
  border-bottom: 1px solid #343b43;
  background: repeating-linear-gradient(180deg, transparent 0 33px, rgba(115, 126, 137, .09) 33px 34px);
}

.activity-chart i {
  height: var(--value);
  min-height: 12px;
  background: #4e8fc9;
  box-shadow: inset 0 -8px 12px rgba(33, 77, 115, .25);
}

.activity-chart i:nth-last-child(-n + 3) { background: var(--green); }

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #6f7b86;
  font-size: 10px;
}

.terminal-panel {
  overflow: hidden;
}

.terminal-panel__header {
  min-height: 74px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-field {
  width: 230px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #79848e;
  background: #13171b;
}

.search-field:focus-within { border-color: #4e8fc9; }

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #e9edf1;
  background: transparent;
  font-size: 12px;
}

.search-field input::placeholder { color: #69747e; }

select {
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #ccd3d9;
  background: #171b20;
  font-size: 12px;
  cursor: pointer;
}

.reset-button { font-size: 16px; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.terminal-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  table-layout: fixed;
}

.terminal-table th,
.terminal-table td {
  height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  color: #b8c1c9;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.terminal-table th {
  height: 42px;
  color: #858f99;
  background: #15191d;
  font-weight: 500;
}

.terminal-table tr:last-child td { border-bottom: 0; }
.terminal-table tbody tr:hover { background: #1c2127; }
.terminal-table tr[hidden] { display: none; }

.terminal-table th:nth-child(1),
.terminal-table td:nth-child(1) { width: 235px; }
.terminal-table th:nth-child(2),
.terminal-table td:nth-child(2) { width: 115px; }
.terminal-table th:nth-child(3),
.terminal-table td:nth-child(3) { width: 105px; }
.terminal-table th:nth-child(4),
.terminal-table td:nth-child(4) { width: 105px; }
.terminal-table th:nth-child(5),
.terminal-table td:nth-child(5) { width: 90px; }
.terminal-table th:nth-child(6),
.terminal-table td:nth-child(6) { width: 140px; }
.terminal-table th:nth-child(7),
.terminal-table td:nth-child(7) { width: 105px; }
.terminal-table th:nth-child(8),
.terminal-table td:nth-child(8) { width: 72px; }

.terminal-table td strong,
.terminal-table td small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-table td strong {
  color: #e3e8ec;
  font-size: 12px;
  font-weight: 550;
}

.terminal-table td small {
  margin-top: 3px;
  color: #77828c;
  font-size: 10px;
}

.status-chip {
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 12px;
  font-size: 11px;
}

.status-chip--online { color: var(--green); background: rgba(66, 185, 131, .08); }
.status-chip--offline { color: var(--red); background: rgba(218, 108, 103, .08); }
.status-chip--warning { color: var(--amber); background: rgba(212, 167, 77, .08); }

.signal {
  width: 54px;
  height: 5px;
  display: inline-block;
  margin-right: 7px;
  overflow: hidden;
  vertical-align: middle;
  background: #343a41;
}

.signal i {
  display: block;
  height: 100%;
  background: var(--green);
}

.signal--offline i { background: var(--red); }
.signal--warning i { background: var(--amber); }

.row-action {
  padding: 4px 0;
  border: 0;
  color: #70a9d7;
  background: transparent;
  cursor: pointer;
}

.row-action:hover { color: #a9d5fa; }

.empty-state {
  height: 190px;
  place-items: center;
  color: #737f8a;
  font-size: 13px;
}

.empty-state:not([hidden]) { display: grid; }

.module-workspace[hidden],
#overviewWorkspace[hidden] { display: none; }

.module-toolbar {
  justify-content: flex-end;
  margin-bottom: 14px;
}

.module-search { margin-right: auto; }

.generic-panel {
  overflow: hidden;
}

.generic-panel .panel-title-row {
  min-height: 70px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.generic-table th:nth-child(1),
.generic-table td:nth-child(1) { width: 100px; }
.generic-table th:nth-child(2),
.generic-table td:nth-child(2) { width: 230px; }
.generic-table th:nth-child(3),
.generic-table td:nth-child(3) { width: 160px; }
.generic-table th:nth-child(4),
.generic-table td:nth-child(4) { width: 100px; }
.generic-table th:nth-child(5),
.generic-table td:nth-child(5) { width: 120px; }
.generic-table th:nth-child(6),
.generic-table td:nth-child(6) { width: 150px; }
.generic-table th:nth-child(7),
.generic-table td:nth-child(7) { width: 80px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid #3f4a54;
  border-radius: 5px;
  color: #e8edf1;
  background: #242a30;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .34);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .system-health { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-app { grid-template-columns: minmax(0, 1fr); }

  .sidebar-toggle { display: inline-flex; }

  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 68px;
    bottom: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }

  .admin-app.is-sidebar-open .admin-sidebar { transform: translateX(0); }

  .sidebar-scrim {
    position: fixed;
    inset: 68px 0 0;
    z-index: 14;
    border: 0;
    background: rgba(0, 0, 0, .5);
  }

  .admin-app.is-sidebar-open .sidebar-scrim { display: block; }

  .admin-main { grid-column: 1; }
}

@media (max-width: 680px) {
  .admin-topbar { padding: 0 12px; }
  .admin-brand { flex: 1; }
  .admin-brand__mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }
  .admin-brand__mark::before,
  .admin-brand__mark::after,
  .admin-brand__mark i::before,
  .admin-brand__mark i::after {
    width: 12px;
    height: 12px;
  }
  .admin-brand__text { flex: 1; }
  .admin-brand__text strong { font-size: 13px; }
  .admin-brand__text small { display: none; }
  .admin-topbar__actions { gap: 5px; }
  .account-button { display: none; }
  .topbar-button span { display: none; }
  .admin-main { padding: 16px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { height: 98px; }
  .health-content { justify-content: space-between; }
  .terminal-panel__header { align-items: flex-start; flex-direction: column; }
  .table-actions { width: 100%; flex-wrap: wrap; }
  .search-field { width: 100%; }
  .table-actions select { flex: 1; min-width: 120px; }
  .module-toolbar { flex-wrap: wrap; }
  .module-toolbar .module-search { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
