/* ─── Auth / Onboarding ────────────────────────────────── */

.auth-shell {
  position: fixed; inset: 0;
  z-index: 300;
  background: var(--bg);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  overflow: auto;
  display: flex;
  animation: authIn 360ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes authIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-bg-soft {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(102,79,173,0.06), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(217,119,87,0.04), transparent 50%);
  pointer-events: none;
}

.auth-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

/* ── Variant A: centered card on calm canvas ───────────── */
.auth-shell.variant-a {
  align-items: center;
  justify-content: center;
}

.auth-card-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 32px 24px;
}
.auth-card-wrap.centered {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 32px 24px;
  width: 100%;
  box-shadow:
    0 1px 2px rgba(31,26,46,0.04),
    0 12px 40px rgba(31,26,46,0.06);
}

.auth-mark-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.auth-card-mark {
  width: 40px; height: 40px;
  background: var(--ink);
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
}
.auth-card-mark svg { width: 22px; height: 22px; }
.auth-card-name {
  font-size: 15px; font-weight: 600; letter-spacing: -0.2px;
}
.auth-card-tag {
  font-size: 12px; color: var(--ink-3); margin-top: 1px;
}

.auth-h1 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.7px;
  margin: 0 0 10px;
  line-height: 1.15;
  text-wrap: pretty;
}
.auth-h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.5px;
  margin: 0 0 8px;
}
.auth-sub {
  font-size: 14px; line-height: 1.55;
  color: var(--ink-3);
  margin: 0 0 24px;
  text-wrap: pretty;
}
.auth-eyebrow, .onb-eyebrow {
  font-family: 'Menlo', ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
  display: block;
}

