:root {
  --ap-primary: #4F46E5;
  --ap-primary-600: #4338CA;
  --ap-primary-100: #EEF0FD;
  --ap-secondary: #64748B;
  --ap-success: #16A34A;
  --ap-success-100: #E7F6EC;
  --ap-warning: #F59E0B;
  --ap-danger: #DC2626;
  --ap-danger-100: #FCEAEA;
  --ap-info: #0EA5E9;
  --ap-light: #F8FAFC;
  --ap-dark: #0F172A;
  --ap-surface: #FFFFFF;
  --ap-text: #475569;
  --ap-text-strong: #0F172A;
  --ap-border: #E7EBF1;
  --ap-radius: 0.75rem;
  --ap-radius-sm: 0.5rem;
  --ap-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .10);
  --ap-bg: #F5F7FB;
  --ap-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --ap-surface: #151B2C;
  --ap-bg: #0B1120;
  --ap-text: #93A0B8;
  --ap-text-strong: #EEF1F7;
  --ap-border: #232C42;
  --ap-primary-100: #1E2247;
}

body {
  font-family: var(--ap-font);
  background: var(--ap-bg);
  color: var(--ap-text);
  font-size: 14px;
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ap-text-strong);
  font-weight: 700;
  letter-spacing: -.01em;
}

.ap-loader-text {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ap-secondary);
}

/* ---------- Shell ---------- */
.ap-auth-shell {
  display: flex;
  min-height: 100vh;
}

/* Brand panel */
.ap-brand-panel {
  flex: 1 1 46%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 3rem;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(155deg, #3730A3 0%, var(--ap-primary) 45%, #7C74F0 100%);
}

.ap-brand-panel::before,
.ap-brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.ap-brand-panel::before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -120px;
}

.ap-brand-panel::after {
  width: 280px;
  height: 280px;
  bottom: -100px;
  left: -80px;
  background: rgba(255, 255, 255, .06);
}

.ap-brand-top {
  display: flex;
  align-items: center;
  gap: .7rem;
  position: relative;
  z-index: 1;
}

.ap-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  backdrop-filter: blur(4px);
}

.ap-brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
}

.ap-brand-mid {
  position: relative;
  z-index: 1;
  margin-top: auto;
  margin-bottom: auto;
  max-width: 420px;
}

.ap-brand-mid h2 {
  color: #fff;
  font-size: 1.9rem;
  line-height: 1.25;
  margin-bottom: .9rem;
}

.ap-brand-mid p {
  color: rgba(255, 255, 255, .82);
  font-size: .95rem;
  line-height: 1.6;
}

.ap-brand-stats {
  display: flex;
  gap: 2rem;
  position: relative;
  z-index: 1;
  margin-top: 2.5rem;
}

.ap-brand-stats div b {
  display: block;
  font-size: 1.3rem;
  color: #fff;
}

.ap-brand-stats div span {
  font-size: .75rem;
  color: rgba(255, 255, 255, .72);
}

.ap-brand-quote {
  position: relative;
  z-index: 1;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .18);
  font-size: .85rem;
  color: rgba(255, 255, 255, .85);
}

/* Form panel */
.ap-form-panel {
  flex: 1 1 54%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: var(--ap-bg);
}

.ap-form-card {
  width: 100%;
  max-width: 420px;
}

.ap-form-head {
  margin-bottom: 1.6rem;
}

.ap-form-head h1 {
  font-size: 1.5rem;
  margin-bottom: .3rem;
}

.ap-form-head p {
  font-size: .86rem;
  color: var(--ap-secondary);
  margin: 0;
}

/* Tabs */
.ap-tabs {
  display: flex;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: .3rem;
  margin-bottom: 1.7rem;
}

.ap-tab-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: .55rem .4rem;
  border-radius: var(--ap-radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ap-secondary);
  transition: background .15s ease, color .15s ease;
}

.ap-tab-btn.active {
  background: var(--ap-primary);
  color: #fff;
}

.ap-panel {
  display: none;
}

