/* ==========================================================================
   SCNet2API 控制台样式
   --------------------------------------------------------------------------
   设计约束：
   - 深石板底 + 单一青绿主色，琥珀色仅用于警示，红色仅用于错误，绿色表示正常；
   - 所有颜色走自定义属性，[data-theme="light"] 只覆盖色值；
   - 不引用任何外部字体、图标、图片或框架；
   - 表格在窄屏横向滚动，设置表单在窄屏降为单列；
   - 键盘焦点始终可见。
   ========================================================================== */

/* ------------------------------ 主题变量 ------------------------------ */
:root {
  color-scheme: dark;

  --bg: #0b1117;
  --bg-glow: rgba(45, 212, 191, 0.055);
  --surface: #121b25;
  --surface-2: #16212d;
  --surface-3: #1c2937;
  --surface-raised: #182430;
  --border: #22313f;
  --border-strong: #2f4152;

  --text: #d8e2ec;
  --text-strong: #f0f6fb;
  --text-dim: #93a6b8;
  --text-faint: #6d8194;

  --accent: #2dd4bf;
  --accent-strong: #6ee9da;
  --accent-ink: #04211d;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-line: rgba(45, 212, 191, 0.4);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #f5b544;
  --warn-soft: rgba(245, 181, 68, 0.13);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.13);
  --info: #7fb3ff;
  --info-soft: rgba(127, 179, 255, 0.13);
  --exhausted: #f08c46;

  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "Consolas", "Liberation Mono", Menlo, monospace;
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
  --sidebar-w: 238px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f5f7;
  --bg-glow: rgba(15, 118, 110, 0.05);
  --surface: #ffffff;
  --surface-2: #f6f9fb;
  --surface-3: #eaf0f5;
  --surface-raised: #ffffff;
  --border: #dce5ec;
  --border-strong: #c3d2dd;

  --text: #24313c;
  --text-strong: #101b24;
  --text-dim: #546777;
  --text-faint: #7b8d9c;

  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --accent-line: rgba(15, 118, 110, 0.35);

  --ok: #047857;
  --ok-soft: rgba(4, 120, 87, 0.1);
  --warn: #a16207;
  --warn-soft: rgba(161, 98, 7, 0.1);
  --err: #b91c1c;
  --err-soft: rgba(185, 28, 28, 0.08);
  --info: #1d4ed8;
  --info-soft: rgba(29, 78, 216, 0.09);
  --exhausted: #b45309;

  --shadow: 0 1px 2px rgba(16, 27, 36, 0.07);
  --shadow-lg: 0 20px 48px rgba(16, 27, 36, 0.18);
}

/* ------------------------------ 基础 ------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(1100px 520px at 18% -8%, var(--bg-glow), transparent 65%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3, h4, p {
  margin: 0;
}

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

a:hover {
  color: var(--accent-strong);
}

button {
  font-family: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0;
  left: -9999px;
  z-index: 200;
  padding: 9px 14px;
  border-radius: 0 0 8px 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ------------------------------ 图标 ------------------------------ */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: -2px;
  pointer-events: none;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

.icon-lg {
  width: 20px;
  height: 20px;
}

/* ------------------------------ 启动与登录 ------------------------------ */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-dim);
}

.boot-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  animation: boot-pulse 1.8s ease-in-out infinite;
}

.boot-text {
  font-size: 13px;
  letter-spacing: 0.03em;
}

@keyframes boot-pulse {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

.noscript {
  position: fixed;
  inset: auto 16px 16px 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--err-soft);
  border: 1px solid var(--err);
  color: var(--err);
  text-align: center;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(412px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}

.brand-mark .icon {
  width: 19px;
  height: 19px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-strong);
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-faint);
}

.login-title {
  font-size: 20px;
  font-weight: 650;
  color: var(--text-strong);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form .btn {
  justify-content: center;
  min-height: 40px;
  font-size: 14px;
}

.login-notice {
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid transparent;
}

.login-notice.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
}

.login-foot .mono {
  color: var(--text-dim);
}

/* ------------------------------ 主框架 ------------------------------ */
.app-root {
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 30;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
  color: inherit;
  border-radius: 8px;
}

.sidebar .brand:hover {
  color: inherit;
}

.sidebar .brand-mark {
  width: 32px;
  height: 32px;
}

