:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #f1f2fa;
  --ink: #191c2b;
  --muted: #6f7488;
  --faint: #9ba1b5;
  --line: #e8eaf3;
  --line-strong: #d9ddec;
  --primary: #6155e8;
  --primary-2: #8c7dff;
  --primary-soft: #efecff;
  --primary-ink: #4538c7;
  --accent: #ff8b6a;
  --ok: #12996a;
  --ok-soft: #e6f8ef;
  --danger: #d9443b;
  --danger-soft: #fdeceb;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(28, 32, 64, 0.06);
  --shadow-hover: 0 18px 40px rgba(60, 55, 130, 0.12), 0 2px 8px rgba(28, 32, 64, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 8% -10%, rgba(108, 92, 231, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 139, 106, 0.07), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(97, 85, 232, 0.18);
}

/* ------------------------------------------------------------- 登录 / 初始化 */

.auth {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(800px 500px at 15% 15%, rgba(108, 92, 231, 0.14), transparent 60%),
    radial-gradient(700px 500px at 85% 85%, rgba(255, 139, 106, 0.14), transparent 60%),
    #f3f4fa;
}

.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}

.auth-glow-a {
  width: 340px;
  height: 340px;
  background: rgba(108, 92, 231, 0.3);
  top: -80px;
  left: -60px;
}

.auth-glow-b {
  width: 300px;
  height: 300px;
  background: rgba(255, 139, 106, 0.24);
  bottom: -70px;
  right: -40px;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  padding: 38px 38px 30px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(40, 38, 92, 0.16);
  backdrop-filter: blur(18px);
  text-align: center;
}

.brand-logo {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-logo.large {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 10px 18px rgba(97, 85, 232, 0.28));
}

.brand-logo.small {
  width: 38px;
  height: 38px;
}

.auth-card h1 {
  margin: 18px 0 4px;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.auth-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
}

.auth-note {
  margin: 20px 0 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.7;
}

.auth-card .field {
  text-align: left;
}

.auth-card .form-error {
  margin: -4px 0 12px;
  text-align: left;
}

#auth-submit {
  margin-top: 6px;
}

/* ------------------------------------------------------------------- 表单 */

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: #4d5268;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.field .hint {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.input-wrap {
  position: relative;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #b3b8ca;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(97, 85, 232, 0.12);
}

input.mono,
textarea.mono,
code,
pre,
.snippet {
  font-family: var(--mono);
}

.input-wrap input {
  padding-right: 46px;
}

.eye-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.eye-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.eye-btn svg {
  width: 18px;
  height: 18px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(97, 85, 232, 0.28);
}

.btn.primary:hover {
  box-shadow: 0 12px 24px rgba(97, 85, 232, 0.34);
}

.btn.quiet {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #4d5268;
}

.btn.quiet:hover {
  border-color: #c9c3ff;
  background: #faf9ff;
  color: var(--primary-ink);
}

.btn.sm {
  min-height: 33px;
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
  min-height: 46px;
}

.btn.danger-text {
  color: var(--danger);
}

.btn.danger-text:hover {
  border-color: #f4b9b5;
  background: var(--danger-soft);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.text-btn:hover {
  color: var(--primary-ink);
}

/* ------------------------------------------------------------------- 布局 */

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(232, 234, 243, 0.9);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 15.5px;
  letter-spacing: -0.2px;
}

.brand-text small {
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
}

.nav button {
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.nav button:hover {
  color: var(--ink);
}

.nav button.active {
  background: var(--surface);
  color: var(--primary-ink);
  box-shadow: 0 2px 8px rgba(40, 42, 90, 0.1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11.5px;
  font-weight: 600;
}

.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(18, 153, 106, 0.14);
}

.page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 30px 26px 70px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fade-up 0.28s ease both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.7px;
}

.page-head .lead {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------- 卡片 */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card + .card {
  margin-top: 18px;
}

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

.card-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.card-head .sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--tint, rgba(97, 85, 232, 0.08));
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tint, var(--primary-soft));
  color: var(--tone, var(--primary));
}

.stat-icon svg {
  width: 17px;
  height: 17px;
}

.stat-value {
  position: relative;
  z-index: 1;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
}

.stat-value small {
  margin-left: 4px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}

.stat-hint {
  position: relative;
  z-index: 1;
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 11.5px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.split > .card {
  margin-top: 0;
}

/* ------------------------------------------------------------------- 概览 */

.snippet {
  position: relative;
  margin: 14px 0 0;
  padding: 16px 16px;
  border-radius: 14px;
  background: #1d2033;
  color: #e7e5ff;
  font-size: 11.5px;
  line-height: 1.7;
  overflow: auto;
  white-space: pre;
}

.snippet .copy-float {
  position: absolute;
  top: 10px;
  right: 10px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #dcd9ff;
}

.snippet .copy-float:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.steps {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  line-height: 1.5;
}

.steps li:last-child {
  border-bottom: 0;
}

.step-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.steps li.done .step-num {
  background: var(--ok-soft);
  color: var(--ok);
}

.steps strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
}

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

