/* RateFileAI v2 focused authentication and onboarding surfaces. */

html,
body {
  min-height: 100%;
}

body.auth-page {
  margin: 0;
  background: var(--page);
}

.auth-skip {
  position: fixed;
  left: -9999px;
  top: var(--s3);
  z-index: 100;
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--surface);
  padding: 9px 14px;
  font-weight: 600;
}

.auth-skip:focus {
  left: var(--s3);
  color: var(--surface);
}

.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(300px, .88fr) minmax(420px, 1.12fr);
}

.auth-brand-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(var(--s5), 4vw, var(--s7));
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  color: var(--ink);
  font: 700 15px var(--font-display);
  text-decoration: none;
}

.auth-brand:hover {
  text-decoration: none;
}

.auth-brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 7px;
  background: var(--brand);
  color: var(--on-brand);
  font: 700 12px var(--font-display);
}

.auth-brand-copy {
  max-width: 390px;
  margin: auto 0;
  padding-block: var(--s7);
}

.auth-brand-copy h2 {
  max-width: 360px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.13;
}

.auth-proof {
  margin-top: var(--s5);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--subtle);
  padding: var(--s4);
}

.auth-proof-list {
  display: grid;
  gap: 10px;
  margin: var(--s3) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 12.5px;
}

.auth-proof-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.auth-proof-list li::before {
  content: "\2713";
  color: var(--ok);
  font-weight: 700;
}

.auth-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  color: var(--ink-3);
  font-size: 11.5px;
}

.auth-main {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(var(--s4), 5vw, var(--s8)) var(--s4);
}

.auth-main:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -4px;
}

.auth-panel {
  width: min(100%, 430px);
}

.auth-panel-wide {
  width: min(100%, 1040px);
}

.auth-heading {
  margin-bottom: var(--s5);
}

.auth-heading h1 {
  font-size: 24px;
  line-height: 1.2;
}

.auth-heading p {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.auth-mount {
  min-height: 326px;
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: var(--s4);
  color: var(--ink-2);
  font-size: 13px;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: var(--r-pill);
  animation: auth-spin .8s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-state {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: var(--s5);
}

.auth-state h2 {
  font-size: 16px;
}

.auth-state p {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.auth-state-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s4);
}

.auth-form {
  display: grid;
  gap: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: var(--s5);
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.auth-form-status {
  min-height: 20px;
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}

.auth-form-status[data-tone="error"] {
  color: var(--up);
}

.auth-form-status[data-tone="success"] {
  color: var(--down);
}

.auth-form input,
.auth-form select,
.auth-form button,
.auth-state-actions a,
.auth-state-actions button {
  min-height: 44px;
}

.auth-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.auth-context {
  margin-top: var(--s5);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--subtle);
  padding: var(--s3) var(--s4);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.55;
}

.auth-alternate {
  margin: var(--s5) 0 0;
  color: var(--ink-2);
  font-size: 12.5px;
}

.auth-unavailable {
  margin-bottom: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--hatch);
  padding: var(--s3) var(--s4);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-unavailable strong {
  color: var(--ink);
}

.auth-role-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(var(--s4), 4vw, var(--s7));
}

.auth-role-shell > header {
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.auth-role-head {
  max-width: 760px;
  margin: var(--s7) auto 0;
}

.auth-role-grid {
  max-width: 1040px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
  margin: var(--s5) auto 0;
}

.auth-role-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: var(--s4);
}

.auth-role-card[data-preview-active="true"] {
  border-color: var(--brand);
  box-shadow: var(--focus);
}

.auth-role-card h2 {
  font-size: 14px;
}

.auth-role-card p {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-role-card ul {
  margin: var(--s3) 0 0;
  padding-left: 18px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.65;
}

.auth-role-card .auth-role-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: auto;
  padding-top: var(--s4);
}

.auth-role-status {
  max-width: 1040px;
  margin: var(--s4) auto 0;
}

.auth-role-continue {
  max-width: 1040px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s3);
  margin: var(--s4) auto 0;
  border-top: 1px solid var(--line);
  padding-top: var(--s4);
}

@media (max-width: 820px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: var(--s4) var(--s5);
  }

  .auth-brand-copy {
    margin: var(--s5) 0 0;
    padding: 0;
  }

  .auth-proof {
    display: none;
  }

  .auth-footer-links {
    margin-top: var(--s4);
  }

  .auth-main {
    place-items: start center;
    padding-block: var(--s6);
  }

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

@media (max-width: 480px) {
  .auth-brand-copy {
    display: none;
  }

  .auth-main {
    padding: var(--s5) var(--s3);
  }

  .auth-form,
  .auth-state {
    padding: var(--s4);
  }

  .auth-role-shell {
    padding: var(--s4);
  }

  .auth-role-head {
    margin-top: var(--s6);
  }

  .auth-role-shell > header [data-role-continue] {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 44px;
    padding-block: 8px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: center;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner {
    animation: none;
  }
}
