:root {
  color-scheme: light;
  --ink: #183047;
  --muted: #3e5668;
  --line: #96aab6;
  --accent: #166854;
  --soft: #e0e8ed;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  background: #d3dde3;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 16px;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #e4ebef 0, #d3dde3 52%, #c3d1da 100%);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input {
  touch-action: manipulation;
}
.auth-card {
  width: min(100%, 480px);
  background: #f5f7f8;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 72px #18304712;
}
.auth-banner {
  background: #080b0d;
  color: #fff;
  padding: 10px 32px 24px;
  text-align: center;
  border-bottom: 1px solid #263037;
}
.brand-logo {
  display: block;
  width: 250px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  filter: grayscale(1) invert(1);
  mix-blend-mode: screen;
}
.auth-body {
  padding: 30px 36px;
}
.wordmark {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.16em;
  line-height: 1.6;
}
.wordmark span {
  display: block;
  color: #b9c5ca;
  font-size: 12px;
  font-weight: 450;
  letter-spacing: 0.045em;
}
h1 {
  font-size: 29px;
  margin: 0 0 24px;
}
p {
  line-height: 1.55;
}
form {
  display: grid;
  gap: 18px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 16px;
  color: var(--muted);
}
input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--soft);
  width: 100%;
  color: var(--ink);
}
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #8bc5b5;
  outline-offset: 3px;
}
button {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  padding: 13px;
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:not(:disabled):hover {
  background: #105544;
}
.secondary:not(:disabled):hover {
  background: #e5edef;
}
.secondary {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--line);
}
a {
  color: var(--accent);
}
#authStatus {
  color: #9b3429;
  min-height: 24px;
  font-size: 16px;
}
#authInfo:empty,
#authStatus:empty {
  display: none;
}
small {
  display: block;
  color: var(--muted);
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
[hidden] {
  display: none !important;
}
#totpEnroll,
#enrollDetails {
  display: grid;
  gap: 20px;
}
#totpQr {
  display: block;
  width: min(100%, 260px);
  height: auto;
  margin: 0 auto;
  background: #fff;
  image-rendering: pixelated;
  border: 10px solid #fff;
  border-radius: 8px;
}
.manual-key {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.manual-key summary {
  font-size: 16px;
  cursor: pointer;
}
.manual-key code {
  display: block;
  margin: 14px 0;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  user-select: all;
}
.manual-key button {
  padding: 9px 12px;
  font-size: 13px;
}
.recovery-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
  gap: 12px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.recovery-list code {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.recovery-actions {
  display: grid;
  gap: 12px;
}
#mfaCode,
#enrollCode {
  font-size: 22px;
  letter-spacing: 0.15em;
}
@media (max-width: 500px) {
  body {
    padding: 14px;
  }
  .auth-body {
    padding: 26px 24px;
  }
  .auth-banner {
    padding: 6px 24px 20px;
  }
  .brand-logo {
    width: 220px;
  }
}

/* Local sign-in and profile share the edition identity. */
.auth-screen {
  --ink: #132e29;
  --muted: #47615a;
  --accent: #006349;
  background: #eaf0ed;
  padding: clamp(12px, 4vw, 56px);
}
.auth-screen .auth-card {
  width: min(100%, 880px);
  border-color: #c6d3ce;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 48px rgb(21 55 43 / 12%);
}
.auth-screen .auth-banner, .profile-page .auth-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: clamp(16px, 3.5vw, 36px);
  min-height: 142px;
  padding: 18px clamp(20px, 4vw, 42px);
  text-align: left;
  color: #fff;
  background: #070b0a;
  border-bottom: 3px solid #08765b;
}
.auth-photons { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.auth-screen .brand-logo, .profile-page .brand-logo {
  width: clamp(98px, 19vw, 162px);
  flex: 0 0 auto;
  margin: 0;
  filter: grayscale(1) invert(1);
  mix-blend-mode: screen;
}
.auth-screen .wordmark, .profile-page .wordmark {
  display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; line-height: 1.25; letter-spacing: normal;
}
.wordmark .auth-purpose { color: #a2dcc7; font-size: 12px; font-weight: 650; letter-spacing: .08em; }
.wordmark .auth-edition { color: #fff; display: block; font-size: clamp(19px, 3.2vw, 32px); font-weight: 720; letter-spacing: -.025em; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(215px, .85fr); align-items: start; }
.auth-screen .auth-body { padding: clamp(24px, 4vw, 42px); min-width: 0; }
.auth-screen h1 { font-size: clamp(25px, 3.5vw, 34px); line-height: 1.18; margin: 0 0 16px; color: #122b25; }
.auth-screen form { gap: 16px; }
.auth-screen label { color: #193c31; font-weight: 600; font-size: 15px; gap: 6px; }
.auth-screen input { background: #fff; border: 1px solid #8ba198; border-radius: 7px; padding: 11px 13px; min-height: 45px; }
.auth-screen button { min-height: 45px; border-radius: 7px; }
.auth-screen button:not(.secondary) { color: #fff; background: #006349; border-color: #006349; }
.auth-screen button:not(.secondary):hover:not(:disabled) { background: #004d39; }
.auth-screen .secondary { background: #f5f8f6; border-color: #809890; }
.auth-screen :is(button, input, a, summary):focus-visible { outline: 3px solid #00654d; outline-offset: 3px; }
.auth-screen #authInfo { color: var(--muted); font-size: 15px; }
.auth-screen #authStatus:not(:empty) { padding: 10px 12px; border-inline-start: 3px solid #aa472b; }
.auth-screen [hidden] { display: none !important; }
.auth-steps { margin: clamp(24px, 4vw, 42px) clamp(24px, 4vw, 38px) 26px 0; padding: 20px; color: #2a463b; background: #f1f6f3; border: 1px solid #cbd8d1; border-radius: 10px; }
.auth-steps h2 { color: #173d2f; font-size: 16px; margin: 0 0 12px; line-height: 1.3; }
.auth-steps ol { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.auth-steps li { display: grid; grid-template-columns: 8px 1fr; gap: 9px; align-items: baseline; font-size: 14px; line-height: 1.35; }
.auth-steps li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1px solid #82978b; }
.auth-steps li[data-state="done"]::before { background: #087653; border-color: #087653; }
.auth-steps progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 3px; background: #cedbd3; accent-color: #087653; }
.auth-steps progress::-webkit-progress-bar { background: #cedbd3; border-radius: 3px; }
.auth-steps progress::-webkit-progress-value { background: #087653; border-radius: 3px; }
.auth-footer { height: 9px; background: #087356; }
.auth-screen .recovery-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); }
@media (max-width: 650px) {
  .auth-screen { place-items: start center; }
  .auth-screen .auth-banner, .profile-page .auth-banner { min-height: 118px; padding: 14px; gap: 8px; }
  .auth-screen .auth-banner .brand-logo, .profile-page .auth-banner .brand-logo { width: clamp(76px, 23vw, 118px); }
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-screen .auth-body { padding: 22px 18px 16px; }
  .auth-steps { margin: 0 18px 22px; padding: 14px 16px; }
  .auth-steps ol { margin-top: 10px; gap: 5px; }
  .wordmark .auth-purpose { font-size: 11px; letter-spacing: .03em; }
}

.auth-step-heading { display: flex; align-items: center; gap: 14px; }
.auth-step-heading h2 { margin: 0; white-space: nowrap; }
.auth-step-heading progress { min-width: 40px; flex: 1; width: auto; }
.auth-local-state { margin: 10px 0 0; font-size: 14px; line-height: 1.4; color: #305b47; }

.auth-sparks > circle { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .auth-sparks > circle { animation-duration: 1150ms; animation-fill-mode: both; animation-timing-function: ease-out; animation-iteration-count: 1; }
  .auth-sparks > circle:nth-child(1) { animation-name: auth-spark-high; }
  .auth-sparks > circle:nth-child(2) { animation-name: auth-spark-low; animation-delay: 80ms; }
  .auth-sparks > circle:nth-child(3) { animation-name: auth-spark-mid; animation-delay: 150ms; }
}
@keyframes auth-spark-high {
  0% { transform: translate(0,0); opacity: 0; } 9% { opacity: .9; }
  56% { transform: translate(355px,-54px); opacity: .78; } 100% { transform: translate(755px,-67px); opacity: 0; }
}
@keyframes auth-spark-low {
  0% { transform: translate(0,0); opacity: 0; } 9% { opacity: .9; }
  56% { transform: translate(355px,46px); opacity: .78; } 100% { transform: translate(755px,35px); opacity: 0; }
}
@keyframes auth-spark-mid {
  0% { transform: translate(0,0); opacity: 0; } 9% { opacity: .9; }
  56% { transform: translate(355px,-17px); opacity: .8; } 100% { transform: translate(755px,-32px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .auth-sparks { display: none; } }
