:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d8e2ef;
  --line-soft: #edf2f7;
  --text: #111827;
  --muted: #667085;
  --muted-2: #98a2b3;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf2ff;
  --green: #16a34a;
  --green-soft: #eafbf1;
  --orange: #f59e0b;
  --orange-soft: #fff4df;
  --purple: #7c3aed;
  --purple-soft: #f2eaff;
  --red: #ef4444;
  --red-soft: #fff1f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 26px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
}
.brand-mark img {
  width: 32px;
  height: 32px;
  filter: brightness(0) invert(1);
}
.brand strong { display: block; font-size: 18px; line-height: 1.05; }
.brand span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
nav { display: grid; gap: 8px; }
.nav {
  width: 100%;
  height: 42px;
  border: 0;
  background: transparent;
  color: #344054;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.nav:hover { background: #f2f6ff; color: var(--blue); }
.nav.active { background: var(--blue-soft); color: var(--blue); }
.nav-icon {
  width: 20px;
  display: inline-flex;
  justify-content: center;
  color: currentColor;
}
.nav-icon img {
  width: 18px;
  height: 18px;
  filter: brightness(0) saturate(100%) invert(18%) sepia(21%) saturate(692%) hue-rotate(180deg) brightness(94%) contrast(88%);
}
.nav.active .nav-icon img,
.nav:hover .nav-icon img {
  filter: brightness(0) saturate(100%) invert(34%) sepia(86%) saturate(1992%) hue-rotate(215deg) brightness(97%) contrast(92%);
}

.app {
  margin-left: 248px;
  min-height: 100vh;
  padding: 26px 28px 34px;
  min-width: 0;
  overflow-x: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.title-block {
  display: grid;
  gap: 12px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}
.clock {
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.clock img,
button img,
.badges img {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
h1, h2, p { margin: 0; }
h1 { font-size: 29px; font-weight: 850; line-height: 1.1; }
h2 { font-size: 17px; font-weight: 800; line-height: 1.2; }
p { color: var(--muted); margin-top: 7px; line-height: 1.55; }

.badges, .chips, .preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.badges span, .chip, .pill, .preset-list span, .preset-list button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 8px 13px;
  color: #344054;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.badges .ok, .chip.ok {
  color: var(--green);
  border-color: #b7ebc6;
  background: var(--green-soft);
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  background: var(--blue-soft);
  border-color: #bfdbfe;
  color: var(--blue);
  font-weight: 750;
}
.pill.ok { color: var(--green); border-color: #bbf7d0; background: var(--green-soft); }
.pill.warn { color: var(--orange); border-color: #fed7aa; background: var(--orange-soft); }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 760;
  background: #f8fafc;
  color: var(--muted);
  border: 1px solid var(--line);
}
.status-badge.ok { background: var(--green-soft); color: var(--green); border-color: #bbf7d0; }
.status-badge.bad { background: var(--red-soft); color: var(--red); border-color: #fecdd3; }
.status-badge.idle { background: #f8fafc; color: var(--muted); }
.mini-pill {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}
.muted { color: var(--muted-2); }
.empty-text { padding: 18px 0; }

.view { display: none; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}
.metric-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-card {
  min-height: 120px;
  padding: 22px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.metric-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.metric-icon img {
  width: 34px;
  height: 34px;
  filter: brightness(0) invert(1);
}
.metric-blue .metric-icon { background: linear-gradient(145deg, #3b82f6, #1d4ed8); }
.metric-green .metric-icon { background: linear-gradient(145deg, #22c55e, #15803d); }
.metric-orange .metric-icon { background: linear-gradient(145deg, #fb923c, #f97316); }
.metric-purple .metric-icon { background: linear-gradient(145deg, #8b5cf6, #6d28d9); }
.metric-card label, label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.metric-card strong {
  display: block;
  font-size: 32px;
  line-height: 1.05;
  font-weight: 850;
}
.metric-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}

.panel {
  padding: 22px;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 760px;
  gap: 26px;
}
.dashboard-main {
  display: grid;
  gap: 18px;
}
.dashboard-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  align-content: start;
}
.user-dashboard .dashboard-layout {
  grid-template-columns: 1fr;
}
.user-dashboard .dashboard-side {
  grid-template-columns: 1fr;
}
.user-dashboard .protocol-panel {
  max-width: none;
}
.user-dashboard .protocol-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 582px);
  gap: 18px;
  align-items: stretch;
}
.page-grid > * {
  min-width: 0;
}
.subscriptions-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}
.subscriptions-main,
.subscriptions-side {
  display: grid;
  gap: 18px;
}
.subs-manager-card {
  overflow-x: hidden;
}
.add-sub-card,
.parse-card,
.compat-card {
  padding: 22px;
}
.panel-head.compact {
  margin-bottom: 12px;
}
.page-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}
.side-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}
.output-panel {
  display: block;
}

code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #fbfdff;
  border: 1px solid #bfd3f5;
  padding: 13px 15px;
  border-radius: 7px;
  color: #0f172a;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 15px;
}
.output-panel code {
  color: #0f3f99;
}
.yaml-address-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.yaml-address-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 88px 88px;
  gap: 10px;
  align-items: center;
}
.yaml-address-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.yaml-address-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yaml-address-row .icon-button {
  width: 100%;
  padding: 0 12px;
}

button, .button {
  border: 0;
  background: var(--blue);
  color: #fff;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
button img, .button img {
  filter: brightness(0) invert(1);
}
button:hover, .button:hover { background: var(--blue-dark); }
button.secondary, .button.secondary {
  background: #fff;
  color: #344054;
  border: 1px solid var(--line);
}
button.secondary img, .button.secondary img {
  filter: brightness(0) saturate(100%) invert(24%) sepia(11%) saturate(1083%) hue-rotate(180deg) brightness(92%) contrast(89%);
}
button.secondary:hover { background: #f8fafc; }
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
button.danger { background: #fff; color: var(--red); border: 1px solid #fecdd3; }
button.danger img {
  filter: brightness(0) saturate(100%) invert(45%) sepia(91%) saturate(2564%) hue-rotate(334deg) brightness(99%) contrast(89%);
}
button.danger:hover { background: var(--red-soft); }
.icon-button { padding: 0 16px; }
td button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}
textarea {
  min-height: 390px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.stack-form {
  display: grid;
  gap: 13px;
}
.stack-form label { margin: 0; color: var(--muted); }
.stack-form input { margin-top: 7px; height: 38px; }
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.button-row.fit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.subscription-panel {
  min-height: 360px;
}
.subscription-table-head,
.subscription-card {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.25fr) 138px 112px 138px;
  gap: 12px;
  align-items: center;
}
.subscription-table-head {
  min-height: 42px;
  padding: 0 16px;
  background: #f8fafc;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.subscription-cards {
  display: grid;
}
.subscription-card {
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}
.subscription-card strong {
  font-size: 14px;
}
.subscription-card small {
  color: var(--muted);
  white-space: nowrap;
}
.subscription-card .status-badge {
  justify-self: start;
  white-space: nowrap;
  width: fit-content;
}
.subs-table-head,
.subs-table-row {
  display: grid;
  grid-template-columns: 56px minmax(82px, .75fr) minmax(180px, 1.55fr) minmax(150px, 1fr) 126px 122px minmax(172px, auto);
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.subs-table-head {
  min-height: 44px;
  padding: 0 16px;
  background: #f8fafc;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.subs-table-body {
  display: grid;
}
.subs-table-row {
  min-height: 62px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}
.subs-table-row code {
  font-size: 12px;
  padding: 8px 10px;
  min-width: 0;
}
.subs-table-row small {
  color: var(--muted);
  line-height: 1.35;
}
.subs-table-row > *,
.subs-table-head > * {
  min-width: 0;
}
.subs-table-row .row-actions {
  justify-content: flex-start;
  min-width: 0;
}
.subs-empty {
  padding: 22px 16px;
  color: var(--muted);
}
.switch {
  display: inline-flex;
  margin: 0;
}
.switch input {
  display: none;
}
.switch i {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d0d5dd;
  position: relative;
  transition: background .16s ease;
}
.switch i::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.16);
  transition: transform .16s ease;
}
.switch input:checked + i {
  background: var(--blue);
}
.switch input:checked + i::after {
  transform: translateX(16px);
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.mini-action {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  color: var(--blue) !important;
  border-color: #bfdbfe !important;
}
.icon-only {
  width: 30px;
  min-height: 30px;
  padding: 0;
}
.icon-only img,
.mini-action img {
  width: 15px;
  height: 15px;
}
.diag-table-head,
.diag-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 80px 90px;
  gap: 12px;
  align-items: center;
}
.diag-table-head {
  min-height: 42px;
  padding: 0 14px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}
.diag-table-body {
  border: 1px solid var(--line-soft);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.diag-table-row {
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
}
.diag-table-row:last-child {
  border-bottom: 0;
}
.diag-table-row span {
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diag-table-row strong {
  color: var(--blue);
}
.diag-table-row em,
.compat-list strong {
  justify-self: start;
  font-style: normal;
  font-size: 12px;
  border-radius: 6px;
  padding: 4px 8px;
}
.diag-table-row em.ok,
.compat-list strong {
  color: var(--green);
  border: 1px solid #bbf7d0;
  background: var(--green-soft);
}
.diag-table-row em.idle {
  color: var(--muted);
  border: 1px solid var(--line);
  background: #f8fafc;
}
.parse-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.parse-result-grid div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}
.parse-result-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.parse-result-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  color: var(--text);
}
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}
.status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}
.compact-result {
  margin-top: 12px;
}
.compat-list {
  display: grid;
  gap: 8px;
}
.compat-list div {
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
}
.compat-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subs-log-list {
  margin-top: 12px;
  display: grid;
  max-height: 260px;
  overflow: auto;
}
.subs-log-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.subs-log-row span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  margin-top: 5px;
}
.subs-log-row p {
  margin: 0;
  color: #475467;
  line-height: 1.5;
}

.protocol-list {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.protocol-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 50px;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
}
.protocol-row:last-child { border-bottom: 0; }
.protocol-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  font-family: Consolas, "Cascadia Code", monospace;
}
.protocol-ss { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.protocol-vmess { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.protocol-vless { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.protocol-trojan { background: #fff7ed; color: #f97316; border-color: #fed7aa; }
.protocol-hysteria2 { background: #ecfeff; color: #0891b2; border-color: #a5f3fc; }
.protocol-tuic { background: #f8fafc; color: #475467; border-color: var(--line); }
.protocol-row strong {
  color: var(--green);
  font-size: 12px;
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 4px 8px;
}
.version-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 7px;
  padding: 14px;
  margin: 16px 0;
}
.version-box span { color: var(--muted); }
.version-box strong {
  color: var(--blue);
  background: #fff;
  border: 1px solid #bfdbfe;
  padding: 5px 9px;
  border-radius: 6px;
}
.install-button {
  width: 100%;
  background: var(--green);
  margin-top: 12px;
}
.install-button:hover { background: #15803d; }
.button-row .install-button {
  margin-top: 0;
}
.update-action {
  min-height: 52px;
}
.dashboard-upload {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 76px;
  padding: 12px;
  border: 1px dashed #b8c7dc;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 0;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.dashboard-upload.drag-over,
.upload-box.rich.drag-over {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}
.dashboard-upload.has-file,
.upload-box.rich.has-file {
  border-color: #86efac;
  background: var(--green-soft);
}
.dashboard-upload img {
  width: 22px;
  height: 22px;
  filter: brightness(0) saturate(100%) invert(38%) sepia(85%) saturate(2267%) hue-rotate(201deg) brightness(97%) contrast(95%);
}
.dashboard-upload strong {
  font-size: 12px;
  color: #344054;
}
.dashboard-upload span {
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line-soft);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
th, td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 8px;
  text-align: left;
  vertical-align: middle;
}
th {
  color: #52647c;
  font-weight: 800;
  font-size: 12px;
  background: #f7f9fc;
}
td { font-size: 13px; }
td code { max-width: 360px; font-size: 12px; padding: 8px 10px; }
td:last-child {
  display: flex;
  gap: 7px;
  align-items: center;
}

.stats-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.stats-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.stats-list span { color: var(--muted); }
.stats-list strong { font-size: 15px; }
.protocol-stats-panel { margin-top: 18px; }

.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 11px;
}
.node-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 13px;
  background: var(--panel-soft);
}
.node-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}
.node-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.result-box, .check-list, .path-list {
  margin-top: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}
.result-box strong, .result-box span { display: block; }
.result-box span { color: var(--muted); margin-top: 7px; line-height: 1.55; }
.diag-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.diag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.diag-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diag-row strong { color: var(--blue); }
.check-list { display: grid; gap: 9px; }
.check-list div {
  padding: 9px 10px;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
}
.check-list .bad { color: var(--red); background: var(--red-soft); }
.check-list .warn { color: var(--orange); background: var(--orange-soft); }
.check-list .ok { color: var(--green); background: var(--green-soft); }
.failure-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}
.failure-item {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
}
.failure-item strong {
  display: block;
  color: var(--red);
  margin-bottom: 5px;
}
.failure-item small {
  color: var(--muted);
  word-break: break-all;
}
.path-list { display: grid; gap: 12px; }
.path-list span { display: block; color: var(--muted); margin-bottom: 6px; }

.chain-list {
  display: grid;
  gap: 12px;
}
.chain-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) minmax(260px, .8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 10px 12px 14px;
  border-radius: 7px;
  border-bottom: 1px solid var(--line-soft);
}
.chain-card.disabled {
  background: #fff7f7;
  border-color: #fecaca;
  box-shadow: inset 3px 0 0 #ef4444;
}
.chain-card.disabled::after {
  content: "已停用";
  position: absolute;
  right: 12px;
  top: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
}
.chain-card.disabled > div:not(.chain-actions) {
  opacity: .62;
}
.chain-index {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #f1f5f9;
  border: 1px solid var(--line-soft);
  color: #475467;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.chain-card strong,
.chain-card span {
  display: block;
}
.chain-card span,
.chain-route span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.chain-route {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
}
.chain-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.chain-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 13px;
}
.chain-power.active {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}
.chain-power.inactive {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff1f2;
}
.chain-source-input {
  min-height: 190px;
}
.chain-form-buttons {
  display: flex;
  margin-top: 2px;
}
.chain-form-buttons button {
  flex: 1;
}

.yaml-overview {
  margin-top: 18px;
}
#yamlPreviewFull {
  background: #fbfdff;
  color: #0f3f99;
  border-color: var(--line);
  font-size: 13px;
  line-height: 1.55;
}
#yamlPreviewFull { min-height: 650px; }
.yaml-code {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  overflow: auto;
  min-height: 260px;
  max-height: 310px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.yaml-column + .yaml-column {
  border-left: 1px solid var(--line);
}
.yaml-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  min-height: 22px;
}
.yaml-line span {
  color: var(--muted-2);
  background: #f8fafc;
  border-right: 1px solid var(--line-soft);
  padding-right: 10px;
  text-align: right;
}
.yaml-line code {
  border: 0;
  background: transparent;
  padding: 0 12px;
  border-radius: 0;
  color: #0f3f99;
  font-size: 13px;
  white-space: pre;
}
.code-panel { padding-bottom: 14px; }
.compact-logs, .logs {
  background: #fff;
  color: #475467;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  margin-top: 14px;
}
.compact-logs { min-height: 128px; }
.logs { min-height: 560px; }
.compact-logs div, .logs div {
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.compact-metrics {
  margin-bottom: 22px;
}
.node-layout,
.rule-layout,
.update-layout,
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.update-layout > .side-stack {
  display: contents;
}
.update-layout > .side-stack > .panel:first-child {
  align-self: stretch;
}
.update-layout > .side-stack > .panel:last-child {
  grid-column: 1 / -1;
}
.update-layout .compact-logs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}
.logs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.node-list-panel {
  overflow-x: auto;
}
.node-toolbar,
.log-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto 180px;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.log-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto;
}
.segmented {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  color: #344054;
  border-radius: 6px;
  font-size: 12px;
}
.segmented button:hover,
.segmented button.active {
  background: var(--blue);
  color: #fff;
}
.hidden {
  display: none !important;
}
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f1f5f9;
}
.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .12);
}
.login-panel h2 {
  margin: 0;
  color: var(--ink);
}
.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}
.login-message {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(320px, 0.95fr) minmax(620px, 1.3fr);
  gap: 14px;
  align-items: center;
  min-height: 88px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.user-admin-layout {
  display: grid;
  gap: 18px;
}
.user-create-panel {
  display: block;
}
.user-create-panel .panel-head {
  margin-bottom: 16px;
}
.user-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(320px, 0.95fr) minmax(620px, 1.3fr);
  gap: 14px;
  align-items: end;
}
.user-create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}
.user-create-form input,
.user-create-form select,
.user-create-form button {
  height: 40px;
}
.create-action-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 132px;
  gap: 12px;
  align-items: end;
}
.create-action-fields > button {
  margin-bottom: 6px;
}
.user-login-name {
  color: #344054;
}
.user-profile strong,
.user-profile span,
.user-token-box span,
.user-token-box code {
  display: block;
}
.user-profile span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.user-token-box {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.user-token-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.user-token-box code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
}
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 360px);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.audit-row.warn strong {
  color: var(--red);
}
.audit-row strong,
.audit-row span {
  display: block;
}
.audit-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.audit-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#users #usersList {
  max-height: calc(100vh - 430px);
  overflow: auto;
}
.audit-list {
  max-height: calc(100vh - 260px);
  overflow: auto;
}
.audit-filters {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 150px 150px 140px minmax(180px, 1fr) 88px;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
}
.audit-filters label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}
.audit-filters input,
.audit-filters select,
.audit-filters button {
  height: 40px;
}
.audit-filters > button {
  margin-bottom: 6px;
}
.user-actions {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(430px, 1.18fr);
  gap: 10px;
  justify-content: end;
}
.user-action-group {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.user-action-group:last-child {
  grid-template-columns: minmax(120px, 1fr) auto auto auto;
}
.inline-password {
  width: 100%;
  height: 40px;
}
.inline-display-name {
  width: 100%;
  height: 40px;
}
.node-table-head,
.node-table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) 92px minmax(170px, 1fr) 70px 76px 118px 78px 82px 112px;
  gap: 12px;
  align-items: center;
  min-width: 1120px;
}
.node-table-head {
  min-height: 44px;
  padding: 0 16px;
  color: var(--muted);
  background: #f8fafc;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 800;
}
.node-table-body {
  display: grid;
}
.node-table-row {
  min-height: 62px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}
