.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  height: auto;
  margin: 0;
  padding: 28px 15px;
  overflow: auto;
  background: radial-gradient(circle at 18% 8%, #321050 0, transparent 34%), radial-gradient(circle at 82% 92%, #190a2b 0, transparent 36%), #07040b;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

.auth-card {
  box-sizing: border-box;
  min-width: 0;
  width: min(560px, 100%);
  padding: clamp(22px, 5vw, 34px);
  background: linear-gradient(150deg, rgba(25,14,38,.98), rgba(10,8,15,.99));
  border: 1px solid #513269;
  border-radius: 16px;
  box-shadow: 0 28px 80px #000, 0 0 42px #7c3aed1f;
}

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

.owner-setup,
.account-access,
.auth-card form {
  min-width: 0;
}

.auth-intro h1 {
  margin: 0;
  color: #a84dff;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.15;
}

.auth-intro { position: relative; min-height: 76px; padding-left: 88px; }
.auth-brand-mark { position: absolute; top: 0; left: 0; width: 70px; height: 70px; filter: drop-shadow(0 0 16px #9333ea66); }
.auth-intro h1 { font-weight: 950; letter-spacing: .1em; }
.auth-intro h1 span { color: #fff; }

.auth-intro > p:last-child {
  margin: 10px 0 0;
  color: #c2c7d8;
}

.auth-eyebrow,
.owner-label {
  margin: 0 0 4px;
  color: #9aa3bb;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.owner-setup {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid #2f6670;
  border-left: 4px solid var(--cyan);
  border-radius: 8px;
  background: #0b1720;
}

.owner-setup-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.owner-setup h2 {
  margin: 8px 0;
  font-size: 1.125rem;
  line-height: 1.35;
}

.owner-setup p {
  margin: 8px 0 0;
  color: #c2c7d8;
}

.local-only {
  padding: 3px 8px;
  border: 1px solid #34717b;
  border-radius: 999px;
  color: #bffcff;
  background: #102b32;
  font-size: .75rem;
  font-weight: 700;
}

.owner-setup pre {
  max-width: 100%;
  margin: 12px 0;
  padding: 11px 12px;
  overflow-x: auto;
  border: 1px solid #34384a;
  border-radius: 6px;
  background: #07090e;
  color: #d9feff;
  font-size: .875rem;
  white-space: pre;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.auth-card button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #36717a;
  border-radius: 6px;
  background: #073b43;
  color: #d3feff;
  cursor: pointer;
  font-weight: 700;
}

.auth-tabs button {
  background: #121723;
  color: #b9c0d2;
}

.auth-tabs button.on {
  border-color: var(--cyan);
  background: #0b3038;
  color: #e8ffff;
  box-shadow: inset 0 -2px var(--cyan);
}

.auth-card button:hover:not(:disabled) {
  border-color: var(--cyan);
}

.auth-card button:focus-visible,
.auth-card input:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.auth-card button:disabled {
  cursor: wait;
  opacity: .65;
}

.auth-card form {
  display: grid;
  gap: 8px;
}

.auth-card form[hidden] {
  display: none;
}

.account-access [role="tabpanel"][hidden] {
  display: none;
}

.secondary-action {
  margin-top: 2px;
  border-color: #4a5065 !important;
  background: #121723 !important;
  color: #c8cede !important;
}

.auth-card label {
  margin-top: 7px;
  color: #d7dbea;
  font-size: .9375rem;
  font-weight: 700;
}

.auth-card input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid #4a5065;
  border-radius: 5px;
  background: #080910;
  color: #fff;
  font-size: 1rem;
}

.auth-card form > button[type="submit"] {
  margin-top: 10px;
}

.form-intro {
  margin: 0 0 4px;
  color: #b7bdcf;
  font-size: .9375rem;
}

.field-help {
  margin: -2px 0 0;
  color: #aeb5c9;
  font-size: .8125rem;
}

.device-approval-wait {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #36717a;
  border-radius: 8px;
  background: #0b1720;
}

.device-approval-wait[hidden] {
  display: none;
}

.device-approval-wait p {
  margin: 0;
}

.auth-status {
  min-height: 24px;
  margin: 18px 0 0;
  color: #cbd2e4;
  font-size: .9375rem;
  font-weight: 700;
}

.auth-status[data-state="busy"] {
  color: #bffcff;
}

.auth-status[data-state="success"] {
  color: var(--bull);
}

.auth-status[data-state="error"] {
  color: #ff7b91;
}

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

@media (max-width: 600px) {
  .auth-page {
    place-items: start center;
    padding: 15px 10px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .owner-setup {
    padding: 15px;
  }

  .auth-tabs {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
