#login-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-login);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cold start with no session: the pre-paint probe (index.html) stamps data-preauth so the login
   overlay shows on the first paint and the app chrome stays hidden behind it — no panel flash before
   app.js runs. boot() clears data-preauth once a token is held. */
html[data-preauth] #login-overlay { display: flex !important; }
html[data-preauth] #app { visibility: hidden; }

/* Redirect spinner — the language-neutral default while auto-login hands off to Keycloak, so no
   translatable button flashes EN→RU first. showLogin() swaps it for the fallback form. */
#login-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: login-spin 0.8s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

/* [hidden] must win over #login-form's display:flex, else the fallback form shows despite the attribute. */
#login-form[hidden] { display: none; }

#login-form {
  background: var(--surface);
  padding: 28px 32px;
  border-radius: var(--r-sm);
  width: 320px;
  box-shadow: 0 12px 40px var(--shadow-login);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#login-form h2 {
  font-size: var(--fs-lg);
  margin-bottom: 4px;
}
#login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-sm);
  color: var(--text-muted-2);
}
#login-form input {
  font: inherit;
  font-size: var(--fs-md);
  padding: 8px 10px;
  border: 1px solid var(--border-input-plain);
  border-radius: var(--r-xs);
  background: var(--surface-raised);
  color: var(--text);
}
#login-form input:focus {
  outline: 0;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px var(--focus-glow);
}
#login-form button {
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent-hover);
  padding: 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  cursor: pointer;
}
#login-form button:hover {
  background: var(--accent-hover);
}
#login-form .error {
  color: var(--error-text);
  font-size: var(--fs-sm);
  margin: 0;
}

