/* ==================== 全局样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4f8ef7;
  --primary-dark: #3a7ae0;
  --bg: #f0f2f5;
  --sidebar-bg: #1e2a3a;
  --sidebar-hover: #2d3f54;
  --sidebar-active: #4f8ef7;
  --text: #333;
  --text-light: #666;
  --text-white: #fff;
  --border: #e8e8e8;
  --success: #52c41a;
  --danger: #ff4d4f;
  --warning: #faad14;
  --info: #1890ff;
}
body { font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ==================== 布局 ==================== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--text-white); display: flex; flex-direction: column; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar .logo { padding: 20px 24px; font-size: 17px; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.1); white-space: nowrap; }
.sidebar .menu { flex: 1; padding: 12px 0; }
.sidebar .menu-item { padding: 12px 24px; cursor: pointer; display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.7); transition: all .2s; font-size: 14px; }
.sidebar .menu-item:hover { background: var(--sidebar-hover); color: var(--text-white); }
.sidebar .menu-item.active { background: var(--sidebar-active); color: var(--text-white); }
.sidebar .menu-item .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar .footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: rgba(255,255,255,0.4); }
.sidebar .footer a { color: rgba(255,255,255,0.6); text-decoration: none; }
.sidebar .footer a:hover { color: var(--text-white); }

.main { flex: 1; margin-left: 220px; padding: 24px 32px; }
.main .header { margin-bottom: 24px; }
.main .header h2 { font-size: 20px; font-weight: 600; }
.main .header .sub { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ==================== 卡片 ==================== */
.card { background: #fff; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ==================== 统计卡片 ==================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.warning { color: var(--warning); }

/* ==================== 表格 ==================== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
th { background: #fafbfc; color: var(--text-light); font-weight: 600; white-space: nowrap; }
tr:hover { background: #fafbfc; }
td .mono { font-family: "Consolas", "Monaco", monospace; font-size: 13px; }

/* ==================== 工具栏 ==================== */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 8px 14px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.toolbar input { min-width: 140px; }

/* ==================== 按钮 ==================== */
.btn { padding: 8px 20px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-default { background: #fff; border: 1px solid #d9d9d9; color: var(--text); }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d9363e; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #45a816; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* ==================== 徽章 ==================== */
.badge { padding: 3px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-unused { background: #e6f7e6; color: #389e0d; }
.badge-used { background: #e6e6fa; color: #531dab; }
.badge-disabled { background: #fff1f0; color: #cf1322; }
.badge-expired { background: #fff7e6; color: #d46b08; }
.badge-success { background: #e6f7e6; color: #389e0d; }
.badge-failed { background: #fff1f0; color: #cf1322; }
.badge-pending { background: #e6f0ff; color: #0958d9; }

/* ==================== 弹窗 ==================== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.45); justify-content: center; align-items: center; z-index: 1000; }
.modal.show { display: flex; }
.modal-card { background: #fff; border-radius: 16px; padding: 32px 36px; width: 420px; max-width: 90%; box-shadow: 0 16px 48px rgba(0,0,0,0.18); animation: modalIn .25s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-card h2 { font-size: 19px; margin-bottom: 6px; font-weight: 600; }
.modal-card .modal-sub { font-size: 13px; color: var(--text-light); margin-bottom: 24px; }
.modal-card .form-group { margin-bottom: 18px; }
.modal-card label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 500; }
.modal-card input, .modal-card select { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 10px; font-size: 14px; outline: none; transition: all .2s; background: #fff; }
.modal-card input:focus, .modal-card select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,142,247,0.1); }
.modal-card input:disabled { background: #f5f5f5; color: #999; cursor: not-allowed; }
.modal-card .btns { display: flex; gap: 12px; margin-top: 28px; }
.modal-card .btns .btn { flex: 1; justify-content: center; padding: 11px; font-size: 15px; }

/* ==================== 激活码列表 ==================== */
.code-list { background: #f6f8fa; border-radius: 8px; padding: 16px 20px; margin-top: 16px; font-family: "Consolas", "Monaco", monospace; font-size: 14px; line-height: 2; }
.code-list .code { display: flex; justify-content: space-between; align-items: center; }
.code-list .code .copy { cursor: pointer; color: var(--primary); font-size: 12px; }

/* ==================== 提示 ==================== */
.alert { padding: 10px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fff1f0; color: #cf1322; }
.alert-success { background: #e6f7e6; color: #389e0d; }
.alert-info { background: #e6f0ff; color: #0958d9; }

/* ==================== 空状态 ==================== */
.empty { text-align: center; padding: 40px; color: var(--text-light); font-size: 14px; }

/* ==================== 分页 ==================== */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pagination .btn { padding: 6px 14px; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .logo { font-size: 0; padding: 20px 0; text-align: center; }
  .sidebar .logo::first-letter { font-size: 17px; }
  .sidebar .menu-item { padding: 12px 0; justify-content: center; font-size: 0; }
  .sidebar .menu-item .icon { font-size: 18px; }
  .sidebar .footer { display: none; }
  .main { margin-left: 60px; padding: 16px; }
}
