:root {
  --bg: #f5f7fb;
  --card: #fff;
  --text: #172033;
  --muted: #667085;
  --border: #dfe3eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #067647;
  --success-bg: #ecfdf3;
  --focus: rgba(37, 99, 235, .16);
  --shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

.login-layout {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr);
  min-height: 100vh;
}

.intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 44px clamp(36px, 5vw, 84px);
  background: linear-gradient(145deg, #172554 0%, #1d4ed8 62%, #2563eb 100%);
  color: #fff;
}

.intro::before,
.intro::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}

.intro::before { width: 460px; height: 460px; right: -260px; top: -120px; }
.intro::after { width: 330px; height: 330px; left: -200px; bottom: -140px; }

.brand, .mobile-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  font-size: 21px;
}

.intro-content { position: relative; z-index: 1; max-width: 560px; }
.eyebrow { margin: 0 0 10px; color: #93c5fd; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.intro h1 { max-width: 520px; margin: 0; font-size: clamp(38px, 4.5vw, 64px); line-height: 1.03; letter-spacing: -.05em; }
.intro-content > p:not(.eyebrow) { max-width: 530px; margin: 24px 0 0; color: #dbeafe; font-size: 18px; line-height: 1.65; }
.benefits { display: grid; gap: 14px; margin: 34px 0 0; padding: 0; list-style: none; color: #eff6ff; }
.benefits li { display: flex; align-items: center; gap: 12px; }
.benefits span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 13px; font-weight: 900; }
.copyright { position: relative; z-index: 1; margin: 0; color: #bfdbfe; font-size: 13px; }

.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(100%, 440px); padding: 42px; border: 1px solid rgba(223, 227, 235, .9); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.mobile-brand { display: none; margin-bottom: 36px; color: var(--text); }
.mobile-brand .brand-icon { background: #dbeafe; color: var(--primary); }
.card-header { margin-bottom: 30px; }
.card-header .eyebrow { color: var(--primary); }
.card-header h2 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.035em; }
.card-header > p:last-child { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }

form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label, .label-row { color: #344054; font-size: 14px; font-weight: 700; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input[type="email"], input[type="password"], input[type="text"] { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; outline: none; color: var(--text); background: #fff; transition: border-color .2s, box-shadow .2s; }
input::placeholder { color: #98a2b3; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
input[aria-invalid="true"] { border-color: var(--danger); }
.password-input { position: relative; }
.password-input input { padding-right: 82px; }
.toggle-password { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); padding: 8px; border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 800; cursor: pointer; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 13px; font-weight: 750; cursor: pointer; }
.text-button:hover { color: var(--primary-dark); text-decoration: underline; }
.field-error { min-height: 17px; color: var(--danger); font-size: 12px; }
.remember { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.4; cursor: pointer; }
.remember input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--primary); }
.submit-button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 800; cursor: pointer; transition: background .2s, transform .2s; }
.submit-button:hover { background: var(--primary-dark); }
.submit-button:active { transform: translateY(1px); }
.submit-button:disabled { cursor: wait; opacity: .72; }
.spinner { display: none; width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .75s linear infinite; }
.submit-button.loading .spinner { display: inline-block; }
.form-message { margin: -10px 0 20px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.form-message.error { background: var(--danger-bg); color: var(--danger); }
.form-message.info { background: #eff6ff; color: #1e40af; }
.form-message.success { background: var(--success-bg); color: var(--success); }
.register-copy { margin: 26px 0 0; color: var(--muted); text-align: center; font-size: 13px; }

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

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .intro { display: none; }
  .mobile-brand { display: flex; }
}

@media (max-width: 520px) {
  .login-panel { align-items: start; padding: 18px 14px; }
  .login-card { padding: 30px 22px; border-radius: 18px; box-shadow: 0 16px 50px rgba(15, 23, 42, .09); }
  .card-header h2 { font-size: 27px; }
  .label-row { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
