/* ==========================================================================
   sms-gateway 管理控制台
   原生 CSS：零框架 / 零 CDN / 零构建
   结构：变量 → 基础 → 布局 → 组件 → 页面 → 响应式 → 动效
   ========================================================================== */

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

  --bg: #070b10;
  --bg-2: #0a0f16;
  --surface: #0e141c;
  --surface-2: #121a24;
  --surface-3: #18222e;
  --surface-hi: #1d2937;
  --border: #1e2937;
  --border-soft: #16202b;
  --border-strong: #2b3a4d;

  --text: #e7eef7;
  --text-dim: #9fb0c3;
  --text-mute: #6c7d90;

  --accent: #2dd4bf;
  --accent-2: #22b8a6;
  --accent-ink: #032621;
  --accent-soft: rgba(45, 212, 191, .13);
  --accent-line: rgba(45, 212, 191, .38);
  --violet: #8b5cf6;

  --st-pending: #94a3b8;
  --st-waiting_sms: #3b82f6;
  --st-sms_received: #06b6d4;
  --st-completed: #22c55e;
  --st-canceled: #64748b;
  --st-expired: #f59e0b;

  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 26px rgba(0, 0, 0, .38);
  --shadow-2: 0 28px 70px rgba(0, 0, 0, .58);

  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;

  --topbar-h: 64px;
  --side-w: 248px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

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

* { margin: 0; padding: 0; }

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

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(45, 212, 191, .07), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(99, 102, 241, .08), transparent 62%),
    linear-gradient(180deg, #070b10 0%, #070b10 55%, #06090d 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

::selection { background: var(--accent-soft); color: var(--text); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7ff3e5; }

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

button { cursor: pointer; background: none; border: 0; }

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

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

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 80;
  padding: 8px 14px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 0; color: var(--accent-ink); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ------------------------------------------------------------------ 图标 */
.ic {
  width: 16px; height: 16px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -2px;
}

/* ------------------------------------------------------------------ 按钮 */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .12s var(--ease), box-shadow .16s var(--ease);
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #36e0cb, var(--accent-2));
  border-color: #3ee6d2;
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(45, 212, 191, .22), 0 1px 0 rgba(255, 255, 255, .35) inset;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #4df0da, #2bc9b5);
  border-color: #5cf2de;
  color: var(--accent-ink);
}
.btn-primary:disabled { box-shadow: none; }

.btn-soft {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #8ff6e8;
}
.btn-soft:hover { background: rgba(45, 212, 191, .2); border-color: var(--accent); color: #b9fff6; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); color: var(--text); }

.btn-danger {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .38);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(239, 68, 68, .22); border-color: rgba(239, 68, 68, .6); color: #fecaca; }

.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }

