:root {
  --bg: #0b1020;
  --bg-elevated: #121a2f;
  --bg-soft: #18233d;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eefc;
  --muted: #93a0b8;
  --primary: #f6821f;
  --primary-2: #ff9f4a;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(246, 130, 31, 0.16), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(96, 165, 250, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button,
input,
textarea,
select {
  font: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(10, 14, 28, 0.72);
  backdrop-filter: blur(10px);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #1a1020;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px rgba(246, 130, 31, 0.35);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.15s ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(246, 130, 31, 0.18), rgba(246, 130, 31, 0.05));
  border-color: rgba(246, 130, 31, 0.35);
}

.sidebar-foot {
  margin-top: auto;
  padding: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.main {
  padding: 28px 32px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.muted {
  color: var(--muted);
}

.panel {
  background: linear-gradient(180deg, rgba(24, 35, 61, 0.92), rgba(18, 26, 47, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-caption {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.compact-grid {
  gap: 12px;
}

label small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.auth-panel {
  max-width: 560px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
.search,
.menu-select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

input:focus,
textarea:focus,
.search:focus,
.menu-select:focus {
  border-color: rgba(246, 130, 31, 0.6);
  box-shadow: 0 0 0 3px rgba(246, 130, 31, 0.12);
}

.search {
  width: min(320px, 100%);
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #1a1020;
  font-weight: 700;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.btn-danger:hover {
  border-color: rgba(248, 113, 113, 0.8);
}

.check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  color: var(--text) !important;
  font-size: 14px !important;
}

.check-row input {
  width: auto;
}

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

.stat {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(18, 26, 47, 0.9);
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat .value {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.list-item:hover {
  border-color: var(--border);
}

.table-wrap {
  overflow: auto;
}

.select-cell {
  width: 38px;
  text-align: center;
}

.select-cell input,
.node-select {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(246, 130, 31, 0.3);
  background: rgba(246, 130, 31, 0.07);
}

.menu-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.menu-select {
  width: auto;
  min-width: 150px;
  appearance: auto;
}

.batch-input {
  width: min(280px, 100%);
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok {
  color: var(--ok);
}
.badge.warn {
  color: var(--warn);
}
.badge.bad {
  color: var(--bad);
}
.badge.info {
  color: var(--info);
}
.badge.neutral {
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
  font-size: 12px;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.error {
  color: var(--bad);
  min-height: 1.2em;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.binding-warning {
  margin-top: 4px;
  color: var(--warn);
  font-size: 12px;
}

.health-mini {
  max-width: 190px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.health-legend {
  margin-top: 16px;
  box-shadow: none;
}

.health-legend p,
.audit-caption {
  margin: 4px 0 0;
  line-height: 1.6;
}

.health-detail {
  margin: 4px 0 18px;
  border-block: 1px solid var(--border);
  padding: 14px 0;
}

.health-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.health-check {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  padding: 7px 0;
}

.health-check-mark {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}

.health-check.pass { color: var(--ok); }
.health-check.warn { color: var(--warn); }
.health-check.fail { color: var(--bad); }

.health-check strong {
  color: var(--text);
  font-size: 13px;
}

.health-check small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.health-scope {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.audit-action {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: #bfdbfe;
  font-size: 12px;
}

input[readonly] {
  color: var(--muted);
  cursor: default;
}

/* 登录入口：故意保持信息最少，不加载任何管理台 DOM。 */
.login-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(246, 130, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 130, 31, 0.035) 1px, transparent 1px),
    #0a0e19;
  background-size: 48px 48px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 24px;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  border: 1px solid rgba(246, 130, 31, 0.24);
  background: #101625;
  padding: clamp(28px, 7vw, 48px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.login-mark {
  display: flex;
  gap: 5px;
  height: 26px;
  align-items: flex-end;
  margin-bottom: 28px;
}

.login-mark span {
  display: block;
  width: 7px;
  background: var(--primary);
}

.login-mark span:nth-child(1) { height: 11px; }
.login-mark span:nth-child(2) { height: 19px; }
.login-mark span:nth-child(3) { height: 26px; }

.login-kicker {
  margin: 0 0 10px;
  color: var(--primary-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.login-copy {
  margin: 16px 0 32px;
  color: var(--muted);
  line-height: 1.65;
}

.login-form label {
  color: var(--text);
  font-size: 0.875rem;
}

.login-form input {
  min-height: 48px;
  margin-top: 8px;
  background: #080c15;
}

.login-form .btn {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
}

.login-form .error {
  margin: 12px 0 0;
  font-size: 0.875rem;
}

.login-foot {
  margin: 0;
  color: #657089;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.hidden {
  display: none !important;
}

.code-block {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #070b16;
  border: 1px solid var(--border);
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #dbe7ff;
  max-height: 320px;
}

.tips {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: #0f1629;
  border-left: 1px solid var(--border);
  z-index: 50;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

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

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-body {
  padding: 18px;
  overflow: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #111827;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 60;
  box-shadow: var(--shadow);
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav {
    flex-direction: row;
    overflow: auto;
  }
  .stats,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 18px;
  }
  .batch-bar {
    align-items: stretch;
  }
  .batch-bar > * {
    width: 100%;
  }
  .menu-field {
    justify-content: space-between;
  }
}
