/* Temple auth pages (sign-in, password, verification, invitation). Tokens only. */

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

body.auth {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  font-family: var(--tp-font);
  font-size: var(--tp-text-body);
  line-height: var(--tp-leading-body);
  color: var(--tp-text);
  background: var(--tp-bg-subtle);
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 960px) { body.auth { grid-template-columns: minmax(360px, 560px) minmax(0, 1fr); } }

img { display: block; max-width: 100%; height: auto; }
a { color: var(--tp-action); }
a:hover { color: var(--tp-action-hover); }
:focus-visible { outline: none; box-shadow: var(--tp-focus-ring); border-radius: var(--tp-radius-sm); }

.skip-link { position: absolute; left: var(--tp-space-4); top: -100px; z-index: 10; background: var(--tp-white); color: var(--tp-text-strong); padding: var(--tp-space-2) var(--tp-space-4); border-radius: var(--tp-radius-sm); }
.skip-link:focus { top: var(--tp-space-4); }

/* Brand panel */
.auth-aside {
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--tp-space-8);
  padding: var(--tp-space-7);
  background: linear-gradient(180deg, var(--tp-inverse-bg) 0%, var(--tp-inverse-bg-deep) 100%);
  color: var(--tp-inverse-text-muted);
}
@media (min-width: 960px) { .auth-aside { display: flex; position: sticky; top: 0; height: 100vh; } }
.auth-brand img { height: 22px; width: auto; }
.auth-aside-body { max-width: 30rem; }
.auth-eyebrow { margin: 0 0 var(--tp-space-3); font-size: var(--tp-text-label); font-weight: var(--tp-weight-semibold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tp-inverse-text-muted); }
.auth-aside-title { margin: 0; color: var(--tp-inverse-text); font-size: var(--tp-text-h2); line-height: var(--tp-leading-tight); font-weight: var(--tp-weight-semibold); letter-spacing: -0.01em; }
.auth-aside-text { margin: var(--tp-space-4) 0 0; font-size: var(--tp-text-lead); }
.auth-aside-text:empty { display: none; }
.auth-points { list-style: none; margin: var(--tp-space-6) 0 0; padding: 0; display: grid; gap: var(--tp-space-3); }
.auth-points li { position: relative; padding-left: var(--tp-space-6); }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 12px; height: 12px; border-radius: var(--tp-radius-pill); background: var(--tp-brand-400); }
.auth-aside-foot { margin: auto 0 0; font-size: var(--tp-text-small); }

/* Form side */
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--tp-space-5); width: 100%; max-width: 1040px; justify-self: center; padding: var(--tp-space-6) var(--tp-gutter); min-width: 0; }
@media (min-width: 960px) { .auth-main { padding: var(--tp-space-8) var(--tp-space-7); } }
.auth-brand--mobile { align-self: center; }
@media (min-width: 960px) { .auth-brand--mobile { display: none; } }
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-card-lg);
  box-shadow: var(--tp-shadow-2);
  padding: var(--tp-space-6) var(--tp-space-5);
}
@media (min-width: 480px) { .auth-card { padding: var(--tp-space-7) var(--tp-space-6); } }
.auth-card--wide { max-width: 560px; }
.auth-help { margin: 0; font-size: var(--tp-text-small); color: var(--tp-text-muted); text-align: center; }

.auth-heading { margin-bottom: var(--tp-space-6); }
.auth-heading h1 { margin: 0; font-size: var(--tp-text-h3); line-height: var(--tp-leading-tight); color: var(--tp-text-strong); font-weight: var(--tp-weight-semibold); }
.auth-heading p { margin: var(--tp-space-2) 0 0; color: var(--tp-text-muted); }
.auth-step { margin: 0 0 var(--tp-space-2); font-size: var(--tp-text-label); font-weight: var(--tp-weight-semibold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--tp-accent-700); }

