/* ============================================
   NetcCheck 管理后台 · 亮色黑白极简风
   字体：站酷庆科黄油体（CDN 加载，失败回退系统字体）
   ============================================ */

:root {
  --bg: #f7f7f5;          /* 暖白背景 */
  --card: #ffffff;        /* 卡片 */
  --border: #e9e9e6;      /* 边框 */
  --border-strong: #d9d9d5;
  --text: #17171a;        /* 主文字 */
  --muted: #8a8a8e;       /* 次要文字 */
  --danger: #e5484d;      /* 仅用于危险操作 */
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 23, 26, .05);
  --shadow-md: 0 8px 28px -10px rgba(23, 23, 26, .16);
  --shadow-lg: 0 20px 60px -20px rgba(23, 23, 26, .25);
  --font-cute: "ZCOOL QingKe HuangYou", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font-cute);
  letter-spacing: .3px;
}

::selection { background: #17171a; color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d9d9d5; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c4c4c0; }
::-webkit-scrollbar-track { background: transparent; }

.layout { display: flex; height: 100vh; }

/* ---------- 侧栏 ---------- */
.sidebar {
  width: 216px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 20px; font-size: 21px;
}
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--text); color: var(--card);
  border-radius: 11px; font-size: 19px;
  box-shadow: var(--shadow-sm);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; margin-bottom: 4px;
  color: var(--muted); cursor: pointer; user-select: none;
  border-radius: 11px;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-item svg { flex-shrink: 0; opacity: .85; transition: transform .25s var(--ease); }
.nav-item:hover { color: var(--text); background: #f2f2ef; }
.nav-item:hover svg { transform: scale(1.08) rotate(-3deg); }
.nav-item.active {
  color: var(--card); background: var(--text);
  box-shadow: var(--shadow-md);
}
.nav-item.active svg { opacity: 1; }
.nav-item:active { transform: scale(.97); }
.sidebar-foot {
  margin-top: auto; padding: 16px 8px 0;
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--border);
}

/* ---------- 主区 ---------- */
.main { flex: 1; overflow: auto; padding: 30px 34px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
h2 { font-size: 23px; font-weight: normal; }
h3 { font-size: 17px; font-weight: normal; margin-bottom: 14px; }

/* 切页入场动画（JS 加 .entering 触发，子元素依次浮现） */
.tab-section.entering > * { animation: fade-up .45s var(--ease) both; }
.tab-section.entering > *:nth-child(2) { animation-delay: .05s; }
.tab-section.entering > *:nth-child(3) { animation-delay: .1s; }
.tab-section.entering > *:nth-child(4) { animation-delay: .15s; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.card-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(23, 23, 26, .04), 0 6px 18px -10px rgba(23, 23, 26, .07);
  overflow-x: auto; /* 窄屏下宽表格横向滚动，不撑破布局 */
}

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .num { font-size: 32px; margin-top: 4px; }

/* ---------- 表单 ---------- */
input, select, textarea {
  background: var(--card);
  border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 12px; border-radius: 10px;
  font: inherit; font-size: 14px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(23, 23, 26, .07);
}
textarea { width: 100%; resize: vertical; font-family: var(--font-mono); }
.form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.form-row label { font-size: 14px; color: var(--muted); }
.form-row label input[type="checkbox"] { margin-right: 5px; accent-color: var(--text); }
.form-col { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-col label { font-size: 14px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #2c2c31, #17171a); color: var(--card);
  border: 1px solid #17171a;
  padding: 9px 18px; border-radius: 11px;
  cursor: pointer; font: inherit; font-size: 14px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(.96); box-shadow: var(--shadow-sm); }
.btn.ghost {
  background: var(--card); color: var(--text); border: 1px solid var(--border-strong);
}
.btn.ghost:hover { border-color: var(--text); background: var(--card); }
.btn.danger { background: var(--card); color: var(--danger); border: 1px solid rgba(229, 72, 77, .45); }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 9px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; white-space: nowrap; }
tbody tr { transition: background .18s var(--ease); }
tbody tr:hover td { background: #fafaf7; }
.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 14px; margin: 8px 0; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* 图表：图例 / 折线 / 条形 */
.chart-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.chart-legend .lg { display: inline-block; width: 20px; border-top: 3px solid #17171a; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.chart-legend .lg-register { border-top-color: #9a9aa0; }
.chart-legend .lg-recharge { border-top: 3px dashed #c4c4c9; }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.bar-name { width: 150px; font-size: 13px; color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f0f0ed; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #3a3a40, #17171a); border-radius: 6px; transition: width .9s var(--ease); }
.bar-num { width: 44px; font-size: 14px; }

/* ---------- 徽章（黑白灰体系） ---------- */
.badge {
  display: inline-block; padding: 2px 11px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
  transition: transform .2s var(--ease);
}
tr:hover .badge { transform: scale(1.05); }
.badge.tag { background: var(--text); color: var(--card); }            /* 正常/未使用 */
.badge.gray { background: #f0f0ed; color: var(--muted); }              /* 已使用 */
.badge.void { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); text-decoration: line-through; } /* 作废 */
.badge.line { background: transparent; color: var(--text); border: 1px solid var(--text); }  /* 永久/普通标记 */
.badge.bad { background: #fdecec; color: var(--danger); }              /* 封禁/停用/过期 */

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 14px; color: var(--muted); }
.pager .btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(23, 23, 26, .32);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.show { display: flex; animation: mask-in .22s var(--ease) both; }
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px; width: 470px; max-width: 94vw; max-height: 88vh;
  overflow: auto; padding: 26px;
  box-shadow: var(--shadow-lg);
  animation: pop-in .32s var(--ease) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.94) translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.close-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#card-result-keys { height: 230px; }

/* ---------- 登录页 ---------- */
#login-mask {
  position: fixed; inset: 0; background: var(--bg);
  background-image: radial-gradient(#e3e3df 1px, transparent 1px);
  background-size: 22px 22px;
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.login-box {
  width: 380px; padding: 36px 32px 26px;
  border-radius: 22px;
  animation: pop-in .5s var(--ease) both;
}
.login-brand {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 26px; font-size: 26px;
}
.login-brand .logo-mark { width: 44px; height: 44px; font-size: 25px; border-radius: 14px; }
.login-box h3 { text-align: center; display: none; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; top: 22px; left: 50%;
  transform: translateX(-50%) translateY(-90px);
  background: var(--card); border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 26px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-md); z-index: 200;
  transition: transform .35s var(--ease);
  pointer-events: none; max-width: 80vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(229, 72, 77, .5); color: var(--danger); }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
