:root {
  --canvas: #0a0c10;
  --surface: #111318;
  --border: #262a32;
  --fg: #f5f6f8;
  --muted: #a6abb4;
  --primary: #f0782e;
  --accent: #29abe2;
  --warn: #f5cf5e;
  --radius-md: 0.625rem;
  --radius-xl: 1.25rem;
  --font-sans: "InterVariable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --spectrum: linear-gradient(120deg, #f0782e 0%, #29abe2 100%);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--fg);
  background:
    radial-gradient(60rem 40rem at 50% -10%, rgba(240, 120, 46, 0.10), transparent 60%),
    radial-gradient(50rem 40rem at 90% 110%, rgba(41, 171, 226, 0.08), transparent 60%),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--spectrum);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}

.auth-logo { display: block; }

.auth-wordmark {
  font-size: 1.25rem;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 620;
  letter-spacing: -0.015em;
  margin: 0 0 0.375rem;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.auth-subtitle strong { color: var(--fg); font-weight: 600; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.auth-field { display: flex; flex-direction: column; gap: 0.375rem; }
.auth-field > span { font-size: 0.8125rem; color: var(--muted); }

.auth-field input {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.625rem 0.75rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.25);
}

.auth-button {
  font: inherit;
  font-weight: 560;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  padding: 0.6875rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 120ms ease, border-color 120ms ease;
}

.auth-button--primary { background: var(--primary); color: #1a0f07; }
.auth-button--primary:hover { filter: brightness(1.06); }

.auth-button--ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.auth-button--ghost:hover:not(:disabled) { border-color: var(--muted); }

.auth-button:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  margin: 1.25rem 0;
}

.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-alt { display: flex; flex-direction: column; gap: 0.625rem; }

.auth-hint {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 1rem 0 0;
  text-align: center;
}

.auth-error {
  background: rgba(245, 207, 94, 0.08);
  border: 1px solid rgba(245, 207, 94, 0.35);
  color: var(--warn);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.auth-scopes {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.auth-scopes li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
}

.auth-scope-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  flex: none;
}

.auth-actions { display: flex; gap: 0.75rem; }
.auth-actions .auth-button { flex: 1; }

.auth-footer {
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  margin: 0;
}

:root {
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.auth-card--wide { max-width: 34rem; }

a.auth-button { text-decoration: none; display: inline-block; text-align: center; }

.auth-back {
  display: inline-block;
  color: var(--muted);
  font-size: 0.8125rem;
  text-decoration: none;
  margin-bottom: 1rem;
}
.auth-back:hover { color: var(--fg); }

.auth-status {
  background: rgba(41, 171, 226, 0.08);
  border: 1px solid rgba(41, 171, 226, 0.35);
  color: #6dccf1;
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.auth-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.auth-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--canvas);
}
.auth-item-main { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.auth-item-title { font-weight: 560; }
.auth-item-sub { color: var(--muted); font-size: 0.8125rem; }
.auth-item-actions { display: flex; align-items: center; gap: 0.625rem; flex: none; }

.auth-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.auth-badge--on { color: #6dccf1; border-color: rgba(41, 171, 226, 0.4); background: rgba(41, 171, 226, 0.08); }
.auth-badge--off { color: var(--muted); }

.auth-key {
  font-family: var(--font-mono);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  letter-spacing: 0.12em;
  word-break: break-all;
}
.auth-uri { color: var(--muted); font-size: 0.75rem; word-break: break-all; margin: 0.5rem 0 0; }

.auth-codes {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.auth-actions form { flex: 1; }
.auth-actions form .auth-button { width: 100%; }

/* Spacing as attributes rather than inline styles, so the Content-Security-Policy can forbid inline style. */
[data-spacing="md"] { margin-top: 1rem; }
[data-spacing="lg"] { margin-top: 1.5rem; }

/* Organization choice on the consent screen. */
fieldset.auth-field { border: 0; margin: 0; padding: 0; }
fieldset.auth-field legend { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.auth-choice { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.75rem; margin-bottom: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.auth-choice:has(input:checked) { border-color: var(--primary); }
.auth-choice .auth-item-sub { margin-left: auto; }
