/* ===================================================
   Sigma Work — Auth UI
   Plain warm light surface, subtle orange accent,
   no decorative glow, no serif display font.
   Kept in sync with css/design-system.css tokens.
   =================================================== */

:root {
  --primary: #007FFF;
  --primary-hover: #0066CC;
  --bg-main: #FAF7F3;
  --card-bg: #FFFFFF;
  --card-border: #E0D8CC;
  --ink-primary: #201C18;
  --ink-secondary: #5C5650;
  --ink-muted: #837C74;
  --accent-primary: #007FFF;
  --accent-hover: #0066CC;
  --accent-emerald: #0E7A4C;
  --accent-emerald-soft: #E9F6EF;
  --error: #C22626;
  --error-soft: #FCEBEB;
  --warning: #8A5A0A;
  --info: #2563A6;
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-full: 9999px;
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.12);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar { display: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--ink-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* No decorative background glow — plain, professional surface */
.glow {
  display: none;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 450px;
  margin: auto;
}

.form-subtitle {
  color: var(--ink-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 8px;
}

.link-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* Brand header */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 24px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  flex: none;
  box-shadow: 0 2px 6px rgba(43, 52, 135, 0.2);
}
.brand-mark::after {
  display: none;
}
.brand-name {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

/* Main Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6) var(--space-5);
  box-shadow: var(--shadow-card);
}

/* Tab Switcher */
.switcher {
  display: flex;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 24px;
  position: relative;
}
.switcher button {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--ink-secondary);
  position: relative;
  z-index: 2;
  transition: color 0.2s ease;
}
.switcher button.active {
  color: var(--ink-primary);
}
.switch-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: #FFFFFF;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}
.switcher.is-login .switch-pill {
  transform: translateX(100%);
}

.form-header {
  text-align: center;
  margin-bottom: 22px;
}
.form-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
}

/* Fields & Inputs */
.field {
  margin-bottom: 15px;
}
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-primary);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--ink-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder {
  color: #94A3B8;
}
.field input:focus, .field select:focus {
  border-color: var(--ink-primary);
  box-shadow: 0 0 0 3.5px rgba(15, 23, 42, 0.08);
}

.pw-wrap {
  position: relative;
}
.pw-toggle-btn, .pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.pw-toggle-btn:hover {
  color: var(--ink-primary);
  background: #F1F5F9;
}
.pw-toggle-btn svg {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

/* Validation states */
.field.has-error input {
  border-color: var(--error) !important;
  background: var(--error-soft) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
}
.field-error {
  display: none;
  font-size: 11.5px;
  font-weight: 500;
  color: #DC2626;
  margin-top: 5px;
  line-height: 1.35;
}
.field-error.show {
  display: block;
}

/* Password Strength Meter */
.password-strength-wrap {
  margin-top: 8px;
  padding: 10px 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
}
.strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: 4px;
  margin-bottom: 7px;
}
.strength-segment {
  height: 100%;
  border-radius: var(--radius-full);
  background: #E2E8F0;
  transition: background-color 0.25s ease;
}
.strength-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--ink-secondary);
}
.strength-text {
  font-weight: 600;
}

.strength-level-0 .strength-segment:nth-child(1) { background: var(--error); }
.strength-level-0 .strength-text { color: var(--error); }

