:root {
  --auth-ink: #0f172a;
  --auth-text: #334155;
  --auth-secondary: #64748b;
  --auth-brand: #2794a2;
  --auth-brand-deep: #0f766e;
  --auth-border: #dce1e6;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
html { background: #fff; }
body.auth-page {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  color: var(--auth-ink);
  font-family: 'Darker Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-kerning: normal;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
.auth-page a { color: inherit; text-decoration: none; }
.auth-page button, .auth-page input { font-family: inherit; }
.auth-header { padding: 1.35rem clamp(1.25rem, 4vw, 3.5rem); }
.auth-header-inner, .auth-footer-inner { width: min(100%, 80rem); margin: auto; }
.auth-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.auth-logo { display: inline-flex; min-height: 2.75rem; align-items: center; }
.auth-logo img { width: auto; height: 1.8rem; }
.auth-header-action { display: inline-flex; align-items: center; gap: 0.65rem; min-height: 2.75rem; font-size: 1rem; font-weight: 500; }
.auth-header-action svg, .auth-back-link svg { width: 1rem; height: 1rem; }
.auth-header-action:hover, .auth-switch a:hover { color: var(--auth-brand-deep); }

/* One small surface shared by sign-in, registration, and account recovery. */
.auth-main {
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 2rem;
}
.auth-workspace { width: min(100%, 25rem); margin: auto; }
.auth-form-panel, .auth-form-wrap { min-width: 0; width: 100%; }
.auth-title-block { margin-bottom: 1.35rem; }
.auth-title-block h1 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.55rem, 2.6vw, 1.8rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.auth-title-block p { margin: 0.65rem 0 0; color: var(--auth-secondary); font-size: 1rem; line-height: 1.5; }
.auth-form { display: grid; gap: 0.8rem; }
.auth-field { display: grid; gap: 0.4rem; }
.auth-field label { color: var(--auth-text); font-size: 1rem; font-weight: 600; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.auth-page .auth-field-link { color: var(--auth-brand-deep); font-size: 0.9rem; font-weight: 500; }
.auth-field-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-control { position: relative; }
.auth-control input {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.5rem;
  outline: 0;
  background: #fff;
  color: var(--auth-ink);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.auth-control.has-action input { padding-right: 4.25rem; }
.auth-control input::placeholder { color: var(--auth-secondary); opacity: 1; font-weight: 400; }
.auth-control input:hover { border-color: #adb8c4; }
.auth-control input:focus { border-color: var(--auth-brand); box-shadow: 0 0 0 3px #f0f9fa; }
.auth-control input:user-invalid { border-color: #b34343; }
.auth-password-toggle {
  position: absolute; top: 50%; right: 0.2rem;
  min-width: 3.75rem; min-height: 2.75rem; padding: 0 0.5rem;
  border: 0; border-radius: 0.35rem; background: transparent;
  color: var(--auth-secondary); font-size: 0.9rem; font-weight: 500;
  transform: translateY(-50%); cursor: pointer;
}
.auth-password-toggle:hover { color: var(--auth-brand-deep); background: #f0f9fa; }
.auth-field-help { margin: 0; color: var(--auth-secondary); font-size: 0.875rem; line-height: 1.4; }
.auth-consent { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.2rem 0; }
.auth-consent input { width: 1.1rem; height: 1.1rem; margin: 0.2rem 0 0; accent-color: var(--auth-brand-deep); flex: 0 0 auto; }
.auth-consent label { color: var(--auth-secondary); font-size: 0.9rem; line-height: 1.5; }
.auth-consent a { color: var(--auth-text); text-decoration: underline; text-decoration-color: #aebbc3; text-underline-offset: 3px; }
.auth-submit {
  width: 100%; min-height: 3rem; margin-top: 0.25rem; padding: 0.65rem 1rem;
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  border: 0; border-radius: 0.5rem; background: var(--auth-ink); color: #fff;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background-color 180ms ease;
}
.auth-submit-icon { display: inline-flex; align-items: center; }
.auth-submit svg { width: 1rem; height: 1rem; transition: transform 180ms ease; }
.auth-submit:hover { background: #1e293b; }
.auth-submit:hover svg { transform: translateX(3px); }
.auth-submit:disabled { cursor: wait; opacity: 0.65; }
.auth-provider-options { display: grid; gap: 0.65rem; margin-top: 0.8rem; }
.auth-provider-divider { display: flex; align-items: center; gap: 0.8rem; color: var(--auth-secondary); font-size: 0.85rem; }
.auth-provider-divider::before, .auth-provider-divider::after { content: ''; height: 1px; flex: 1; background: var(--auth-border); }
.auth-provider-button {
  display: flex; min-height: 3rem; align-items: center; justify-content: center; gap: 0.7rem;
  border: 1px solid var(--auth-border); border-radius: 0.5rem; background: #fff;
  color: var(--auth-ink); font-size: 0.98rem; font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.auth-provider-button:hover { border-color: #adb8c4; background: #f8fafc; }
.auth-provider-button svg { width: 1.1rem; height: 1.1rem; flex: none; }
.auth-provider-button:focus-visible { outline: 2px solid var(--auth-brand); outline-offset: 3px; }
.auth-provider-button.yahoo { min-height: 3rem; padding: 0.35rem 1rem; border-color: #d8ccff; background: #fff; color: #4b16c7; box-shadow: 0 8px 18px rgba(91, 43, 207, .12); }
.auth-provider-button.yahoo:hover { border-color: #bba7ff; background: #fff; }
.auth-provider-button.yahoo:focus-visible { outline-color: #6f2cff; }
.auth-provider-button.yahoo img { display: block; flex: none; width: 1.45rem; height: 1.45rem; object-fit: contain; }
.auth-switch { margin: 1rem 0 0; color: var(--auth-secondary); font-size: 0.95rem; line-height: 1.5; text-align: center; }
.auth-switch a { margin-left: 0.3rem; color: var(--auth-brand-deep); font-weight: 600; }
.auth-banner { margin-bottom: 1rem; padding: 0.8rem 1rem; border-radius: 0.5rem; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.auth-banner-error { background: #fef2f2; color: #991b1b; }
.auth-banner-success { background: #f0f9fa; color: #115e59; }
.auth-back-link { display: inline-flex; min-height: 2.75rem; margin-top: 1rem; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.auth-page .auth-success-action { display: flex; width: fit-content; min-height: 2.75rem; align-items: center; margin-top: 0.75rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-footer { padding: 0.65rem clamp(1.25rem, 4vw, 3.5rem); color: var(--auth-secondary); font-size: 0.875rem; }
.auth-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.auth-footer p { margin: 0; }
.auth-footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.auth-footer-links a { display: inline-flex; min-height: 2.75rem; align-items: center; }
.auth-footer a:hover { color: var(--auth-brand-deep); }
.auth-page a:focus-visible, .auth-page button:focus-visible, .auth-consent input:focus-visible { outline: 2px solid var(--auth-brand); outline-offset: 3px; }
@media (max-width: 640px) {
  .auth-header { padding: 1rem 1.25rem; }
  .auth-logo img { height: 1.6rem; }
  .auth-header-action { font-size: 0.95rem; }
  .auth-main { padding: 1rem 1.25rem 1.25rem; }
  .auth-title-block { margin-bottom: 1.15rem; }
  .auth-footer-inner { flex-direction: column-reverse; gap: 0.75rem; text-align: center; }
  .auth-footer-links { justify-content: center; gap: 0 1rem; }
  .auth-footer-support { flex-basis: 100%; justify-content: center; }
}

/* Keep both auth flows visible on ordinary laptop/tablet heights. The main
   row remains scrollable as a safety valve for genuinely short windows. */
@media (max-height: 760px) {
  .auth-header { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .auth-logo { min-height: 2.35rem; }
  .auth-logo img { height: 1.55rem; }
  .auth-header-action { min-height: 2.35rem; }
  .auth-main { padding-top: 0.75rem; padding-bottom: 0.9rem; }
  .auth-title-block { margin-bottom: 0.9rem; }
  .auth-title-block p { margin-top: 0.35rem; line-height: 1.3; }
  .auth-form { gap: 0.6rem; }
  .auth-field { gap: 0.25rem; }
  .auth-control input { min-height: 2.7rem; padding-top: 0.45rem; padding-bottom: 0.45rem; }
  .auth-field-help { font-size: 0.8rem; line-height: 1.25; }
  .auth-consent { gap: 0.5rem; padding: 0.05rem 0; }
  .auth-consent label { font-size: 0.82rem; line-height: 1.25; }
  .auth-submit { min-height: 2.7rem; margin-top: 0.1rem; }
  .auth-provider-options { gap: 0.45rem; margin-top: 0.55rem; }
  .auth-provider-button { min-height: 2.7rem; }
  .auth-provider-divider { gap: 0.6rem; }
  .auth-switch { margin-top: 0.65rem; font-size: 0.85rem; }
  .auth-footer { padding-top: 0.4rem; padding-bottom: 0.4rem; font-size: 0.78rem; }
  .auth-footer-links a { min-height: 2.1rem; }
}

@media (max-height: 560px) {
  /* Keep controls reachable rather than shrinking text below a comfortable
     reading size on genuinely tiny windows. */
  body.auth-page { height: auto; }
  .auth-main { align-items: flex-start; }
}

@media (max-width: 640px) and (max-height: 760px) {
  .auth-header { padding: 0.65rem 1rem; }
  .auth-main { padding: 0.55rem 1rem 0.7rem; }
  .auth-title-block { margin-bottom: 0.7rem; }
  .auth-title-block h1 { font-size: 1.45rem; }
  .auth-form { gap: 0.45rem; }
  .auth-field label { font-size: 0.9rem; }
  .auth-control input { min-height: 2.5rem; font-size: 1rem; }
  .auth-consent label { font-size: 0.78rem; }
  .auth-provider-button { min-height: 2.5rem; }
  .auth-switch { margin-top: 0.45rem; }
  .auth-footer-inner { gap: 0.35rem; }
  .auth-footer-links a { min-height: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
