:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1a1d23; --muted: #6b7280; --border: #dfe2e8;
  --accent-from: #0ea5e9; --accent-mid: #6366f1; --accent-to: #a855f7; --focus: #6366f1;
  --btn-text: #ffffff; --error: #dc2626; --shadow: 0 10px 40px rgba(99, 102, 241, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --card: #121212; --text: #f0f2f8; --muted: #8b95a8; --border: #2a2a2a;
    --accent-from: #ef4444; --accent-mid: #dc2626; --accent-to: #C8102E; --focus: #ef4444;
    --error: #ef4444; --shadow: 0 10px 40px rgba(200, 16, 46, .15);
  }
}
:root[data-theme="dark"] {
    --bg: #000000; --card: #121212; --text: #f0f2f8; --muted: #8b95a8; --border: #2a2a2a;
    --accent-from: #ef4444; --accent-mid: #dc2626; --accent-to: #C8102E; --focus: #ef4444;
    --error: #ef4444; --shadow: 0 10px 40px rgba(200, 16, 46, .15);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 17px; line-height: 1.4;
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
}
.card {
  width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border);
  border-radius: 24px; padding: 40px 32px; box-shadow: var(--shadow);
}
h1 { margin: 0 0 8px; font-size: 32px; font-weight: 700; text-align: center; letter-spacing: -.01em; }
.lead { margin: 0 0 28px; text-align: center; color: var(--muted); word-break: break-word; }
.error { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; color: var(--error);
  border: 1px solid var(--error); text-align: center; font-size: 16px; }
.field {
  display: block; width: 100%; height: 54px; padding: 0 16px; margin: 0 0 14px; font: inherit; font-size: 17px;
  color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 14px; outline: none;
}
.field:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.pw { position: relative; }
.pw .field { padding-right: 96px; }
.toggle {
  position: absolute; right: 8px; top: 8px; height: 38px; padding: 0 12px; font: inherit; font-size: 15px;
  color: var(--muted); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
}
.btn {
  display: block; width: 100%; height: 54px; font: inherit; font-size: 17px; font-weight: 600;
  border-radius: 14px; border: 1px solid transparent; cursor: pointer;
}
.btn.primary { color: var(--btn-text); background: linear-gradient(135deg, var(--accent-from), var(--accent-mid), var(--accent-to)); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { color: var(--text); background: transparent; border-color: var(--border); }
.back { margin: 20px 0 0; text-align: center; }
a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }
.apps { list-style: none; margin: 0 0 24px; padding: 0; }
.apps li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.apps .role { color: var(--muted); font-size: 15px; }
[hidden] { display: none !important; }
.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; color: var(--muted);
  border: 1px solid var(--border); text-align: center; font-size: 16px; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 15px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
form + form { margin-top: 12px; }
form.inline { margin-top: 16px; text-align: center; }
.link { font: inherit; font-size: 16px; color: var(--focus); background: none; border: 0; cursor: pointer; padding: 6px; }
.link:hover { text-decoration: underline; }
.field.code { text-align: center; font-size: 26px; letter-spacing: .3em; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.alt { margin-top: 12px; }
.tg-icon { width: 24px; height: 24px; margin-right: 10px; flex: none; }

.theme-toggle {
  position: fixed; top: 14px; right: 14px; width: 42px; height: 42px; display: none; align-items: center;
  justify-content: center; padding: 0; color: var(--muted); background: var(--card);
  border: 1px solid var(--border); border-radius: 50%; cursor: pointer;
}
.js .theme-toggle { display: flex; }
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
