/*
 * Sign-in pages of the identity server (login, two-factor, signed-in, access denied, error).
 * Matches the PLUTO launchpad / ROC Reports look: same emerald tokens, Orbitron heading, Sora text, Pluto logo, card.
 * Self-contained on purpose: no framework, nothing loaded from another site, no script, so it works under a strict
 * Content-Security-Policy (default-src 'self'). Light and dark follow the visitor's system setting.
 */

@font-face {
  font-family: "Sora";
  src: url("../fonts/sora-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Orbitron";
  src: url("../fonts/orbitron-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --background: 140 15% 98%;
  --foreground: 140 40% 12%;
  --card: 0 0% 100%;
  --primary: 142 71% 30%;
  --primary-foreground: 0 0% 100%;
  --primary-light: 142 60% 50%;
  --muted: 140 20% 92%;
  --muted-foreground: 140 15% 40%;
  --destructive: 0 72% 42%;
  --destructive-soft: 0 72% 51% / 0.1;
  --border: 140 20% 82%;
  --ring: 142 71% 30%;
  --radius: 0.75rem;
  --glow: 142 71% 30%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 140 25% 7%;
    --foreground: 140 15% 94%;
    --card: 140 22% 10%;
    --primary: 142 60% 45%;
    --primary-foreground: 140 40% 6%;
    --primary-light: 142 60% 60%;
    --muted: 140 16% 16%;
    --muted-foreground: 140 10% 68%;
    --destructive: 0 80% 70%;
    --destructive-soft: 0 72% 58% / 0.14;
    --border: 140 14% 24%;
    --ring: 142 60% 55%;
    --glow: 142 60% 45%;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

/* soft glow in two corners, as on the launchpad */
.auth-page::before,
.auth-page::after {
  content: "";
  position: absolute;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: hsl(var(--primary) / 0.06);
  filter: blur(64px);
  pointer-events: none;
}

.auth-page::before {
  top: -10rem;
  right: -10rem;
}

.auth-page::after {
  bottom: -10rem;
  left: -10rem;
}

.auth-main {
  position: relative;
  width: 100%;
  max-width: 28rem;
}

.auth-brand {
  margin-bottom: 2rem;
  text-align: center;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  padding: 0.5rem;
  overflow: hidden;
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: 1rem;
  background: hsl(var(--card));
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.08), 0 0 15px -3px hsl(var(--glow) / 0.2);
}

.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-name {
  margin: 0.75rem 0 0;
  font-family: "Orbitron", "Sora", system-ui, sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: hsl(var(--primary));
  background-image: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-light)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card {
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: 0 10px 30px -10px hsl(0 0% 0% / 0.18), 0 0 15px -3px hsl(var(--glow) / 0.15);
}

.auth-card-header {
  padding: 1.5rem 1.5rem 0;
}

.auth-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.auth-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.auth-input {
  display: block;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--background));
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
}

.auth-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.auth-input:focus-visible,
.auth-button:focus-visible,
.auth-link:focus-visible,
.auth-check input:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.auth-check input {
  width: 1rem;
  height: 1rem;
  accent-color: hsl(var(--primary));
}

.auth-button {
  display: inline-flex;
  width: 100%;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border: 0;
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.auth-button:hover {
  filter: brightness(1.08);
}

.auth-button-secondary {
  margin-top: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
}

.auth-alert {
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid hsl(var(--destructive) / 0.35);
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--destructive-soft));
  color: hsl(var(--destructive));
  font-size: 0.875rem;
}

.auth-alert ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-note {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
}

.auth-link {
  color: hsl(var(--primary));
  font-weight: 500;
}

.auth-footer {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.auth-card select.auth-input {
  padding-right: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .auth-main {
    animation: auth-in 0.35s ease-out;
  }
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- account settings (password, two-factor): a wider card under a slim header bar ---- */

.auth-page-top {
  align-items: flex-start;
  padding-top: 2rem;
}

.auth-main-wide {
  max-width: 38rem;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.account-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.account-logo {
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.25rem;
  overflow: hidden;
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: 0.75rem;
  background: hsl(var(--card));
}

.account-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.account-name {
  font-family: "Orbitron", "Sora", system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: hsl(var(--primary));
}

.account-actions {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.account-link {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.account-link:hover,
.account-link:focus-visible {
  color: hsl(var(--foreground));
  text-decoration: underline;
}

.account-link-button {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.account-signout {
  margin: 0;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid hsl(var(--border) / 0.6);
}

.setting:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.setting form {
  margin: 0;
}

.setting-text-block {
  min-width: 0;
}

.setting-title {
  font-weight: 600;
}

.setting-text {
  margin-top: 0.125rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.auth-button-compact {
  width: auto;
  min-width: 5.5rem;
  margin: 0;
  flex-shrink: 0;
}

.auth-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}

.auth-badge-on {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}

.auth-success {
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid hsl(var(--primary) / 0.35);
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-size: 0.875rem;
}

.auth-steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
}

.auth-steps li {
  margin-bottom: 0.5rem;
}

/* the QR code must stay black on white in the dark theme, or phones cannot read it */
.auth-qr {
  display: flex;
  width: max-content;
  min-width: 11rem;
  min-height: 11rem;
  margin: 0 auto 1.25rem;
  padding: 0.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #ffffff;
}

.auth-key {
  display: block;
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--background));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.auth-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.auth-codes li {
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--background));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  text-align: center;
  user-select: all;
}

.auth-note-spaced {
  margin: 1rem 0 0;
  font-size: 0.875rem;
}

.auth-button + .auth-button-secondary {
  margin-top: 0.75rem;
}

@media (max-width: 30rem) {
  .setting {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-button-compact {
    width: 100%;
  }
}