.node-table-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-table-row code {
  padding: 8px 10px;
  font-size: 12px;
}
.node-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 1120px;
  padding: 14px 16px 0;
  color: var(--muted);
  font-size: 13px;
}
.logs-pagination {
  min-width: 0;
  border-top: 1px solid var(--line-soft);
  margin-top: 2px;
}
.pager-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pager-buttons button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.pager-buttons button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.pager-buttons button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.pager-buttons em {
  color: var(--muted-2);
  font-style: normal;
  padding: 0 4px;
}
.type-pill,
.source-pill,
.latency {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
}
.type-pill {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
}
.source-pill {
  color: #475467;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.latency.ok {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
}
.latency.warn {
  color: var(--orange);
  background: var(--orange-soft);
  border: 1px solid #fed7aa;
}
.latency.bad {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #fecdd3;
}
.latency.idle {
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
}
.table-empty {
  padding: 22px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
}
.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.bar-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}
.bar-row span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}
.bar-row i {
  height: 9px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}
.bar-row strong {
  text-align: right;
  color: var(--text);
}
.diagnostic-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.diagnostic-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel-soft);
}
.diagnostic-row span {
  color: var(--muted);
}
.diagnostic-row.ok strong { color: var(--green); }
.diagnostic-row.warn strong { color: var(--orange); }
.failure-list.compact {
  max-height: 220px;
}
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.strategy-note {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.strategy-note div {
  border: 1px solid var(--line-soft);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
}
.strategy-note strong {
  display: block;
  margin-bottom: 5px;
}
.strategy-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.group-card {
  border: 1px solid var(--line-soft);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 14px;
}
.group-card.core {
  background: #fff;
  border-color: #bfdbfe;
}
.group-card-head,
.group-card-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.group-card strong {
  font-size: 15px;
}
.group-card-head span {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
}
.group-card p {
  min-height: 44px;
  margin-top: 10px;
  color: #475467;
}
.group-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}
.group-card-actions {
  flex-shrink: 0;
}
.group-card-actions .icon-only {
  width: 30px;
  height: 30px;
}
.compact-editor {
  min-height: 260px;
}
.editor-head {
  margin-top: 8px;
  margin-bottom: 10px;
}
.preset-list.tall {
  margin-top: 14px;
}
.preset-list:has(.preset-entry) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.preset-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 32px;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.preset-entry .secondary:first-child {
  justify-content: flex-start;
  min-width: 0;
  border-color: transparent;
  background: transparent;
  padding: 7px 6px;
  font-weight: 800;
}
.preset-entry .icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
}
.rule-editors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.rule-editors label {
  color: var(--muted);
}
.rule-editors textarea {
  margin-top: 8px;
  min-height: 560px;
}
.rule-preview {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.rule-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.rule-row span {
  color: var(--muted-2);
  text-align: right;
  font-family: Consolas, "Cascadia Code", monospace;
}
.rule-row code {
  padding: 8px 10px;
  font-size: 12px;
}
.version-box.large {
  margin-top: 0;
  min-height: 60px;
}
.upload-box.rich {
  justify-items: center;
  text-align: center;
  padding: 30px 18px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.upload-box.rich + .button-row {
  margin-top: 16px;
}
.upload-box.rich img {
  width: 32px;
  height: 32px;
  filter: brightness(0) saturate(100%) invert(38%) sepia(85%) saturate(2267%) hue-rotate(201deg) brightness(97%) contrast(95%);
}
.upload-box.rich strong {
  color: #344054;
}
.upload-box.rich span {
  color: var(--muted);
}
.visually-hidden-file {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.log-row {
  display: grid;
  grid-template-columns: 170px 70px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0 !important;
}
.log-row span {
  color: var(--muted);
}
.log-row strong {
  width: fit-content;
  min-width: 54px;
  text-align: center;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
}
.log-row.error strong {
  color: var(--red);
  background: var(--red-soft);
  border-color: #fecdd3;
}
.log-row.warn strong,
.log-row.warning strong {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: #fed7aa;
}
.log-row p {
  margin: 0;
  color: #475467;
  line-height: 1.5;
}
.update-log-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
}
.update-log-row span {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 999px;
  margin-top: 5px;
}
.update-log-row p {
  margin: 0;
  color: #475467;
  line-height: 1.5;
}
.upload-box {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px dashed #adc4e6;
  border-radius: 8px;
  background: #f8fbff;
  margin-top: 14px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.settings-grid label { color: var(--muted); }
.settings-wide { grid-column: 1 / -1; }
.settings-grid input,
.settings-grid select,
.settings-grid textarea { margin-top: 7px; }
.settings-grid textarea { min-height: 120px; }
.settings-submit {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(360px, 100%);
  margin-top: 6px;
}
.settings-grid label small {
  display: block;
  margin-top: 7px;
  color: #667085;
  font-weight: 500;
}
.dialog-form label small {
  display: block;
  margin-top: 6px;
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
}
.dialog-form .type-help {
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #344054;
}
.dialog-field {
  display: grid;
  gap: 8px;
}
.dialog-label {
  color: var(--muted);
  font-weight: 700;
}
.source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.source-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #101828;
  cursor: pointer;
}
.source-option:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .08) inset;
}
.source-option input {
  width: auto;
  margin: 3px 0 0;
}
.source-option strong {
  display: block;
  font-size: 13px;
  color: #101828;
}
.source-option small {
  margin-top: 4px;
}
.field-help {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
}
.candidate-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 168px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.candidate-option {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
  color: #101828 !important;
  cursor: pointer;
}
.candidate-option:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--blue) !important;
}
.candidate-option input {
  width: auto;
  margin: 0;
}
.candidate-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.domain-list-editor {
  min-height: 220px !important;
  font-family: Consolas, "Cascadia Code", monospace;
}
.muted-field {
  opacity: .55;
}
.muted-field input,
.muted-field textarea {
  background: #f8fafc;
}
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-field input {
  width: auto;
  margin: 0;
}
.toggle-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 74px;
  padding: 14px 16px !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}
