/* =========================================================================
   HSB Auth Layout — shared by login, register, recover, verify
   =========================================================================
   Split-screen on desktop, form-first single column on mobile. Depends on
   hsb-theme.css for tokens and hsb-motion.css for entrance animation.
   ========================================================================= */

.hsb-auth {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3.5vw, 2.5rem);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}

.hsb-auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: auto;
}

.hsb-auth-card {
  display: grid;
  grid-template-columns: 0.85fr 1fr;
  border-radius: 24px;
  overflow: hidden;
  background: var(--hsb-surface);
  border: 1px solid var(--hsb-border);
  box-shadow: var(--hsb-shadow-lg);
  transition: border-color var(--hsb-dur) var(--hsb-ease),
              box-shadow var(--hsb-dur) var(--hsb-ease);
}

/* ---- Brand panel ------------------------------------------------------- */

.hsb-auth-aside {
  position: relative;
  padding: clamp(2rem, 3.5vw, 2.75rem);
  background: var(--hsb-grad-brand);
  color: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Soft geometric wash */
.hsb-auth-aside::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 55% at 15% 8%, rgba(255, 255, 255, 0.22) 0%, transparent 60%),
    radial-gradient(60% 50% at 90% 95%, rgba(255, 255, 255, 0.14) 0%, transparent 60%);
  pointer-events: none;
}

.hsb-auth-aside-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.hsb-auth-brand {
  color: #ffffff;
  margin-bottom: 1.75rem;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.hsb-auth-brand:hover { color: #ffffff; }

.hsb-auth-logo {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.hsb-auth-logo svg { width: 19px; height: 19px; }

.hsb-auth-eyebrow {
  display: inline-block;
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: var(--hsb-r-pill);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hsb-auth-headline {
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.hsb-auth-sub {
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 1.5rem;
}

/* Floating interface preview */
.hsb-preview {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 16px 36px -18px rgba(2, 12, 24, 0.5);
}
.hsb-preview-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.hsb-preview-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}
.hsb-preview-body { padding: 0.85rem; }
.hsb-preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.hsb-preview-stat {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.hsb-preview-stat small {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}
.hsb-preview-stat strong {
  display: block;
  font-size: 0.98rem;
  color: #ffffff;
  margin-top: 0.15rem;
  font-weight: 700;
}
.hsb-trend {
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 600;
  color: #86efac;
}
.hsb-trend-warn { color: #fde68a; }

.hsb-preview-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 48px;
}
.hsb-preview-chart span {
  flex: 1;
  height: var(--h, 40%);
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.4) 100%);
}

.hsb-auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.hsb-auth-points li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}
.hsb-auth-points span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.65rem;
  font-weight: 700;
}

/* ---- Form panel -------------------------------------------------------- */

.hsb-auth-main {
  display: flex;
  flex-direction: column;
  background: var(--hsb-surface);
  padding: clamp(1.75rem, 3.2vw, 2.5rem);
  box-sizing: border-box;
  justify-content: space-between;
}

.hsb-auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem; /* 24px gap below controls */
}

.hsb-btn-sm {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: 0.83rem;
  border-radius: var(--hsb-r-md);
}

.hsb-auth-form-wrap {
  width: 100%;
  max-width: 448px;
  margin: auto 0;
  padding-bottom: 0.5rem;
}

.hsb-auth-title {
  font-size: clamp(1.4rem, 2vw, 1.65rem);
  font-weight: 700;
  color: var(--hsb-text);
  margin: 0 0 0.35rem; /* 6px gap to description */
  letter-spacing: -0.02em;
}

.hsb-auth-lede {
  font-size: 0.88rem;
  color: var(--hsb-text-muted);
  margin: 0 0 1.5rem; /* 24px gap to form */
  line-height: 1.45;
}

/* Standardized flexbox form container with strict spacing */
.hsb-auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px; /* Base field spacing */
  width: 100%;
}

.hsb-auth-form .hsb-field {
  gap: 8px; /* 8px label to input */
}

.hsb-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0;
}

.hsb-auth-link {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--hsb-link);
  text-decoration: none;
  transition: color var(--hsb-dur-fast);
}
.hsb-auth-link:hover {
  text-decoration: underline;
  color: var(--hsb-brand-strong);
}

