:root {
  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #34D399;
  --primary-bg: #ECFDF5;
  --bg: #F0FDF4;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --sidebar-bg: #065F46;
  --sidebar-text: rgba(255,255,255,0.85);
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --success: #10B981;
  --radius: 14px;
  --shadow: 0 2px 16px rgba(16,185,129,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #059669 0%, #047857 50%, #065F46 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo { font-size: 32px; }
.brand h1 { font-size: 18px; font-weight: 700; color: #fff; }
.brand span { font-size: 12px; opacity: 0.7; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255,255,255,0.1); }
.nav-item.active {
  background: rgba(255,255,255,0.15);
  border-left-color: #34D399;
  color: #fff;
  font-weight: 600;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.admin-info { display: flex; align-items: center; gap: 10px; }
.admin-avatar { font-size: 24px; }
.admin-name { font-size: 13px; color: #fff; display: block; }
.admin-role { font-size: 11px; opacity: 0.7; }

.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { font-size: 18px; font-weight: 700; color: var(--text); }

.top-actions { display: flex; align-items: center; gap: 16px; }

.server-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-online { background: #10B981; box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.status-offline { background: #EF4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }

.current-time { font-size: 13px; color: var(--text-muted); font-family: monospace; }

.btn-refresh {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-refresh:hover { background: var(--primary-bg); border-color: var(--primary); }

.page-content { flex: 1; padding: 24px 28px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.users { background: #EFF6FF; }
.stat-icon.active { background: #ECFDF5; }
.stat-icon.content { background: #FFF7ED; }
.stat-icon.checkins { background: #FDF2F8; }
.stat-icon.knowledge { background: #F0F9FF; }
.stat-icon.vip { background: #FFFBEB; }

.stat-info { flex: 1; }
.stat-number { font-size: 24px; font-weight: 700; color: var(--text); display: block; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.stat-trend {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.stat-trend.up { background: #ECFDF5; color: #059669; }

.section-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title { font-size: 15px; font-weight: 600; color: var(--text); }

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

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: #F9FAFB;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  color: var(--text);
}

.data-table tr:hover { background: #FAFBFC; }

.btn-primary {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover { background: #047857; }

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-edit { background: #EFF6FF; color: #2563EB; }
.btn-edit:hover { background: #DBEAFE; }
.btn-delete { background: #FEF2F2; color: #DC2626; }
.btn-delete:hover { background: #FEE2E2; }
.btn-approve { background: #ECFDF5; color: #059669; }
.btn-approve:hover { background: #D1FAE5; }
.btn-reject { background: #FEF3C7; color: #D97706; }
.btn-reject:hover { background: #FDE68A; }
.btn-view { background: #F3F4F6; color: #374151; }
.btn-view:hover { background: #E5E7EB; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #ECFDF5; color: #059669; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-gray { background: #F3F4F6; color: #6B7280; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  background: #fff;
}

.form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.api-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}

.api-item:last-child { border-bottom: none; }

.method-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  min-width: 48px;
  text-align: center;
}

.method-GET { background: #ECFDF5; color: #059669; }
.method-POST { background: #EFF6FF; color: #2563EB; }
.method-PUT { background: #FEF3C7; color: #D97706; }
.method-DELETE { background: #FEF2F2; color: #DC2626; }

.api-path {
  font-family: monospace;
  font-size: 13px;
  color: #374151;
  min-width: 200px;
}

.api-desc {
  flex: 1;
  color: var(--text-secondary);
  font-size: 13px;
}

.latency-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.latency-fast { background: #ECFDF5; color: #059669; }
.latency-medium { background: #FEF3C7; color: #D97706; }
.latency-slow { background: #FEF2F2; color: #DC2626; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state .empty-text { font-size: 14px; }

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #F3F4F6;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: #E5E7EB; }

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

.actions-cell { display: flex; gap: 6px; }

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-text, .sidebar .brand span, .sidebar-footer { display: none; }
  .sidebar-header { padding: 16px 8px; justify-content: center; }
  .brand h1 { font-size: 14px; }
  .main-content { margin-left: 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; gap: 0; }
}
