/* CopilotKit brand tokens (Plus Jakarta Sans, Spline Sans Mono for controls, the verified palette). */
:root {
  --bg: #ededf5;
  --surface: #ffffff;
  --text: #010507;
  --text-secondary: #57575b;
  --border: #e2e2ea;
  --border-strong: #dbdbe5;
  --field: #fafafc;
  --accent: #010507;
  --accent-text: #ffffff;
  --focus: #bec2ff;
  --ok: #189370;
  --ok-soft: #85ecce4d;
  --error: #fa5f67;
  --error-soft: #fa5f671a;
  --glow-a: #bec2ff4d;
  --glow-b: #85ecce4d;
  --radius: 16px;
  --radius-small: 10px;
  color-scheme: light;
}

/* ?theme=light or ?theme=dark pins the theme (the script sets data-theme); otherwise the system's. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #010507;
    --surface: #111216;
    --text: #ffffff;
    --text-secondary: #afafb7;
    --border: #2b2b2b;
    --border-strong: #3a3a40;
    --field: #0a0b0e;
    --accent: #ffffff;
    --accent-text: #010507;
    --focus: #bec2ff;
    --ok: #85ecce;
    --ok-soft: #85ecce26;
    --error-soft: #fa5f6726;
    --glow-a: #bec2ff1a;
    --glow-b: #85ecce14;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #010507;
    --surface: #111216;
    --text: #ffffff;
    --text-secondary: #afafb7;
    --border: #2b2b2b;
    --border-strong: #3a3a40;
    --field: #0a0b0e;
    --accent: #ffffff;
    --accent-text: #010507;
    --focus: #bec2ff;
    --ok: #85ecce;
    --ok-soft: #85ecce26;
    --error-soft: #fa5f6726;
    --glow-a: #bec2ff1a;
    --glow-b: #85ecce14;
    color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* The page shows one step at a time by the hidden attribute; a display rule must never undo it. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(60rem 30rem at 15% -10%, var(--glow-a), transparent 60%),
    radial-gradient(50rem 30rem at 100% 110%, var(--glow-b), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 34rem;
  margin: 0 auto;
  padding: 48px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand .logo {
  height: 28px;
  width: auto;
  display: block;
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 1px 2px #0105070d;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--text-secondary);
  margin: 0 0 16px;
}

/* Who can approve: the likeliest reason for a refusal, so it sits above sign-in, readable. */
.who-can {
  margin: 0 0 24px;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: var(--glow-a);
  font-size: 14px;
  font-weight: 600;
}

.code-row .code {
  font-size: 20px;
  letter-spacing: 0.12em;
}

.code-row .match {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

#sign-in {
  justify-content: center;
}

/* Clerk's sign-in card fills the column instead of keeping its own fixed width. */
#sign-in > * {
  width: 100%;
  max-width: 100%;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}

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

.who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}

.step + .step {
  margin-top: 16px;
}

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

.row {
  display: flex;
  gap: 8px;
}

#code {
  flex: 1;
  min-width: 0;
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border-strong);
  background: var(--field);
  color: var(--text);
}

#code::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

#code:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* Sentence case, the face Clerk's own buttons use beside them. */
.button {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

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

.facts {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  overflow: hidden;
}

.facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
}

.facts > div + div {
  border-top: 1px solid var(--border);
}

dt {
  font-size: 12px;
  color: var(--text-secondary);
}

dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mono {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
}

.hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 12px 0 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.done {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-small);
  background: var(--ok-soft);
}

.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ok);
  color: var(--surface);
}

.done-title {
  margin: 4px 0 0;
  font-weight: 700;
}

.done .hint {
  margin-top: 2px;
  color: var(--text);
}

.error {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: var(--error-soft);
  border: 1px solid var(--error);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.error p {
  margin: 0;
}

.error a {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 480px) {
  .shell {
    padding-top: 24px;
  }
  .card {
    padding: 24px 20px;
  }
  .row {
    flex-direction: column;
  }
}
