:root {
  color-scheme: light;
  --bg: #f2f4f0;
  --ink: #171a17;
  --ink-soft: #414741;
  --muted: #687168;
  --line: #dfe3dd;
  --line-strong: #c9cec7;
  --surface: #ffffff;
  --surface-subtle: #fbfcfa;
  --brand: #315be8;
  --brand-mark-bg: #171a17;
  --brand-mark-bar: #ffffff;
  --primary-bg: #171a17;
  --primary-hover: #292d29;
  --primary-ink: #ffffff;
  --danger: #b63838;
  --danger-soft: #fff0ef;
  --danger-line: #f3d7d4;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1210;
  --ink: #eef2ed;
  --ink-soft: #c1c8c1;
  --muted: #929b93;
  --line: #2b312c;
  --line-strong: #414942;
  --surface: #171b18;
  --surface-subtle: #1d221e;
  --brand: #8299ff;
  --brand-mark-bg: #eef2ed;
  --brand-mark-bar: #171b18;
  --primary-bg: #eef2ed;
  --primary-hover: #d8ded8;
  --primary-ink: #111411;
  --danger: #ef7c7c;
  --danger-soft: #3a2021;
  --danger-line: #653133;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); margin: 0; min-height: 100vh; transition: background-color .18s ease, color .18s ease; }
button, input { color: inherit; font: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(49,91,232,.22); outline-offset: 2px; }

.login-shell { background: var(--surface); display: grid; grid-template-columns: minmax(420px, .82fr) minmax(500px, 1.18fr); min-height: 100vh; }
.login-card { display: flex; flex-direction: column; justify-content: center; margin: 0 auto; max-width: 500px; padding: 56px 64px; position: relative; width: 100%; }
.theme-toggle { align-items: center; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; display: inline-flex; height: 38px; justify-content: center; position: absolute; right: 64px; top: 38px; width: 38px; }
.theme-toggle:hover { border-color: var(--line-strong); }
.theme-toggle span { display: inline-block; font-size: 15px; line-height: 1; transition: transform .2s ease; }
.theme-toggle:hover span { transform: rotate(12deg); }
.brand { align-items: center; display: flex; gap: 10px; margin-bottom: 72px; }
.brand-mark { align-items: flex-end; background: var(--brand-mark-bg); border-radius: 8px; display: inline-flex; gap: 2px; height: 30px; justify-content: center; padding: 7px; width: 30px; }
.brand-mark i { background: var(--brand-mark-bar); border-radius: 1px; display: block; width: 3px; }
.brand-mark i:nth-child(1) { height: 7px; opacity: .7; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { background: #8aa0ff; height: 17px; }
.brand-name { font-size: 18px; font-weight: 760; letter-spacing: -.7px; }
.brand-name span { color: var(--brand); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 780; letter-spacing: 1.2px; margin: 0; }
.login-copy h1 { font-size: clamp(28px, 3vw, 38px); letter-spacing: -1.4px; line-height: 1.08; margin: 10px 0 12px; }
.login-copy > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; max-width: 390px; }
form { display: grid; gap: 16px; margin-top: 34px; }
label { display: grid; gap: 7px; }
label > span:first-child { color: var(--ink-soft); font-size: 11px; font-weight: 680; }
input { background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 9px; height: 46px; padding: 0 13px; transition: border-color .15s, box-shadow .15s; width: 100%; }
input:hover { border-color: var(--line-strong); }
input:focus { border-color: #8da2ef; box-shadow: 0 0 0 3px rgba(49,91,232,.08); outline: 0; }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 86px; }
.password-field button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 680; height: 34px; padding: 0 10px; position: absolute; right: 6px; top: 6px; }
.submit-button { background: var(--primary-bg); border: 0; border-radius: 9px; color: var(--primary-ink); cursor: pointer; font-size: 13px; font-weight: 700; height: 46px; margin-top: 4px; }
.submit-button:hover { background: var(--primary-hover); }
.submit-button:disabled { cursor: wait; opacity: .58; }
.login-error { background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 8px; color: var(--danger); font-size: 11px; line-height: 1.45; padding: 10px 12px; }
.security-note { align-items: flex-start; border-top: 1px solid var(--line); color: var(--muted); display: flex; gap: 10px; margin-top: 42px; padding-top: 18px; }
.security-note > span { color: #16876b; font-size: 11px; margin-top: 2px; }
.security-note p { font-size: 10px; line-height: 1.5; margin: 0; }
.security-note strong { color: var(--ink-soft); }

.login-context { background: #171a17; color: #fff; min-height: 100vh; overflow: hidden; padding: 72px; position: relative; }
.context-grid { background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 46px 46px; inset: 0; mask-image: linear-gradient(to bottom right, #000, transparent 82%); position: absolute; }
.context-content { max-width: 590px; position: relative; top: 18%; }
.context-content p { color: #8fa7ff; font-size: 10px; font-weight: 750; letter-spacing: 1.4px; margin: 0 0 22px; }
.context-content strong { display: block; font-size: clamp(36px, 4vw, 62px); letter-spacing: -2.5px; line-height: 1.04; }
.context-content span { color: #abb2ab; display: block; font-size: 13px; line-height: 1.65; margin-top: 24px; max-width: 430px; }
.context-metrics { bottom: 72px; display: grid; gap: 1px; grid-template-columns: 1fr 1fr; left: 72px; max-width: 590px; position: absolute; right: 72px; }
.context-metrics div { border-top: 1px solid #414641; padding: 17px 16px 0 0; }
.context-metrics div + div { padding-left: 20px; }
.context-metrics span { color: #7f877f; display: block; font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.context-metrics strong { display: block; font-size: 12px; margin-top: 6px; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-card { min-height: 100vh; }
  .login-context { display: none; }
}

@media (max-width: 520px) {
  .login-card { justify-content: flex-start; padding: 32px 22px; }
  .theme-toggle { right: 22px; top: 24px; }
  .brand { margin-bottom: 70px; }
  .login-copy h1 { font-size: 30px; }
}
