*, *::before, *::after { box-sizing: border-box; margin: 2px; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ── Page loader ── */
#page-loader {
  position: fixed; inset: 0;
  background: linear-gradient(145deg, #1e0a4a 0%, #2a1270 40%, #1a3a7a 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .4s ease;
}
#page-loader.hidden { opacity: 0; pointer-events: none; }

.loader-box {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}

/* Logo + spinning arc container */
.loader-logo-wrap {
  position: relative;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.loader-logo {
  width: 42px; height: 42px; object-fit: contain;
  filter: brightness(0) invert(1);
  animation: loader-pulse 1.8s ease-in-out infinite;
}
.loader-arc {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: #4ed5de;
  border-right-color: rgba(78,213,222,.4);
  animation: spin .9s linear infinite;
}
/* Second outer ring */
.loader-logo-wrap::before {
  content: '';
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.07);
  border-top-color: rgba(74,36,174,.6);
  animation: spin 1.6s linear infinite reverse;
}

.loader-text {
  font-size: .88rem; font-weight: 600;
  color: rgba(255,255,255,.75);
  letter-spacing: .04em;
  display: flex; align-items: baseline; gap: 1px;
}
.loader-dots span {
  animation: loader-dot-blink 1.2s infinite;
  opacity: 0;
}
.loader-dots span:nth-child(1) { animation-delay: 0s; }
.loader-dots span:nth-child(2) { animation-delay: .2s; }
.loader-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loader-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .7; transform: scale(.92); }
}
@keyframes loader-dot-blink {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

/* ── Main card ── */
.auth-card {
  display: flex;
  width: 100%;
  max-width: 1100px;
  min-height: 620px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 20, 60, 0.16);
}

/* ── LEFT PANEL ── */
.auth-left {
  flex: 0 0 54%;
  background: linear-gradient(145deg, #1e0a4a 0%, #2a1270 35%, #1a3a7a 75%, #0e4d8c 100%);
  display: flex;
  flex-direction: column;
  padding: 48px 52px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
/* Decorative circles */
.auth-left::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.auth-left::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -60px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(78, 213, 222,.08);
  pointer-events: none;
}
.auth-left-inner { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; }

.auth-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 52px;
}
.auth-brand img { height: 36px; filter: brightness(0) invert(1); }
.auth-brand-name {
  font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: .02em;
}

