:root {
  --bg1: #07111f;
  --bg2: #0b1730;
  --card: #0f1b31;
  --line: #243a60;
  --line2: #304a76;
  --text: #eef4ff;
  --muted: #97aacd;
  --green: #6fce67;
  --green2: #5dc264;
  --blue: #60afe5;
  --danger: #ef5b71;
  --shadow: 0 14px 34px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(111, 206, 103, .08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(96, 175, 229, .09), transparent 30%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(111, 206, 103, .42);
  outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }

.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(15, 27, 49, .97);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.logo { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 16px; }
.brand h1 { margin: 0; font-size: 22px; line-height: 1.15; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.login-error {
  display: none;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(239, 91, 113, .35);
  border-radius: 14px;
  color: #ffb9c4;
  background: rgba(239, 91, 113, .10);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.login-error.show { display: block; }
.field { margin-bottom: 12px; }
.field-top-gap { margin-top: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.input {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line2);
  border-radius: 14px;
  color: var(--text);
  background: #0b1629;
}
.input:focus { border-color: var(--green2); outline: none; box-shadow: 0 0 0 3px rgba(93, 194, 100, .12); }
.login-check-row { margin: 2px 0 14px; }
.login-check { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 13px; line-height: 1.45; user-select: none; }
.login-check input { margin-top: 2px; accent-color: var(--green2); }
.btn, .link-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 850;
  cursor: pointer;
}
.btn.green { color: #061108; border-color: var(--green2); background: linear-gradient(135deg, var(--green), var(--green2)); }
.btn.blue { color: #061524; border-color: var(--blue); background: var(--blue); }
.btn.ghost, .link-btn { color: var(--text); border-color: var(--line2); background: #1b2744; }
.full-btn { width: 100%; }
.login-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link-btn { flex: 1 1 auto; font-size: 12px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 8, 18, .76);
}
.modal.show { display: flex; }
.modal-card {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line2);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.modal-card-sm { max-width: 430px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line2);
  border-radius: 50%;
  color: var(--text);
  background: #172846;
  font-size: 24px;
}
.modal-title { margin: 0 48px 4px 0; font-size: 20px; }
.modal-sub { margin: 0 48px 16px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-box { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #142440; }
.detail-box label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.detail-box strong { display: block; overflow-wrap: anywhere; }
.otp-status { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: #0b1629; font-size: 12px; }
.otp-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }

.login-page-loading { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; padding: 18px; background: rgba(2, 8, 18, .72); }
.login-page-loading.show { display: grid; }
.login-page-loading-card { min-width: 210px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: var(--card); text-align: center; }
.login-page-loading-spinner { width: 38px; height: 38px; margin: 0 auto 12px; border: 4px solid #314668; border-top-color: var(--green2); border-radius: 50%; animation: login-page-spin .8s linear infinite; }
.toast-wrap { position: fixed; right: 14px; bottom: 14px; z-index: 220; display: grid; gap: 8px; max-width: calc(100% - 28px); }
.toast { min-width: 230px; max-width: 400px; padding: 11px 13px; border: 1px solid var(--line2); border-radius: 14px; color: #fff; background: #10203a; box-shadow: var(--shadow); font-size: 12px; }
.toast.ok { border-color: rgba(70, 212, 138, .45); }
.toast.error { border-color: rgba(239, 91, 113, .45); }
@keyframes login-page-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .login-page-loading-spinner { animation: none; border-color: rgba(93, 194, 100, .5); }
}

@media (max-width: 480px) {
  .login-wrap { align-items: flex-start; padding: 18px 14px; }
  .detail-grid, .otp-actions { grid-template-columns: 1fr; }
}
