/* Admin sign-in and password screens.
 *
 * One stylesheet for both, so they read as the same product. The earlier pages
 * each carried their own: a blurred photo behind a card on one, a red "error"
 * header on the other, and `overflow: hidden` on both — which on a phone with
 * the keyboard open left the submit button somewhere nobody could scroll to.
 */

:root {
  --auth-brand: #1e3a8a;
  --auth-brand-strong: #172c6b;
  --auth-brand-soft: #e8edf8;
  --auth-ink: #111827;
  --auth-muted: #5b6475;
  --auth-line: #d7dce5;
  --auth-page: #f3f5f9;
  --auth-card: #ffffff;
  --auth-ok: #15803d;
  --auth-ok-soft: #e7f5ec;
  --auth-bad: #b42318;
  --auth-bad-soft: #fdecea;
  --auth-warn-soft: #fff6e0;
  --auth-radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.auth {
  margin: 0;
  min-height: 100%;
  background: var(--auth-page);
  color: var(--auth-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Two columns on a wide screen, one on a phone. The page scrolls; nothing is
   ever clipped. */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr); }
}

/* The photo panel: the coach, unblurred, with the company line over it. Hidden
   on a phone, where it would only push the form off the screen. */
.auth-visual {
  display: none;
  position: relative;
  background: var(--auth-brand) center / cover no-repeat;
  color: #fff;
}

@media (min-width: 900px) {
  .auth-visual { display: flex; align-items: flex-end; }
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 30%, rgba(15, 23, 42, 0.78) 100%);
}

.auth-visual-copy {
  position: relative;
  z-index: 1;
  padding: 48px;
  max-width: 520px;
}

.auth-visual-copy h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.auth-visual-copy p { margin: 0; opacity: 0.9; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.08);
  padding: 32px 28px;
}

@media (max-width: 420px) {
  .auth-card { padding: 28px 20px; }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--auth-line);
}

.auth-brand-name { font-weight: 700; line-height: 1.2; }
.auth-brand-sub { font-size: 0.8125rem; color: var(--auth-muted); }

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.auth-lede {
  color: var(--auth-muted);
  margin: 0 0 24px;
  font-size: 0.9375rem;
}

/* Messages from the server: said plainly, above the form they are about. */
.auth-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.9375rem;
}

.auth-alert-error { background: var(--auth-bad-soft); color: var(--auth-bad); }
.auth-alert-success { background: var(--auth-ok-soft); color: var(--auth-ok); }
.auth-alert-info, .auth-alert-warning { background: var(--auth-warn-soft); color: #7a4b00; }

.auth-field { margin-bottom: 18px; }

.auth-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
}

.auth-input-wrap { position: relative; }

.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 1rem;
  color: var(--auth-ink);
  background: #fff;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input.has-toggle { padding-right: 76px; }

.auth-input:focus {
  outline: none;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.18);
}

.auth-input[aria-invalid="true"] { border-color: var(--auth-bad); }

/* Show / hide, as a word rather than an icon nobody is sure about. */
.auth-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-brand);
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
}

.auth-toggle:hover { background: var(--auth-brand-soft); }
.auth-toggle:focus-visible { outline: 2px solid var(--auth-brand); outline-offset: 1px; }

.auth-hint {
  font-size: 0.8125rem;
  color: var(--auth-muted);
  margin-top: 6px;
}

.auth-caps {
  display: none;
  font-size: 0.8125rem;
  color: #7a4b00;
  margin-top: 6px;
}

.auth-caps.is-on { display: block; }

.auth-submit {
  width: 100%;
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: var(--auth-brand);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s;
}

.auth-submit:hover { background: var(--auth-brand-strong); }
.auth-submit:focus-visible { outline: 3px solid rgba(30, 58, 138, 0.35); outline-offset: 2px; }
.auth-submit[disabled] { background: #9aa6c2; cursor: not-allowed; }

.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: auth-spin 0.8s linear infinite;
}

.auth-submit.is-busy .auth-spinner { display: inline-block; }

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

/* The rules for a new password, ticked off as they are met. */
.auth-rules {
  list-style: none;
  padding: 12px 14px;
  margin: 0 0 18px;
  background: var(--auth-page);
  border-radius: 10px;
  font-size: 0.875rem;
}

.auth-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-muted);
  padding: 2px 0;
}

.auth-rules li::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #b6bdcb;
}

.auth-rules li.is-met { color: var(--auth-ok); }

.auth-rules li.is-met::before {
  border-color: var(--auth-ok);
  background: var(--auth-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.4' d='M4 8.5l2.5 2.5L12 5.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--auth-muted);
}

.auth-foot a { color: var(--auth-brand); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
