* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }

.login-container { display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(135deg, #001529 0%, #1890ff 100%); }
.login-card { background: #fff; padding: 48px 40px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); width: 400px; }
.login-card h2 { text-align: center; margin-bottom: 36px; color: #001529; font-size: 22px; }
.login-card h2::before { content: ''; display: block; width: 48px; height: 48px; margin: 0 auto 16px; background: #1890ff; border-radius: 12px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; font-size: 13px; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: all 0.3s; background: #fff; height: 40px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 3px rgba(24,144,255,0.12); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.25s; line-height: 1.5; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-lg { padding: 12px 28px; font-size: 15px; height: 44px; }
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; box-shadow: 0 2px 8px rgba(24,144,255,0.35); }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #73d13d; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #ffc53d; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-default:hover { color: #1890ff; border-color: #1890ff; }
.btn-sm { padding: 5px 14px; font-size: 13px; border-radius: 4px; }
.btn-block { width: 100%; }

.dashboard { display: none; }
.dashboard.active { display: flex; }

.sidebar { width: 220px; background: #001529; color: #fff; min-height: 100vh; display: flex; flex-direction: column; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-header h3 { font-size: 18px; color: #fff; margin-bottom: 4px; }
.sidebar-header p { font-size: 12px; color: rgba(255,255,255,0.45); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: rgba(255,255,255,0.65); text-decoration: none; transition: all 0.25s; font-size: 14px; border-left: 3px solid transparent; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-nav a.active { color: #fff; background: #1890ff; border-left-color: #fff; }
.sidebar-nav a .nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer a { display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 10px; color: rgba(255,255,255,0.45); text-decoration: none; border-radius: 6px; transition: all 0.25s; font-size: 13px; }
.sidebar-footer a:hover { color: #ff7875; background: rgba(255,77,79,0.1); }

.main { flex: 1; padding: 24px 32px; overflow-y: auto; max-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; color: #001529; font-weight: 600; }

.card { background: #fff; border-radius: 8px; padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.card-header h3 { font-size: 16px; color: #001529; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; }
th { background: #fafafa; font-weight: 600; color: #555; font-size: 13px; white-space: nowrap; }
tr:hover td { background: #fafafa; }
td { font-size: 14px; color: #333; }
.empty-row td { text-align: center; color: #bbb; padding: 40px; font-size: 14px; }
.action-btns { display: flex; gap: 8px; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.45); z-index: 1000; animation: fadeIn 0.2s ease; }
.modal.active { display: flex; justify-content: center; align-items: center; }
.modal-content { background: #fff; padding: 0; border-radius: 10px; width: 520px; max-width: 92%; box-shadow: 0 8px 32px rgba(0,0,0,0.18); animation: slideUp 0.25s ease; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; color: #001529; }
.modal-close { width: 28px; height: 28px; border: none; background: none; cursor: pointer; font-size: 18px; color: #999; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #f5f5f5; color: #333; }
.modal-body { padding: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid #f0f0f0; background: #fafafa; border-radius: 0 0 10px 10px; }

.code-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code-form select, .code-form input { padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; height: 38px; transition: all 0.3s; }
.code-form select:focus, .code-form input:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.code-form select { min-width: 160px; }
.code-form input { width: 110px; }

/* 自定义下拉选择框 */
.custom-select { position: relative; min-width: 180px; user-select: none; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #fff; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; cursor: pointer; transition: all 0.25s; height: 38px; }
.custom-select-trigger:hover { border-color: #40a9ff; }
.custom-select.open .custom-select-trigger { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.12); border-radius: 6px 6px 0 0; }
.custom-select-arrow { font-size: 12px; color: #999; transition: transform 0.25s; margin-left: 8px; }
.custom-select.open .custom-select-arrow { transform: rotate(180deg); }
.custom-select-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #1890ff; border-top: none; border-radius: 0 0 6px 6px; max-height: 240px; overflow-y: auto; display: none; z-index: 100; box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.custom-select.open .custom-select-dropdown { display: block; }
.custom-select-option { padding: 9px 14px; cursor: pointer; font-size: 14px; transition: background 0.15s; display: flex; align-items: center; gap: 8px; }
.custom-select-option:hover { background: #e6f7ff; }
.custom-select-option.selected { background: #f0f5ff; color: #1890ff; font-weight: 500; }
.custom-select-option .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.custom-select-option .dot.active { background: #52c41a; }
.custom-select-option .dot.inactive { background: #d9d9d9; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px 0; }
.pagination button { min-width: 36px; height: 36px; border: 1px solid #d9d9d9; border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.pagination button:hover { border-color: #1890ff; color: #1890ff; }
.pagination button.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: #999; padding: 0 8px; }

.codes-result { background: #f6f8fa; border: 1px solid #e8e8e8; border-radius: 6px; padding: 16px; margin-top: 12px; max-height: 240px; overflow-y: auto; font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; line-height: 2; word-break: break-all; color: #333; }
.codes-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.codes-result-header span { font-size: 13px; color: #888; font-family: 'Microsoft YaHei', sans-serif; }

.search-box { display: flex; align-items: center; }
.search-box input { padding: 6px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 13px; width: 240px; height: 34px; transition: all 0.3s; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23bfbfbf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 10px center; padding-left: 32px; }
.search-box input:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }

.toast { position: fixed; top: 24px; right: 24px; padding: 12px 24px; background: #52c41a; color: #fff; border-radius: 8px; z-index: 2000; display: none; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); max-width: 360px; }
.toast.error { background: #ff4d4f; }
.toast.show { display: block; animation: slideInRight 0.35s ease; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) } }

.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-warning { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.badge-danger { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.badge-info { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }

/* 仪表盘 */
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 10px; padding: 20px 24px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; transition: all 0.25s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.stat-info { flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; color: #001529; line-height: 1.3; }
.stat-label { font-size: 13px; color: #999; margin-top: 4px; }

.dashboard-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; }
.chart-card h3 { font-size: 15px; color: #001529; font-weight: 600; margin-bottom: 16px; }

@media (max-width: 1200px) { .dashboard-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .dashboard-stats { grid-template-columns: 1fr; }
  .dashboard-charts { grid-template-columns: 1fr; }
}

/* ==================== 移动端适配 ==================== */

/* 移动端顶部栏（默认隐藏） */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 50px; background: #001529; color: #fff; align-items: center; justify-content: space-between; padding: 0 16px; z-index: 900; }
.hamburger-btn { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.hamburger-btn:active { background: rgba(255,255,255,0.1); }
.mobile-title { font-size: 16px; font-weight: 600; }

/* 遮罩层 */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 800; }
.sidebar-overlay.active { display: block; }

/* 移动端响应式 */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .dashboard.active { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: -260px; bottom: 0; width: 240px;
    z-index: 850; transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.active { display: block; }
  .main { padding: 16px 12px; padding-top: 66px; max-height: none; }

  .login-card { width: 92%; padding: 32px 24px; }
  .login-card h2 { font-size: 20px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .page-header h2 { font-size: 18px; }
  .action-btns { width: 100%; flex-wrap: wrap; }

  .card { padding: 16px; margin-bottom: 12px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; }
  .code-form { width: 100%; }
  .code-form select { min-width: 120px; flex: 1; }
  .code-form input { flex: 1; min-width: 80px; }

  th, td { padding: 8px 10px; font-size: 13px; }

  .modal-content { max-width: 96%; margin: 0 2%; }
  .modal-body { padding: 16px; }
  .modal-actions { padding: 12px 16px; }

  .stat-card { padding: 14px 16px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-value { font-size: 20px; }
  .chart-card { padding: 16px; }

  .toast { top: auto; bottom: 24px; right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 480px) {
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 12px; }
  .btn { padding: 6px 14px; font-size: 13px; }
  .pagination button { min-width: 32px; height: 32px; font-size: 13px; }
  .custom-select { min-width: 140px; }
}
