.login-page {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(51, 65, 85, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(51, 65, 85, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  color: var(--ink);
}

.login-page [hidden] {
  display: none !important;
}

.login-header {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-brand > div {
  display: grid;
  gap: 2px;
}

.login-brand strong {
  font-size: 14px;
  line-height: 1.3;
}

.login-brand span:not(.brand-mark) {
  color: var(--muted);
  font-size: 11px;
}

.login-brand .brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.login-brand .brand-mark svg {
  width: 21px;
  height: 21px;
  fill: rgba(5, 150, 105, 0.09);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.access-badge {
  min-height: 30px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.access-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.login-shell {
  width: min(438px, calc(100% - 32px));
  margin: auto;
  padding: 8px 0 32px;
}

.login-panel {
  padding: 28px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow:
    var(--shadow),
    0 18px 48px rgba(15, 23, 42, 0.07);
}

.login-panel .panel-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
}

.panel-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.panel-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.login-panel h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.login-help {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
}

.otp-control {
  position: relative;
  width: 100%;
  min-height: 54px;
  cursor: text;
}

.otp-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  opacity: 0;
  cursor: text;
}

.otp-slots {
  min-height: 54px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 11px;
  pointer-events: none;
}

.otp-slots span {
  width: 43px;
  height: 47px;
  display: grid;
  place-items: center;
  border-bottom: 2px solid #94a3b8;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 25px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

.otp-control:hover .otp-slots span {
  border-color: var(--primary);
}

.otp-control:focus-within .otp-slots span.active {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.field-help {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.login-submit {
  min-height: 44px;
  margin-top: 2px;
  border-color: var(--primary);
  background: var(--primary);
  font-size: 13px;
}

.login-submit:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.setup-notice {
  margin-bottom: 18px;
  padding: 12px 13px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: var(--accent-soft);
}

.setup-notice strong {
  color: #065f46;
  font-size: 12px;
}

.setup-notice p {
  margin: 5px 0 0;
  color: #475569;
  font-size: 11px;
  line-height: 1.55;
}

.qr-frame {
  width: 210px;
  height: 210px;
  margin: 0 auto 11px;
  padding: 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.qr-frame img {
  width: 192px;
  height: 192px;
}

.qr-warning {
  margin: 0 0 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  color: var(--amber);
  font-size: 11px;
  line-height: 1.5;
}

.qr-warning svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  fill: var(--amber-soft);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.login-loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 11px;
  color: var(--muted);
  font-size: 12px;
}

.loading-indicator {
  width: 23px;
  height: 23px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: login-spin 0.8s linear infinite;
}

.login-message {
  min-height: 19px;
  margin-top: 14px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.login-message:not(:empty) {
  padding: 9px 11px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: var(--red-soft);
}

.login-message.success {
  color: #047857;
}

.login-message.success:not(:empty) {
  border-color: #a7f3d0;
  background: var(--accent-soft);
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-height: 620px) {
  .login-header {
    padding: 14px 0;
  }

  .login-shell {
    padding-bottom: 16px;
  }

  .login-panel {
    padding-top: 22px;
    padding-bottom: 20px;
  }
}

@media (max-width: 520px) {
  .login-header {
    width: min(100% - 32px, 438px);
    padding: 17px 0;
  }

  .access-badge {
    display: none;
  }

  .login-shell {
    padding: 6px 0 20px;
  }

  .login-panel {
    padding: 24px 22px 22px;
  }

  .login-panel h1 {
    font-size: 21px;
  }

  .otp-slots {
    gap: 8px;
  }

  .otp-slots span {
    width: min(40px, 12vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-indicator {
    animation-duration: 1.8s;
  }

  .otp-slots span {
    transition: none;
  }
}