/* Primary Sign In / Action Button */
.hsb-btn-primary {
  height: 48px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--hsb-grad-brand);
  color: var(--hsb-text-on-brand);
  border: 0;
  box-shadow: 0 6px 18px -6px var(--hsb-brand-ring);
  transition: transform var(--hsb-dur-fast) var(--hsb-ease),
              box-shadow var(--hsb-dur) var(--hsb-ease),
              opacity var(--hsb-dur-fast);
}
.hsb-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -6px var(--hsb-brand-ring);
}
.hsb-btn-primary:active {
  transform: translateY(0) scale(0.985);
}

/* Divider with centered text */
.hsb-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 4px 0 0;
  color: var(--hsb-text-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hsb-divider::before,
.hsb-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hsb-border-strong);
}

/* Google Sign In Button */
.hsb-google {
  height: 48px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  gap: 0.6rem;
  border: 1px solid var(--hsb-border-strong);
  background: var(--hsb-surface);
  color: var(--hsb-text);
  box-shadow: var(--hsb-shadow-sm);
  transition: background-color var(--hsb-dur-fast),
              border-color var(--hsb-dur-fast),
              transform var(--hsb-dur-fast),
              box-shadow var(--hsb-dur-fast);
}
.hsb-google:hover {
  background: var(--hsb-surface-2);
  border-color: var(--hsb-text-subtle);
  transform: translateY(-1px);
  box-shadow: var(--hsb-shadow);
}
.hsb-google:active {
  transform: translateY(0) scale(0.985);
}
.hsb-google svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.hsb-auth-foot {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--hsb-text-muted);
}

/* ---- Multi-step register ---------------------------------------------- */

.hsb-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0;
  list-style: none;
}
.hsb-step {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}
.hsb-step-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  border: 1px solid var(--hsb-border-strong);
  background: var(--hsb-surface);
  color: var(--hsb-text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  transition: background-color var(--hsb-dur) var(--hsb-ease),
              color var(--hsb-dur) var(--hsb-ease),
              border-color var(--hsb-dur) var(--hsb-ease);
}
.hsb-step-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--hsb-text-subtle);
  white-space: nowrap;
}
.hsb-step-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--hsb-border);
  position: relative;
  overflow: hidden;
}
.hsb-step-line::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--hsb-grad-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--hsb-dur-slow) var(--hsb-ease);
}
.hsb-step[data-state="done"] .hsb-step-line::after { transform: scaleX(1); }
.hsb-step[data-state="active"] .hsb-step-dot,
.hsb-step[data-state="done"] .hsb-step-dot {
  background: var(--hsb-grad-brand);
  border-color: transparent;
  color: var(--hsb-text-on-brand);
}
.hsb-step[data-state="active"] .hsb-step-label,
.hsb-step[data-state="done"] .hsb-step-label {
  color: var(--hsb-text);
}

.hsb-panel-step { display: none; }
.hsb-panel-step[data-active="true"] {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: hsb-step-in 380ms var(--hsb-ease-out) both;
}
@keyframes hsb-step-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}

.hsb-form-grid {
  display: grid;
  gap: 14px 12px;
  grid-template-columns: 1fr 1fr;
}
.hsb-form-grid .hsb-span-2 { grid-column: 1 / -1; }

.hsb-step-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.hsb-step-actions .hsb-btn { flex: 1; }

/* Review summary block */
.hsb-review {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.hsb-review-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--hsb-surface-2);
  border: 1px solid var(--hsb-border);
  border-radius: var(--hsb-r-sm);
  font-size: 0.85rem;
}
.hsb-review-row dt { color: var(--hsb-text-subtle); margin: 0; font-weight: 500; }
.hsb-review-row dd { color: var(--hsb-text); font-weight: 600; margin: 0; text-align: right; word-break: break-word; }

/* Account Recovery / Forgot Password Elements */
.hsb-recovery-box {
  padding: 1rem;
  border-radius: var(--hsb-r-md);
  background: var(--hsb-surface-2);
  border: 1px solid var(--hsb-border);
  margin-bottom: 0.5rem;
}
.hsb-recovery-question {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--hsb-text);
  margin-top: 0.25rem;
}