.steps a {
  font-size: 12px;
  font-weight: 600;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ------------------------------------------------------------------- 端点 */

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.endpoint-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.endpoint-card:hover {
  transform: translateY(-2px);
  border-color: #c9c3ff;
  box-shadow: var(--shadow-hover);
}

.endpoint-card.off {
  border-style: dashed;
  opacity: 0.76;
}

.ep-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ep-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.ep-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.endpoint-card.off .ep-dot {
  background: var(--faint);
  box-shadow: none;
}

.ep-title h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge.primary {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.off {
  background: #f1f2f6;
  color: var(--faint);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #dfe2ec;
  transition: background 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 22, 50, 0.22);
  transition: transform 0.18s ease;
}

.switch[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.switch[aria-pressed="true"]::after {
  transform: translateX(18px);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.copy-label {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.copy-row code {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #41465c;
  font-size: 11.5px;
}

.copy-row .icon-btn {
  width: 26px;
  height: 26px;
  border-color: transparent;
  background: transparent;
}

.copy-row .icon-btn:hover {
  background: var(--surface-3);
}

.ep-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.ep-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: #5f6479;
  font-family: var(--mono);
  font-size: 10px;
}

.chip.more {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-family: var(--font);
  font-weight: 600;
}

.ep-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ep-footer .danger-text {
  margin-left: auto;
}

/* ------------------------------------------------------------------- 凭证 */

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

.cred-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 6px;
  border-bottom: 1px dashed var(--line);
}

.cred-row:last-child {
  border-bottom: 0;
}

.cred-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
}

.cred-icon.apple {
  background: #f1f2f7;
  color: #303344;
}

.cred-icon svg {
  width: 19px;
  height: 19px;
}

.cred-main {
  min-width: 0;
  flex: 1 1 auto;
}

.cred-main strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13.5px;
}

.cred-main span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cred-main .mono {
  font-family: var(--mono);
  font-size: 11px;
}

.cred-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 38px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty strong {
  font-size: 13.5px;
}

.empty p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------- 日志 */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-3);
}

.segmented button {
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(30, 32, 70, 0.1);
}

