/* Mobile login hardening: keep all four role sign-in screens visually consistent. */
@media (max-width: 860px) {
  html,
  body,
  #root {
    min-height: 100%;
    width: 100%;
    background: #002548;
  }

  body {
    overflow-x: hidden;
  }

  .role-login-shell,
  .role-login-shell .lp-shell,
  .role-login-shell .lp-right {
    background: #002548 !important;
  }

  .role-login-shell .lp-shell {
    min-height: 100dvh !important;
    display: block !important;
  }

  .role-login-shell .lp-brand {
    display: none !important;
  }

  .role-login-shell .lp-right {
    min-height: 100dvh !important;
    width: 100% !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: max(24px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
  }

  .role-login-shell .lp-form-wrap {
    width: 100% !important;
    max-width: 480px !important;
    transform: none !important;
    margin: 0 auto !important;
  }

  .role-login-shell .lp-form-header {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 0 18px !important;
  }

  /* Every role follows the same order on mobile. */
  .role-login-shell .lp-form-header > .lp-form-title {
    order: 1 !important;
  }

  .role-login-shell .lp-form-header > .role-login-switcher {
    order: 2 !important;
  }

  .role-login-shell .lp-form-header > .lp-form-sub {
    order: 3 !important;
  }

  .role-login-shell .lp-form-title {
    margin: 0 0 8px !important;
    color: #ffffff !important;
    font-size: 36px !important;
    line-height: 1.05 !important;
  }

  .role-login-shell .lp-form-sub,
  .role-login-shell .role-login-sub {
    color: rgba(255,255,255,.62) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  .role-login-switcher {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin: 14px 0 12px !important;
    padding: 5px !important;
    border: 1px solid rgba(255,255,255,.15) !important;
    border-radius: 13px !important;
    background: rgba(0,25,41,.62) !important;
  }

  .role-login-option {
    min-width: 0 !important;
    min-height: 47px !important;
    padding: 7px 6px !important;
    border-radius: 9px !important;
    color: rgba(255,255,255,.68) !important;
    background: transparent !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  .role-login-option.active {
    color: #003865 !important;
    background: #59c3b8 !important;
  }

  .role-login-shell .lp-field {
    margin-bottom: 13px !important;
  }

  .role-login-shell .lp-label {
    color: rgba(255,255,255,.78) !important;
  }

  .role-login-shell .lp-input {
    min-height: 49px !important;
    border-color: rgba(255,255,255,.18) !important;
    background: rgba(255,255,255,.075) !important;
    color: #ffffff !important;
  }

  .role-login-shell .lp-input::placeholder {
    color: rgba(255,255,255,.34) !important;
  }

  .role-login-shell .lp-btn-primary,
  .role-login-shell .role-login-google,
  .role-login-shell .lp-btn-google {
    min-height: 50px !important;
    border-radius: 9px !important;
  }

  .role-login-shell .lp-google-help,
  .role-login-shell .lp-privacy,
  .role-login-shell .lp-switch {
    font-size: 11px !important;
    line-height: 1.45 !important;
  }

  .role-login-shell .lp-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .role-code-modal-backdrop {
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)) !important;
    align-items: center !important;
  }

  .role-code-modal {
    width: min(100%, 430px) !important;
    max-height: calc(100dvh - 32px) !important;
    overflow-y: auto !important;
    padding: 24px 20px !important;
  }

  .role-code-modal-actions {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Redesigned preview login: compact white logo header with the form centered below it. */
  .pvl-shell {
    min-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #002548 !important;
  }

  .pvl-brand {
    width: 100% !important;
    min-height: 104px !important;
    flex: 0 0 104px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: max(12px, env(safe-area-inset-top)) 18px 10px !important;
    background: #ffffff !important;
    transform: none !important;
  }

  .pvl-brand-inner {
    width: 100% !important;
    max-width: 520px !important;
    margin: 0 auto !important;
    text-align: center !important;
  }

  .pvl-logo {
    content: url('/uth-logo.png') !important;
    display: block !important;
    width: 122px !important;
    height: auto !important;
    max-height: 72px !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center center !important;
  }

  .pvl-tagline,
  .pvl-mission {
    display: none !important;
  }

  .pvl-right {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px 16px max(18px, env(safe-area-inset-bottom)) !important;
    background: #002548 !important;
  }

  .pvl-form-wrap {
    width: 100% !important;
    max-width: 430px !important;
    margin: 0 auto !important;
  }

  .pvl-form-header {
    text-align: center !important;
    margin-bottom: 18px !important;
  }

  .pvl-title {
    margin: 0 0 16px !important;
    text-align: center !important;
  }

  .pvl-role-switcher {
    width: min(100%, 390px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .pvl-sub {
    text-align: center !important;
  }

  .pvl-body,
  .pvl-body form {
    width: 100% !important;
  }

  .pvl-primary,
  .pvl-google {
    width: min(100%, 390px) !important;
    display: flex !important;
    margin-left: auto !important;
    margin-right: auto !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .pvl-google-help {
    margin: 8px auto 0 !important;
    max-width: 390px !important;
  }

  .pvl-divider {
    width: min(100%, 390px) !important;
    margin: 17px auto 14px !important;
  }
}

@media (max-width: 390px) {
  .role-login-shell .lp-right {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .role-login-shell .lp-form-title {
    font-size: 33px !important;
  }

  .role-login-option {
    min-height: 45px !important;
    font-size: 10px !important;
  }

  .pvl-brand {
    min-height: 96px !important;
    flex-basis: 96px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .pvl-logo {
    width: 112px !important;
  }

  .pvl-right {
    padding: 14px 14px max(14px, env(safe-area-inset-bottom)) !important;
  }

  .pvl-form-header {
    margin-bottom: 15px !important;
  }

  .pvl-title {
    margin-bottom: 13px !important;
  }

  .pvl-divider {
    margin-top: 15px !important;
    margin-bottom: 12px !important;
  }
}
