/* ============================================================
   夜梦云验证 · 基础样式（设计变量 / 组件 / 工具类）
   ============================================================ */
:root {
  --bg: #060a13;
  --bg-soft: #0a101d;
  --panel: #0d1524;
  --panel-2: #111b2e;
  --panel-3: #16223a;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e8eefc;
  --text-2: #b7c4da;
  --muted: #8193ad;
  --faint: #5c6b83;
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(79, 140, 255, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.85);
  --font: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
code, pre, kbd { font-family: var(--mono); }

::selection { background: rgba(79, 140, 255, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.18); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.3); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grow { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: 0.18s ease;
  user-select: none;
}
.btn:hover { background: rgba(148, 163, 184, 0.12); color: var(--text); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn svg { flex: none; }

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, #5b95ff, #3b74e8);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(79, 140, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(135deg, #6ba0ff, #4a80f0); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(148, 163, 184, 0.1); color: var(--text); }

.btn-danger { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.3); color: #fda4a4; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.5); color: #fecaca; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 14px; border-radius: 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.field .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 10, 19, 0.62);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: 0.16s ease;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: #4f5f77; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(79, 140, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.13);
  background: rgba(6, 10, 19, 0.85);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238193ad' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.select option { background: #0d1524; color: var(--text); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 99px; background: rgba(148, 163, 184, 0.22); position: relative; transition: 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; transition: 0.2s; }
.switch input:checked + .track { background: linear-gradient(135deg, #5b95ff, #3b74e8); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch .label { font-size: 13px; color: var(--text-2); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.badge-plain::before { display: none; }
.badge-success { color: #5eead4; background: var(--success-soft); border-color: rgba(52, 211, 153, 0.22); }
.badge-warning { color: #fcd34d; background: var(--warning-soft); border-color: rgba(251, 191, 36, 0.22); }
.badge-danger { color: #fca5a5; background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.22); }
.badge-info { color: #93c5fd; background: rgba(79, 140, 255, 0.12); border-color: rgba(79, 140, 255, 0.24); }
.badge-muted { color: #94a3b8; background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.18); }
.badge-purple { color: #c4b5fd; background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.24); }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  background: rgba(9, 14, 25, 0.95);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data tbody td { padding: 13px 14px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); color: var(--text-2); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
table.data .strong { color: var(--text); font-weight: 600; }
table.data .cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
table.data .empty-row td { padding: 44px 16px; text-align: center; color: var(--faint); }

/* ---------- 卡片 / 面板 ---------- */
.panel {
  background: linear-gradient(180deg, rgba(17, 27, 46, 0.72), rgba(10, 16, 29, 0.72));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-head h3 { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.panel-head .sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.panel-body { padding: 18px; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px 40px;
  overflow-y: auto;
  background: rgba(2, 5, 11, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in 0.16s ease;
}
.modal {
  width: 100%;
  max-width: 540px;
  background: linear-gradient(180deg, #101a2c, #0b1321);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 40px 120px -30px #000;
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-sm { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.modal-head .sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }
.modal-close { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); display: grid; place-items: center; }
.modal-close:hover { background: rgba(148, 163, 184, 0.1); color: var(--text); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(13, 21, 36, 0.96);
  box-shadow: 0 18px 50px -18px #000;
  font-size: 13px;
  color: var(--text-2);
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}
.toast.success { border-color: rgba(52, 211, 153, 0.36); }
.toast.error { border-color: rgba(248, 113, 113, 0.4); }
.toast .ico { flex: none; margin-top: 1px; }
.toast.success .ico { color: var(--success); }
.toast.error .ico { color: var(--danger); }
.toast .msg { line-height: 1.5; word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }

/* ---------- 加载 / 空状态 ---------- */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(148, 163, 184, 0.25); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--muted); font-size: 13px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 56px 20px; text-align: center; }
.empty .empty-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(79, 140, 255, 0.08); border: 1px solid rgba(79, 140, 255, 0.16); color: #7aa7ff; margin-bottom: 4px; }
.empty h4 { font-size: 14px; font-weight: 700; }
.empty p { font-size: 12.5px; color: var(--faint); max-width: 360px; line-height: 1.7; }

/* ---------- 其他 ---------- */
.divider { height: 1px; background: var(--border); }
.code-block {
  position: relative;
  background: #060b14;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.7;
  color: #b9c9e2;
  white-space: pre;
}
.code-block .cmt { color: #5f7392; }
.code-block .str { color: #7dd3fc; }
.code-block .kw { color: #c4b5fd; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(13, 21, 36, 0.9);
  color: var(--muted);
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }

.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; color: var(--text-2); background: rgba(148, 163, 184, 0.07); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pagination .pages { display: flex; align-items: center; gap: 6px; }
.pagination button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--text-2); font-size: 12px; }
.pagination button:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(148, 163, 184, 0.08); }
.pagination button.active { background: var(--accent-soft); border-color: rgba(79, 140, 255, 0.4); color: #93c5fd; }
.pagination button:disabled { opacity: 0.35; cursor: default; }

.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 34px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal-backdrop { padding: 3vh 12px 24px; }
}