.ap-panel.active {
  display: block;
  animation: apFade .25s ease;
}

@keyframes apFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form elements */
.ap-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ap-text-strong);
  margin-bottom: .4rem;
  display: block;
}

.ap-input-group {
  position: relative;
  margin-bottom: 1.05rem;
}

.ap-input-group i.ap-input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ap-secondary);
  font-size: 1rem;
}

.ap-input-group .form-control {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  padding: .65rem .9rem .65rem 2.5rem;
  font-size: .87rem;
  color: var(--ap-text-strong);
}

.ap-input-group .form-control:focus {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-100);
  outline: none;
}

.ap-toggle-pass {
  position: absolute;
  right: .8rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ap-secondary);
  font-size: 1rem;
  cursor: pointer;
}

.ap-strength {
  height: 4px;
  border-radius: 10px;
  background: var(--ap-border);
  margin-top: .5rem;
  overflow: hidden;
}

.ap-strength-bar {
  height: 100%;
  width: 0%;
  background: var(--ap-danger);
  transition: width .2s ease, background .2s ease;
}

.ap-strength-label {
  font-size: .72rem;
  color: var(--ap-secondary);
  margin-top: .3rem;
}

.btn-ap-primary {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
  color: #fff;
  font-weight: 600;
  font-size: .87rem;
  padding: .62rem 1rem;
}

.btn-ap-social {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  color: var(--ap-text-strong);
  font-weight: 600;
  font-size: .83rem;
  padding: .55rem;
  border-radius: var(--ap-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.btn-ap-social:hover {
  background: var(--ap-bg);
}

.ap-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.4rem 0;
  color: var(--ap-secondary);
  font-size: .78rem;
}

.ap-divider::before,
.ap-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ap-border);
}

.ap-link {
  color: var(--ap-primary);
  font-weight: 600;
}

.ap-link:hover {
  color: var(--ap-primary-600);
}

.ap-form-foot {
  text-align: center;
  font-size: .85rem;
  color: var(--ap-secondary);
  margin-top: 1.5rem;
}

.ap-back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .83rem;
  font-weight: 600;
  color: var(--ap-text-strong);
  margin-bottom: 1.2rem;
}

.ap-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--ap-radius-sm);
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 1.8rem;
  right: 1.8rem;
  z-index: 2;
}

.ap-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  font-size: .83rem;
}

.ap-otp-row {
  display: flex;
  gap: .6rem;
  margin-bottom: 1.3rem;
}

.ap-otp-row input {
  width: 100%;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ap-text-strong);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  padding: .55rem 0;
}

.ap-otp-row input:focus {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px var(--ap-primary-100);
  outline: none;
}

.ap-success-box {
  text-align: center;
  padding: .5rem 0 1rem;
}

.ap-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ap-success-100);
  color: var(--ap-success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.1rem;
}

@media (max-width: 900px) {
  .ap-brand-panel {
    display: none;
  }

  .ap-form-panel {
    flex: 1 1 100%;
  }
}

/* Text colors */
.ap-color-text {
  color: var(--ap-text);
}

.ap-color-strong {
  color: var(--ap-text-strong);
}

.ap-color-secondary {
  color: var(--ap-secondary);
}

/* Font weight */
.ap-fw-600 {
  font-weight: 600;
}

/* Font sizes */
.ap-fs-083 {
  font-size: .83rem;
}

.ap-fs-087 {
  font-size: .87rem;
}

.ap-fs-13 {
  font-size: 1.3rem;
}

/* Form check label (remember me / agree terms) */
.ap-check-label {
  color: var(--ap-text);
  font-size: .83rem;
}

/* Sent-to email highlight (OTP step) */
.ap-sent-email {
  color: var(--ap-text-strong);
  font-weight: 600;
}

/* Success view heading and description */
.ap-success-heading {
  font-size: 1.3rem;
}

.ap-success-desc {
  color: var(--ap-secondary);
  font-size: .87rem;
}

/* Hidden panel (used for forgot-password steps) */
.ap-hidden {
  display: none;
}
