* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========== 登录页面 ========== */
.login-container {
  background: white;
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  margin: 100px auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-container h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-form input {
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.login-form input:focus {
  outline: none;
  border-color: #667eea;
}

.login-form button {
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.login-form button:hover {
  transform: translateY(-2px);
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

/* ========== 管理页面 ========== */
.header {
  background: white;
  border-radius: 12px;
  padding: 20px 30px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
  color: #333;
  font-size: 24px;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.status-badge {
  background: #27ae60;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ========== 统计卡片 ========== */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-label {
  color: #666;
  font-size: 14px;
  margin-bottom: 10px;
}

.stat-value {
  color: #333;
  font-size: 32px;
  font-weight: 700;
}

/* ========== 筛选区域 ========== */
.filter-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row select {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  flex: 1;
  min-width: 150px;
}

.filter-row input[type="text"] {
  flex: 2;
}

.filter-row input:focus,
.filter-row select:focus {
  outline: none;
  border-color: #667eea;
}

/* ========== 按钮样式 ========== */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  padding: 10px 20px;
  background: #95a5a6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: #7f8c8d;
}

.btn-danger {
  padding: 10px 20px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-danger:hover {
  transform: translateY(-2px);
  background: #c0392b;
}

/* ========== 表格样式 ========== */
.table-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f8f9fa;
}

th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  color: #555;
}

tbody tr:hover {
  background: #f8f9fa;
}

.loading {
  text-align: center;
  color: #999;
  padding: 40px !important;
}

.error-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.error-type-AUTH_ERROR {
  background: #e74c3c;
  color: white;
}

.error-type-UPLOAD_ERROR {
  background: #e67e22;
  color: white;
}

.error-type-GENERATE_ERROR {
  background: #f39c12;
  color: white;
}

.error-type-POLL_ERROR {
  background: #3498db;
  color: white;
}

.error-type-TIMEOUT_ERROR {
  background: #9b59b6;
  color: white;
}

.error-type-UNKNOWN_ERROR {
  background: #95a5a6;
  color: white;
}

.token-preview {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #666;
}

.error-message-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 分页 ========== */
.pagination-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination-info {
  color: #666;
  font-size: 14px;
}

.pagination-info span {
  font-weight: 600;
  color: #333;
}

.pagination-buttons {
  display: flex;
  gap: 10px;
}

.pagination-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 15px;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-row input,
  .filter-row select,
  .filter-row button {
    width: 100%;
  }

  .stats-container {
    grid-template-columns: 1fr;
  }

  .pagination-container {
    flex-direction: column;
    gap: 15px;
  }

  .pagination-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* ========== 标签页样式 ========== */
.tabs-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: white;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
}

.tab-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== Token日志表格样式 ========== */
.badge.success {
  background: #4caf50;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge.error {
  background: #f44336;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

table code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

td.empty, td.loading, td.error {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}

td.error {
  color: #f44336;
}
