:root {
  --bg: #0a0b0f;
  --bg-elev: #12141a;
  --bg-card: #161923;
  --border: #242836;
  --border-light: #2e3346;
  --text: #e8ecf4;
  --text-dim: #8890a8;
  --text-faint: #4e5468;
  --accent: #ffd447;
  --accent-dim: #c9a337;
  --green: #22c493;
  --red: #ef4c5c;
  --amber: #ff9f43;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  min-height: 100vh;
  position: relative;
}

/* Sidebar (brand) */
.auth-sidebar {
  background: linear-gradient(180deg, #12141a 0%, #0a0b0f 100%);
  border-right: 1px solid var(--border);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-sidebar::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -40%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,212,71,0.08), transparent 70%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.brand-mark {
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
}
.brand-text {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.tagline { position: relative; z-index: 1; }
.tagline h1 {
  font-family: 'Fraunces', serif;
  font-size: 48px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.tagline p {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 360px;
  line-height: 1.6;
}

.meta {
  display: flex;
  gap: 24px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  z-index: 1;
}

/* Main card area */
.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
}

.auth-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.auth-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-error, .auth-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.auth-error {
  background: rgba(239,76,92,0.08);
  border: 1px solid rgba(239,76,92,0.25);
  color: #ffb5be;
}
.auth-message.info {
  background: rgba(77,140,255,0.08);
  border: 1px solid rgba(77,140,255,0.25);
  color: #a5c3ff;
}
.auth-message.success {
  background: rgba(34,196,147,0.08);
  border: 1px solid rgba(34,196,147,0.25);
  color: #86e3c5;
}
.auth-message.error {
  background: rgba(239,76,92,0.08);
  border: 1px solid rgba(239,76,92,0.25);
  color: #ffb5be;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}
.auth-field input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.auth-field .hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 13px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  transition: all 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-oauth {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: all 0.15s;
}
.btn-oauth:hover { border-color: var(--border-light); background: var(--bg); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footnote {
  margin-top: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.auth-footnote a {
  color: var(--accent);
  text-decoration: none;
}
.auth-footnote a:hover { color: var(--accent-dim); }
.auth-footnote .sep { margin: 0 8px; color: var(--text-faint); }

.auth-footer {
  margin-top: 32px;
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--text-faint);
}
.auth-footer a {
  color: inherit;
  text-decoration: none;
}
.auth-footer a:hover { color: var(--text-dim); }

/* Spinner */
.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Callback page */
body.auth-callback {
  display: flex;
  align-items: center;
  justify-content: center;
}
.callback-box {
  text-align: center;
  padding: 40px;
}
.spinner-lg {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}
.callback-text {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}
.callback-sub {
  color: var(--text-dim);
  font-size: 13px;
}

@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-sidebar { padding: 32px 24px; min-height: auto; }
  .tagline h1 { font-size: 32px; }
  .auth-main { padding: 24px; }
}