.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-switch {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d0d5dd;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .08);
  transition: background .18s ease, box-shadow .18s ease;
}
.toggle-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .2);
  transition: transform .18s ease;
}
.toggle-card input:checked + .toggle-switch {
  background: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .2);
}
.toggle-card input:checked + .toggle-switch i {
  transform: translateX(20px);
}
.toggle-card > span:last-child {
  grid-column: 1;
  grid-row: 1;
}
.toggle-card strong {
  display: block;
  color: var(--text);
  font-weight: 800;
}
.toggle-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 7px;
  padding: 12px;
  min-height: 120px;
}

.toast-root {
  position: fixed;
  top: 22px;
  right: 26px;
  z-index: 80;
  display: grid;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  max-width: 420px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(16, 24, 40, .16);
}
.toast-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-soft);
}
.toast-icon img {
  width: 18px;
  height: 18px;
  filter: brightness(0) saturate(100%) invert(47%) sepia(95%) saturate(485%) hue-rotate(89deg) brightness(92%) contrast(87%);
}
.toast.error .toast-icon {
  background: var(--red-soft);
}
.toast.error .toast-icon img {
  filter: brightness(0) saturate(100%) invert(45%) sepia(91%) saturate(2564%) hue-rotate(334deg) brightness(99%) contrast(89%);
}
.toast p {
  margin: 0;
  color: #344054;
  font-weight: 700;
}
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: start center;
  padding: 44px 16px;
  overflow: auto;
  background: rgba(15, 23, 42, .22);
  backdrop-filter: blur(2px);
}
.app-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .22);
  overflow: hidden;
}
.strategy-dialog,
.preset-dialog {
  width: min(680px, calc(100vw - 32px));
}
.app-dialog .dialog-content {
  min-width: 0;
  overflow: auto;
  max-height: calc(100dvh - 90px);
  padding-right: 4px;
}
.dialog-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
}
.dialog-icon img {
  width: 24px;
  height: 24px;
  filter: brightness(0) saturate(100%) invert(34%) sepia(86%) saturate(1992%) hue-rotate(215deg) brightness(97%) contrast(92%);
}
.app-dialog.warning .dialog-icon {
  background: var(--orange-soft);
}
.app-dialog.warning .dialog-icon img {
  filter: brightness(0) saturate(100%) invert(65%) sepia(78%) saturate(1505%) hue-rotate(352deg) brightness(98%) contrast(95%);
}
.app-dialog.danger .dialog-icon,
.app-dialog.error .dialog-icon {
  background: var(--red-soft);
}
.app-dialog.danger .dialog-icon img,
.app-dialog.error .dialog-icon img {
  filter: brightness(0) saturate(100%) invert(45%) sepia(91%) saturate(2564%) hue-rotate(334deg) brightness(99%) contrast(89%);
}
.dialog-content h2 {
  font-size: 18px;
  line-height: 1.25;
}
.dialog-content p {
  margin-top: 8px;
  color: #475467;
  white-space: pre-line;
}
.dialog-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.dialog-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.dialog-form textarea {
  min-height: 120px;
  resize: vertical;
}
.dialog-actions {
  position: sticky;
  bottom: -1px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.82), #fff 45%);
}
button.danger.solid {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
button.danger.solid:hover {
  background: #dc2626;
}

@media (max-width: 1500px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subscriptions-layout { grid-template-columns: 1fr; }
  .subscriptions-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .subs-table-head,
  .subs-table-row {
    grid-template-columns: 48px minmax(82px, .75fr) minmax(170px, 1.35fr) minmax(140px, .95fr) 118px 112px minmax(170px, auto);
  }
  .metric-card {
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 16px;
    padding: 20px;
  }
  .metric-icon {
    width: 60px;
    height: 60px;
  }
}
@media (max-width: 1150px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-side, .subscriptions-side, .page-grid, .page-grid.two, .preview-layout, .update-layout {
    grid-template-columns: 1fr;
  }
  .update-layout .compact-logs {
    grid-template-columns: 1fr;
  }
  .subs-manager-card {
    overflow-x: hidden;
  }
  .user-create-panel {
    grid-template-columns: 1fr;
  }
  .user-create-panel .panel-head {
    margin-bottom: 4px;
  }
  .user-row,
  .user-create-form {
    grid-template-columns: 1fr;
  }
  .create-action-fields {
    grid-template-columns: 1fr;
  }
  .user-token-box {
    grid-template-columns: 1fr;
  }
  .user-actions {
    grid-template-columns: 1fr;
  }
  .audit-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .user-action-group,
  .user-action-group:last-child {
    grid-template-columns: 1fr auto;
  }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; }
  .app { margin-left: 0; padding: 16px; }
  .topbar, .panel-head { flex-direction: column; align-items: flex-start; }
  .metrics, .settings-grid, .button-row { grid-template-columns: 1fr; }
  .settings-submit { width: 100%; }
  .audit-filters { grid-template-columns: 1fr; }
  .yaml-address-row { grid-template-columns: 1fr; }
  .subscription-table-head { display: none; }
  .subscription-card { grid-template-columns: 1fr; padding: 12px 0; }
  .chain-card { grid-template-columns: 40px minmax(0, 1fr); }
  .chain-route,
  .chain-actions {
    grid-column: 2;
  }
  .chain-actions { justify-content: flex-start; }
  .chain-pagination {
    align-items: flex-start;
    flex-direction: column;
  }
  .diag-table-head { display: none; }
  .diag-table-row,
  .parse-result-grid {
    grid-template-columns: 1fr;
  }
}
