:root {
  --page-bg: #f2f4fb;
  --panel-tint: #f4f6ff;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef0ff;
  --text: #171b2f;
  --muted: #687086;
  --soft: #9aa4b8;
  --field-bg: #f0f4ff;
  --field-border: #d8dded;
  --shadow: 0 32px 90px rgba(31, 41, 85, 0.16);
  --shell-max-width: 1060px;
  --shell-max-height: 646px;
  --page-gutter: clamp(20px, 4.5vw, 56px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--page-gutter);
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 19% 18%, rgba(202, 209, 255, 0.92), transparent 29%),
    radial-gradient(circle at 84% 16%, rgba(205, 231, 255, 0.74), transparent 27%),
    linear-gradient(180deg, #f9fbff 0%, var(--page-bg) 100%);
}

.login-shell {
  width: min(var(--shell-max-width), calc(100vw - (var(--page-gutter) * 2)));
  height: clamp(560px, calc(100dvh - (var(--page-gutter) * 2)), var(--shell-max-height));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: rise .5s ease-out both;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.brand-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  background: linear-gradient(160deg, #f7f8ff 0%, var(--panel-tint) 55%, #eef2ff 100%);
}
.illustration-wrap { width: 100%; display: flex; justify-content: center; margin-bottom: 28px; }
.login-illu { width: 100%; max-width: 380px; max-height: 300px; object-fit: contain; }
.brand-title { margin: 0 0 10px; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-copy { margin: 0; max-width: 34ch; color: var(--muted); font-size: .92rem; line-height: 1.55; }

.form-panel { display: flex; align-items: center; justify-content: center; padding: 48px; }
.form-inner { width: 100%; max-width: 360px; }

.form-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.logo-well {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary-soft); border: 1px solid #e0e7ff;
  box-shadow: 0 8px 20px -10px rgba(79, 70, 229, .45);
}
.form-brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.form-brand-sub { font-size: .88rem; color: var(--muted); margin-top: 2px; }

label { display: block; font-size: .8rem; font-weight: 600; color: #334155; margin: 0 0 7px; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.label-row label { margin-bottom: 7px; }
.forgot-link { font-size: .78rem; font-weight: 600; color: var(--primary); cursor: help; margin-bottom: 7px; }

.field {
  width: 100%; padding: 13px 14px; font: inherit; font-size: .92rem; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field::placeholder { color: var(--soft); }
.field:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .16); }

.password-wrap { position: relative; }
.password-wrap .field { padding-right: 46px; }
.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; background: transparent; border-radius: 10px;
  color: var(--muted); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}
.toggle-pass:hover { color: var(--primary); background: var(--primary-soft); }
.toggle-pass:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn-signin {
  width: 100%; margin-top: 22px; border: 0; border-radius: 12px; padding: 14px 16px;
  background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  box-shadow: 0 12px 24px -12px rgba(79, 70, 229, .7);
  transition: background .15s, transform .1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-signin:hover { background: var(--primary-dark); }
.btn-signin:active { transform: translateY(1px); }
.btn-signin:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.btn-signin[disabled] { opacity: .75; cursor: progress; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px;
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 12px; font-size: .85rem; line-height: 1.45;
}
.alert i { font-size: 1.05rem; line-height: 1.3; }

.footer-copy { margin: 34px 0 0; text-align: center; font-size: .75rem; color: var(--soft); }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; height: auto; }
  .brand-panel { display: none; }
  .form-panel { padding: 36px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell { animation: none; }
}
