:root {
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --radius: 16px;

  --hero-bg: #0a1628;
  --hero-accent: #3b82f6;
  --hero-accent-2: #06b6d4;
  --hero-text: #f8fafc;
  --hero-muted: rgba(248, 250, 252, .72);

  --panel-bg: #ffffff;
  --panel-text: #0f172a;
  --panel-muted: #64748b;
  --panel-line: #e2e8f0;
  --panel-input: #f8fafc;
  --panel-input-focus: #ffffff;
  --panel-ring: rgba(59, 130, 246, .28);

  --btn-from: #2563eb;
  --btn-to: #1d4ed8;
  --btn-shadow: 0 14px 32px rgba(37, 99, 235, .32);

  --err: #b91c1c;
  --err-bg: #fef2f2;
  --err-border: #fecaca;
}

html[data-theme="dark"] {
  --panel-bg: #0f172a;
  --panel-text: #f1f5f9;
  --panel-muted: #94a3b8;
  --panel-line: rgba(148, 163, 184, .18);
  --panel-input: rgba(15, 23, 42, .65);
  --panel-input-focus: rgba(15, 23, 42, .85);
  --panel-ring: rgba(96, 165, 250, .35);
  --err-bg: rgba(127, 29, 29, .22);
  --err-border: rgba(248, 113, 113, .35);
  --err: #fca5a5;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--panel-text);
  background: var(--panel-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.login-page {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 960px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { min-height: 220px; padding: 32px 24px 28px; }
  .login-hero__features { display: none; }
}

.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 44px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(59, 130, 246, .45), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(6, 182, 212, .28), transparent 50%),
    linear-gradient(155deg, #07101f 0%, #0f2744 42%, #0a1628 100%);
  color: var(--hero-text);
  overflow: hidden;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 85%);
  pointer-events: none;
}

.login-hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: loginFloatOrb 14s ease-in-out infinite;
}

.login-hero__orb--1 {
  width: 320px; height: 320px;
  top: -80px; right: -60px;
  background: rgba(59, 130, 246, .35);
}

.login-hero__orb--2 {
  width: 240px; height: 240px;
  bottom: 10%; left: -40px;
  background: rgba(6, 182, 212, .22);
  animation-delay: -5s;
}

@keyframes loginFloatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.05); }
}

.login-hero__top,
.login-hero__bottom { position: relative; z-index: 1; }

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand__mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
}

.login-brand__logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.login-brand__name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.login-brand__tag {
  margin-top: 4px;
  font-size: 13px;
  color: var(--hero-muted);
  font-weight: 500;
}

.login-hero__headline {
  margin: 48px 0 0;
  max-width: 420px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.login-hero__headline em {
  font-style: normal;
  background: linear-gradient(90deg, #93c5fd, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-hero__lead {
  margin: 16px 0 0;
  max-width: 400px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--hero-muted);
  font-weight: 500;
}

.login-hero__features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 40px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 600;
  color: rgba(248, 250, 252, .92);
  transition: background .2s var(--ease), transform .2s var(--ease);
}

.login-feature:hover {
  background: rgba(255, 255, 255, .1);
  transform: translateX(4px);
}

.login-feature i {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, .25);
  color: #93c5fd;
  font-size: 15px;
  flex-shrink: 0;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px 40px;
  background: var(--panel-bg);
  position: relative;
}

.login-panel__toolbar {
  position: absolute;
  top: 20px;
  right: 20px;
}

.login-icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: var(--panel-input);
  color: var(--panel-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: color .2s, border-color .2s, background .2s, transform .15s;
}

.login-icon-btn:hover {
  color: var(--panel-text);
  border-color: rgba(59, 130, 246, .35);
  transform: translateY(-1px);
}

.login-card {
  width: min(420px, 100%);
  animation: loginCardIn .65s var(--ease) both;
}

body.has-error .login-card {
  animation: loginCardIn .65s var(--ease) both, loginShake .45s ease .12s both;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .1);
  border: 1px solid rgba(59, 130, 246, .2);
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 18px;
}

html[data-theme="dark"] .login-card__eyebrow {
  color: #93c5fd;
  background: rgba(59, 130, 246, .15);
}

.login-card__title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--panel-text);
}

.login-card__sub {
  margin: 8px 0 28px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--panel-muted);
  font-weight: 500;
}

.login-alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 44px 14px 14px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--err-border);
  background: var(--err-bg);
  color: var(--err);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  position: relative;
}

.login-alert.hide { display: none; }
.login-alert__icon { margin-top: 1px; font-size: 15px; }

.login-alert__close {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: .7;
}

.login-alert__close:hover {
  opacity: 1;
  background: rgba(0,0,0,.06);
}

.login-form { margin: 0; }
.login-field { margin-bottom: 18px; }

.login-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--panel-text);
}

.login-input-wrap { position: relative; }

.login-input {
  width: 100%;
  height: 50px;
  padding: 0 44px;
  border-radius: var(--radius);
  border: 1.5px solid var(--panel-line);
  background: var(--panel-input);
  color: var(--panel-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s, transform .15s;
}

.login-input::placeholder {
  color: var(--panel-muted);
  font-weight: 400;
}

.login-input:hover { border-color: rgba(59, 130, 246, .35); }

.login-input:focus {
  border-color: #3b82f6;
  background: var(--panel-input-focus);
  box-shadow: 0 0 0 4px var(--panel-ring);
  transform: translateY(-1px);
}

.login-input-ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--panel-muted);
  font-size: 15px;
  pointer-events: none;
  transition: color .2s;
}

.login-input-wrap:focus-within .login-input-ico { color: #3b82f6; }

.login-toggle-pwd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--panel-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.login-toggle-pwd:hover {
  color: var(--panel-text);
  background: rgba(59, 130, 246, .08);
}

.login-submit {
  width: 100%;
  height: 52px;
  margin-top: 8px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--btn-from), var(--btn-to));
  box-shadow: var(--btn-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .2s var(--ease), box-shadow .2s, filter .2s;
}

.login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, .4);
  filter: brightness(1.04);
}

.login-submit:active { transform: translateY(0); }

.login-submit__spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loginSpin .7s linear infinite;
}

.login-form.is-loading .login-submit__spinner { display: block; }
.login-form.is-loading .login-submit__icon { display: none; }

@keyframes loginSpin { to { transform: rotate(360deg); } }

.login-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--panel-muted);
  font-weight: 500;
}

.login-foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 960px) {
  .login-panel { padding-top: 48px; }
  .login-hero__headline { margin-top: 24px; font-size: 26px; }
}

@media (max-width: 420px) {
  .login-card__title { font-size: 24px; }
  .login-input { height: 48px; font-size: 16px; }
}
