html.auth-html,
html.auth-html body.auth-body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
}

.auth-body {
  background: var(--bg);
}

.shell {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  padding:
    max(16px, calc(8px + env(safe-area-inset-top, 0px)))
    16px
    max(24px, calc(12px + env(safe-area-inset-bottom, 0px)));
  background:
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(40, 110, 210, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(6, 20, 40, 0.55) 0%, rgba(6, 20, 40, 0.78) 42%, rgba(6, 20, 40, 0.94) 100%),
    url('/images/student-login-hero.jpg') center 30% / cover no-repeat;
}

/* App instalado: reserva mais margem (Android muitas vezes reporta safe-area 0) */
html.is-standalone .shell {
  padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 12px));
  padding-bottom: max(36px, calc(env(safe-area-inset-bottom, 0px) + 20px));
}

@media all and (display-mode: standalone) {
  .shell {
    padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 12px));
    padding-bottom: max(36px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  }
}

html[data-theme="light"] .shell {
  background:
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(0, 82, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(245, 247, 250, 0.55) 0%, rgba(245, 247, 250, 0.88) 55%, #f5f7fa 100%),
    url('/images/student-login-hero.jpg') center 30% / cover no-repeat;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  flex: 0 0 auto;
  margin: auto 0;
}

.theme-fab {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 5;
  border: 1px solid rgba(140, 180, 230, 0.35);
  background: rgba(12, 28, 55, 0.55);
  color: #e8f1ff;
  backdrop-filter: blur(10px);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.theme-fab [data-theme-label] { display: none; }
html[data-theme="light"] .theme-fab {
  background: rgba(255,255,255,0.85);
  color: #0b1b3a;
  border-color: #eaecf0;
}

.brand {
  text-align: center;
  padding: 0 8px;
  flex: 0 0 auto;
}
.brand-ico {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2d8fff, #1760e8);
  box-shadow: 0 8px 20px rgba(30, 120, 255, 0.4);
  color: #fff;
}
.brand-ico svg { width: 22px; height: 22px; }
.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] .brand h1 {
  color: #0b1b3a;
  text-shadow: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(77, 176, 255, 0.55);
  background: rgba(10, 30, 60, 0.35);
  color: #dcecff;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
html[data-theme="light"] .pill {
  background: rgba(255,255,255,0.9);
  color: #0b1b3a;
  border-color: #c7d7ff;
}
.pill svg { width: 14px; height: 14px; color: #4db0ff; }

.auth-card {
  flex: 0 0 auto;
  width: 100%;
  background: rgba(12, 28, 55, 0.78);
  border: 1px solid rgba(140, 180, 230, 0.22);
  border-radius: 22px;
  padding: 16px 14px 14px;
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color: #e8f1ff;
}
html[data-theme="light"] .auth-card {
  background: rgba(255,255,255,0.96);
  border-color: #eaecf0;
  color: #101828;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.1);
}

.welcome {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.welcome-ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(77, 176, 255, 0.15);
  color: #4db0ff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.welcome-ico svg { width: 16px; height: 16px; }
.welcome h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.welcome p { display: none; }

.auth-field { margin-bottom: 8px; }
.auth-field label {
  display: block;
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #9db2d0;
}
html[data-theme="light"] .auth-field label { color: #667085; }

.control {
  position: relative;
  display: flex;
  align-items: center;
}
.control .lead-ico {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: #7ea0c8;
  pointer-events: none;
}
.control input {
  width: 100%;
  border: 1px solid rgba(120, 160, 210, 0.28);
  border-radius: 12px;
  background: rgba(8, 20, 42, 0.78);
  color: #fff;
  padding: 11px 40px 11px 36px;
  font-weight: 600;
  font-size: 0.9rem;
  outline: none;
}
html[data-theme="light"] .control input {
  background: #f9fafb;
  color: #101828;
  border-color: #eaecf0;
}
.control input::placeholder { color: #6f87a8; font-weight: 500; }
.control input:focus {
  border-color: rgba(77, 176, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(77, 176, 255, 0.18);
}
.control .trail {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #7ea0c8;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.control .trail svg { width: 16px; height: 16px; }
.control .check { color: #34d399; pointer-events: none; }

.row-opts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 10px;
}
.remember {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9db2d0;
  font-size: 0.72rem;
  font-weight: 600;
}
html[data-theme="light"] .remember { color: #667085; }
.remember-hint {
  margin: -4px 0 10px;
  color: #7b91b0;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.35;
}
html[data-theme="light"] .remember-hint { color: #98a2b3; }
.remember input {
  width: 14px;
  height: 14px;
  accent-color: #1e78ff;
  margin: 0;
}
.forgot {
  color: #4db0ff;
  font-size: 0.72rem;
  font-weight: 700;
}
html[data-theme="light"] .forgot { color: #0052ff; }

.btn-enter {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, #1e78ff 0%, #3aa0ff 100%);
  box-shadow: 0 8px 18px rgba(30, 120, 255, 0.3);
}
.btn-enter svg { width: 16px; height: 16px; }
.btn-enter.bio {
  margin-top: 8px;
  background: transparent;
  border: 1px solid rgba(77, 176, 255, 0.55);
  box-shadow: none;
  color: #9fd0ff;
}
html[data-theme="light"] .btn-enter.bio {
  color: #0052ff;
  border-color: #0052ff;
}

.secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  color: #7b91b0;
  font-size: 0.62rem;
  font-weight: 600;
}
html[data-theme="light"] .secure { color: #98a2b3; }
.secure svg { width: 12px; height: 12px; color: #34d399; }

.error {
  color: #f87171;
  font-size: 0.74rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.back-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  color: #4db0ff;
  font-size: 0.82rem;
  font-weight: 700;
}
html[data-theme="light"] .back-link { color: #0052ff; }

.install-link.auth {
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  border-radius: 12px;
  border-color: rgba(77, 176, 255, 0.55);
  background: rgba(77, 176, 255, 0.12);
  color: #9fd0ff;
}
html[data-theme="light"] .install-link.auth {
  border-color: #0052ff;
  background: #e8efff;
  color: #0052ff;
}
.install-link.auth[hidden],
.install-link[hidden] {
  display: none !important;
}

@media (max-height: 760px) {
  .auth-stack { gap: 10px; }
  .brand-ico { width: 44px; height: 44px; margin-bottom: 6px; }
  .brand h1 { font-size: 1.28rem; }
  .welcome { margin-bottom: 8px; }
  .welcome-ico { width: 30px; height: 30px; }
  .secure { display: none; }
  .auth-card { padding: 12px; }
  .btn-enter { padding: 10px 12px; }
}

@media (max-height: 680px) {
  .shell { justify-content: flex-start; }
  .auth-stack { margin: 0; gap: 8px; }
  .pill { margin-top: 6px; padding: 4px 8px; font-size: 0.65rem; }
  .welcome { display: none; }
}
