:root {
  --bg: #0f172a;
  --bg-elevated: #1f2937;
  --bg-soft: #111827;
  --border: #374151;
  --border-soft: #4b5563;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
}

.page-base {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page-auth {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.page-container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.page-narrow {
  max-width: 56rem;
}

.auth-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.4);
}

.card-narrow {
  width: 100%;
  max-width: 28rem;
}

.page-title {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-header > div:first-child {
  min-width: 0;
}

@media (min-width: 768px) {
  .section-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.text-muted {
  color: var(--text-muted);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-help {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft);
  color: var(--text);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.5);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #475569;
  color: #f8fafc;
}

.btn-secondary:hover {
  background: #334155;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-outline {
  border: 1px solid var(--primary);
  color: #e9d5ff;
}

.btn-outline:hover {
  background: rgba(124, 58, 237, 0.2);
}

.link {
  color: #c4b5fd;
}

.link:hover {
  color: #ddd6fe;
}

.alert {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid;
}

.alert-info {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.45);
  color: #e9d5ff;
}

.alert-success {
  background: rgba(22, 163, 74, 0.2);
  border-color: rgba(22, 163, 74, 0.5);
  color: #bbf7d0;
}

.alert-danger {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
  color: #fecaca;
}

.empty-state {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

.table-base {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.table-base thead {
  background: #374151;
}

.table-base th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #d1d5db;
}

.table-base td {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.table-base tbody tr:hover {
  background: #374151;
}

.table-fixed {
  table-layout: fixed;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(22, 163, 74, 0.2);
  color: #bbf7d0;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.badge-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #fecaca;
}

.spinner {
  display: inline-flex;
  height: 1rem;
  width: 1rem;
  border-radius: 999px;
  border: 2px solid var(--border-soft);
  border-top-color: #d1d5db;
  animation: spin 1s linear infinite;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
