:root {
  color-scheme: dark;
  --text: #f4f8ff;
  --muted: #a8bad1;
  --soft: #617189;
  --blue: #1689ff;
  --blue2: #56b5ff;
  --line: rgba(126, 183, 255, .28);
  --panel: rgba(4, 14, 29, .74);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020815 url("/assets/zetvis-login-hero.png") center / cover no-repeat;
}

@media (display-mode: standalone) {
  body {
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: clamp(92px, 7.6vw, 150px);
}

.login-panel {
  width: min(clamp(520px, 30vw, 620px), calc(100vw - 40px));
  min-height: clamp(660px, 78vh, 760px);
  padding: 46px 56px 38px;
  border: 1px solid rgba(94,169,255,.62);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(112,183,255,.16), transparent 20%),
    linear-gradient(180deg, rgba(4,14,31,.98), rgba(3,12,27,.97));
  box-shadow:
    0 0 0 1px rgba(255,255,255,.05) inset,
    0 0 46px rgba(22,137,255,.22),
    0 34px 90px rgba(0,0,0,.52);
}

.lock-orb {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  border: 1px solid rgba(32,136,255,.75);
  border-radius: 999px;
  background: rgba(5,31,73,.38);
  box-shadow: 0 0 30px rgba(22,137,255,.42);
}

.lock-orb span {
  width: 30px;
  height: 24px;
  display: block;
  position: relative;
  border: 4px solid #4da6ff;
  border-radius: 6px;
}

.lock-orb span::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 17px;
  height: 22px;
  border: 4px solid #4da6ff;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.login-panel h2 {
  margin: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
}

.login-panel > p {
  margin: 12px 0 34px;
  color: var(--muted);
  text-align: center;
}

form { display: grid; gap: 16px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }

input {
  width: 100%;
  height: 62px;
  border: 1px solid rgba(154,188,229,.26);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  outline: none;
  background: rgba(8,20,37,.72);
  font-size: 16px;
}

input:focus {
  border-color: rgba(64,160,255,.78);
  box-shadow: 0 0 0 3px rgba(22,137,255,.16);
}

.forgot-link {
  justify-self: end;
  color: #35aaff;
  text-decoration: none;
  font-size: 14px;
}

.primary-login {
  height: 62px;
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  background: linear-gradient(180deg, #3aa0ff, #126ef2);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 16px 30px rgba(18,110,242,.28);
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  color: var(--soft);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: "";
  height: 1px;
  background: rgba(154,188,229,.16);
}

.sso-button {
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154,188,229,.22);
  border-radius: 8px;
  color: #eef6ff;
  text-decoration: none;
  background: rgba(8,20,37,.58);
  font-weight: 800;
}

.pwa-install {
  height: 52px;
  border: 1px solid rgba(68,154,255,.38);
  border-radius: 8px;
  color: #dcecff;
  cursor: pointer;
  background: rgba(49,130,246,.14);
  font-weight: 900;
}

.permission-button {
  height: 52px;
  border: 1px solid rgba(68,154,255,.34);
  border-radius: 8px;
  color: #dcecff;
  cursor: pointer;
  background: rgba(255,255,255,.055);
  font-weight: 900;
}

.permission-button:hover { background: rgba(49,130,246,.16); }
.permission-button:disabled { opacity: .72; cursor: wait; }

.pwa-install:hover { background: rgba(49,130,246,.22); }
.pwa-install[hidden] { display: none; }

.error {
  min-height: 20px;
  margin: 0;
  color: #ff8b8b;
  text-align: center;
  font-size: 13px;
}

@media (max-width: 1100px) {
  body { overflow: auto; }
  .login-shell {
    justify-content: center;
    padding: 42px 18px 84px;
  }
  .login-panel { min-height: auto; }
}

@media (max-width: 620px) {
  body {
    min-height: 100dvh;
    background-position: 35% center;
  }
  .login-shell {
    min-height: 100dvh;
    justify-content: center;
    align-items: flex-end;
    padding: 24px 14px 28px;
  }
  .login-panel {
    width: 100%;
    padding: 26px 18px 22px;
    border-radius: 16px;
  }
  .lock-orb { width: 76px; height: 76px; margin-bottom: 18px; }
  .login-panel h2 { font-size: 22px; }
  .login-panel > p { margin-bottom: 24px; font-size: 14px; }
  input, .primary-login, .sso-button { height: 52px; }
}

@media (display-mode: standalone) and (max-width: 620px) {
  .login-shell {
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  }
  .login-panel {
    max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
  }
}

@media (max-width: 380px) {
  .login-panel { padding: 22px 14px 18px; }
  form { gap: 12px; }
}