.sidebar .brand-name {
  font-size: 14px;
}

.nav {
  flex: 1;
  min-height: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

.nav-link .icon {
  color: currentColor;
  opacity: 0.9;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.user-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

.user-line .user-name {
  color: var(--text-dim);
  font-family: var(--mono);
}

.version-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.sidebar-foot .btn {
  justify-content: center;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 22px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

/* 不支持 color-mix 的浏览器回退到半透明基色 */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar {
    background: var(--bg);
  }
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.content {
  width: 100%;
  max-width: 1480px;
  padding: 18px 22px 36px;
  margin: 0 auto;
  flex: 1;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.screen[hidden] {
  display: none;
}

/* 空的错误槽 / 结果槽不占布局高度 */
.screen > div:empty {
  display: none;
}

.login-foot-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.login-foot-actions .btn {
  min-height: 26px;
  padding: 3px 6px;
}

.app-foot {
  padding: 14px 22px 20px;
  color: var(--text-faint);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.app-foot .mono {
  color: var(--text-dim);
}

/* ------------------------------ 页面卡片 ------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.card-head-left {
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-strong);
}

.card-title .icon {
  color: var(--accent);
}

.card-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.card-body {
  padding: 16px;
}

.card-body.tight {
  padding: 0;
}

.card-body.pad-sm {
  padding: 12px;
}

.card-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

/* ------------------------------ 布局网格 ------------------------------ */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
  gap: 12px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: start;
}

.overview-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ------------------------------ 统计卡 ------------------------------ */
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.55;
}

.stat.tone-ok::before { background: var(--ok); }
.stat.tone-warn::before { background: var(--warn); }
.stat.tone-err::before { background: var(--err); }
.stat.tone-info::before { background: var(--info); }
.stat.tone-dim::before { background: var(--border-strong); }

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.stat-label .icon {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.stat-value {
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.stat-value .unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 3px;
  letter-spacing: 0;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
}

.stat-sub .mono {
  color: var(--text-dim);
}

/* ------------------------------ 元信息横条 ------------------------------ */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  align-items: flex-start;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.meta-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.meta-value {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  overflow-wrap: anywhere;
  max-width: 46ch;
}

.meta-value.is-ellipsis {
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------ 徽标与标签 ------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-dim);
}

.badge .dot,
.dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-dim { background: var(--surface-3); color: var(--text-dim); }
.badge-mono { font-family: var(--mono); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  font-family: var(--mono);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-err { color: var(--err); }
.tone-dim { color: var(--text-dim); }
.tone-accent { color: var(--accent); }

.muted { color: var(--text-dim); }
.dim { color: var(--text-faint); }
.strong { color: var(--text-strong); }
.break { overflow-wrap: anywhere; word-break: break-word; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.xsmall { font-size: 11.5px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.06s ease;
  user-select: none;
}

.btn:hover {
  background: var(--surface-3);
  color: var(--text-strong);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--err) 45%, transparent);
  color: var(--err);
}

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

.btn-sm {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.btn-xs {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-icon {
  padding: 6px;
  min-width: 32px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.is-busy {
  opacity: 0.75;
  pointer-events: none;
}

.btn.is-busy::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: -2px;
}

/* ------------------------------ 表单 ------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
}

.field-help {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.45;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.textarea {
  min-height: 132px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 1px), calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--err);
}

.field-note {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
}

.form-error {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--err-soft);
  color: var(--err);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.form-error:empty {
  display: none;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.check-line input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-height: 30px;
}

.switch-line input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.switch-line .track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.switch-line .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch-line input:checked + .track {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.switch-line input:checked + .track::after {
  transform: translateX(16px);
  background: var(--accent);
}

.switch-line input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-text {
  font-size: 13px;
  color: var(--text);
}

.field-check .switch-text {
  font-weight: 550;
  color: var(--text-dim);
}

.field-check {
  justify-content: flex-start;
  padding-top: 2px;
}

.dialog-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
}

.dialog-form .field-wide {
  grid-column: 1 / -1;
}

.dialog-form .form-error {
  grid-column: 1 / -1;
}

.dialog-form .dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 2px;
}

/* ------------------------------ 工具栏与筛选 ------------------------------ */
.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  align-items: end;
}

.filters .field {
  gap: 4px;
}

.filters .check-line {
  min-height: 34px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.hint-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-faint);
  flex-wrap: wrap;
}

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.notice .icon {
  margin-top: 1px;
}

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

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

.notice-err {
  background: var(--err-soft);
  color: var(--err);
}

.notice strong {
  font-weight: 650;
}

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--err) 40%, transparent);
  border-radius: var(--radius-sm);
  background: var(--err-soft);
  color: var(--err);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.error-banner .error-text {
  flex: 1;
  min-width: 0;
}

.error-banner .btn {
  flex: none;
}

/* ------------------------------ 表格 ------------------------------ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 760px;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 12px;
  text-align: left;
  font-weight: 550;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

table.data tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tbody tr:hover td {
  background: var(--surface-2);
}

table.data tbody tr.is-err td {
  background: var(--err-soft);
}

table.data tbody tr.is-err:hover td {
  background: color-mix(in srgb, var(--err-soft) 60%, var(--surface-2));
}

table.data td.wrap,
table.data th.wrap {
  white-space: normal;
  min-width: 170px;
  max-width: 280px;
}

table.data .cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 268px;
}

table.data .cell-sub {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-top: 2px;
}

.table-accounts { min-width: 1400px; }
.table-logs { min-width: 1220px; }
.table-models { min-width: 780px; }
.table-tokens { min-width: 840px; }
.table-aliases { min-width: 640px; }
.table-audit { min-width: 760px; }
.table-ops { min-width: 760px; }

.empty-cell {
  padding: 26px 16px !important;
  text-align: center;
  color: var(--text-faint);
  white-space: normal !important;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

.empty .icon {
  width: 26px;
  height: 26px;
  opacity: 0.65;
}

.empty.small {
  padding: 18px 10px;
  font-size: 12px;
}

/* ------------------------------ 进度与图表 ------------------------------ */
.mini-bar {
  width: 100%;
  min-width: 66px;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.mini-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.mini-bar.tone-warn > i { background: var(--warn); }
.mini-bar.tone-err > i { background: var(--err); }
.mini-bar.tone-ok > i { background: var(--ok); }

.window-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.window-cell .window-text {
  display: flex;
  gap: 4px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
}

.window-cell .window-text b {
  font-weight: 600;
  color: var(--text);
}

.meter {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.meter.tone-warn > i { background: var(--warn); }
.meter.tone-err > i { background: var(--err); }

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

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

.chart-svg {
  display: block;
  width: 100%;
  min-width: 560px;
  height: auto;
}

.chart-svg text {
  fill: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

.chart-svg .grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-svg .axis-line {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.chart-svg .bar-ok { fill: var(--accent); }
.chart-svg .bar-err { fill: var(--err); }

.chart-svg .bar-group:hover .bar-ok { fill: var(--accent-strong); }
.chart-svg .bar-group:hover .bar-err { fill: #ff9c9c; }

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--text-faint);
  flex: none;
}

.swatch-ok { background: var(--accent); }
.swatch-err { background: var(--err); }
.swatch-active { background: var(--ok); }
.swatch-cooling { background: var(--warn); }
.swatch-probation { background: var(--info); }
.swatch-invalid { background: var(--err); }
.swatch-exhausted { background: var(--exhausted); }
.swatch-disabled { background: var(--border-strong); }

.poolbar {
  display: flex;
  height: 12px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.poolbar > span {
  display: block;
  height: 100%;
  min-width: 0;
}

.poolbar .seg-active { background: var(--ok); }
.poolbar .seg-cooling { background: var(--warn); }
.poolbar .seg-probation { background: var(--info); }
.poolbar .seg-invalid { background: var(--err); }
.poolbar .seg-exhausted { background: var(--exhausted); }
.poolbar .seg-disabled { background: var(--border-strong); }

.pool-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 12px;
}

.pool-legend .legend-item {
  justify-content: space-between;
  gap: 8px;
  color: var(--text-dim);
}

.pool-legend .legend-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.pool-legend b {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

/* ------------------------------ 键值列表 ------------------------------ */
.kv-list {
  display: flex;
  flex-direction: column;
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}

.kv:last-child {
  border-bottom: none;
}

.kv-k {
  color: var(--text-dim);
  flex: none;
}

.kv-v {
  font-family: var(--mono);
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}

.kv-v .badge {
  font-family: var(--sans);
}

/* ------------------------------ 导入区 ------------------------------ */
.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 218px;
  gap: 14px;
  align-items: start;
}

.import-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.import-side .btn {
  width: 100%;
}

.import-summary {
  margin-top: 12px;
}

.import-summary .summary-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
}

.import-summary .summary-line b {
  font-family: var(--mono);
  color: var(--text-strong);
}

.skip-list {
  margin: 8px 0 0;
  padding: 8px 10px 8px 26px;
  max-height: 180px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.skip-list li::marker {
  color: var(--warn);
}

/* ------------------------------ 折叠块 ------------------------------ */
details.collapse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

details.collapse > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 600;
  user-select: none;
}

details.collapse > summary::-webkit-details-marker {
  display: none;
}

details.collapse > summary:hover {
  background: var(--surface-2);
}

details.collapse > summary .icon.chev {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform 0.16s ease;
}

details.collapse[open] > summary .icon.chev {
  transform: rotate(180deg);
}

details.collapse > summary .summary-hint {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-faint);
}

.collapse-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.collapse-body.pad-top {
  padding-top: 14px;
}

.state-help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.state-help li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

.state-help .badge {
  flex: none;
  margin-top: 1px;
}

/* ------------------------------ Toast ------------------------------ */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--info);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
  animation: toast-in 0.18s ease-out;
}

