/* Design tokens (research §6): slate neutral scale, single blue primary,
   4px spacing scale, small/medium radii, prefers-color-scheme dark theming. */
:root {
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  --bg: #ffffff;
  --surface: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --input-bg: #ffffff;

  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --success: #15803d;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;

    --error: #fca5a5;
    --error-bg: #3f1d1d;
    --error-border: #7f1d1d;
    --success: #86efac;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

h1 {
  margin: 0 0 var(--space-2);
  font-size: 1.5rem;
}

.subtitle {
  margin: 0 0 var(--space-6);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary-600);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--primary-700);
}

.button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.button.is-busy .spinner {
  display: inline-block;
}

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

.status {
  margin-top: var(--space-4);
  font-size: 0.95rem;
}

.status:empty {
  display: none;
}

.status.is-error {
  padding: var(--space-3) var(--space-4);
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
}

.status.is-success {
  color: var(--success);
}

.status-message {
  display: block;
}

.status-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.85rem;
  opacity: 0.85;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
