:root {
  --auth-primary: #1769e0;
  --auth-primary-dark: #0d4ead;
  --auth-accent: #49b9d1;
  --auth-text: #162033;
  --auth-muted: #68758a;
  --auth-border: #e4eaf2;
  --auth-bg: #f4f7fb;
  --auth-card: rgba(255, 255, 255, 0.96);
}

html,
body {
  min-height: 100%;
  background: var(--auth-bg);
}

.auth-page {
  min-height: 100svh;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #f5f7fb;
}

.auth-shell {
  width: min(1480px, 100%);
  max-height: calc(100svh - 36px);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(218, 226, 238, 0.9);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(27, 45, 76, 0.16);
  overflow: hidden;
}

.auth-layout {
  min-height: min(760px, calc(100svh - 36px));
}

.auth-panel-left {
  padding: clamp(38px, 4.2vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--auth-card);
}

.platform-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(24px, 4vh, 40px);
}

.platform-brand img {
  width: 185px;
  max-width: 68%;
  max-height: 52px;
  object-fit: contain;
}

.platform-badge {
  border-left: 1px solid var(--auth-border);
  padding-left: 12px;
  color: var(--auth-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--auth-primary-dark);
  background: rgba(23, 105, 224, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-title {
  margin: 0 0 10px;
  color: var(--auth-text);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.auth-welcome-sub {
  max-width: 470px;
  margin-bottom: clamp(22px, 3vh, 32px);
  color: var(--auth-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.auth-label {
  margin-bottom: 7px;
  color: #344054;
  font-size: 0.84rem;
  font-weight: 700;
}

.auth-input,
.auth-password-wrap .form-control,
.auth-password-wrap .btn {
  min-height: 50px;
}

.auth-input,
.auth-password-wrap .form-control {
  border-color: var(--auth-border);
  border-radius: 13px;
  padding: 11px 15px;
  color: var(--auth-text);
  background: #fbfcfe;
  box-shadow: none;
}

.auth-input:focus,
.auth-password-wrap .form-control:focus {
  border-color: rgba(23, 105, 224, 0.65);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(23, 105, 224, 0.1);
}

.auth-password-wrap .form-control {
  border-radius: 13px 0 0 13px;
}

.auth-password-wrap .btn {
  width: 54px;
  border-color: var(--auth-border);
  border-left: 0;
  border-radius: 0 13px 13px 0;
  color: #67748a;
  background: #fbfcfe;
}

.auth-submit {
  min-height: 50px;
  border: 0;
  border-radius: 13px;
  padding: 0 26px;
  font-weight: 750;
  background: linear-gradient(135deg, var(--auth-primary), #2984f0);
  box-shadow: 0 12px 24px rgba(23, 105, 224, 0.24);
}

.auth-forgot {
  color: var(--auth-primary);
  font-size: 0.9rem;
  font-weight: 650;
}

.auth-footer {
  margin-top: clamp(24px, 4vh, 36px);
  padding-top: 18px;
  border-top: 1px solid var(--auth-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--auth-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.auth-partner {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.auth-partner img {
  max-width: 110px;
  max-height: 34px;
  object-fit: contain;
}

.auth-panel-right {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(30px, 4vw, 56px);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(145deg, #244f83 0%, #256fa9 48%, #2d9fd3 100%);
}

.client-brand-card {
  width: min(560px, 88%);
  min-height: 210px;
  padding: 24px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 55px rgba(18, 74, 116, 0.18);
}

.client-brand-label {
  margin-bottom: 14px;
  color: #708196;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.client-logo {
  width: 100%;
  max-width: 360px;
  max-height: 105px;
  object-fit: contain;
}

.client-name-fallback {
  margin: 0;
  color: var(--auth-text);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}

.client-access-label {
  margin-top: 14px;
  color: #46657e;
  font-size: 0.86rem;
  font-weight: 600;
}

.hero-window {
  width: min(680px, 92%);
  margin-top: 24px;
  position: relative;
  z-index: 2;
  border: 7px solid rgba(255, 255, 255, 0.64);
  border-radius: 21px;
  overflow: hidden;
  box-shadow: 0 25px 55px rgba(16, 74, 118, 0.23);
  transform: none;
}

.hero-window img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-caption {
  width: min(520px, 92%);
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.alert,
.modal-content {
  border: 0;
  border-radius: 13px;
}

/* Tablet con altezza ridotta */
@media (min-width: 768px) and (max-height: 760px) {
  .auth-page {
    padding: 12px;
  }
  .auth-shell {
    max-height: calc(100svh - 24px);
  }
  .auth-layout {
    min-height: calc(100svh - 24px);
  }
  .auth-panel-left {
    padding: 24px 34px;
  }
  .platform-brand {
    margin-bottom: 18px;
  }
  .auth-welcome-sub {
    margin-bottom: 18px;
    line-height: 1.4;
  }
  .auth-footer {
    margin-top: 18px;
    padding-top: 14px;
  }
  .client-brand-card {
    min-height: 145px;
    padding: 18px 28px;
  }
  .client-logo {
    max-height: 80px;
  }
  .hero-window {
    margin-top: 16px;
    width: min(500px, 92%);
  }
  .hero-caption {
    display: none;
  }
}

/* Mobile: layout compatto, pensato per stare in una schermata */
@media (max-width: 767.98px) {
  body {
    overflow-x: hidden;
  }

  .auth-page {
    min-height: 100svh;
    padding: 0;
    align-items: stretch;
    background: #fff;
    overflow-y: auto;
  }

  .auth-shell {
    width: 100%;
    min-height: 100svh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-layout {
    min-height: 100svh;
  }

  .auth-panel-left {
    min-height: 100svh;
    padding: max(18px, env(safe-area-inset-top)) 20px
      max(16px, env(safe-area-inset-bottom));
    justify-content: center;
  }

  .platform-brand {
    margin-bottom: 18px;
  }

  .platform-brand img {
    width: 155px;
  }

  .platform-badge {
    font-size: 0.64rem;
  }

  .auth-kicker {
    margin-bottom: 9px;
    padding: 5px 9px;
    font-size: 0.7rem;
  }

  .auth-title {
    margin-bottom: 6px;
    font-size: 1.75rem;
  }

  .auth-welcome-sub {
    margin-bottom: 18px;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .auth-panel-left form .mb-3 {
    margin-bottom: 12px !important;
  }

  .auth-label {
    margin-bottom: 5px;
    font-size: 0.78rem;
  }

  .auth-input,
  .auth-password-wrap .form-control,
  .auth-password-wrap .btn,
  .auth-submit {
    min-height: 46px;
  }

  .auth-panel-left form > .d-flex {
    margin-top: 14px !important;
    gap: 7px !important;
  }

  .auth-submit {
    width: 100%;
  }

  .auth-forgot {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    font-size: 0.82rem;
  }

  .auth-footer {
    margin-top: 16px;
    padding-top: 12px;
    display: block;
    font-size: 0.68rem;
    text-align: center;
  }

  .auth-partner {
    display: none;
  }
}

/* Telefoni molto bassi: elimino elementi non essenziali */
@media (max-width: 767.98px) and (max-height: 700px) {
  .auth-panel-left {
    justify-content: flex-start;
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .platform-brand {
    margin-bottom: 10px;
  }
  .auth-kicker {
    display: none;
  }
  .auth-welcome-sub {
    margin-bottom: 12px;
    font-size: 0.82rem;
  }
  .auth-footer {
    margin-top: 10px;
    padding-top: 8px;
  }
}

@media (max-width: 767.98px) and (max-height: 620px) {
  .auth-welcome-sub,
  .auth-footer {
    display: none;
  }

  .platform-brand {
    margin-bottom: 12px;
  }
  .auth-title {
    margin-bottom: 14px;
  }
}

/* Versione desktop piÃ¹ ampia e pulita */
@media (min-width: 992px) {
  .auth-panel-left {
    padding-left: clamp(54px, 5vw, 88px);
    padding-right: clamp(54px, 5vw, 88px);
  }

  .auth-panel-left form,
  .auth-welcome-sub,
  .auth-footer {
    width: 100%;
    max-width: 560px;
  }

  .auth-submit {
    min-width: 210px;
  }
}