.toast.is-ok { border-left-color: var(--ok); }
.toast.is-warn { border-left-color: var(--warn); }
.toast.is-err { border-left-color: var(--err); }
.toast.is-info { border-left-color: var(--info); }

.toast .toast-icon {
  color: var(--text-dim);
  margin-top: 1px;
}

.toast.is-ok .toast-icon { color: var(--ok); }
.toast.is-warn .toast-icon { color: var(--warn); }
.toast.is-err .toast-icon { color: var(--err); }
.toast.is-info .toast-icon { color: var(--info); }

.toast-msg {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.toast-close {
  flex: none;
  padding: 1px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text);
  background: var(--surface-3);
}

.toast.is-out {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

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

/* ------------------------------ 对话框 ------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 8, 12, 0.66);
  backdrop-filter: blur(3px);
  animation: backdrop-in 0.14s ease;
}

[data-theme="light"] .modal-backdrop {
  background: rgba(20, 35, 46, 0.42);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.16s ease;
}

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

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px 18px 0;
}

.modal-headings {
  min-width: 0;
  flex: 1;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.modal-desc {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-dim);
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.modal-close {
  flex: none;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.modal-foot .modal-foot-left {
  margin-right: auto;
}

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

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

/* ------------------------------ 结果与代码块 ------------------------------ */
.result-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.reply-box,
.codebox {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow: auto;
}

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

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

/* ------------------------------ 复制行 / 密钥 ------------------------------ */
.copyline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.copyline code {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-strong);
  white-space: nowrap;
  overflow-x: auto;
  padding: 2px 0;
}

