/* NapCat 控制台 · 全局设计系统
   深色科技风，零依赖，纯 CSS 变量驱动。 */

:root {
  --bg: #080b12;
  --bg-2: #0b1020;
  --panel: rgba(255, 255, 255, 0.032);
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.32);
  --text: #e6edf8;
  --text-2: #b6c3d8;
  --muted: #8194ad;
  --brand: #38bdf8;
  --brand-2: #6366f1;
  --brand-3: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --violet: #a78bfa;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --grad: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  --grad-soft: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.16));
  --shadow: 0 18px 50px -22px rgba(2, 6, 23, 0.9);
  --shadow-lg: 0 30px 80px -30px rgba(2, 6, 23, 0.95);
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 12% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(800px 480px at 92% 0%, rgba(99, 102, 241, 0.2), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(34, 211, 238, 0.1), transparent 65%),
    linear-gradient(180deg, #080b12 0%, #070a11 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.16s ease;
}

a:hover {
  color: var(--brand-3);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.28;
}

p {
  margin: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(56, 189, 248, 0.28);
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.32) transparent;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.26);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
  background-clip: padding-box;
}

/* ---------------- 布局原子类 ---------------- */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

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

.wrap-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

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

.small {
  font-size: 12px;
}

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

.center {
  text-align: center;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.014)),
    rgba(11, 16, 30, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 20px;
}

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

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

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 650;
}

.card-title svg {
  width: 17px;
  height: 17px;
  color: var(--brand);
}

.card-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.card-hover {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.34);
  box-shadow: var(--shadow-lg);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease,
    color 0.16s ease, opacity 0.16s ease;
}

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

.btn:hover {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(148, 163, 184, 0.5);
}

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

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

.btn-primary {
  border-color: transparent;
  background: var(--grad);
  color: #06111d;
  font-weight: 650;
  box-shadow: 0 12px 30px -14px rgba(56, 189, 248, 0.9);
}

.btn-primary:hover {
  background: var(--grad);
  filter: brightness(1.08);
  color: #06111d;
}

.btn-ok {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

.btn-ok:hover {
  background: rgba(52, 211, 153, 0.22);
}

.btn-warn {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.13);
  color: #fcd34d;
}

.btn-warn:hover {
  background: rgba(251, 191, 36, 0.22);
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.13);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.22);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: var(--radius-xs);
}

.btn-sm svg {
  width: 13px;
  height: 13px;
}

.btn-xs {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-xs);
}

/* ---------------- 徽标 ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-ok {
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(52, 211, 153, 0.13);
  color: #6ee7b7;
}

.badge-warn {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.13);
  color: #fcd34d;
}

.badge-danger {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(248, 113, 113, 0.13);
  color: #fca5a5;
}

.badge-brand {
  border-color: rgba(56, 189, 248, 0.34);
  background: rgba(56, 189, 248, 0.13);
  color: #7dd3fc;
}

.badge-violet {
  border-color: rgba(167, 139, 250, 0.34);
  background: rgba(167, 139, 250, 0.13);
  color: #c4b5fd;
}

.badge-muted {
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.dot-ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.dot-warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
}

.dot-danger {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16);
}

.dot-brand {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > label,
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #5f7189;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(56, 189, 248, 0.62);
  background: rgba(6, 10, 20, 0.9);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.input-error {
  border-color: rgba(248, 113, 113, 0.7) !important;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
  transition: background 0.18s ease;
  flex: 0 0 auto;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--grad);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: #06111d;
}

/* ---------------- 表格 ---------------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 620px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #0d1424;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--text-2);
  vertical-align: middle;
}

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

.table tbody tr {
  transition: background 0.14s ease;
}

.table tbody tr:hover {
  background: rgba(56, 189, 248, 0.045);
}

.table .cell-main {
  color: var(--text);
  font-weight: 600;
}

.table .cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.table th:last-child,
.table td:last-child {
  text-align: right;
}

/* ---------------- 标签页 ---------------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 10, 20, 0.6);
  flex-wrap: wrap;
}

.tab {
  height: 30px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab.is-active {
  background: var(--grad);
  color: #06111d;
}

/* ---------------- 统计卡 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stat {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--grad);
  opacity: 0.7;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.stat-label svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.stat-value {
  margin-top: 8px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

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

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 14, 0.76);
  backdrop-filter: blur(6px);
  animation: fade-in 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #101828, #0b1120);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-lg {
  max-width: 720px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 650;
}

.modal-body {
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

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

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(15, 22, 38, 0.97);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  animation: toast-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}

.toast.is-out {
  animation: toast-out 0.2s ease forwards;
}

.toast-ok {
  border-color: rgba(52, 211, 153, 0.45);
}

.toast-err {
  border-color: rgba(248, 113, 113, 0.45);
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.45);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.toast-ok svg {
  color: var(--ok);
}

.toast-err svg {
  color: var(--danger);
}

.toast-info svg {
  color: var(--brand);
}

/* ---------------- 状态占位 ---------------- */

.loading,
.empty,
.error-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.error-box {
  color: #fca5a5;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(148, 163, 184, 0.24);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* 代码块 */
.code {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(3, 7, 15, 0.85);
  color: #a5f3fc;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.logs {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: #05080f;
  color: #9db3cc;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 键值列表 */
.kv {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 9px 14px;
  font-size: 13px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  color: var(--text-2);
  word-break: break-all;
}

/* 分隔线 */
.hr {
  height: 1px;
  background: var(--line);
  border: none;
  margin: 16px 0;
}

/* ---------------- 汉堡导航（左侧抽屉） ---------------- */

/* 触发按钮：桌面折叠侧栏，移动端打开抽屉 */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(148, 163, 184, 0.5);
  color: var(--text);
}

.nav-toggle:active {
  transform: translateY(1px);
}

.burger,
.burger::before,
.burger::after {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.22s ease, background 0.22s ease;
}

.burger {
  position: relative;
}

.burger::before,
.burger::after {
  content: "";
  position: absolute;
  left: 0;
}

.burger::before {
  top: -6px;
}

.burger::after {
  top: 6px;
}

/* 抽屉展开时汉堡变叉号 */
body.sidebar-open .burger {
  background: transparent;
}

body.sidebar-open .burger::before {
  transform: translateY(6px) rotate(45deg);
}

body.sidebar-open .burger::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* 侧栏顶部：品牌 + 关闭按钮 */
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.sidebar-close svg {
  width: 16px;
  height: 16px;
}

/* 抽屉遮罩 */
.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(3, 6, 14, 0.66);
  backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease;
}

/* 动画 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

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

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(18px);
  }
}

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

@media (max-width: 720px) {
  .wrap {
    padding: 0 16px;
  }

  .card {
    padding: 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  /* 宽表格在手机上横向滑动，避免撑破布局 */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 620px;
  }

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

  .toast {
    max-width: none;
  }
}