.auth-left-headline {
  font-size: 2rem; font-weight: 800; line-height: 1.2;
  color: #fff; margin-bottom: 14px; letter-spacing: -.01em;
}
.auth-left-headline span { color: #4ed5de; }

.auth-left-sub {
  font-size: .95rem; color: rgba(255,255,255,.72); line-height: 1.6; margin-bottom: 20px;
}

.auth-hero-image {
  width: 100%; max-height: 200px; object-fit: contain;
  margin-top: 24px; margin-bottom: 0; border-radius: 10px;
}

.auth-feature-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.auth-feature-item {
  display: flex; align-items: flex-start; gap: 14px;
}
.auth-feature-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .85rem; color: #4ed5de;
}
.auth-feature-text strong { display: block; font-size: .9rem; color: #fff; font-weight: 600; }
.auth-feature-text span { font-size: .8rem; color: rgba(255,255,255,.6); }

.auth-left-footer {
  margin-top: auto; padding-top: 36px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; gap: 10px;
}
.auth-trust-dots { display: flex; gap: 5px; }
.auth-trust-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.35);
}
.auth-trust-dot.active { background: #4ed5de; }
.auth-trust-text { font-size: .78rem; color: rgba(255,255,255,.55); }

/* ── RIGHT PANEL ── */
.auth-right {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px 48px;
  overflow-y: auto;
}

.auth-right-header { margin-bottom: 28px; text-align: center; }
.auth-right-header h1 {
  font-size: 1.6rem; font-weight: 800; color: #0f1729;
  letter-spacing: -.02em; margin-bottom: 6px;
}
.auth-right-header h1 .accent { color: #4a24ae; }
.auth-right-header p { font-size: .875rem; color: #6b7a99; line-height: 1.5; }

/* Alerts */
.auth-alert {
  padding: 10px 14px; border-radius: 8px;
  font-size: .84rem; font-weight: 500; margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.auth-alert-danger  { background: #fff1f2; color: #c0152a; border: 1px solid #fecdd3; }
.auth-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Tab switcher ── */
.auth-tabs {
  display: flex; gap: 4px;
  background: #f3f4f8; border-radius: 10px;
  padding: 4px; margin-bottom: 28px;
}
.auth-tab-btn {
  flex: 1; padding: 9px 0;
  border: none; background: transparent; border-radius: 8px;
  font-size: .875rem; font-weight: 600; color: #6b7a99;
  cursor: pointer; transition: all .2s;
}
.auth-tab-btn.active {
  background: #fff; color: #4a24ae;
  box-shadow: 0 1px 6px rgba(0,0,0,.10);
}
.auth-tab-pane { display: none; }
.auth-tab-pane.active { display: block; }

/* Admin badge */
.admin-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: #f0edff; border: 1.5px solid #c5b8f4;
  color: #4a24ae; border-radius: 999px;
  padding: 7px 14px; font-size: .8rem; font-weight: 700;
  margin-bottom: 24px;
}

/* ── Form fields ── */
.field-group { margin-bottom: 16px; }
.field-group label {
  display: block; font-size: .78rem; font-weight: 600;
  color: #374259; margin-bottom: 7px; letter-spacing: .03em;
}
.field-wrap { position: relative; }
.field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #b0bcc8; font-size: .8rem; pointer-events: none; z-index: 1;
}
.field-wrap input {
  width: 100%; height: 44px;
  padding: 0 42px 0 40px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: .9rem; color: #1a2035;
  background: #fafbfc;
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.field-wrap input::placeholder { color: #c5cdd8; }
.field-wrap input:focus {
  border-color: #4a24ae; background: #fff;
  box-shadow: 0 0 0 3px rgba(74,36,174,.1);
}
.field-group.is-invalid .field-wrap input {
  border-color: #dc3545; background: #fff8f8;
}
.field-group.is-invalid .field-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(220,53,69,.1);
}
.field-error {
  font-size: .75rem; color: #dc3545; font-weight: 500;
  margin-top: 5px; display: none;
}

/* Eye button */
.btn-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #b0bcc8; cursor: pointer;
  padding: 0; font-size: .8rem; z-index: 2;
}
.btn-eye:hover { color: #5d6778; }

/* Password strength */
.strength-bars { display: flex; gap: 4px; margin-top: 8px; }
.strength-bars .s-bar {
  flex: 1; height: 3px; border-radius: 3px;
  background: #e9ecef; transition: background .25s;
}
.strength-hint { font-size: .72rem; font-weight: 600; margin-top: 4px; min-height: 14px; }
.hint-weak   { color: #dc3545; }
.hint-fair   { color: #fd7e14; }
.hint-good   { color: #e6a817; }
.hint-strong { color: #198754; }

/* Remember / Forgot */
.auth-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.auth-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .83rem; color: #6b7a99; }
.auth-row input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: #4a24ae; cursor: pointer;
}
.auth-row a, .auth-forgot { font-size: .83rem; color: #4a24ae; text-decoration: none; font-weight: 500; }
.auth-row a:hover, .auth-forgot:hover { text-decoration: underline; }

/* Terms */
.terms-card {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f8f9ff; border: 1.5px solid #e2e6ff;
  border-radius: 9px; padding: 12px 14px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color .2s;
}
.terms-card:hover { border-color: #4a24ae; }
.terms-card.is-invalid { border-color: #dc3545; background: #fff8f8; }
.terms-cb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border: 2px solid #c5cfe0;
  border-radius: 4px; flex-shrink: 0; margin-top: 1px; cursor: pointer;
  position: relative; background: #fff; transition: all .15s;
}
.terms-cb:checked { background: #4a24ae; border-color: #4a24ae; }
.terms-cb:checked::after {
  content: ''; position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg);
}
.terms-text { font-size: .8rem; color: #5d6b82; line-height: 1.5; }
.terms-text a { color: #4a24ae; text-decoration: none; font-weight: 500; }
.terms-text a:hover { text-decoration: underline; }

/* Submit button */
.btn-submit {
  width: 100%; height: 46px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #4a24ae 0%, #3866d6 55%, #3ab8d8 100%);
  color: #fff; font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: opacity .2s, transform .1s;
  letter-spacing: .01em; margin-bottom: 16px;
}
.btn-submit:hover { opacity: .92; }
.btn-submit:active { transform: scale(.99); }
.btn-submit:disabled { opacity: .65; cursor: not-allowed; }

/* Divider + switch link */
.or-divider {
  text-align: center; position: relative; margin: 6px 0 14px;
  font-size: .8rem; color: #c0c8d8;
}
.or-divider::before, .or-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 42%; height: 1px; background: #edf0f7;
}
.or-divider::before { left: 0; }
.or-divider::after  { right: 0; }

.switch-link { text-align: center; font-size: .85rem; color: #6b7a99; }
.switch-link a { color: #4a24ae; font-weight: 600; text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

/* Footer */
.auth-right-footer {
  padding-top: 24px;
  text-align: center; font-size: .78rem; color: #b0bcc8;
}

/* ── Terms / Privacy Modal ── */
.legal-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 41, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  padding: 16px;
}
.legal-modal-overlay.open {
  opacity: 1; pointer-events: all;
}
.legal-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%; max-width: 640px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(15, 23, 41, 0.22);
  transform: translateY(16px) scale(.98);
  transition: transform .2s;
  overflow: hidden;
}
.legal-modal-overlay.open .legal-modal {
  transform: translateY(0) scale(1);
}
.legal-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #edf0f7;
  flex-shrink: 0;
}
.legal-modal-title {
  font-size: 1.05rem; font-weight: 800; color: #0f1729;
  margin: 0; display: flex; align-items: center;
}
.legal-modal-close {
  background: #f3f4f8; border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 1.1rem; line-height: 1;
  color: #6b7a99; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.legal-modal-close:hover { background: #ffe4e6; color: #c0152a; }
.legal-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  font-size: .88rem; color: #374151; line-height: 1.7;
}
.legal-modal-body p { margin: 0 0 12px; }
.legal-modal-body p:last-child { margin-bottom: 0; }
.legal-modal-body ul { padding-left: 20px; margin: 0 0 12px; }
.legal-modal-body ul li { margin-bottom: 4px; }
.legal-section {
  border: 1px solid #edf0f7; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px;
}
.legal-section-title {
  font-size: .88rem; font-weight: 700; color: #2b3140;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.legal-num {
  background: linear-gradient(135deg, #4a24ae, #3883e5);
  color: #fff; font-size: .7rem; font-weight: 800;
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.legal-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #edf0f7;
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}
.btn-legal-agree {
  height: 40px; padding: 0 20px; border: none; border-radius: 9px;
  background: linear-gradient(135deg, #4a24ae 0%, #3866d6 55%, #3ab8d8 100%);
  color: #fff; font-size: .875rem; font-weight: 700; cursor: pointer;
  transition: opacity .2s;
}
.btn-legal-agree:hover { opacity: .9; }
.btn-legal-close {
  height: 40px; padding: 0 16px; border: 1.5px solid #e2e8f0;
  border-radius: 9px; background: #fff; color: #6b7a99;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-legal-close:hover { border-color: #4a24ae; color: #4a24ae; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .auth-left { display: none; }
  .auth-right { padding: 36px 32px; }
  .auth-card { max-width: 480px; border-radius: 16px; }
}
@media (max-width: 480px) {
  body { padding: 10px; }
  .auth-right { padding: 28px 20px; }
  .auth-card { border-radius: 14px; }
}