/* Alerts */
.auth-alerts { display: grid; gap: var(--tp-space-3); margin-bottom: var(--tp-space-5); }
.auth-alert { padding: var(--tp-space-3) var(--tp-space-4); border-radius: var(--tp-radius-sm); font-size: var(--tp-text-small); border: 1px solid transparent; }
.auth-alert--danger { background: var(--tp-danger-100); color: var(--tp-danger-700); border-color: rgba(163, 38, 46, 0.2); }
.auth-alert--warning { background: var(--tp-warning-100); color: var(--tp-warning-700); border-color: rgba(138, 90, 0, 0.2); }
.auth-alert--success { background: var(--tp-success-100); color: var(--tp-success-700); border-color: rgba(30, 107, 71, 0.2); }
.auth-alert--info, .auth-alert--message { background: var(--tp-info-100); color: var(--tp-info-700); border-color: rgba(6, 78, 111, 0.2); }

/* Fields */
.auth-form { display: grid; gap: var(--tp-space-5); }
.auth-row { display: grid; gap: var(--tp-space-5); }
@media (min-width: 480px) { .auth-row--2 { grid-template-columns: 1fr 1fr; } }
.auth-field { display: grid; gap: var(--tp-space-2); min-width: 0; }
.auth-field label { font-size: var(--tp-text-small); font-weight: var(--tp-weight-semibold); color: var(--tp-text-strong); }
.auth-field input, .auth-field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font: inherit;
  color: var(--tp-text);
  background: var(--tp-white);
  border: 1px solid var(--tp-border-control);
  border-radius: var(--tp-radius-sm);
  transition: border-color var(--tp-duration-fast) var(--tp-ease), box-shadow var(--tp-duration-fast) var(--tp-ease);
}
.auth-field input:focus, .auth-field select:focus { outline: none; border-color: var(--tp-accent-500); box-shadow: 0 0 0 3px var(--tp-accent-100); }
.auth-field--invalid input, .auth-field--invalid select { border-color: var(--tp-danger-700); }
.auth-hint { margin: 0; font-size: var(--tp-text-small); color: var(--tp-text-muted); }
.auth-error:empty { display: none; }
.auth-error { margin: 0; font-size: var(--tp-text-small); color: var(--tp-danger-700); font-weight: var(--tp-weight-medium); }
.auth-readonly { padding: var(--tp-space-3) var(--tp-space-4); border-radius: var(--tp-radius-sm); background: var(--tp-neutral-100); color: var(--tp-text); word-break: break-word; }

.auth-check { display: flex; gap: var(--tp-space-3); align-items: flex-start; font-size: var(--tp-text-small); }
.auth-field .auth-check { line-height: 1.5rem; font-weight: var(--tp-weight-regular); color: var(--tp-text); }
.auth-field .auth-check input { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 2px 0 0; border-radius: 4px; accent-color: var(--tp-accent-700); flex: none; }

.auth-panel { padding: var(--tp-space-4); border-radius: var(--tp-radius-card); background: var(--tp-brand-50); border: 1px solid var(--tp-border); font-size: var(--tp-text-small); color: var(--tp-text); }
.auth-panel strong { color: var(--tp-text-strong); }

/* Actions */
.auth-actions { display: grid; gap: var(--tp-space-3); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--tp-space-3); font-size: var(--tp-text-small); font-weight: var(--tp-weight-semibold); }
.auth-foot { margin: var(--tp-space-6) 0 0; font-size: var(--tp-text-small); color: var(--tp-text-muted); text-align: center; }
.auth-foot a { font-weight: var(--tp-weight-semibold); }
.auth-step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tp-space-3); margin-top: var(--tp-space-2); }
.auth-step-actions [data-action="next"], .auth-step-actions [data-action="submit"] { margin-left: auto; min-width: 9rem; }
@media (max-width: 479px) { .auth-step-actions .btn { flex: 1 1 100%; margin-left: 0; } .auth-step-actions [data-action="prev"] { order: 2; } }

