:root {
  --bg:        #050508;
  --elevated:  #0a0a0f;
  --surface:   #0d0d14;
  --surface-2: #111118;
  --border:    rgba(255,255,255,0.06);
  --border-hi: rgba(255,255,255,0.10);
  --text:      #ffffff;
  --muted:     #a0a0a8;
  --dim:       #4a4a56;
  --accent:    #3b6ff5;
  --accent-dim:rgba(59,111,245,0.10);
  --red:       #ef4444;
  --green:     #22c55e;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  background: radial-gradient(circle, rgba(59,111,245,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a, button { font-family: inherit; color: inherit; text-decoration: none; cursor: pointer; border: none; background: none; }
input { font-family: inherit; color: var(--text); outline: none; }
::placeholder { color: var(--dim); }

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.auth-brand img { height: 30px; width: auto; }
.auth-brand-tag {
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(59,111,245,0.15);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.auth-subtitle {
  font-size: 0.8125rem;
  color: var(--dim);
  line-height: 1.5;
}

.auth-field {
  margin-bottom: 1rem;
}
.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 450;
  color: var(--muted);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}
.auth-input-wrap {
  position: relative;
}
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
  width: 100%;
  height: 44px;
  padding: 0 0.875rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8125rem;
  transition: all 0.2s ease;
}
.auth-field input:hover { border-color: var(--border-hi); }
.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.pw-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--muted); }

.name-field {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin-bottom 0.3s ease;
}
.name-field.show {
  max-height: 80px;
  opacity: 1;
  margin-bottom: 1rem;
}

.auth-submit {
  width: 100%;
  height: 44px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.25rem;
  position: relative;
  overflow: hidden;
}
.auth-submit:hover { opacity: 0.88; }
.auth-submit:active { transform: scale(0.99); }
.auth-submit:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.auth-submit .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.auth-submit.loading .btn-text { display: none; }
.auth-submit.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-error {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--red);
  margin-bottom: 1rem;
  display: none;
  line-height: 1.4;
}
.auth-error.show { display: flex; align-items: center; gap: 0.5rem; }

.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.8125rem;
  color: var(--dim);
}
.auth-footer a {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
.auth-footer a:hover { color: var(--accent); }

.auth-legal {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.6875rem;
  color: var(--dim);
  line-height: 1.6;
}
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-legal a:hover { color: var(--text); }

.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.8125rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeUp 0.2s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; } }
.toast.ok { border-color: rgba(34,197,94,0.3); color: var(--green); }
.toast.err { border-color: rgba(239,68,68,0.3); color: var(--red); }

@media (max-width: 440px) {
  .auth-container { padding: 1rem; }
  .auth-brand { margin-bottom: 2rem; }
}
