.auth-loading > .app-shell,
.auth-loading > .desktop-shell,
.auth-locked > .app-shell,
.auth-locked > .desktop-shell {
  visibility: hidden;
}

.auth-gate[hidden],
.auth-gate .is-hidden {
  display: none !important;
}

.auth-gate {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  min-width: 0;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  place-items: center;
  background: var(--canvas, #101214);
  color: var(--ink, #f4f4f0);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.auth-card {
  width: min(100%, 420px);
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--line-strong, #3a4143);
  border-radius: 14px;
  background: var(--surface, #15181a);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.24);
}

.auth-heading {
  margin-bottom: 26px;
}

.auth-heading[data-mode="login"] {
  margin-bottom: 26px;
}

.auth-heading[data-mode="login"] h1,
.auth-heading[data-mode="login"] p {
  display: none;
}

.auth-heading[data-mode="login"] .auth-product-wordmark {
  margin-bottom: 0;
}

.auth-product-wordmark {
  display: block;
  width: max-content;
  margin-bottom: 12px;
  color: var(--ink, #f3f4f0);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  line-height: 1.15;
}

.auth-heading span {
  color: var(--accent, #55a9a0);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-heading h1 {
  margin: 8px 0 6px;
  color: var(--ink, #f4f4f0);
  font-size: clamp(1.65rem, 5vw, 2rem);
  line-height: 1.08;
}

.auth-heading p,
.auth-denied p {
  margin: 0;
  color: var(--muted, #9da19f);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted, #9da19f);
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong, #3a4143);
  border-radius: 8px;
  outline: none;
  background: var(--field, #141719);
  color: var(--ink, #f4f4f0);
  font-size: 1rem;
}

.auth-form input:focus {
  border-color: var(--accent, #55a9a0);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(85, 169, 160, 0.13));
}

.auth-password-control {
  position: relative;
  display: block;
}

.auth-password-control > input {
  padding-right: 52px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 8px;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #9da19f);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  background: var(--accent-soft, rgba(85, 169, 160, 0.13));
  color: var(--ink, #f4f4f0);
}

.auth-password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-password-toggle [data-eye-closed] {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] [data-eye-open] {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] [data-eye-closed] {
  display: initial;
}

.auth-name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-setup-note {
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--accent, #55a9a0) 45%, var(--line-strong, #3a4143));
  border-radius: 8px;
  background: var(--accent-soft, rgba(85, 169, 160, 0.13));
  color: var(--accent-strong, #69beb4);
  font-size: 0.78rem;
  font-weight: 750;
}

.auth-form-hint {
  margin: 0;
  color: var(--muted, #9da19f);
  font-size: 0.76rem;
  line-height: 1.5;
}

.auth-primary,
.auth-secondary {
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 760;
}

.auth-primary {
  margin-top: 3px;
  background: var(--accent, #55a9a0);
  color: #101514;
}

.auth-secondary {
  margin-top: 18px;
  border-color: var(--line-strong, #3a4143);
  background: transparent;
  color: var(--ink, #f4f4f0);
}

.auth-link {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--accent-strong, #69beb4);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-form.is-busy {
  opacity: 0.66;
}

.auth-message {
  margin: -8px 0 18px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong, #3a4143);
  border-radius: 7px;
  color: var(--ink-soft, #d6d7d2);
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-message[data-kind="error"] {
  border-color: color-mix(in srgb, var(--danger, #ef6d6d) 55%, var(--line-strong, #3a4143));
  background: color-mix(in srgb, var(--danger, #ef6d6d) 10%, transparent);
  color: var(--danger, #ef6d6d);
}

.auth-message[data-kind="success"] {
  border-color: color-mix(in srgb, var(--success, #51cf91) 50%, var(--line-strong, #3a4143));
  background: color-mix(in srgb, var(--success, #51cf91) 9%, transparent);
  color: var(--success, #51cf91);
}

.auth-denied strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

[data-auth-sign-out].auth-settings-signout {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: 1px solid var(--line-strong, #3a4143);
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #9da19f);
  font-weight: 700;
}

.auth-preview [data-auth-sign-out] {
  display: none;
}

@media (max-width: 600px) {
  .auth-gate {
    align-items: end;
    padding-inline: 14px;
  }

  .auth-card {
    border-radius: 14px 14px 8px 8px;
  }

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