/* ----------------------------------------------------------------------------
 * Shared stylesheet for the auth pages: /login, /signup, /pending,
 * /reset-password. Tokens mirror the deck's design tokens (--color-bg,
 * --color-surface, etc.) so the visual reads as the same product.
 * ---------------------------------------------------------------------------- */

:root {
  --color-bg: #0a0a0b;
  --color-surface: #131316;
  --color-border: #26262b;
  --color-text: #f4f4f5;
  --color-text-muted: #a1a1aa;
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --color-accent-warm: #f59e0b;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------------------------------- layout */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 2rem 1.75rem;
}

.auth-card--wide {
  max-width: 480px;
}

.brand {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* Logo variant of the brand mark — used in place of .brand on /login.html.
 * Sized larger than the text brand and horizontally centered in the card. */
.brand-logo {
  display: block;
  height: 48px;
  width: auto;
  margin: 0 auto 1.75rem;
  user-select: none;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.subtitle {
  margin: 0 0 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ------------------------------------------------------------- form fields */

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

input[type='email'],
input[type='password'],
input[type='text'],
textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 120ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--color-accent);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.field {
  margin-bottom: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 420px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .field-row > div {
    margin-bottom: 1rem;
  }
}

.field-hint {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ------------------------------------------------------------- buttons */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 120ms ease,
    opacity 120ms ease,
    border-color 120ms ease;
  text-decoration: none;
}

button:hover,
.btn:hover {
  background: var(--color-accent-hover);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-text-muted);
}

/* --------------------------------------------- Sign in with Google button
 *
 * Built to Google's Identity branding guidelines (dark theme) rather than
 * hand-rolled. Google specifies the surface (#131314), stroke (#8E918F),
 * label colour (#E3E3E3), Roboto Medium 14px, a 40px control, a 4px radius,
 * a 20px logo inset 12px from the leading edge, and the wording
 * "Sign in with Google". A near-miss version of this button — off-spec
 * sizing, the wording "Continue with Google", the G mark inlined by hand —
 * is one of the strongest phishing signals an automated classifier reads off
 * a login page, and this origin was listed for social engineering on
 * 24 Aug 2026. Keep it on spec.
 */

.gsi-material-button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-appearance: none;
  background-color: #131314;
  background-image: none;
  border: 1px solid #8e918f;
  border-radius: 4px;
  box-sizing: border-box;
  color: #e3e3e3;
  cursor: pointer;
  font-family: 'Roboto', arial, sans-serif;
  font-size: 14px;
  height: 40px;
  letter-spacing: 0.25px;
  outline: none;
  overflow: hidden;
  padding: 0 12px;
  position: relative;
  text-align: center;
  transition:
    background-color 0.218s,
    border-color 0.218s,
    box-shadow 0.218s;
  vertical-align: middle;
  white-space: nowrap;
  width: 100%;
  min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
  height: 20px;
  margin-right: 12px;
  min-width: 20px;
  width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: 100%;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
  flex-grow: 1;
  font-family: 'Roboto', arial, sans-serif;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
  transition: opacity 0.218s;
  bottom: 0;
  left: 0;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.gsi-material-button:disabled {
  cursor: default;
  background-color: #13131461;
  border-color: #8e918f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents,
.gsi-material-button:disabled .gsi-material-button-icon {
  opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
  background-color: white;
  opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
  box-shadow:
    0 1px 2px 0 rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
  background-color: white;
  opacity: 8%;
}

/* ------------------------------------------- site context + legal footer */

.brand-logo-link {
  display: inline-block;
  text-decoration: none;
}

.auth-context {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: -0.5rem 0 1.5rem;
}

.auth-context strong {
  color: var(--color-text);
  font-weight: 600;
}

.auth-context a {
  color: var(--color-accent);
  text-decoration: none;
}

.auth-context a:hover {
  text-decoration: underline;
}

.auth-legal {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: #71717a;
  text-align: center;
}

.auth-legal a {
  color: #71717a;
  text-decoration: none;
}

.auth-legal a:hover {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.auth-legal .sep {
  margin: 0 0.4rem;
  color: #52525b;
}

/* ------------------------------------------------------------- divider */

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ------------------------------------------------------------- messages */

.error-msg,
.success-msg,
.info-msg,
.warm-msg {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.error-msg {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.success-msg {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.info-msg {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.warm-msg {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

/* ------------------------------------------------------------- links + footer */

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
}

.footer-links a {
  color: var(--color-text);
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-links .sep {
  color: var(--color-border);
  margin: 0 0.5rem;
}

/* ------------------------------------------------------------- account info row */

.user-row {
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.875rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.875rem;
}

.user-row .user-row__label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.user-row .user-row__value {
  color: var(--color-text);
  word-break: break-all;
}

/* ------------------------------------------------------------- auth guard loading state
 * Same rules as the inline block in /index.html, kept here so pages that
 * use enforceAccess() (currently /pending.html) hide content cleanly. */

body.auth-loading > * {
  visibility: hidden;
}

body.auth-loading::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.7);
  animation: auth-spin 0.85s linear infinite;
  z-index: 9999;
}

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