:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #1e3a5f;
  --primary-hover: #2c4a6e;
  --accent: #b8860b;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok-bg: #ecfdf5;
  --ok: #047857;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}
html.dark-mode {
  color-scheme: dark;
  --bg: #0a0f1a;
  --surface: #151d2e;
  --ink: #f1f5f9;
  --muted: #a8b4c4;
  --line: #2a3548;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --accent: #e8d48b;
  --danger: #fca5a5;
  --danger-bg: rgba(185, 28, 28, 0.2);
  --ok-bg: rgba(4, 120, 87, 0.2);
  --ok: #6ee7b7;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .2s ease;
}
.auth-shell {
  width: 100%;
  max-width: 440px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  transition: background-color .25s ease, border-color .2s ease;
}
.auth-brand .auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: block;
  margin: 0 auto 14px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}
.auth-brand {

  text-align: center;
  margin-bottom: 28px;
}
.auth-brand .mark {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: #0f172a;
  color: #e8d48b;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; letter-spacing: -0.02em;
}
html.dark-mode .auth-brand .mark {
  background: #1e3a5f;
  color: #e8d48b;
}
.auth-brand h1 {
  margin-bottom: 0;
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.auth-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-control {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  min-height: 46px;
  transition: border-color .15s, box-shadow .15s, background .2s;
}
.form-control:focus {
  outline: none;
  border-color: #64748b;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}
html.dark-mode .form-control:focus {
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}
.form-control::placeholder { color: var(--muted); opacity: .8; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 18px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 10px;
  font-weight: 650;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.99); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
html.dark-mode .btn-primary { color: #0f172a; background: #e8d48b; }
.btn-primary:hover { filter: brightness(1.06); color: inherit; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(185,28,28,.25); }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: rgba(4,120,87,.25); }
.alert-info {
  background: rgba(59,130,246,.1);
  color: #1d4ed8;
  border-color: rgba(59,130,246,.25);
}
html.dark-mode .alert-info { color: #93c5fd; }
.auth-links {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.auth-links a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}
html.dark-mode .auth-links a { color: #93c5fd; }
.auth-links a:hover { text-decoration: underline; }
.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.auth-check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #1e3a5f;
  flex-shrink: 0;
}
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow);
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover { border-color: #94a3b8; }
.terms-page .auth-shell { max-width: 720px; }
.terms-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.terms-body h2 {
  font-size: 16px;
  margin: 22px 0 8px;
}
.terms-body p, .terms-body li { color: var(--muted); }
.terms-body ul { padding-left: 1.2em; }
@media (max-width: 480px) {
  body { padding: 16px 12px; align-items: flex-start; padding-top: 56px; }
  .auth-card { padding: 24px 18px; }
  .auth-brand h1 { font-size: 20px; }
  .theme-toggle { top: 10px; right: 10px; width: 40px; height: 40px; }
}
