:root {
  color-scheme: light;
  --page-ink: #133447;
  --surface: #ffffff;
  --text: #18384b;
  --heading: #0d3046;
  --muted: #5d7485;
  --border: #cfe1ec;
  --border-strong: #91b5cb;
  --primary: #2f82ad;
  --primary-dark: #205f82;
  --accent-soft: #e6f3fb;
  --danger-bg: #fff5ec;
  --danger-border: #e2a16b;
  --danger-ink: #9a5a25;
  --radius: 8px;
  --radius-card: 16px;
  --shadow-card: 0 24px 60px rgba(25, 71, 99, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(47, 130, 173, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 130, 173, 0.03) 1px, transparent 1px),
    linear-gradient(135deg, #f9fdff 0%, #eaf7ff 44%, #f4fbff 100%);
  background-size:
    34px 34px,
    34px 34px,
    auto;
  color: var(--text);
  font-family:
    "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 40px 36px 30px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 10px 22px rgba(47, 127, 161, 0.28);
  margin-bottom: 16px;
}

.login-mark svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

.login-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.login-brand h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  line-height: 1.25;
  color: var(--heading);
  text-wrap: balance;
}

.login-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-field label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--text);
  font: inherit;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.login-field input::placeholder {
  color: #9bb1bf;
}

.login-field input:hover {
  border-color: var(--primary);
}

.login-field input:focus-visible {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-password {
  position: relative;
  display: flex;
  align-items: center;
}

.login-password input {
  padding-right: 84px;
}

.login-toggle {
  position: absolute;
  right: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--primary-dark);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.login-toggle:hover {
  background: var(--accent-soft);
}

.login-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-error {
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.login-submit {
  min-height: 48px;
  margin-top: 2px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 760;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 120ms ease;
}

.login-submit:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(47, 127, 161, 0.22);
}

.login-submit:active {
  transform: translateY(1px);
}

.login-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-submit[aria-busy="true"] {
  opacity: 0.72;
  cursor: progress;
}

.login-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.login-lock {
  font-size: 0.9rem;
}

@media (max-width: 460px) {
  .login-card {
    padding: 32px 22px 26px;
  }
}

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

/* Registrazione su invito (blocco I2). Volutamente SOTTO il modulo di accesso e
   dietro un pulsante: la pagina serve a far entrare chi ha gia' un account, e
   registrarsi e' l'eccezione. */

.login-register {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--login-border, rgba(0, 0, 0, 0.12));
}

.login-register-toggle {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--login-border, rgba(0, 0, 0, 0.18));
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
}

.login-register-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.login-register-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.login-register-form {
  margin-top: 14px;
}

.login-register-intro {
  margin: 0 0 12px;
  font-size: 0.86rem;
  line-height: 1.5;
  opacity: 0.8;
}

.login-register-form label em {
  font-style: normal;
  font-weight: 500;
  opacity: 0.7;
}

/* Marchio sulla pagina di accesso (blocco L1). Piu' grande che nell'app: qui
   il logo e' la prima cosa che si vede, dentro non serve piu' presentarsi. */

.login-brand .brand-title {
  margin: 6px 0 8px;
  line-height: 0;
}

.login-brand .brand-title img {
  height: 40px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.login-descriptor {
  margin-top: 0;
  opacity: 0.75;
}

@media (max-width: 520px) {
  .login-brand .brand-title img {
    height: 32px;
  }
}