/* A8: secondary links underline on hover only; body text links keep their underline. */
.auth-links a, .auth-foot a, .auth-help a { text-decoration: none; }
.auth-links a:hover, .auth-foot a:hover, .auth-help a:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tp-space-2);
  min-height: 48px; padding: 10px 20px; border-radius: var(--tp-radius-button);
  font: inherit; font-weight: var(--tp-weight-semibold); font-size: 0.9375rem; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--tp-duration) var(--tp-ease), border-color var(--tp-duration) var(--tp-ease);
}
.btn-primary { background: var(--tp-action); color: var(--tp-action-text); }
.btn-primary:hover { background: var(--tp-action-hover); color: var(--tp-action-text); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--tp-white); color: var(--tp-text-strong); border-color: var(--tp-border-control); }
.btn-secondary:hover { background: var(--tp-brand-50); color: var(--tp-text-strong); }
.btn-block { width: 100%; }

.is-hidden { display: none !important; }
.auth-actions--spaced { margin-top: var(--tp-space-5); }
.auth-dev-link { margin-top: var(--tp-space-5); }
.auth-card > p { margin: 0 0 var(--tp-space-4); }
.auth-label { font-size: var(--tp-text-small); font-weight: var(--tp-weight-semibold); color: var(--tp-text-strong); }
.auth-fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: var(--tp-space-4); min-width: 0; }
.auth-fieldset legend { padding: 0; margin-bottom: var(--tp-space-1); font-size: 1.0625rem; font-weight: var(--tp-weight-semibold); color: var(--tp-text-strong); }
.auth-fieldset + .auth-fieldset { padding-top: var(--tp-space-5); border-top: 1px solid var(--tp-border); }
.auth-prefix { display: flex; align-items: stretch; }
.auth-prefix span { display: inline-flex; align-items: center; padding: 0 var(--tp-space-4); background: var(--tp-neutral-100); border: 1px solid var(--tp-border-control); border-right: 0; border-radius: var(--tp-radius-sm) 0 0 var(--tp-radius-sm); font-weight: var(--tp-weight-semibold); color: var(--tp-text-strong); }
.auth-prefix input { border-radius: 0 var(--tp-radius-sm) var(--tp-radius-sm) 0 !important; }
.auth-invite-summary { display: grid; gap: var(--tp-space-3); margin-bottom: var(--tp-space-6); }
@media (min-width: 480px) { .auth-invite-summary { grid-template-columns: 1fr 1fr; } }
.auth-card:has(.auth-fieldset) { max-width: 560px; }

/* Step progress (signup A9, activation A7). The *--js parts only show once signup.js runs. */
.auth-progress { list-style: none; margin: 0 0 var(--tp-space-2); padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--tp-space-2); font-size: var(--tp-text-small); color: var(--tp-text-muted); }
.auth-progress li { padding-top: var(--tp-space-3); border-top: 4px solid var(--tp-neutral-100); }
.auth-progress li.is-done { border-top-color: var(--tp-accent-500); }
.auth-progress li.is-current { border-top-color: var(--tp-accent-700); color: var(--tp-text-strong); font-weight: var(--tp-weight-semibold); }
form:not(.is-stepped) .auth-step--js, form:not(.is-stepped) .auth-progress--js { display: none; }
.is-stepped .auth-fieldset + .auth-fieldset { padding-top: 0; border-top: 0; }

/* Wide card for longer forms (cardholder activation, A7). One column below 480 px. */
.auth-card.auth-card--wide { max-width: 720px; }
@media (min-width: 720px) { .auth-card--wide { padding: var(--tp-space-7) var(--tp-space-7); } }
.auth-row-note { margin: 0; align-self: start; }
@media (min-width: 480px) { .auth-row-note { padding-top: 30px; } }
.auth-row-spacer { display: none; }
@media (min-width: 480px) { .auth-row-spacer { display: block; } }
.auth-fieldset .auth-invite-summary { margin-bottom: 0; }
