:root {
  color-scheme: dark;
  --bg: #0f0f0f;
  --panel: #171717;
  --line: #2a2a2a;
  --text: #e6e6e6;
  --muted: #9a9a9a;
  --accent: #00a8ff;
  --accent-strong: #0077ff;
  --shadow: rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 700px at 8% 15%, rgba(0,168,255,0.08), transparent 60%),
    radial-gradient(700px 500px at 85% 80%, rgba(0,119,255,0.06), transparent 60%),
    linear-gradient(180deg, #0a0a0a 0%, var(--bg) 100%);
  overflow-x: hidden;
  min-height: 100vh;
}

/* subtle noise overlay */
.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: soft-light;
  z-index: 0;
}

.wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* ===== SPLIT PANEL (sign-in, set-password) ===== */
.panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px var(--shadow);
  overflow: hidden;
}

.left {
  padding: 48px 44px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(420px 320px at 15% 20%, rgba(0,168,255,0.10), transparent 70%),
    radial-gradient(350px 280px at 80% 85%, rgba(0,119,255,0.07), transparent 70%);
  display: flex;
  flex-direction: column;
}

.headline {
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 14px;
}

.sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 32px;
  max-width: 400px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.stat span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.right {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-brand {
  display: none !important;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.4px;
  color: #fff;
}

.card-brand span {
  color: var(--accent);
}

/* ===== CENTERED CARD (forgot, reset, email-sent, access-sent) ===== */
.auth-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 30px 80px var(--shadow);
}

/* ===== SHARED BRAND ===== */
.brand {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  margin-bottom: 32px;
}

.auth-card .brand {
  font-size: 28px;
  margin-bottom: 14px;
}

.brand span {
  color: var(--accent);
}

/* ===== HEADINGS ===== */
.auth-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.auth-header p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.form-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ===== FORM ===== */
.auth-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d0d0d;
  color: var(--text);
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,168,255,0.15);
}

.field input::placeholder {
  color: #555;
}

/* ===== BUTTONS ===== */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 30px rgba(0,168,255,0.2);
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,168,255,0.35);
}

.primary .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s, transform 0.2s;
  animation: beatlab-spin 0.8s linear infinite;
}

.primary.loading {
  pointer-events: none;
  opacity: 0.9;
}

.primary.loading .btn-spinner {
  opacity: 1;
  transform: scale(1);
}

@keyframes beatlab-spin {
  to { transform: rotate(360deg); }
}

/* ===== LINKS & MISC ===== */
.auth-links {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-links a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ===== PASSWORD TOGGLE ===== */
.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 48px;
}

.pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.pw-toggle:hover {
  color: var(--muted);
}

.notice {
  background: #111a21;
  border: 1px solid #214659;
  color: #cfe9ff;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===== SUCCESS TOAST (same pattern as dashboard welcome popup) ===== */
.success-toast {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  color: #fff;
  padding: 14px 28px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease;
}

.success-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.success-toast svg {
  flex-shrink: 0;
}

.hidden {
  display: none;
}

/* ===== FOOTER + LANGUAGE ===== */
.auth-foot {
  margin-top: 24px;
  font-size: 12px;
  color: #555;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.support-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}

.support-link:hover {
  color: #fff;
  text-decoration: underline;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  color: #cfcfcf;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.lang-trigger:hover {
  border-color: #2a2a2a;
  color: #fff;
}

.lang-trigger svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.lang-menu {
  position: absolute;
  right: 0;
  bottom: 40px;
  min-width: 210px;
  padding: 8px;
  background: #0f0f0f;
  border: 1px solid #222;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  display: none;
  z-index: 50;
}

.lang-menu.open {
  display: block;
}

.lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #c8c8c8;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.lang-option:hover {
  background: #171717;
  color: #fff;
}

.lang-option.active {
  background: #151515;
  color: #fff;
}

.lang-switch button::before {
  content: none !important;
}

.lang-flag {
  width: 26px;
  height: 18px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
}

.lang-flag svg {
  width: 26px;
  height: 18px;
  display: block;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .panel {
    grid-template-columns: 1fr !important;
  }
  .left {
    display: none !important;
  }
  .right {
    display: block !important;
    width: 100% !important;
    padding: 36px 32px;
  }
  .lang-switch {
    position: absolute;
    top: 16px;
    right: 16px;
  }
  .card-brand {
    display: flex !important;
    font-size: 28px;
  }
}

@media (max-width: 560px) {
  .wrap {
    padding: 16px;
  }
  .right {
    padding: 28px 22px;
  }
  .auth-card {
    padding: 24px;
  }
  .auth-links {
    flex-direction: column;
    gap: 8px;
  }
}
