:root {
  --bg: #071225;
  --surface: #0b1930;
  --surface-2: #0f213d;
  --surface-3: #132947;
  --brand: #1b3f8b;
  --brand-hover: #2451aa;
  --text: #f6f8fc;
  --muted: #9bacbf;
  --subtle: #73849a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.17);
  --success: #4fd18b;
  --danger: #ff7d7d;
  --warning: #f6c86a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
a { color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.page-shell {
  width: min(1240px, calc(100% - 40px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 88px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
}
.brand-logo-wrap {
  width: 112px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 7px 10px;
  background: #ffffff;
  border-radius: 12px;
}
.brand-logo-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 17px; letter-spacing: -0.01em; }
.brand-copy small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.service-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c9d4e2;
  background: var(--surface-2);
  font-size: 13px;
  white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(79, 209, 139, 0.12); }

.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: 58px;
  align-items: center;
  padding: 64px;
  background: var(--surface);
}
.intro { max-width: 670px; }
.intro-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
  padding: 9px 12px;
  border: 1px solid rgba(74, 120, 218, 0.35);
  border-radius: 999px;
  color: #bfcdf0;
  background: rgba(27, 63, 139, 0.22);
  font-size: 13px;
  font-weight: 700;
}
.intro-badge svg { font-size: 17px; }
.intro h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}
.intro > p {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}
.feature-row {
  margin-top: 42px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.feature-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.feature-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #d2def8;
  background: var(--brand);
}
.feature-icon svg { font-size: 19px; }
.feature-item > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.feature-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.feature-item small { margin-top: 3px; overflow: hidden; color: var(--subtle); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.login-card {
  width: 100%;
  max-width: 470px;
  justify-self: end;
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.25);
}
.card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.card-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #e3eafe;
  background: var(--brand);
}
.card-icon svg { font-size: 22px; }
.card-heading h2 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.card-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.login-form { display: grid; gap: 21px; }
.field-group { display: grid; gap: 9px; }
.field-group label { color: #e9eef7; font-size: 13px; font-weight: 700; }
.label-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.caps-warning { color: var(--warning); font-size: 11px; font-weight: 700; }
.field-control { position: relative; display: flex; align-items: center; }
.field-icon {
  position: absolute;
  left: 15px;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #8495ab;
  pointer-events: none;
}
.field-icon svg { font-size: 18px; }
.field-control input {
  width: 100%;
  height: 54px;
  padding: 0 52px 0 47px;
  color: var(--text);
  caret-color: #ffffff;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  outline: none;
}
.field-control input::placeholder { color: #6f8197; }
.field-control input:focus { border-color: #6689da; box-shadow: 0 0 0 4px rgba(66, 106, 197, 0.18); }
.field-control input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255, 125, 125, 0.12); }
.field-help { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.45; }
.password-toggle {
  position: absolute;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #8fa0b5;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus-visible { color: #fff; background: rgba(255,255,255,0.06); outline: none; }
.password-toggle svg { font-size: 19px; }
.eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

.login-button {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 2px;
  padding: 13px 18px;
  color: #ffffff;
  background: var(--brand);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  font-weight: 800;
  cursor: pointer;
}
.login-button:hover { background: var(--brand-hover); }
.login-button:focus-visible { outline: 3px solid rgba(126, 160, 235, 0.5); outline-offset: 2px; }
.login-button:disabled { cursor: wait; opacity: 0.8; }
.button-icon { display: grid; place-items: center; }
.button-icon svg { font-size: 20px; }
.button-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
}
.login-button.is-loading .button-icon { display: none; }
.login-button.is-loading .button-loader { display: block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-alert {
  margin: -8px 0 20px;
  padding: 12px 14px;
  color: #ffd4d4;
  background: rgba(117, 26, 38, 0.35);
  border: 1px solid rgba(255, 125, 125, 0.35);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}
.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.privacy-note svg { flex: 0 0 auto; margin-top: 2px; color: var(--success); font-size: 18px; }
.privacy-note p { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.55; }
.fallback-link {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: #b9c8ea;
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 200, 234, 0.35);
}
.fallback-link:hover { color: #fff; border-bottom-color: #fff; }

.footer {
  min-height: 58px;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--subtle);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.footer-separator { width: 4px; height: 4px; border-radius: 50%; background: #52647a; }

@media (max-width: 1040px) {
  .main-content { grid-template-columns: 1fr 430px; gap: 34px; padding: 48px 36px; }
  .feature-row { grid-template-columns: 1fr; max-width: 360px; }
}
@media (max-width: 840px) {
  .page-shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 16px 20px; }
  .brand-copy small { display: none; }
  .service-status span:last-child { display: none; }
  .service-status { width: 32px; height: 32px; justify-content: center; padding: 0; }
  .main-content { grid-template-columns: 1fr; gap: 36px; padding: 38px 20px 42px; }
  .intro { max-width: none; text-align: center; }
  .intro-badge { margin-left: auto; margin-right: auto; }
  .intro h1 { max-width: 720px; margin-left: auto; margin-right: auto; font-size: clamp(38px, 11vw, 58px); }
  .intro > p { margin-left: auto; margin-right: auto; font-size: 16px; }
  .feature-row { display: none; }
  .login-card { max-width: 520px; justify-self: center; }
}
@media (max-width: 520px) {
  .topbar { min-height: 72px; }
  .brand-logo-wrap { width: 92px; height: 36px; }
  .brand-copy strong { font-size: 14px; }
  .main-content { padding-top: 30px; }
  .intro-badge { margin-bottom: 18px; }
  .intro h1 { font-size: 39px; }
  .intro > p { margin-top: 17px; font-size: 15px; line-height: 1.65; }
  .login-card { padding: 23px 18px; border-radius: 22px; }
  .card-heading { margin-bottom: 24px; }
  .card-icon { width: 44px; height: 44px; }
  .card-heading h2 { font-size: 23px; }
  .field-control input { height: 52px; }
  .footer { flex-wrap: wrap; padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