.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: "";
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.btn-primary.loading::after { border-color: rgba(3, 38, 33, .35); border-top-color: #032621; }

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

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

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ 表单 */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.field-hint { color: var(--text-mute); font-size: 11.5px; line-height: 1.45; }
.field-err { color: #fca5a5; font-size: 11.5px; }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  background: #0a1017;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.input::placeholder,
.textarea::placeholder { color: #4f6073; }
.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);
  background: #0b131b;
}
.input:disabled,
.select:disabled,
.textarea:disabled { opacity: .55; cursor: not-allowed; }
.input.invalid,
.textarea.invalid { border-color: rgba(239, 68, 68, .65); box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }

.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) 14px, calc(100% - 11px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select option { background: #0e141c; color: var(--text); }

.textarea {
  min-height: 150px;
  padding: 9px 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}

.json-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.json-toolbar .json-status {
  margin-left: auto;
  color: var(--text-mute);
  font-size: 11.5px;
  font-family: var(--mono);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.json-status.ok { color: #9df0b4; }
.json-status.bad { color: #fca5a5; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input {
  appearance: none;
  width: 34px; height: 19px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background .18s var(--ease), border-color .18s var(--ease);
  flex: 0 0 auto;
}
.checkbox input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.checkbox input:checked { background: var(--accent-soft); border-color: var(--accent); }
.checkbox input:checked::after { transform: translateX(15px); background: var(--accent); }
.checkbox span { font-size: 12.5px; color: var(--text-dim); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.switch-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.switch-mini:hover { border-color: var(--border-strong); color: var(--text); }
.switch-mini .dot { width: 7px; height: 7px; }
.switch-mini.on { color: #a7f3d0; border-color: rgba(34, 197, 94, .38); }

/* ------------------------------------------------------------------ 通用布局件 */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.page { display: flex; flex-direction: column; gap: 18px; padding-bottom: 40px; }

/* ------------------------------------------------------------------ 卡片 */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 40%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-sub { margin-top: 3px; color: var(--text-mute); font-size: 12px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 4px 18px 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-mute);
  font-size: 12px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ 登录页 */
.login-view {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(760px 420px at 50% -10%, rgba(45, 212, 191, .16), transparent 62%),
    radial-gradient(620px 420px at 88% 108%, rgba(99, 102, 241, .14), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 72px);
  mask-image: linear-gradient(180deg, #000 30%, rgba(0, 0, 0, .35) 100%);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  width: min(408px, 100%);
  padding: 28px 26px 22px;
  background:
    radial-gradient(320px 160px at 20% 0%, rgba(45, 212, 191, .09), transparent 70%),
    linear-gradient(180deg, #111a24, #0b1118);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  animation: rise .5s var(--ease) both;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand-text { min-width: 0; }
.login-title { font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.login-sub { color: var(--text-mute); font-size: 12px; letter-spacing: .04em; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(45, 212, 191, .22), rgba(99, 102, 241, .16));
  border: 1px solid rgba(45, 212, 191, .3);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  color: var(--accent);
  flex: 0 0 auto;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error {
  padding: 9px 11px;
  border: 1px solid rgba(239, 68, 68, .38);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, .1);
  color: #fecaca;
  font-size: 12.5px;
  line-height: 1.45;
}
.login-alt {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.login-alt summary {
  cursor: pointer;
  color: var(--text-mute);
  font-size: 12px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.login-alt summary::-webkit-details-marker { display: none; }
.login-alt summary::before {
  content: "+";
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
}
.login-alt[open] summary::before { content: "−"; }
.login-alt-body { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.login-alt-body .btn { margin-top: 2px; }
.login-hint { color: var(--text-mute); font-size: 11.5px; }
.login-foot {
  margin-top: 18px;
  color: #526273;
  font-size: 11px;
  text-align: center;
  letter-spacing: .01em;
}
.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 90;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #1b1010;
  border: 1px solid rgba(239, 68, 68, .4);
  color: #fecaca;
  font-size: 13px;
}

/* ------------------------------------------------------------------ 应用骨架 */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #0b1118, #080d13 70%);
  border-right: 1px solid var(--border);
  z-index: 20;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  flex: 0 0 auto;
}
.side-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.side-brand .brand-name { font-size: 14px; font-weight: 700; letter-spacing: .02em; line-height: 1.15; }
.side-brand .brand-tag { display: block; color: var(--text-mute); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }

.nav {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 520;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--text); }
.nav-item .nav-ic { color: var(--text-mute); display: inline-flex; transition: color .15s var(--ease); }
.nav-item:hover .nav-ic { color: var(--accent); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, .14), rgba(45, 212, 191, .035) 70%, transparent);
  color: #d9fff9;
}
.nav-item.active .nav-ic { color: var(--accent); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(45, 212, 191, .65);
}
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-foot {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-badge { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-dim); }
.side-foot-text { color: var(--text-mute); font-size: 10.5px; letter-spacing: .04em; }

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

.topbar {
  flex: 0 0 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 22, .82);
  backdrop-filter: blur(14px);
  z-index: 15;
}
.topbar-left { min-width: 0; }
.page-title { font-size: 16px; font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
.page-sub {
  color: var(--text-mute);
  font-size: 11.5px;
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11.5px;
  white-space: nowrap;
}
.pill.bad { color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.pill.bad .dot { background: var(--danger); box-shadow: 0 0 8px rgba(239, 68, 68, .7); }
.clock { color: var(--text-mute); font-size: 12px; letter-spacing: .02em; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 11px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  min-width: 0;
}
.avatar {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--accent), #3b82f6);
  color: #04120f;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px;
  scrollbar-width: thin;
  scrollbar-color: #263241 transparent;
}

/* ------------------------------------------------------------------ 状态点 / 徽标 */
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  display: inline-block;
  flex: 0 0 auto;
}
.dot-live { background: var(--ok); box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: live 2.4s ease-out infinite; }
.dot-pending { background: var(--st-pending); }
.dot-waiting_sms { background: var(--st-waiting_sms); }
.dot-sms_received { background: var(--st-sms_received); }
.dot-completed { background: var(--st-completed); }
.dot-canceled { background: var(--st-canceled); }
.dot-expired { background: var(--st-expired); }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--danger); }

@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .03);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.badge .dot { width: 6px; height: 6px; }

.badge.s-pending { color: #d6dee8; border-color: rgba(148, 163, 184, .34); background: rgba(148, 163, 184, .1); }
.badge.s-waiting_sms { color: #bcd4ff; border-color: rgba(59, 130, 246, .4); background: rgba(59, 130, 246, .13); }
.badge.s-sms_received { color: #a5f3fc; border-color: rgba(6, 182, 212, .45); background: rgba(6, 182, 212, .14); }
.badge.s-completed { color: #b7f7c9; border-color: rgba(34, 197, 94, .42); background: rgba(34, 197, 94, .13); }
.badge.s-canceled { color: #cbd5e1; border-color: rgba(100, 116, 139, .4); background: rgba(100, 116, 139, .14); }
.badge.s-expired { color: #fde1b0; border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .13); }

.badge.role-admin { color: #ddd0ff; border-color: rgba(139, 92, 246, .45); background: rgba(139, 92, 246, .14); }
.badge.role-user { color: var(--text-dim); }
.badge.role-active { color: #b7f7c9; border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .12); }
.badge.role-bad { color: #fecaca; border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .12); }
.badge.kind-charge { color: #fecaca; border-color: rgba(239, 68, 68, .32); background: rgba(239, 68, 68, .1); }
.badge.kind-refund { color: #b7f7c9; border-color: rgba(34, 197, 94, .32); background: rgba(34, 197, 94, .1); }
.badge.kind-recharge { color: #bcd4ff; border-color: rgba(59, 130, 246, .35); background: rgba(59, 130, 246, .1); }
.badge.kind-adjust { color: #fde1b0; border-color: rgba(245, 158, 11, .32); background: rgba(245, 158, 11, .1); }

/* ------------------------------------------------------------------ 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 15px 16px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 55%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat::after {
  content: "";
  position: absolute;
  right: -38px; top: -38px;
  width: 108px; height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(45, 212, 191, .13)), transparent 68%);
  pointer-events: none;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.stat-ic {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--accent);
}
.stat-value {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value small { font-size: 12px; font-weight: 600; color: var(--text-mute); margin-left: 4px; }
.stat-sub { margin-top: 6px; color: var(--text-mute); font-size: 11.5px; }
.stat.is-ok .stat-value { color: #9df0b4; }
.stat.is-warn .stat-value { color: #fcd38d; }
.stat.is-bad .stat-value { color: #fca5a5; }

/* ------------------------------------------------------------------ 分布图（纯 CSS） */
.split-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .95fr); gap: 18px; align-items: start; }

.bars { display: flex; flex-direction: column; gap: 13px; padding: 4px 0 2px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.bar-val { font-family: var(--mono); font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.bar-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #0a1017;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 1px auto 1px 1px;
  min-width: 2px;
  border-radius: 999px;
  background: var(--bar-color, var(--accent));
  box-shadow: 0 0 12px -2px var(--bar-color, var(--accent));
  transition: width .5s var(--ease);
}
.bar-fill.f-pending { --bar-color: var(--st-pending); }
.bar-fill.f-waiting_sms { --bar-color: var(--st-waiting_sms); }
.bar-fill.f-sms_received { --bar-color: var(--st-sms_received); }
.bar-fill.f-completed { --bar-color: var(--st-completed); }
.bar-fill.f-canceled { --bar-color: var(--st-canceled); }
.bar-fill.f-expired { --bar-color: var(--st-expired); }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut {
  position: relative;
  width: 172px; height: 172px;
  border-radius: 50%;
  background: conic-gradient(#1c2734 0% 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px var(--border) inset, 0 18px 40px rgba(0, 0, 0, .38);
}
.donut::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .05);
  pointer-events: none;
}
.donut-hole {
  position: relative;
  z-index: 1;
  width: 112px; height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #111a24, var(--surface) 72%);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.donut-total { font-family: var(--mono); font-size: 25px; font-weight: 600; line-height: 1.1; }
.donut-cap { color: var(--text-mute); font-size: 10.5px; letter-spacing: .08em; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; width: 100%; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-dim); }
.legend-item b { margin-left: auto; font-family: var(--mono); color: var(--text); font-weight: 500; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }

/* ------------------------------------------------------------------ 表格 */
.table-wrap {
  width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  border-top: 1px solid var(--border-soft);
}
.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  min-width: 720px;
}
.data thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  background: #101821;
  border-bottom: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.data thead th.col-right { text-align: right; }
.data tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
  vertical-align: middle;
}
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover td { background: rgba(255, 255, 255, .022); }
.data td.col-right { text-align: right; }
.data td .t-main { color: var(--text); font-weight: 600; }
.data td .t-sub { display: block; color: var(--text-mute); font-size: 11px; margin-top: 2px; }
.data .cell-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.data .cell-phone { font-family: var(--mono); color: #d8f3ff; letter-spacing: .02em; white-space: nowrap; }
.data .cell-code-hit {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: #a5f3fc;
  text-shadow: 0 0 14px rgba(6, 182, 212, .35);
}
.data .cell-money { font-family: var(--mono); color: #dbe7f3; white-space: nowrap; text-align: right; }
.data .cell-money.neg { color: #fca5a5; }
.data .cell-money.pos { color: #9df0b4; }
.data .cell-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.data .cell-id { font-family: var(--mono); font-size: 12px; color: var(--text); font-weight: 600; white-space: nowrap; }
.data .row-actions { display: flex; align-items: center; gap: 5px; justify-content: flex-end; flex-wrap: nowrap; }

.linkish {
  color: #bfe9ff;
  cursor: pointer;
  border-bottom: 1px dashed rgba(191, 233, 255, .28);
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.linkish:hover { color: #fff; border-color: rgba(255, 255, 255, .5); }
.copy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}
.copy-chip:hover { color: var(--accent); }

/* ------------------------------------------------------------------ 工具栏 / 分页 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
}
.toolbar-left,
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 124px; height: 32px; min-height: 32px; padding-top: 0; padding-bottom: 0; }
.toolbar .input { width: auto; height: 32px; min-height: 32px; }

.search {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search .search-ic {
  position: absolute;
  left: 9px;
  color: var(--text-mute);
  pointer-events: none;
  display: inline-flex;
}
.search input {
  width: 220px;
  height: 32px;
  min-height: 32px;
  padding-left: 30px;
  background: #0a1017;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), width .2s var(--ease);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  width: 260px;
}
.search input::placeholder { color: #4f6073; }

.auto-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(45, 212, 191, .08);
  border: 1px solid rgba(45, 212, 191, .22);
  color: #9cefe4;
  font-size: 11px;
  white-space: nowrap;
}
.auto-pill.paused { color: var(--text-mute); border-color: var(--border); background: transparent; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.pager-info { color: var(--text-mute); font-size: 11.5px; }
.pager-info b { color: var(--text-dim); font-family: var(--mono); font-weight: 500; }
.pager-btns { display: flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------ Toast */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-mute);
  background: rgba(16, 23, 32, .96);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px);
  animation: toastIn .26s var(--ease) both;
  cursor: pointer;
}
.toast.out { animation: toastOut .2s var(--ease) both; }
.toast-ic { display: inline-flex; margin-top: 1px; color: var(--text-dim); }
.toast-msg { min-width: 0; overflow-wrap: anywhere; }
.toast.t-ok { border-left-color: var(--ok); }
.toast.t-ok .toast-ic { color: var(--ok); }
.toast.t-error { border-left-color: var(--danger); }
.toast.t-error .toast-ic { color: var(--danger); }
.toast.t-warn { border-left-color: var(--warn); }
.toast.t-warn .toast-ic { color: var(--warn); }
.toast.t-info { border-left-color: var(--accent); }
.toast.t-info .toast-ic { color: var(--accent); }

@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ------------------------------------------------------------------ 弹窗 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(3, 6, 10, .68);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s var(--ease);
  overflow-y: auto;
}
.overlay.in { opacity: 1; }
.modal {
  width: min(560px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(420px 200px at 12% 0%, rgba(45, 212, 191, .07), transparent 70%),
    linear-gradient(180deg, #111a24, #0b1118);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  transform: translateY(10px) scale(.985);
  opacity: .6;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.overlay.in .modal { transform: none; opacity: 1; }
.modal.wide { width: min(760px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 15px; font-weight: 680; letter-spacing: .01em; }
.modal-sub { margin-top: 3px; color: var(--text-mute); font-size: 12px; line-height: 1.45; }
.modal-x { flex: 0 0 auto; color: var(--text-mute); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}
.modal-foot {
  padding: 13px 20px 17px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.confirm-msg { color: var(--text); font-size: 13.5px; line-height: 1.55; }
.confirm-detail {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: #0a1017;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

/* 详情表格 */
.kv-grid {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 9px 14px;
  align-items: start;
}
.kv-k { color: var(--text-mute); font-size: 11.5px; letter-spacing: .03em; padding-top: 3px; }
.kv-v { color: var(--text); font-size: 12.5px; min-width: 0; overflow-wrap: anywhere; }
.kv-v.mono { font-family: var(--mono); }
.kv-v .copy-inline {
  margin-left: 6px;
  color: var(--text-mute);
  display: inline-flex;
  vertical-align: -3px;
}
.kv-v .copy-inline:hover { color: var(--accent); }
.kv-empty { color: var(--text-mute); }

.json-view {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #080e14;
  border: 1px solid var(--border);
  color: #cfe3f5;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}

/* ------------------------------------------------------------------ 接码测试台 */
.tb-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tb-form { display: flex; flex-direction: column; gap: 14px; }
.tb-hint {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(45, 212, 191, .06);
  border: 1px solid rgba(45, 212, 191, .2);
  color: #9cefe4;
  font-size: 11.5px;
  line-height: 1.5;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.tb-live { display: flex; flex-direction: column; gap: 16px; }
.steps { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.step {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-mute);
  font-size: 11.5px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.step-dot {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: #0b1219;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-mute);
  transition: all .2s var(--ease);
}
.step.done .step-dot { border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .14); color: #b7f7c9; }
.step.done { color: #b7f7c9; }
.step.active .step-dot { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 212, 191, .1); }
.step.active { color: var(--text); font-weight: 600; }
.step-sep {
  width: 26px; height: 1px;
  background: var(--border);
  margin: 0 8px;
  flex: 0 0 auto;
}

.channel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.channel-box {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 60%),
    #0a1017;
  border: 1px solid var(--border);
  min-width: 0;
}
.channel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-mute);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.channel-value {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #d8f3ff;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.channel-value.dim { color: #46586b; font-weight: 500; font-size: 16px; }
.channel-value.code { color: #8beaf5; }
.channel-value.code.hit {
  color: #eafffe;
  text-shadow: 0 0 18px rgba(6, 182, 212, .55), 0 0 44px rgba(6, 182, 212, .25);
  animation: codeFlash .9s var(--ease) 2;
}
.code-hint { margin-top: 8px; color: #5de6d4; font-size: 11.5px; display: flex; align-items: center; gap: 5px; }
.channel-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

.tb-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-mute); font-size: 11.5px; }
.countdown { font-family: var(--mono); color: var(--text-dim); }
.countdown.low { color: #fcd38d; }
.countdown.over { color: #fca5a5; }

.log {
  height: 210px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #070d13;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-line { display: flex; gap: 8px; color: var(--text-dim); }
.log-time { color: #46586b; flex: 0 0 auto; }
.log-tag { flex: 0 0 auto; color: var(--accent); }
.log-line.bad .log-tag { color: var(--danger); }
.log-line.bad { color: #fca5a5; }
.log-line.ok .log-tag { color: var(--ok); }
.log-empty { color: #46586b; }
.log-msg { min-width: 0; overflow-wrap: anywhere; }

@keyframes codeFlash {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ------------------------------------------------------------------ 设置页 */
.settings-rows { display: flex; flex-direction: column; gap: 10px; }
.setting-row {
  display: grid;
  grid-template-columns: minmax(160px, 280px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .014);
  transition: border-color .16s var(--ease);
}
.setting-row:hover { border-color: var(--border); }
.setting-key { font-family: var(--mono); font-size: 12px; }
.setting-val { font-family: var(--mono); font-size: 12px; }
.setting-del { color: var(--text-mute); }
.setting-del:hover { color: var(--danger); }
.settings-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, .07);
  border: 1px solid rgba(59, 130, 246, .22);
  color: #bfdbfe;
  font-size: 11.5px;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ 空态 / 骨架 / 错误 */
.empty {
  padding: 46px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-mute);
}
.empty-ic {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  color: #46586b;
  margin-bottom: 2px;
}
.empty-title { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.empty-sub { font-size: 12px; max-width: 420px; line-height: 1.5; }

.sk {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #101923 25%, #16222f 37%, #101923 63%);
  background-size: 400% 100%;
  animation: shimmer 1.35s ease-in-out infinite;
}
.sk-line { height: 11px; }
.sk-block { height: 100%; border-radius: 10px; }
.sk-card { height: 96px; border-radius: var(--radius); border: 1px solid var(--border-soft); }
.sk-row { height: 34px; margin: 8px 12px; }

@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.err-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, .32);
  background: rgba(239, 68, 68, .07);
  color: #fecaca;
}
.err-ic { color: var(--danger); display: inline-flex; margin-top: 2px; }
.err-title { font-size: 13px; font-weight: 650; }
.err-msg { margin-top: 3px; font-size: 12px; color: #f3b7b7; overflow-wrap: anywhere; }
.err-code { margin-top: 6px; font-family: var(--mono); font-size: 11px; color: #b98c8c; }
.err-box .btn { margin-top: 10px; }

/* ------------------------------------------------------------------ 卡密池 */
.modal.xwide { width: min(1000px, 100%); }

.stat-grid.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-grid.stat-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .stat-grid.stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .stat-grid, .stat-grid.stat-grid-3, .stat-grid.stat-grid-4, .stat-grid.stat-grid-2 { grid-template-columns: 1fr; } }
.stat.is-bad { border-color: rgba(239, 68, 68, .4); }
.stat.is-bad .stat-sub { color: #e7a1a1; }

/* 状态色标 */
.dot-unused { background: var(--ok); }
.dot-used { background: var(--st-waiting_sms); }
.dot-invalid { background: var(--danger); }
.dot-reserved { background: var(--warn); }

.badge.cs-unused { color: #b7f7c9; border-color: rgba(34, 197, 94, .42); background: rgba(34, 197, 94, .13); }
.badge.cs-used { color: #bcd4ff; border-color: rgba(59, 130, 246, .4); background: rgba(59, 130, 246, .13); }
.badge.cs-invalid { color: #fecaca; border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .12); }
.badge.cs-reserved { color: #fde1b0; border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .13); }

/* 批量导入 */
.cards-import {
  padding: 13px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 60%), #0b1118;
}
.cards-import-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 11px; }
.cards-import-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}
.cards-import-title .ic { color: var(--accent); }
.cards-import-sub { color: var(--text-mute); font-size: 11.5px; line-height: 1.45; }
.cards-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
  align-items: start;
}
.cards-import-side { display: flex; flex-direction: column; gap: 9px; }
.cards-import .textarea { min-height: 88px; }
.cards-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #080e14;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}
.cards-note.ok { border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .08); color: #b7f7c9; }
.cards-note.bad { border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .08); color: #fecaca; }

/* 过滤 chips */
.chip-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, .04); }
.chip.on {
  color: #b9fff6;
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.chip-n {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
}
.chip.on .chip-n { color: inherit; }

/* 列表 */
.cards-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b1118;
  overflow: hidden;
}
.cards-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
}
.cards-list-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cards-list-meta { color: var(--text-mute); font-size: 11px; }
.cards-table { max-height: 336px; }
.cards-table .data { min-width: 760px; }
.cards-table .data tbody td { padding: 9px 12px; }
.cell-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cell-actions .t-sub { text-align: right; }
.btn-ghost.danger:hover {
  color: #fecaca;
  border-color: rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .12);
}
.cards-foot { width: 100%; }
.cards-foot-hint {
  color: var(--text-mute);
  font-size: 11.5px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ 动效 */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.page > * { animation: rise .32s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .04s; }
.page > *:nth-child(3) { animation-delay: .08s; }
.page > *:nth-child(4) { animation-delay: .1s; }
.page > *:nth-child(5) { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}

/* ------------------------------------------------------------------ 响应式 ≤ 900px */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100svh;
    width: 100%;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    width: 100%;
    min-width: 0;
  }
  .main { width: 100%; min-width: 0; }
  .side-brand {
    height: 52px;
    padding: 0 16px;
    border-bottom: 0;
  }
  .side-brand .brand-mark { width: 30px; height: 30px; }
  .nav {
    flex: 0 0 auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    min-width: 0;
    padding: 0 10px 9px;
    gap: 4px;
    mask-image: linear-gradient(90deg, #000 94%, transparent);
  }
  .nav-item {
    padding: 7px 11px;
    font-size: 12.5px;
    gap: 7px;
  }
  .nav-item.active::before {
    left: 8px; right: 8px; top: auto; bottom: 0;
    width: auto; height: 2px;
    border-radius: 2px;
  }
  .nav-ic .ic { width: 15px; height: 15px; }
  .side-foot { display: none; }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 10px 16px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .page-sub { display: none; }
  .clock, .pill { display: none; }
  .content { padding: 16px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-2 { grid-template-columns: minmax(0, 1fr); }
  .tb-grid { grid-template-columns: minmax(0, 1fr); }
  .channel { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .setting-row { grid-template-columns: minmax(0, 1fr) auto; }
  .setting-row .setting-val { grid-column: 1 / -1; grid-row: 2; }
  .setting-row .setting-del { grid-row: 1; grid-column: 2; }
  .data { min-width: 640px; }
  .cards-import-grid { grid-template-columns: minmax(0, 1fr); }
  .cards-import-side { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
  .cards-import-side .field { flex: 1 1 160px; }
  .cards-import-side .btn { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 23px; }
  .search input { width: 100%; }
  .toolbar { padding: 11px 12px; }
  .toolbar .select { min-width: 104px; }
  .card-head { padding: 14px 14px 10px; }
  .card-body { padding: 4px 14px 14px; }
  .pager { padding: 10px 12px; }
  .legend { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px 18px; }
  .user-chip { padding-right: 4px; }
  .user-name { display: none; }
  .modal-head { padding: 15px 16px 11px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px 15px; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; }
  .stat-grid.stat-grid-3 { gap: 8px; }
  .stat-grid.stat-grid-3 .stat { padding: 11px 11px 10px; }
  .stat-grid.stat-grid-3 .stat-ic { display: none; }
  .stat-grid.stat-grid-3 .stat-value { font-size: 20px; }
  .cards-table .data { min-width: 700px; }
}

/* ---------- 自动补货面板 ---------- */
.procure-panel {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(56, 189, 248, .04);
}
.procure-form .form-grid { gap: 10px; }
.procure-line {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.procure-line.is-ok { color: #7ee8b0; }
.procure-line.is-warn { color: #f5c76b; }
.procure-line.is-wait { color: #8fc7ff; }
.procure-line.is-bad { color: #fca5a5; }
.procure-panel .checkbox { font-size: 12.5px; }
.procure-head { align-items: flex-start; }
.procure-head-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.procure-status { margin: 2px 0 10px; }
.procure-status .procure-line { font-size: 12px; }
/* ---------- 自动补货：邮件通知子区块 ---------- */
.procure-mail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, .18);
}
.procure-mail .form-grid { gap: 10px; }
.procure-mail .checkbox { font-size: 12.5px; }
.procure-mail .field-hint { font-size: 11px; }