body.auth-page {
  --auth-panel: rgba(15, 23, 42, 0.96);
  --auth-panel-soft: rgba(30, 41, 59, 0.9);
  --auth-line: rgba(148, 163, 184, 0.28);
  --auth-text: #f8fafc;
  --auth-muted: #b7c2d1;
  --auth-link: #67e8f9;
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  place-items: center;
  overflow-x: hidden;
  padding: clamp(4.75rem, 8vw, 6.5rem) clamp(1rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem);
  background-color: #07111f !important;
  color: var(--auth-text);
}

body.auth-page::before,
body.auth-page::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  pointer-events: none;
}

body.auth-page::before {
  inset: -1.5rem;
  background: url("assets/catmind-auth-cat.jpg") center 43% / cover no-repeat;
  filter: blur(10px) saturate(0.72);
  opacity: 0.16;
  transform: scale(1.04);
}

body.auth-page::after {
  z-index: -1;
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 211, 238, 0.16), transparent 34rem),
    radial-gradient(circle at 88% 75%, rgba(59, 130, 246, 0.18), transparent 35rem),
    rgba(2, 8, 23, 0.78);
}

.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(18rem, 0.78fr);
  width: min(62rem, 100%);
  height: min(43rem, calc(100svh - 7rem));
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: 1.75rem;
  background: var(--auth-panel);
  box-shadow: 0 2rem 6rem rgba(2, 8, 23, 0.38), 0 0.35rem 1.2rem rgba(2, 8, 23, 0.22);
}

.auth-panel {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  padding: clamp(1.75rem, 4vw, 3.25rem);
  background: linear-gradient(145deg, var(--auth-panel) 0%, var(--auth-panel) 72%, var(--auth-panel-soft) 100%);
}

.auth-brand {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: clamp(1.35rem, 3vh, 1.9rem);
}

.auth-brand .theme-logo {
  width: auto;
  height: 2.8rem;
  max-width: 11rem;
}