.copyline .btn {
  flex: none;
}

.secret-panel {
  position: relative;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(45, 212, 191, 0.42);
  background: #0a1418;
  color: #d7f2ee;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.08), 0 16px 36px rgba(0, 0, 0, 0.35);
}

.secret-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.secret-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 650;
  color: #8cf3e6;
}

.secret-title .icon {
  color: #5eead4;
}

.secret-warn {
  margin: 8px 0 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #f5c76b;
  overflow-wrap: anywhere;
}

.secret-panel .copyline {
  background: #061013;
  border-color: rgba(45, 212, 191, 0.3);
}

.secret-panel .copyline code {
  color: #d7f2ee;
}

.secret-panel .copyline .btn {
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(45, 212, 191, 0.45);
  color: #9ff0e6;
}

.secret-panel .copyline .btn:hover {
  background: rgba(45, 212, 191, 0.26);
  color: #ffffff;
}

.secret-panel .tag {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: #cfe9e5;
}

.secret-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.secret-foot .dim {
  color: #7fa5a0;
  font-size: 11.5px;
}

.secret-panel .btn-ghost {
  color: #a9c9c4;
  border-color: transparent;
}

.secret-panel .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
}

/* ------------------------------ 设置页 ------------------------------ */
.settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-toolbar-left {
  min-width: 0;
}

