*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --border: #ebebeb;
  --border2: #d4d4d4;
  --ink: #0a0a0a;
  --ink2: #333333;
  --ink3: #888888;
  --purple: #5b21b6;
  --purple-d: #4c1d95;
  --purple-bg: #f0ebff;
  --purple-txt: #3b0764;
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.05);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --ui-scale: 1.1;
}

html {
  zoom: var(--ui-scale);
}

html, body { height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ── Brand panel ── */
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: linear-gradient(145deg, #4c1d95 0%, #5b21b6 45%, #6d28d9 100%);
  color: #fff;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 100%, rgba(255,255,255,.12) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(255,255,255,.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-brand::after {
  content: '';
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  pointer-events: none;
}

.brand-top {
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.logo-icon [class^="iconoir-"] { font-size: 20px; }

.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.logo-sub {
  font-size: 12px;
  opacity: .75;
  margin-top: 2px;
}

.brand-content {
  position: relative;
  z-index: 1;
  max-width: 380px;
}

.brand-headline {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.03em;
  margin-bottom: 16px;
}

.brand-desc {
  font-size: 15px;
  line-height: 1.6;
  opacity: .88;
  font-weight: 400;
}

.brand-features {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: .92;
}

.brand-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-feature-icon [class^="iconoir-"] { font-size: 17px; }

.brand-footer {
  position: relative;
  z-index: 1;
  font-size: 12px;
  opacity: .6;
  font-family: 'DM Mono', monospace;
  letter-spacing: .04em;
}

/* ── Form panel ── */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  animation: fadeUp .4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card-header {
  margin-bottom: 32px;
}

.login-card-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
}

.login-card-header p {
  font-size: 14px;
  color: var(--ink3);
  margin-top: 6px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  margin-bottom: 7px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.input-wrap:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(91,33,182,.12);
}

.input-wrap [class^="iconoir-"] {
  font-size: 18px;
  color: var(--ink3);
  flex-shrink: 0;
}

.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  min-width: 0;
}

.input-wrap input::placeholder { color: var(--ink3); }

.toggle-pw {
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ink3);
  display: flex;
  align-items: center;
  transition: color .12s;
}

.toggle-pw:hover { color: var(--ink2); }
.toggle-pw [class^="iconoir-"] { font-size: 18px; }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}

.link {
  font-size: 13px;
  font-weight: 500;
  color: var(--purple);
  text-decoration: none;
  transition: color .12s;
}

.link:hover { color: var(--purple-d); }

.btn-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: none;
  border-radius: var(--r-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #0a0a0a;
  cursor: pointer;
  transition: background .15s, transform .1s;
  box-shadow: var(--shadow);
}

.btn-submit:hover { background: var(--purple-d); }
.btn-submit:active { transform: scale(.99); }
.btn-submit [class^="iconoir-"] { font-size: 17px; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  font-size: 12px;
  color: var(--ink3);
  font-family: 'DM Mono', monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.demo-hint {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--purple-bg);
  border: 1px solid #e9e0ff;
  font-size: 12px;
  color: var(--purple-txt);
  line-height: 1.5;
}

.demo-hint strong {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: 'DM Mono', monospace;
}

.demo-hint code {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  background: rgba(91,33,182,.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--ink3);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.login-alert {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  margin-bottom: 20px;
}

.login-alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.login-alert-info {
  background: var(--purple-bg);
  color: var(--purple-txt);
  border: 1px solid #e9e0ff;
}

.login-alert-info strong {
  font-weight: 600;
}

.input-code {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  letter-spacing: 0.25em;
  text-align: center;
}

.login-footer-sep {
  margin: 0 8px;
  color: var(--border2);
}

.toast {
  position: fixed;
  top: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  font-size: 20px;
  color: #15803d;
}

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 32px 28px; min-height: auto; }
  .brand-content { margin-top: 32px; }
  .brand-headline { font-size: 26px; }
  .brand-features { display: none; }
  .brand-footer { display: none; }
}