*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #050505;
  --bg2: #0e0e0e;
  --bg3: #141414;
  --border: #262626;
  --text: #f5f5f5;
  --text-2: #969696;
  --blue: #3478ff;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse at 50% 38%, #131313 0%, #080808 40%, var(--bg) 72%);
  color: var(--text);
  font: 14px/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #76a4ff; outline-offset: 4px; }

.login-wrap { width: 100%; max-width: 420px; }
.logo-area { text-align: center; margin-bottom: 28px; }
.login-logo {
  display: block;
  width: 240px;
  height: 64px;
  max-width: 100%;
  margin: 0 auto;
  object-fit: cover;
  mix-blend-mode: lighten;
}
.logo-area p { margin-top: 8px; color: var(--text-2); font-size: 12px; letter-spacing: .3px; }

.card {
  padding: 32px;
  background: var(--bg2);
  border: 1px solid #222;
  border-radius: 16px;
  box-shadow: 0 24px 64px #0006, 0 1px 0 #ffffff04 inset;
}
.card-heading { margin-bottom: 28px; text-align: center; }
.card-heading h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.7px; }
.card-heading p { margin-top: 9px; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #c9c9c9; font-size: 13px; font-weight: 500; }
.input-wrap { position: relative; }
.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: #808080;
  transform: translateY(-50%);
  pointer-events: none;
  transition: color .15s;
}
.input-wrap:focus-within .input-icon { color: #83aaff; }
.form-group input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0 15px 0 45px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  caret-color: #83aaff;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.form-group input::placeholder { color: #777; opacity: 1; }
.form-group input:hover { border-color: #373737; }
.form-group input:focus { border-color: #4b80e6; box-shadow: 0 0 0 3px #3478ff12; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg3) inset !important;
  box-shadow: 0 0 0 1000px var(--bg3) inset !important;
  caret-color: var(--text);
}

.btn-login, .btn-confirm {
  position: relative;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid #4b7aee;
  border-radius: 9px;
  background: linear-gradient(180deg, #2e6bea, #2559d2);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn-login { width: 100%; margin-top: 4px; }
.btn-login:hover:not(:disabled), .btn-confirm:hover:not(:disabled) { background: #3472ef; border-color: #668ff0; }
.btn-login:disabled, .btn-confirm:disabled { opacity: .6; cursor: wait; }
.error-msg {
  display: none;
  margin-top: 18px;
  padding: 11px 13px;
  border: 1px solid #f8717138;
  border-radius: 9px;
  background: #ef444410;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.error-msg.visible { display: block; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000b;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-overlay.visible { display: flex; }
.modal-2fa {
  width: 100%;
  max-width: 410px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 30px 28px 28px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 28px 80px #0009;
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.badge-2fa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  background: #131a26;
  border: 1px solid #263144;
  border-radius: 13px;
  color: #83aaff;
}
.badge-2fa svg { stroke: currentColor; }
.modal-2fa h2 { font-size: 22px; font-weight: 600; letter-spacing: -.5px; line-height: 1.3; }
.modal-2fa .sub { max-width: 290px; margin: 10px auto 24px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.otp-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp-input {
  width: 100%;
  min-width: 0;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--bg3);
  color: var(--text);
  font-size: 23px;
  font-weight: 500;
  text-align: center;
  caret-color: #83aaff;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.otp-input:focus { border-color: #4b80e6; box-shadow: 0 0 0 3px #3478ff1a; }
.otp-input.filled { border-color: #3b547e; }
.otp-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 31px; gap: 6px; margin: 18px 0 22px; padding: 5px 12px; border: 1px solid #262626; border-radius: 7px; background: #141414; color: var(--text-2); font-size: 12px; }
.otp-chip.err { color: #fca5a5; border-color: #f8717140; background: #ef444410; }
.modal-actions { display: flex; gap: 10px; }
.btn-confirm { flex: 1; }
.btn-cancel { min-height: 48px; padding: 12px 18px; border: 1px solid #303030; border-radius: 9px; background: transparent; color: #bababa; font-size: 14px; cursor: pointer; transition: color .15s, border-color .15s; }
.btn-cancel:hover { border-color: #484848; color: var(--text); }

@media (max-width: 480px) {
  body { padding: 28px 20px; }
  .card { padding: 28px 24px; }
  .card-heading h1 { font-size: 23px; }
  .login-logo { width: 220px; height: 60px; }
  .form-group input { font-size: 16px; }
  .modal-2fa { padding: 26px 20px 22px; }
  .otp-row { gap: 6px; }
  .otp-input { height: 50px; font-size: 21px; }
}
@media (max-height: 650px) { body { align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