.search {
  position: relative;
  flex: 1 1 220px;
  max-width: 300px;
  margin-left: auto;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search input {
  min-height: 36px;
  padding: 8px 12px 8px 33px;
  border-radius: 9px;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfbfe;
}

td.nowrap {
  white-space: nowrap;
}

td.time {
  color: var(--muted);
  white-space: nowrap;
}

td.tool {
  font-family: var(--mono);
  font-size: 11px;
  color: #41465c;
}

td.dim {
  color: var(--faint);
  font-size: 11.5px;
}

td.err {
  max-width: 280px;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-row {
  padding: 30px 16px;
  color: var(--faint);
  text-align: center;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------- 设置 */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-grid .card {
  margin-top: 0;
}

.settings-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: #7a5716;
  font-size: 11.5px;
  line-height: 1.65;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.info-row span {
  color: var(--muted);
}

.info-row code {
  font-size: 11px;
  color: #41465c;
}

/* ------------------------------------------------------------------- 弹窗 */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 27, 48, 0.42);
  backdrop-filter: blur(4px);
  animation: overlay-in 0.18s ease both;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(620px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(20, 22, 50, 0.3);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal.wide {
  width: min(760px, 100%);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

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

.modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.modal-body {
  padding: 18px 22px;
}

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

.modal-close {
  flex: 0 0 auto;
}

.tool-picker {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
}

.picker-head .links {
  display: flex;
  gap: 10px;
}

.picker-body {
  max-height: 280px;
  overflow: auto;
  padding: 6px 0;
}

.tool-group-title {
  padding: 9px 14px 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.tool-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.tool-option:hover {
  background: var(--surface-2);
}

.tool-option input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.tool-option span {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  color: #41465c;
  word-break: break-all;
}

.tool-option small {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-family: var(--font);
  font-size: 10.5px;
  line-height: 1.45;
}

/* ------------------------------------------------------------------- 提示 */

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(25, 27, 48, 0.16);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
  animation: toast-in 0.22s ease both;
}

.toast.ok {
  border-left: 3px solid var(--ok);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.out {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------- 响应式 */

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

  .split,
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav button {
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 22px 15px 56px;
  }

  .topbar-inner {
    padding: 10px 15px;
  }

  .brand-text small,
  .live-pill {
    display: none;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head h1 {
    font-size: 23px;
  }

  .head-actions {
    width: 100%;
  }

  .head-actions .btn {
    flex: 1;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat {
    padding: 15px;
  }

  .stat-value {
    font-size: 22px;
  }

  .endpoint-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .cred-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .cred-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .cred-main span {
    white-space: normal;
  }

  .search {
    margin-left: 0;
    max-width: none;
    width: 100%;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal {
    max-height: 92vh;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 17px;
    padding-right: 17px;
  }

  .toast-root {
    left: 15px;
    right: 15px;
    bottom: 15px;
  }

  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------- 补丁 */

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 2px;
  color: #4d5268;
  font-size: 12.5px;
  cursor: pointer;
}

.checkline input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.stack .card {
  margin-top: 0;
}

.modal-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.modal-error {
  margin: 0 22px 14px;
}

input:disabled,
textarea:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .modal-error {
    margin-left: 17px;
    margin-right: 17px;
  }
}

/* ------------------------------------------------------------------- 能力 */

.cap-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px;
}

.cap-tile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.cap-tile:hover {
  transform: translateY(-1px);
  border-color: #c9c3ff;
  background: #faf9ff;
}

.cap-tile-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--tint, var(--primary-soft));
  color: var(--tone, var(--primary));
}

.cap-tile-icon svg {
  width: 18px;
  height: 18px;
}

.cap-tile-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.cap-tile-body strong {
  font-size: 12.5px;
  letter-spacing: -0.1px;
}

.cap-tile-body small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cap-toolbar-card {
  padding: 14px 16px;
  margin-bottom: 16px;
}

.cap-toolbar-card .toolbar {
  margin-bottom: 0;
}

.cap-filter-count {
  margin-left: 3px;
  color: var(--faint);
  font-size: 10px;
}

.segmented button.active .cap-filter-count {
  color: var(--primary);
}

.cap-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cap-groups .card + .card {
  margin-top: 0;
}

.cap-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.cap-group-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--tint, var(--primary-soft));
  color: var(--tone, var(--primary));
}

.cap-group-icon svg {
  width: 19px;
  height: 19px;
}

.cap-group-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.cap-group-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.cap-group-head .badge {
  flex: 0 0 auto;
  margin-left: auto;
}

.cap-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: 1px dashed var(--line);
}

.cap-row:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.cap-main {
  min-width: 0;
  flex: 1 1 auto;
}

.cap-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.cap-name-line code {
  color: #31364c;
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
}

.cap-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.cap-endpoint {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.cap-endpoint.warn {
  color: var(--warn);
}

.cap-endpoint.none {
  color: var(--danger);
}

.cap-row .icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
}

.badge.read {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.write {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.generic {
  background: #e9f4ff;
  color: #2f7fd4;
}

@media (max-width: 720px) {
  .cap-overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cap-tile-body small {
    white-space: normal;
  }

  .cap-toolbar-card .segmented {
    max-width: 100%;
    overflow-x: auto;
  }

  .cap-toolbar-card .segmented button {
    flex: 0 0 auto;
  }

  .cap-group-head .badge {
    display: none;
  }
}

/* ------------------------------------------------------------------- 主机 */

.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.host-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.host-card:hover {
  transform: translateY(-2px);
  border-color: #b9e6d1;
  box-shadow: var(--shadow-hover);
}

.host-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.host-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.host-title h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.host-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.host-dot.fail {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.host-dot.off {
  background: var(--faint);
  box-shadow: none;
}

.badge.fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.host-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.host-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.host-error {
  display: -webkit-box;
  margin: -2px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.host-actions .danger-text {
  margin-left: auto;
}

.quick-cmds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 5px;
}

.terminal-output {
  min-height: 110px;
  max-height: 300px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 12px;
  background: #1d2033;
  color: #e7e5ff;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-text code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #41465c;
}

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

  .host-actions .danger-text {
    margin-left: 0;
  }

  .terminal-output {
    max-height: 240px;
  }

  .xhs-search-row {
    flex-direction: column;
  }

  .xhs-feed {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------------------------------------------- 触达 */

.notify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.notify-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.notify-card:hover {
  transform: translateY(-2px);
  border-color: #f0dcae;
  box-shadow: var(--shadow-hover);
}

.notify-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.notify-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.notify-title h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ------------------------------------------------------------------ 小红书 */
.xhs-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 4px 0 10px;
}

.xhs-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2, #f7f8fa);
}

.xhs-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.xhs-stat strong {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.xhs-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.xhs-pill.ok {
  background: #e6f8ef;
  color: #12996a;
}

.xhs-pill.off {
  background: #f1f2f4;
  color: #7b8494;
}

.xhs-search-row {
  display: flex;
  gap: 10px;
  margin: 4px 0 14px;
}

.xhs-search-row input {
  flex: 1;
}

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

.xhs-feed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.xhs-feed strong {
  font-size: 14px;
}

.xhs-feed p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.xhs-feed-id {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.xhs-qr {
  display: flex;
  justify-content: center;
  padding: 12px 0;
  min-height: 220px;
}

.xhs-qr img {
  width: 260px;
  height: 260px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.xhs-qr-tip {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.xhs-login-ok {
  color: #12996a;
  font-weight: 600;
  font-size: 15px;
}
