/* ── Sign-in ─────────────────────────────────────────────────────────────────
   The one page an operator sees before anything else, and the one page no admin
   script runs on. Everything here is CSS: the notice dismisses itself, and the
   dismiss control is a label, so nothing waits on JavaScript that never loads.
   Brand tokens only — the palette comes from base.css.
   ────────────────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(var(--brand-accent-rgb), 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 70% 45% at 90% 10%, rgba(var(--brand-accent-purple-rgb), 0.18) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(var(--brand-accent-dim-rgb), 0.10) 0%, transparent 55%),
    #0b1220;
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.login-card {
  width: 100%;
  max-width: 26rem;
  padding: 1.5rem 1.5rem 1.6rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  background-image:
    linear-gradient(#111827, #111827),
    var(--brand-gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(var(--brand-accent-rgb), 0.12);
}

.login-card__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.login-card__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}
.login-card__sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.login-form--sub { margin-top: 0.6rem; }

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.login-field__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
}
.login-field__note {
  font-size: 0.68rem;
  line-height: 1.4;
  color: #7f8ea3;
}

.login-input {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #e2e8f0;
  background-color: rgba(2, 6, 23, 0.66);
  border: 1px solid rgba(148, 163, 184, 0.24);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-input::placeholder { color: #55637a; }
.login-input:focus {
  border-color: rgba(var(--brand-accent-rgb), 0.6);
  box-shadow: 0 0 0 2px rgba(var(--brand-accent-rgb), 0.18);
}
.login-input--code {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  padding-block: 0.7rem;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: #cbd5e1;
  user-select: none;
}
.login-check input {
  width: 1rem;
  height: 1rem;
  border-radius: 0.28rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background-color: rgba(2, 6, 23, 0.66);
  accent-color: rgb(var(--brand-accent-rgb));
}

.login-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 650;
  /* Solid, not the brand gradient: a gradient puts the label over a different colour at
     each stop, and no single label colour survives all of them across six brands. */
  color: var(--on-accent, #08101c);
  background: var(--brand-accent);
  transition: filter 0.15s ease, transform 0.05s ease;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible {
  outline: 2px solid rgba(var(--brand-accent-rgb), 0.7);
  outline-offset: 2px;
}
.login-btn--ghost {
  background: transparent;
  color: var(--text-muted, #94a3b8);
  border: 1px solid rgba(148, 163, 184, 0.24);
  font-weight: 550;
}
.login-btn--ghost:hover {
  color: #e2e8f0;
  border-color: rgba(var(--brand-accent-rgb), 0.45);
  filter: none;
}

/* ── Locale switch ───────────────────────────────────────────────────────── */

.login-locale {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.login-locale__item {
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  background: rgba(2, 6, 23, 0.5);
}
.login-locale__item + .login-locale__item {
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}
.login-locale__item:hover { color: #e2e8f0; }
.login-locale__item.is-active {
  color: var(--on-accent);
  background: rgba(var(--brand-accent-rgb), 0.8);
}

/* ── Notice ──────────────────────────────────────────────────────────────────
   Sits above the page, not inside the card, so a failed attempt does not reflow
   the form under the operator's cursor. */

.login-notify {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: 0.65rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.8rem;
  line-height: 1.45;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  animation: login-notify-in 0.22s ease-out both, login-notify-out 0.4s ease-in 9s both;
}
.login-notify.is-err {
  color: #fecaca;
  background: #2a1113;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.login-notify.is-ok {
  color: #dcfce7;
  background: #0d2417;
  border: 1px solid rgba(34, 197, 94, 0.45);
}
.login-notify__icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0b1220;
}
.login-notify.is-err .login-notify__icon { background: #f87171; }
.login-notify.is-ok .login-notify__icon { background: #4ade80; }
.login-notify__msg { min-width: 0; overflow-wrap: anywhere; }
.login-notify__x {
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0 0.15rem;
  opacity: 0.65;
  font-size: 0.8rem;
  line-height: 1.4;
  user-select: none;
}
.login-notify__x:hover { opacity: 1; }

/* Checking the hidden box removes the notice; it is the only state this page keeps. */
.login-notify__x-state:checked ~ .login-notify { display: none; }

@keyframes login-notify-in {
  from { opacity: 0; transform: translate(-50%, -0.5rem); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes login-notify-out {
  from { opacity: 1; visibility: visible; }
  to { opacity: 0; visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .login-notify { animation: none; }
}