.strength-level-1 .strength-segment:nth-child(1),
.strength-level-1 .strength-segment:nth-child(2) { background: var(--warning); }
.strength-level-1 .strength-text { color: #D97706; }

.strength-level-2 .strength-segment:nth-child(1),
.strength-level-2 .strength-segment:nth-child(2),
.strength-level-2 .strength-segment:nth-child(3) { background: #10B981; }
.strength-level-2 .strength-text { color: #059669; }

.strength-level-3 .strength-segment { background: #10B981; }
.strength-level-3 .strength-text { color: #059669; }

/* Password Requirements Checklist */
.pw-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #E2E8F0;
  font-size: 11px;
}
.pw-req {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}
.pw-req.met {
  color: #059669;
  font-weight: 600;
}
.pw-req svg {
  width: 12px;
  height: 12px;
  flex: none;
}
.pw-req .icon-cross { color: #CBD5E1; }
.pw-req .icon-check { display: none; color: #059669; }
.pw-req.met .icon-cross { display: none; }
.pw-req.met .icon-check { display: inline-block; }

.hidden-field {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
}
.hidden-field.show {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-bottom: 15px;
}
.hidden-field-inner { overflow: hidden; }

/* Remember Me & Forgot Password */
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 16px;
}
.remember-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.remember-wrap input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #CBD5E1;
  border-radius: 4px;
  background: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.remember-wrap input[type="checkbox"]:checked {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
}
.remember-wrap input[type="checkbox"]:checked::after {
  content: "✓";
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
}
.remember-wrap span {
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-weight: 500;
}

.link {
  font-size: 12.5px;
  color: var(--ink-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}
.link:hover {
  color: var(--accent-hover);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  margin-top: 4px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  background: #E2E8F0;
  color: #94A3B8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary.loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: btnSpin 0.65s linear infinite;
  display: none;
}
.btn-primary.loading .btn-spinner {
  display: inline-block;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #E2E8F0;
}

/* Social Login Buttons */
.social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn-social {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-social:hover {
  border-color: #CBD5E1;
  background: #F8FAFC;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}
.btn-social svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.switch-line {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-secondary);
}

/* Back Button & Step Layout */
.step-top {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #F1F5F9;
  color: var(--ink-secondary);
  text-decoration: none;
  border: 1px solid #E2E8F0;
  transition: all 0.15s ease;
}

.back-btn:hover {
  background: #E2E8F0;
  color: var(--ink-primary);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.step-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 8px;
  text-align: center;
}

.step-sub {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-bottom: 22px;
  text-align: center;
}

/* Secondary Button */
.btn-secondary {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  color: var(--ink-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

.btn-secondary:disabled {
  background: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
}

/* Confirmation Check Icon */
.done-wrap {
  text-align: center;
  padding: 8px 0;
}

.done-check {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: #EFF6FF;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.done-check svg {
  width: 26px;
  height: 26px;
}

/* OTP 6-Digit Box Group */
.otp-input-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 20px;
}

.otp-digit {
  width: 48px;
  height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-primary);
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.otp-digit:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3.5px rgba(0, 127, 255, 0.15);
  background: #FFFFFF;
}

.otp-digit.filled {
  border-color: #94A3B8;
  background: #F8FAFC;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 48px));
  pointer-events: none;
}
.toast {
  /* Was its own separate copy of these rules (border-radius: var(--radius-md)
     = 8px here vs 12px in design-system.css, plus a different box-shadow) —
     so a toast on the login/signup/password pages looked visibly different
     from every other page in the app. Matched byte-for-byte to
     design-system.css's .toast so there's only one real toast look. */
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 32px -4px rgba(32, 24, 16, 0.14), var(--shadow-sm);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.toast.toast-hiding {
  animation: toastOut 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-icon {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 1px;
}
.toast-content { flex: 1; min-width: 0; }
.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.3;
}
.toast-msg {
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-top: 2px;
  line-height: 1.4;
}
.toast-close {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.toast-close:hover {
  color: var(--ink-primary);
  background: #F1F5F9;
}
.toast-close svg { width: 14px; height: 14px; }
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  animation: toastProgress linear forwards;
}

.toast-success .toast-icon { color: var(--accent-emerald); }
.toast-success .toast-progress { background: var(--accent-emerald); }

.toast-error .toast-icon { color: var(--error); }
.toast-error .toast-progress { background: var(--error); }

.toast-warning .toast-icon { color: var(--warning); }
.toast-warning .toast-progress { background: var(--warning); }

.toast-info .toast-icon { color: var(--info); }
.toast-info .toast-progress { background: var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.96); }
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 480px) {
  body { padding:var(--space-5) var(--space-3); align-items:flex-start; }
  .wrap { width:100%; max-width:100%; margin:var(--space-5) auto; }
  .card { padding:var(--space-5) var(--space-4); border-radius:var(--radius-lg); }
  .brand { margin-bottom: 16px; }
  .form-header h1,
  .step-title { font-size: 20px; }
  .field input,
  .field select { padding: 10px 12px; }
  .row-between { flex-direction: column; align-items: flex-start; gap: 8px; }
  .social-row { grid-template-columns: 1fr; gap: 8px; }
  .pw-checklist { grid-template-columns: 1fr; }
  .btn-primary,
  .btn-secondary,
  .btn-social,
  .back-btn { min-height: 44px; }
  .toast-container { top:var(--space-3); right:var(--space-3); width:calc(100vw - 24px); }
}
