/*
 * Login e bootstrap owner di Rego.
 *
 * Foglio autonomo, senza dipendenze dalla shell owner. Ordine: token chiari e
 * scuri; card/form; passaggio MFA e messaggi; focus, disabled e responsive.
 * Gli stati visuali sono attivati da attributi nativi (`hidden`, `required`,
 * `aria-busy`) e non richiedono style inline, in coerenza con la CSP.
 */
:root {
  color-scheme: light;
  --accent: #3949ab;
  --accent-strong: #1a237e;
  --on-accent: #fff;
  --background: #dfe3e6;
  --card: #fff;
  --field: #f7f8f9;
  --text: #1a1d21;
  --muted: #5c6470;
  --border: #c3c9ce;
  --danger: #b42318;
  --focus: #5c6bc0;
  --shadow: 0 14px 42px rgba(12, 15, 18, .2);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #8c9eff;
  --accent-strong: #9fa8da;
  --on-accent: #111417;
  --background: #1b1e24;
  --card: #191d21;
  --field: #1e2327;
  --text: #e3e6e8;
  --muted: #a8b0b8;
  --border: #3a4148;
  --danger: #ffaaa3;
  --focus: #aeb8ff;
  --shadow: 0 14px 42px rgba(0, 0, 0, .52);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font: 14px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--background);
}

.box {
  width: min(390px, 100%);
  padding: 30px 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 3px;
  color: var(--accent-strong);
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h1::before {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
}

.sub {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

label, .mfa-heading {
  display: block;
  margin: 13px 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.label-note {
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
}

#totp-code, #recovery-code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: .08em;
}

.mfa {
  margin-top: 18px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#vai {
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  background: var(--accent);
  color: var(--on-accent);
}

#vai:hover { background: var(--accent-strong); }

.factor-switch {
  min-height: 32px;
  margin-top: 8px;
  padding: 3px 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button:disabled { opacity: .62; cursor: wait; }

#err {
  min-height: 20px;
  margin-top: 11px;
  color: var(--danger);
  font-size: 12.5px;
}

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 440px) {
  body { padding: 14px; align-items: flex-start; }
  .box { margin-top: 6vh; padding: 24px 21px; }
  h1 { font-size: 19px; }
}