.hsb-otp-notice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--hsb-r-md);
  background: var(--hsb-brand-soft);
  border: 1px solid var(--hsb-brand-ring);
  color: var(--hsb-text);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.hsb-otp-notice strong {
  color: var(--hsb-brand);
  font-weight: 700;
}

/* Modal Confirmation Dialog */
.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
}
.confirm-modal.show {
  display: flex;
  animation: hsb-fade-in 220ms var(--hsb-ease-out) both;
}
.confirm-dialog {
  width: min(440px, 100%);
  background: var(--hsb-surface);
  border-radius: 20px;
  border: 1px solid var(--hsb-border-strong);
  box-shadow: var(--hsb-shadow-lg);
  padding: 1.6rem;
  text-align: left;
  color: var(--hsb-text);
  animation: hsb-scale-up 260ms var(--hsb-ease-out) both;
}
.confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hsb-text);
  margin: 0 0 0.4rem;
  letter-spacing: -0.015em;
}
.confirm-copy {
  font-size: 0.88rem;
  color: var(--hsb-text-muted);
  line-height: 1.5;
  margin: 0 0 1.4rem;
}
.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.confirm-actions .hsb-btn {
  flex: 1;
}

/* Status icon — colour follows the modal's data-status. */
.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  color: var(--hsb-warning);
  background: var(--hsb-warning-bg);
  border: 1px solid currentColor;
}
.confirm-icon svg {
  width: 22px;
  height: 22px;
}
.confirm-modal[data-status="danger"] .confirm-icon {
  color: var(--hsb-danger);
  background: var(--hsb-danger-bg);
}
.confirm-modal[data-status="duplicate"] .confirm-icon {
  color: var(--hsb-brand);
  background: var(--hsb-brand-soft);
}
.confirm-alt {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  color: var(--hsb-text-muted);
  text-align: center;
}

/* Review Page Sections & Missing Badges */
.hsb-review-section {
  margin-bottom: 1.25rem;
}
.hsb-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.hsb-review-header h4 {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hsb-brand);
  margin: 0;
}
.hsb-review-edit {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--hsb-r-pill);
}
.hsb-review-missing {
  color: #ef4444;
  font-weight: 600;
  font-size: 0.82rem;
}
.hsb-missing-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--hsb-brand-soft);
  border: 1px solid var(--hsb-brand-ring);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.hsb-missing-list:empty {
  display: none;
}
.hsb-missing-list li {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hsb-text);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.hsb-missing-list li::before {
  content: '•';
  color: #ef4444;
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.25;
}
/* Field name on top, the specific reason underneath. */
.hsb-missing-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.hsb-missing-reason {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--hsb-text-muted);
}
.confirm-modal[data-status="danger"] .hsb-missing-list {
  background: var(--hsb-danger-bg);
  border-color: var(--hsb-danger);
}
.confirm-modal[data-status="duplicate"] .hsb-missing-list li::before {
  color: var(--hsb-brand);
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 900px) {
  .hsb-auth-card {
    grid-template-columns: 1fr;
    border-radius: 20px;
  }
  .hsb-auth-aside {
    order: 2;
    padding: 1.5rem;
  }
  .hsb-auth-main {
    order: 1;
    padding: 1.75rem;
  }
  .hsb-auth-topbar { margin-bottom: 1.5rem; }
  .hsb-preview { display: none; }
  .hsb-auth-headline { font-size: 1.3rem; }
  .hsb-auth-sub { margin-bottom: 1rem; }
  .hsb-auth-points {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 560px) {
  .hsb-auth {
    padding: 0;
  }
  .hsb-auth-card {
    border-radius: 0;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    box-shadow: none;
  }
  .hsb-auth-shell { max-width: none; }
  .hsb-auth-main { padding: 1.25rem; }
  .hsb-auth-form-wrap { max-width: 100%; }
  .hsb-form-grid { grid-template-columns: 1fr; }
  .hsb-btn { width: 100%; min-height: 48px; }
  .hsb-auth-topbar .hsb-btn { width: auto; }
  .hsb-step-label { display: none; }
}
