:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg-side: #f4f8f7; --bg-main: #fff; --text: #1f2937; --text-sub: #6b7280;
  --label: #4b5563; --border: #d1d5db; --border-focus: #0d9488;
  --accent: #0d9488; --accent-hover: #0f766e; --err: #dc2626;
  --toggle-bg: #f3f4f6; --divider: #e5e7eb; --focus-ring: rgba(13,148,136,.18);
  --side-grad: linear-gradient(160deg,#f0fbf8 0%,#f4f8f7 52%,#e8f5f2 100%);
  --side-glow: rgba(13,148,136,.14); --brand-fg: #0f172a;
  --button-bg: #0f8177; --button-hover: #0f766e; --button-fg: #ffffff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-side: #0f1419; --bg-main: #1a1f29; --text: #e5e7eb; --text-sub: #9ca3af;
  --label: #9ca3af; --border: #374151; --border-focus: #14b8a6;
  --accent: #14b8a6; --accent-hover: #0d9488; --err: #f87171;
  --toggle-bg: #262d3a; --divider: #1f2937; --focus-ring: rgba(20,184,166,.25);
  --side-grad: linear-gradient(160deg,#0d1a1a 0%,#0f1419 52%,#101f1e 100%);
  --side-glow: rgba(20,184,166,.16); --brand-fg: #f1f5f9;
  --button-bg: #14b8a6; --button-hover: #0d9488; --button-fg: #0f1419;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; min-width: 280px; min-height: 100vh; min-height: 100dvh;
  display: flex; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  background: var(--bg-main); color: var(--text); -webkit-font-smoothing: antialiased;
}
.side {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 48px; background: var(--bg-side); background-image: var(--side-grad);
  border-right: 1px solid var(--divider); overflow: hidden;
}
.side::before {
  content: ""; position: absolute; width: 520px; height: 520px; left: -140px; bottom: -200px;
  border-radius: 50%; background: radial-gradient(circle,var(--side-glow) 0%,transparent 70%);
  pointer-events: none;
}
.side-inner { position: relative; max-width: 340px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; letter-spacing: -.03em;
}
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: -.035em; color: var(--brand-fg); }
.brand-name em { font-style: normal; color: var(--accent); }
.brand-tag { margin: 18px 0 0; font-size: 14px; line-height: 1.55; color: var(--text-sub); }
.brand-rule { width: 44px; height: 3px; border-radius: 2px; background: var(--accent); opacity: .85; margin-top: 22px; }
.main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: 72px 24px; }
.auth-panel { width: 100%; max-width: 380px; }
.brand-sm { display: none; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand-sm .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.brand-sm .brand-name { font-size: 17px; }
.theme-toggle {
  position: absolute; top: 20px; right: 20px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--toggle-bg); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--text-sub); }
.theme-toggle svg, .password-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon, :root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
h1 { margin: 0 0 26px; font-size: 27px; font-weight: 700; letter-spacing: -.025em; color: var(--text); }
.sub { margin: -18px 0 24px; font-size: 14px; line-height: 1.5; color: var(--text-sub); }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 500; color: var(--label); }
.field { margin-bottom: 18px; }
input {
  display: block; width: 100%; padding: 11px 13px; background: var(--bg-main);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  font: inherit; font-size: 14px; transition: border-color .15s,box-shadow .15s;
}
input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.password-field { position: relative; }
.password-field:has(.password-toggle:not([hidden])) input { padding-right: 48px; }
button { font-family: inherit; cursor: pointer; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none;
  border: 0; color: var(--text-sub); padding: 10px; display: flex; border-radius: 4px;
}
.password-toggle:hover { color: var(--text); }
.eye-slash { display: none; }
.password-toggle[aria-pressed="true"] .eye-slash { display: block; }
.primary, .secondary { width: 100%; padding: 12px; border-radius: 6px; font-size: 15px; font-weight: 600; }
.primary { border: 0; background: var(--button-bg); color: var(--button-fg); margin-top: 6px; transition: background .15s,box-shadow .15s; }
.primary:hover { background: var(--button-hover); }
.secondary { border: 0; background: transparent; color: var(--text-sub); font-size: 14px; font-weight: 400; }
.secondary:hover { color: var(--accent); }
button:focus-visible, .error:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
button:disabled { opacity: .65; cursor: wait; }
.code-input { font-size: 20px; letter-spacing: 8px; text-align: center; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; }
.error-slot { min-height: 18px; margin-bottom: 12px; }
.error { color: var(--err); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.field-help, .help { font-size: 12px; line-height: 1.55; color: var(--text-sub); }
.field-help { margin: 10px 0 0; }
.help { margin-top: 18px; }
.help p { margin: 0 0 8px; }
.status { margin: 12px 0 0; color: var(--text-sub); font-size: 13px; text-align: center; }
.status:empty { display: none; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .side { display: none; }
  .brand-sm { display: flex; }
  .main { padding: 80px 22px 28px; }
  input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; } }