/* Microsoft button */
.ms-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 1px 2px rgba(31,26,46,0.08);
}
.ms-btn:hover { background: #2a2440; }
.ms-btn:active { transform: translateY(1px); }
.ms-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.ms-btn.busy { background: #2a2440; }
.ms-btn .sp {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px;
  color: var(--ink-4);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.auth-link {
  width: 100%;
  background: transparent; border: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }

.auth-tenant-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 16px 0 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-family: 'Menlo', ui-monospace, monospace;
  letter-spacing: -0.1px;
}

.onb-checkbox {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--ink-4);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all 120ms ease;
}
.onb-option[aria-current="true"] .onb-checkbox {
  border-color: var(--accent);
  background: var(--accent);
}
.onb-checkbox-tick {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.auth-fineprint {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.6;
  text-wrap: pretty;
}

.auth-foot {
  display: flex; align-items: center; gap: 14px;
  font-size: 11.5px;
  color: var(--ink-4);
  padding: 16px 8px;
}
.auth-foot.centered { justify-content: center; }
.auth-status {
  display: inline-flex; align-items: center; gap: 6px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(41,178,99,0.15);
}

/* ── Variant B: split (dark left, light right) ─────────── */
.auth-shell.variant-b {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(440px, 1fr);
}

.auth-side {
  position: relative;
  background:
    radial-gradient(circle at 80% 20%, rgba(102,79,173,0.5), transparent 55%),
    radial-gradient(circle at 20% 90%, rgba(217,119,87,0.25), transparent 55%),
    #1F1A2E;
  color: #fff;
  padding: 56px 56px 40px;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.auth-decoration {
  position: absolute;
  top: 56px; right: -120px;
  width: 380px; height: 380px;
  pointer-events: none;
}
.auth-ring {
  position: absolute; inset: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  animation: ringPulse 5s ease-in-out infinite;
}
.auth-ring.r1 { animation-delay: 0s; }
.auth-ring.r2 { inset: 30px; animation-delay: 1s; border-color: rgba(255,255,255,0.18); }
.auth-ring.r3 { inset: 60px; animation-delay: 2s; border-color: rgba(255,255,255,0.24); }
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}
.auth-mark {
  position: absolute;
  top: 50%; left: 50%;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  background: linear-gradient(135deg, #664FAD, #d97757);
  border-radius: 16px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 8px 32px rgba(102,79,173,0.5);
}
.auth-mark svg { width: 32px; height: 32px; }

.auth-side-quote {
  margin-top: auto;
  position: relative; z-index: 1;
  max-width: 420px;
}
.auth-side-headline {
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin: 8px 0 16px;
  text-wrap: pretty;
}
.auth-side-sub {
  font-size: 14.5px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 22px;
  text-wrap: pretty;
}
.auth-side-pill-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.auth-pill {
  font-size: 11.5px;
  padding: 5px 11px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

.variant-b .auth-card-wrap {
  align-self: center;
  justify-self: center;
  padding: 56px 48px;
  max-width: 480px;
}

/* ── Onboarding wizard ─────────────────────────────────── */
.onb-shell {
  width: 100%;
  max-width: 580px;
  padding: 40px 24px 24px;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}

.onb-progress {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}
.onb-step {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative;
}
.onb-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 13px; left: calc(50% + 18px); right: calc(-50% + 18px);
  height: 1px;
  background: var(--line);
}
.onb-step.done:not(:last-child)::after { background: var(--accent); }
.onb-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-3);
  display: grid; place-items: center;
  position: relative; z-index: 1;
  transition: all 200ms ease;
}
.onb-step.done .onb-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.onb-step.curr .onb-dot {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.onb-step-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.onb-step.curr .onb-step-label { color: var(--ink); font-weight: 600; }
.onb-step.done .onb-step-label { color: var(--ink-2); }

.onb-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 36px 22px;
  width: 100%;
  box-shadow:
    0 1px 2px rgba(31,26,46,0.04),
    0 16px 50px rgba(31,26,46,0.06);
}

.onb-checklist {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.onb-checklist li {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
  color: var(--ink-2);
}
.onb-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.onb-field {
  margin-bottom: 14px;
}
.onb-field label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.onb-field input, .onb-field select {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.onb-field input:focus, .onb-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.onb-options {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 6px;
}
.onb-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}
.onb-option:hover { border-color: rgba(102,79,173,0.4); background: rgba(102,79,173,0.02); }
.onb-option[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.onb-option.ghost { border-style: dashed; }
.onb-option.ghost:hover { background: var(--bg); }

.onb-option-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-4);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: border-color 120ms ease;
}
.onb-option[aria-current="true"] .onb-option-radio { border-color: var(--accent); }
.onb-option-radio-inner {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.onb-option-name {
  font-size: 14.5px; font-weight: 600;
  letter-spacing: -0.15px;
}
.onb-option-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
.onb-suggested {
  display: inline-block;
  margin-left: 8px;
  font-size: 10.5px; font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--ok-soft);
  color: var(--ok);
  letter-spacing: 0.02em;
}

/* Switches in onboarding */
.onb-switch {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
}
.onb-switch input { position: absolute; opacity: 0; pointer-events: none; }
.onb-switch-track {
  width: 38px; height: 22px;
  background: var(--ink-4);
  border-radius: 99px;
  position: relative;
  flex-shrink: 0;
  transition: background 160ms ease;
}
.onb-switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.onb-switch input:checked ~ .onb-switch-track {
  background: var(--accent);
}
.onb-switch input:checked ~ .onb-switch-track .onb-switch-thumb {
  transform: translateX(16px);
}

.onb-card-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.onb-btn-ghost {
  background: transparent; border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  font-family: inherit;
  cursor: pointer;
}
.onb-btn-ghost:hover { background: var(--bg); }
.onb-btn-ghost:disabled { color: var(--ink-4); cursor: not-allowed; opacity: 0.6; }
.onb-btn-primary {
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease;
}
.onb-btn-primary:hover { background: #573e98; }

/* Responsive */
@media (max-width: 880px) {
  .auth-shell.variant-b {
    grid-template-columns: 1fr;
  }
  .auth-side { display: none; }
}
