/* ── Sign-in pages (login, lockout, forgot password, register) ─────────
   Deep navy page with fine grain and the app's connected sources in the background (_AuthNetwork),
   one white card in front. Card colours come from the theme tokens (data-theme="clarity-slate");
   the navy background colours are page-local below. Prefix: auth- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

.auth-body {
  --auth-page: #13213b;                     /* deep navy */
  --auth-line: #ffffff;                     /* spokes and tiles (used with low opacity) */
  --auth-beam: #a5b4fc;                     /* data beams */
  --auth-beam-end: #c7d2fe;
  --auth-icon: rgba(226, 232, 240, 0.9);
  --auth-ok: #34d399;                       /* "connected" */
  --auth-page-text: rgba(255, 255, 255, 0.72);
  --auth-page-link: #c7d2fe;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--auth-page);
  -webkit-font-smoothing: antialiased;
}

/* ── Background: connections, beams, grain ── */
.auth-net { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.auth-net .auth-link { stroke: url(#authLineFade); stroke-width: 1.2; fill: none; }
.auth-net .auth-beam { stroke: url(#authBeamFade); stroke-width: 1.8; stroke-linecap: round; fill: none; stroke-dasharray: 110 2000; stroke-dashoffset: 110; }
.auth-net .auth-tile rect { fill: url(#authTileFill); stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.auth-net .auth-tile-icon { stroke: var(--auth-icon); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.auth-net .auth-status { fill: var(--auth-ok); stroke: var(--auth-page); stroke-width: 3; }
.auth-net .auth-pulse { fill: none; stroke: var(--auth-ok); stroke-width: 1.5; opacity: 0; }

/* Fine film grain over the navy: texture, not a pattern */
.auth-grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── Card ── */
.auth-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 3rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2.25rem 2.25rem 2rem;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; font-size: 1rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.auth-brand img { width: 32px; height: 32px; border-radius: 8px; }

.auth-title { margin: 0 0 .35rem; font-size: 1.55rem; font-weight: 650; letter-spacing: -.03em; }
.auth-lead { margin: 0 0 1.75rem; font-size: .88rem; color: var(--muted); }
.auth-subtitle { margin: 0 0 1.75rem; font-size: .9rem; color: var(--muted); line-height: 1.55; }

/* ── Form ── */
.auth-form-group { margin-bottom: 1.25rem; }
.auth-form-label { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.auth-input-wrap { position: relative; }
.auth-form-input {
  width: 100%;
  height: 44px;
  padding: 0 .9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .92rem;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.auth-input-wrap .auth-form-input { padding-right: 2.6rem; }
.auth-form-input::placeholder { color: var(--muted); opacity: .8; }
.auth-form-input:focus { outline: none; background: var(--card); border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.auth-form-input.input-validation-error { border-color: var(--red); }

.auth-reveal {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; padding: .35rem; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.auth-reveal:hover, .auth-reveal[aria-pressed="true"] { color: var(--primary); background: var(--primary-light); }
.auth-reveal svg { width: 17px; height: 17px; }

.auth-hint { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; font-size: .78rem; font-weight: 500; color: var(--amber); }
.auth-hint[hidden] { display: none; }

.auth-validation-error { display: block; margin-top: .35rem; font-size: .78rem; color: var(--red); }
.auth-validation-error:empty { display: none; }

/* Alerts: icon + text in a tinted box (no bullet lists) */
.auth-alert-danger, .auth-alert-info {
  --c: var(--red);
  display: flex; align-items: flex-start; gap: .6rem;
  margin-bottom: 1.25rem; padding: .7rem .85rem; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  background: color-mix(in srgb, var(--c) 7%, var(--card));
  color: var(--text); font-size: .86rem; font-weight: 500; line-height: 1.45;
}
.auth-alert-info { --c: var(--amber); }
.auth-alert-danger svg, .auth-alert-info svg { flex: none; width: 18px; height: 18px; margin-top: .05rem; color: var(--c); }
/* Register still uses the validation summary list */
.auth-alert-danger ul { margin: 0; padding: 0; list-style: none; }
.auth-alert-danger:empty, .auth-alert-danger.validation-summary-valid { display: none; }

.auth-checkbox-wrapper { display: flex; align-items: center; gap: .55rem; margin: .25rem 0 1.5rem; }
.auth-checkbox { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.auth-checkbox-label { font-size: .85rem; color: var(--text-secondary); cursor: pointer; }

.auth-btn-submit {
  width: 100%;
  height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none; /* also used on links ("Back to sign in") */
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: background .15s, opacity .15s;
}
.auth-btn-submit:hover { background: var(--primary-dark); }
.auth-btn-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 30%, transparent); }
.auth-btn-submit:disabled { opacity: .75; cursor: default; }
.auth-btn-submit svg { width: 16px; height: 16px; transition: transform .15s; }
.auth-btn-submit:hover svg { transform: translateX(3px); }
.auth-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ── Under the card (on navy) ── */
.auth-footnote { margin: 0; font-size: .84rem; color: var(--auth-page-text); text-align: center; }
.auth-footnote a { color: var(--auth-page-link); }
.auth-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footnote a:hover, .auth-link:hover { text-decoration: underline; }

/* Status pages (locked out, password help) */
.auth-status-icon {
  width: 44px; height: 44px; margin-bottom: 1rem; border-radius: 12px; display: grid; place-items: center;
  color: var(--amber); background: var(--amber-light);
}
.auth-status-icon svg { width: 22px; height: 22px; }

/* Register (admin only) and external logins keep working with the same classes */
.auth-links { margin-top: 1rem; text-align: center; font-size: .85rem; }
.auth-divider { margin: 1.25rem 0 .75rem; text-align: center; font-size: .78rem; color: var(--muted); }
.auth-external-btns { display: flex; flex-direction: column; gap: .5rem; }
.auth-btn-external {
  padding: .6rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.auth-btn-external:hover { border-color: var(--primary); }
.auth-text-center { text-align: center; }
.auth-logo { display: none; } /* .auth-brand replaces the old emoji logo */

@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation: none; }
  .auth-net .auth-beam, .auth-net .auth-pulse { display: none; }
}
/* Phones: keep the navy and grain, drop the tiles that would crowd the card */
@media (max-width: 640px) {
  .auth-net { display: none; }
  .auth-card { padding: 2rem 1.5rem 1.75rem; }
}