.settings-toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-strong);
}

.settings-toolbar-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.settings-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.settings-section-head h3 {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-strong);
}

.settings-section-head .section-note {
  font-size: 11.5px;
  color: var(--text-faint);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  padding: 16px;
}

.settings-grid .field-wide {
  grid-column: 1 / -1;
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(9px);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.14);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .savebar {
    background: var(--surface);
  }
}

.savebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dirty-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}

.dirty-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

.dirty-indicator.is-dirty {
  color: var(--warn);
}

.dirty-indicator.is-dirty::before {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.env-note {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.env-note code {
  color: var(--text-dim);
}

.password-card .card-body {
  max-width: 720px;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
  align-items: start;
}

.password-form .field-wide {
  grid-column: 1 / -1;
}

.password-form .form-error {
  grid-column: 1 / -1;
}

.password-form .form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ops-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ops-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.ops-block + .ops-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ------------------------------ 关于页 ------------------------------ */
.endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--accent-line);
  background: var(--accent-soft);
}

.endpoint code {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--accent);
  overflow-x: auto;
  white-space: nowrap;
}

.snippet {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--surface-2);
}

.snippet-head .snippet-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}

.snippet pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre;
}

.api-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

.api-item code {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 7px;
}

.api-item .api-desc {
  color: var(--text-dim);
}

/* ------------------------------ 分页 ------------------------------ */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-dim);
}

.pager-info {
  font-family: var(--mono);
  color: var(--text-faint);
}

.pager-btns {
  display: flex;
  gap: 6px;
}

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1180px) {
  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .overview-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .sidebar .brand {
    padding: 0;
    flex: none;
  }

  .sidebar .brand-text {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }

  .sidebar .brand-sub {
    display: none;
  }

  .nav {
    flex: 1 1 100%;
    min-width: 0;
    order: 3;
  }

  .nav-list {
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 12.5px;
    border: 1px solid var(--border);
    background: var(--surface-2);
  }

  .nav-link.is-active {
    border-color: var(--accent-line);
  }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-top: 0;
    border-top: 0;
    margin-left: auto;
  }

  .sidebar-foot .user-line {
    display: none;
  }

  .sidebar-foot .version-line {
    display: none;
  }

  .sidebar-foot .btn {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 12px;
  }

  .topbar {
    position: static;
    padding: 11px 16px;
  }

  .content {
    padding: 14px 16px 30px;
  }

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

@media (max-width: 820px) {
  .grid-2,
  .overview-side,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .import-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .import-side .btn {
    grid-column: 1 / -1;
  }

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

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

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

  .dialog-form .field-wide {
    grid-column: auto;
  }

  .dialog-form .form-error,
  .dialog-form .dialog-actions {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  .content {
    padding: 12px 12px 26px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar-title {
    font-size: 14px;
  }

  .topbar-sub {
    display: none;
  }

  .sidebar {
    padding: 9px 12px;
  }

  .grid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat {
    padding: 11px;
  }

  .stat-label {
    font-size: 11.5px;
  }

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

  .card-head {
    padding: 12px;
  }

  .card-body {
    padding: 12px;
  }

  .card-body.tight {
    padding: 0;
  }

  .savebar {
    padding: 10px 12px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .modal-head {
    padding: 14px 14px 0;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-foot {
    padding: 11px 14px;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

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

  .filter-actions {
    grid-column: 1 / -1;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-group {
    width: 100%;
  }

  .toolbar-group .btn {
    flex: 1 1 auto;
  }

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

  .meta-row {
    gap: 10px 18px;
  }

  .app-foot {
    padding: 12px;
  }
}

@media (max-width: 400px) {
  .content {
    padding: 10px 10px 22px;
  }

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

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

  .nav-link {
    padding: 5px 8px;
    font-size: 12px;
  }

  .nav-link .icon {
    width: 14px;
    height: 14px;
  }

  .sidebar .brand-name {
    font-size: 13px;
  }

  .login-card {
    padding: 20px;
  }

  .card-head {
    gap: 8px;
  }

  .ip-actions .btn {
    width: 100%;
  }

  .pager {
    padding: 9px 10px;
  }
}

/* ------------------------------ 动效偏好 ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}