:root {
  --navy: #0b1220;
  --navy-2: #111b2e;
  --mv: #2563eb;
  --mv-dark: #1d4ed8;
  --mv-soft: #3b9dcc;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #b91c1c;
  --ok: #047857;
  --radius: 18px;
  --font: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

html.auth-booting .auth { visibility: hidden; }
html.auth-booting .auth-gate { display: grid; }
.auth-gate {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  background: var(--navy);
  z-index: 20;
  color: #fff;
}
.auth-gate__box {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.auth-gate__box p { margin: 0; color: rgba(255,255,255,.72); font-size: 14px; }
.auth-gate__spin {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #93c5fd;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.auth {
  min-height: 100vh;
  display: grid;
}

.auth__brand {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(720px 420px at 12% 18%, rgba(59,157,204,.22), transparent 62%),
    radial-gradient(640px 380px at 90% 88%, rgba(37,99,235,.18), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #0a101c 100%);
  padding: 28px 22px 22px;
}
.brand-shapes,
.brand-shapes::before,
.brand-shapes::after {
  position: absolute;
  border: 1px solid rgba(147,197,253,.16);
  pointer-events: none;
}
.brand-shapes {
  width: 240px;
  height: 240px;
  right: -70px;
  bottom: -80px;
  border-radius: 42px;
  transform: rotate(18deg);
}
.brand-shapes::before {
  content: "";
  inset: 28px;
  border-radius: 32px;
}
.brand-shapes::after {
  content: "";
  width: 88px;
  height: 88px;
  left: -120px;
  top: 40px;
  border-radius: 50%;
}

.brand {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(37,99,235,.22);
  border: 1px solid rgba(147,197,253,.28);
  font-weight: 900;
  letter-spacing: .04em;
}
.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}
.brand p {
  margin: 3px 0 0;
  color: rgba(255,255,255,.72);
  font-size: .9rem;
}
.brand-points {
  position: relative;
  display: none;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 600;
}
.brand-points li {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}

.auth__panel {
  display: grid;
  place-items: center;
  padding: 20px 16px 28px;
}
.panel-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .06);
  padding: 28px 22px 18px;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -.03em;
}
.panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.form { display: grid; gap: 14px; margin-top: 22px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  outline: none;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  border-color: var(--mv);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.field.is-invalid input {
  border-color: #fecaca;
  box-shadow: 0 0 0 4px rgba(185,28,28,.08);
}
.field-error { min-height: 16px; color: var(--danger); font-size: 12px; font-weight: 600; }
.caps { color: #c2410c; font-size: 12px; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 46px; }
.eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
}
.eye-btn svg[hidden] { display: none !important; }
.eye-btn:hover, .eye-btn:focus-visible { color: var(--mv-dark); background: #eff6ff; }
.form-row { display: flex; justify-content: flex-end; }
.text-link {
  border: 0;
  background: none;
  color: var(--mv-dark);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.text-link:hover, .text-link:focus-visible { text-decoration: underline; }
.back-link { justify-self: start; margin-top: 4px; }
.form-alert {
  min-height: 20px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.form-alert.is-error { color: var(--danger); }
.form-alert.is-ok { color: var(--ok); }
.btn-primary {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: var(--mv);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-primary:hover { background: var(--mv-dark); }
.btn-primary:disabled { opacity: .72; cursor: not-allowed; }
.btn-spin {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading .btn-spin { display: inline-block; }
.secure-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.secure-note strong { display: block; color: #334155; }
.panel-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.view[hidden] { display: none !important; }
.sent-check {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  background: #ecfdf5;
  color: var(--ok);
  font-weight: 900;
}
.sent h2 { margin: 0; }
.sent p { color: var(--muted); line-height: 1.5; }
.sent .btn-primary { margin-top: 8px; }

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

html, body { overflow-x: hidden; }

@media (min-width: 900px) {
  body { background: var(--navy); }
  .auth {
    grid-template-columns: minmax(340px, 1.05fr) minmax(400px, 1fr);
    width: 100%;
    max-width: none;
    min-height: 100vh;
    align-items: stretch;
  }
  .auth__brand {
    min-height: 100vh;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
  }
  .brand-points { display: flex; flex-wrap: wrap; }
  .brand h1 { font-size: 1.75rem; }
  .auth__panel {
    background: var(--bg);
    min-height: 100vh;
    padding: 40px 32px;
  }
  .panel-card {
    width: min(420px, 100%);
    padding: 36px 32px 22px;
  }
}

@media (min-width: 900px) and (max-height: 780px) {
  .auth__brand, .auth__panel { padding-top: 28px; padding-bottom: 28px; }
  .panel-head h2 { font-size: 1.45rem; }
  .form { margin-top: 16px; gap: 10px; }
  .panel-card { padding: 28px 28px 16px; }
}

@media (max-width: 899px) {
  .brand-points { display: none; }
  .auth__brand { padding: 22px 18px 18px; }
  .panel-card { padding: 24px 16px 16px; }
  .field input, .btn-primary { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