.auth-title {
  margin: 0;
  color: var(--auth-text);
  font-size: clamp(1.9rem, 3.5vw, 2.4rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-align: start;
}

.auth-subtitle {
  margin: 0.55rem 0 1.6rem;
  color: var(--auth-muted);
  font-size: 0.98rem;
  line-height: 1.55;
  text-align: start;
}

.auth-provider {
  margin-bottom: 1.35rem;
}

.auth-provider .google-auth-button {
  min-height: 3.15rem;
  gap: 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.35rem;
  color: var(--auth-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--auth-line);
  content: "";
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-field {
  width: 100%;
  min-height: 3.15rem;
  border: 1px solid rgba(148, 163, 184, 0.52);
  border-radius: 0.85rem;
  outline: none;
  background: rgba(30, 41, 59, 0.88);
  padding: 0.78rem 1rem;
  color: var(--auth-text);
  box-shadow: inset 0 1px 2px rgba(2, 8, 23, 0.2);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.auth-field::placeholder {
  color: #94a3b8;
}

.auth-field:hover {
  border-color: rgba(103, 232, 249, 0.62);
}

.auth-field:focus {
  border-color: #22d3ee;
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18), inset 0 1px 2px rgba(2, 8, 23, 0.16);
}

.auth-primary-button {
  min-height: 3.15rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
  padding: 0.8rem 1.25rem;
  color: #fff !important;
  font-weight: 800;
  box-shadow: 0 0.8rem 1.8rem rgba(8, 145, 178, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.auth-primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow: 0 1rem 2.1rem rgba(8, 145, 178, 0.28);
}

.auth-primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.auth-form-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.auth-page .auth-link {
  color: var(--auth-link);
  font-weight: 700;
  text-decoration: none;
}

.auth-page .auth-link:hover,
.auth-page .auth-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.auth-message {
  min-height: 1.25rem;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.84rem;
}

.auth-switch {
  margin: 1.35rem 0 0;
  color: var(--auth-muted);
  font-size: 0.86rem;
  text-align: center;
}

.auth-page .registration-legal-note {
  max-width: 29rem;
  margin: 2rem auto 0;
  color: var(--auth-muted);
  font-size: 0.68rem;
  line-height: 1.55;
  text-align: center;
}

body.auth-register-page .auth-brand {
  margin-bottom: 1.2rem;
}

body.auth-register-page .auth-subtitle {
  margin-bottom: 1.25rem;
}

body.auth-register-page .auth-provider {
  margin-bottom: 1rem;
}

body.auth-register-page .auth-divider {
  margin-top: 1rem;
}

body.auth-register-page .auth-form {
  gap: 0.8rem;
}

body.auth-register-page .password-tools {
  gap: 0.45rem;
  margin-top: 0.4rem;
}

body.auth-register-page .password-tool-button {
  min-height: 2.2rem;
  padding: 0.35rem 0.65rem;
}

body.auth-register-page .password-generated-status:empty,
body.auth-register-page .auth-message:empty {
  display: none;
}

body.auth-register-page .auth-switch {
  margin-top: 1rem;
}

body.auth-register-page .registration-legal-note {
  margin-top: 0.9rem;
}

body.auth-page .registration-legal-note a,
html:not([data-theme="dark"]) body.auth-page .registration-legal-note a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

body.auth-page .registration-legal-note a:hover,
body.auth-page .registration-legal-note a:focus-visible {
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 0.15rem;
}

.auth-visual {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #dce6e5;
}

.auth-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 59% 50%;
  filter: saturate(0.72) contrast(0.94);
  opacity: 0.88;
  transform: scale(1.015);
}

.auth-visual::before,
.auth-visual::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
}

.auth-visual::before {
  background: linear-gradient(90deg, var(--auth-panel) 0%, rgba(15, 23, 42, 0.18) 17%, transparent 43%);
}

.auth-visual::after {
  background:
    linear-gradient(180deg, rgba(8, 145, 178, 0.05), rgba(15, 23, 42, 0.2)),
    radial-gradient(circle at 55% 35%, transparent 0%, rgba(15, 23, 42, 0.12) 100%);
}

.auth-close {
  position: absolute;
  z-index: 5;
  top: 1rem;
  inset-inline-end: 1rem;
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  font-size: 1.35rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 0.45rem 1.2rem rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  transition: transform 160ms ease, background-color 160ms ease;
}

.auth-close:hover {
  transform: scale(1.04);
  background: #fff;
}

html:not([data-theme="dark"]) body.auth-page {
  --auth-panel: rgba(255, 255, 255, 0.97);
  --auth-panel-soft: rgba(247, 250, 249, 0.98);
  --auth-line: rgba(100, 116, 139, 0.24);
  --auth-text: #172033;
  --auth-muted: #5f6878;
  --auth-link: #075f75;
  display: grid;
  background-color: #e9eeec !important;
  color: var(--auth-text) !important;
}

html:not([data-theme="dark"]) body.auth-page::before {
  filter: blur(11px) saturate(0.58);
  opacity: 0.2;
}

html:not([data-theme="dark"]) body.auth-page::after {
  background:
    radial-gradient(circle at 16% 22%, rgba(255, 255, 255, 0.78), transparent 32rem),
    radial-gradient(circle at 86% 78%, rgba(14, 165, 233, 0.13), transparent 32rem),
    rgba(234, 238, 235, 0.78);
}

html:not([data-theme="dark"]) .auth-shell {
  border-color: rgba(148, 163, 184, 0.3);
  background: var(--auth-panel);
  box-shadow: 0 2rem 6rem rgba(51, 65, 85, 0.2), 0 0.35rem 1.2rem rgba(51, 65, 85, 0.1);
}

/* Override the legacy light-theme auth rule in theme.css that sets main to 100% width. */
html:not([data-theme="dark"]) body.auth-page main.auth-shell {
  width: min(62rem, 100%);
}

html:not([data-theme="dark"]) .auth-visual::before {
  background: linear-gradient(90deg, var(--auth-panel) 0%, rgba(255, 255, 255, 0.28) 17%, transparent 43%);
}

html:not([data-theme="dark"]) body.auth-page .auth-field {
  border-color: #aeb8bd !important;
  background-color: #f4f7f6 !important;
  color: var(--auth-text) !important;
}

html:not([data-theme="dark"]) body.auth-page .auth-field:hover {
  border-color: #87949c !important;
  background-color: #f0f5f5 !important;
}

html:not([data-theme="dark"]) body.auth-page .auth-field:focus {
  border-color: #0891b2 !important;
  background-color: #f7fdff !important;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.16), inset 0 1px 2px rgba(51, 65, 85, 0.05);
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(35rem, 100%);
    height: auto;
    min-height: 0;
  }

  .auth-panel {
    min-height: min(42rem, calc(100svh - 7rem));
  }

  .auth-visual {
    display: none;
  }

  .auth-close {
    background: var(--auth-panel-soft);
    color: var(--auth-text);
  }
}

@media (max-width: 640px) {
  body.auth-page,
  html:not([data-theme="dark"]) body.auth-page {
    align-items: start;
    padding: 4.4rem 0.75rem max(0.75rem, env(safe-area-inset-bottom)) !important;
  }

  .auth-shell {
    border-radius: 1.25rem;
  }

  .auth-panel {
    min-height: calc(100svh - 5.15rem);
    justify-content: flex-start;
    padding: 3.75rem 1.25rem 1.5rem;
  }

  .auth-brand {
    margin-bottom: 1.6rem;
  }

  .auth-brand .theme-logo {
    height: 2.75rem;
    max-width: 10.5rem;
  }

  .auth-title {
    font-size: clamp(1.85rem, 9vw, 2.3rem);
  }

  .auth-subtitle {
    margin-bottom: 1.5rem;
  }

  .auth-form-tools {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-primary-button,
  .auth-close,
  .auth-field {
    transition: none;
  }
}
