:root {
  --primary: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --gray-50: #111827;
  --gray-100: #1f2937;
  --gray-200: #374151;
  --gray-300: #4b5563;
  --gray-500: #9ca3af;
  --gray-700: #d1d5db;
  --gray-900: #f9fafb;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

/* Request Form */
.request-form-container {
  max-width: 600px;
  margin: 40px auto;
  padding: 32px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.request-form-container h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--gray-500);
  margin-bottom: 24px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
}

.btn:hover { opacity: 0.9; }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  width: auto;
}

.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); }

.notice {
  padding: 12px 16px;
  background: #dcfce7;
  color: #166534;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.errors {
  padding: 12px 16px;
  background: #fef2f2;
  color: var(--danger);
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.errors ul { margin-left: 16px; }

/* Admin Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: var(--gray-100);
  color: var(--gray-900);
  padding: 20px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar h2 {
  padding: 0 20px;
  font-size: 18px;
  margin-bottom: 24px;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
}

.admin-sidebar nav a i {
  width: 16px;
  text-align: center;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  background: rgba(0,0,0,0.05);
  color: #111827;
}

.admin-sidebar .sidebar-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--gray-200);
}

.admin-sidebar .sidebar-footer a {
  color: var(--gray-700);
  text-decoration: none;
  font-size: 13px;
}

.admin-content {
  flex: 1;
  padding: 32px;
}

.admin-content h1 {
  font-size: 24px;
  margin-bottom: 24px;
}

/* Cards & Tables */
.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 140px;
  padding: 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
  padding: 10px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-fire { background: #fef2f2; color: var(--danger); }
.badge-bug { background: #fefce8; color: var(--warning); }
.badge-feature { background: #eff6ff; color: var(--primary); }
.badge-up { background: #dcfce7; color: var(--success); }
.badge-down { background: #fef2f2; color: var(--danger); }

a { color: var(--primary); }

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

.token-url {
  font-family: monospace;
  background: var(--gray-100);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  margin-top: 32px;
}

.section-header h2 {
  font-size: 18px;
}

/* Login */
.login-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 32px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.login-container h1 {
  margin-bottom: 24px;
  text-align: center;
}

/* Sidebar logo */
.sidebar-logo {
  display: block;
  padding: 0 20px;
  margin-bottom: 24px;
}

.sidebar-logo img {
  width: 100%;
  display: block;
  mix-blend-mode: multiply;
}

/* Dark mode toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}

.theme-toggle:hover {
  background: rgba(0,0,0,0.05);
  color: #111827;
}

/* Logout button */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #dc2626;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  width: 100%;
  justify-content: center;
  transition: opacity 0.2s;
}

.logout-btn:hover {
  opacity: 0.9;
}

/* Dark mode overrides */
[data-theme="dark"] .admin-sidebar {
  background: #f3f4f6;
  color: var(--gray-900);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] table,
[data-theme="dark"] .request-form-container,
[data-theme="dark"] .login-container {
  background: var(--gray-100);
  color: var(--gray-900);
}

[data-theme="dark"] th {
  background: var(--gray-50);
}

[data-theme="dark"] .btn-outline {
  background: var(--gray-100);
  color: var(--gray-700);
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .badge-fire { background: #450a0a; }
[data-theme="dark"] .badge-bug { background: #422006; }
[data-theme="dark"] .badge-feature { background: #1e3a5f; }
[data-theme="dark"] .badge-up { background: #14532d; }
[data-theme="dark"] .badge-down { background: #450a0a; }

[data-theme="dark"] .notice {
  background: #14532d;
  color: #86efac;
}

[data-theme="dark"] .errors {
  background: #450a0a;
}
