/**
 * CERMAT Auth — split viewport login (brand | form)
 * Isolated from emonev.css app chrome.
 */
html.auth-html {
  height: 100%;
  margin: 0;
}

body.auth-page {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: #041628;
  color: #1e293b;
}

/* Full-viewport 2-column shell (flex = more reliable than grid alone) */
body.auth-page .auth-shell {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh;
  position: relative;
  z-index: 1;
}

body.auth-page .auth-panel {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Left: brand (proporsional, muat 1 viewport laptop) ───── */
body.auth-page .auth-panel--brand {
  flex: 1 1 44%;
  width: 44%;
  max-width: 44%;
  color: #ffffff !important;
  overflow: hidden;
  background: #003A8C;
}

body.auth-page .auth-brand-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(0, 163, 255, .35) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 85%, rgba(255, 140, 0, .28) 0%, transparent 50%),
    linear-gradient(160deg, #041628 0%, #003A8C 42%, #0057C8 100%);
}

body.auth-page .auth-brand-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: .75;
  pointer-events: none;
}

body.auth-page .auth-stage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, transparent 20%, rgba(4, 16, 31, .5) 100%);
}

body.auth-page .auth-stage-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, .015) 3px,
    rgba(255, 255, 255, .015) 4px
  );
  opacity: .5;
}

body.auth-page .auth-brand-content {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(.55rem, 1.4vh, .9rem);
  padding: clamp(16px, 3vh, 28px) clamp(18px, 2.8vw, 36px);
  max-width: 520px;
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  color: #ffffff !important;
  overflow: hidden;
}

body.auth-page .auth-brand-top {
  flex-shrink: 0;
}

body.auth-page .auth-logo {
  width: min(220px, 28vw, 26vh);
  max-width: 240px;
  max-height: min(220px, 28vh);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  margin: 0 0 clamp(8px, 1.2vh, 14px);
  border-radius: 18px;
  background: #ffffff;
  padding: 14px 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .55),
    0 10px 28px rgba(0, 0, 0, .30);
}

body.auth-page .auth-brand-name,
body.auth-page h1.auth-brand-name {
  font-size: clamp(1.7rem, 3vw, 2.25rem) !important;
  font-weight: 800 !important;
  letter-spacing: .1em;
  margin: 0 0 8px !important;
  color: #ffffff !important;
  line-height: 1.15;
}

body.auth-page .auth-brand-tagline,
body.auth-page p.auth-brand-tagline {
  font-size: clamp(.78rem, 1.05vw, .92rem) !important;
  color: rgba(255, 255, 255, .92) !important;
  margin: 0 0 4px !important;
  font-weight: 500;
  line-height: 1.35;
}

body.auth-page .auth-brand-desc,
body.auth-page p.auth-brand-desc {
  font-size: .74rem !important;
  color: #FFB020 !important;
  margin: 0 !important;
  font-weight: 500;
  line-height: 1.35;
  max-width: 34em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.auth-page .auth-feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 0 1 auto;
  min-height: 0;
}

body.auth-page .auth-feature {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 140, 0, .28);
  background: rgba(4, 22, 40, .55);
  min-height: 0;
}

body.auth-page .auth-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 140, 0, .20);
  color: #FF8C00 !important;
  line-height: 1;
}

body.auth-page .auth-feature-icon i,
body.auth-page .auth-feature-icon .bi {
  font-size: 1.25rem !important;
  line-height: 1 !important;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.auth-page .auth-feature strong {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: #ffffff !important;
  margin-bottom: 2px;
  line-height: 1.2;
}

body.auth-page .auth-feature span {
  font-size: .68rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, .78) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.auth-page .auth-brand-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  flex-shrink: 0;
}

body.auth-page .auth-stat {
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
}

body.auth-page .auth-stat-label {
  display: block;
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55) !important;
  margin-bottom: 2px;
}

body.auth-page .auth-stat-value {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  color: #FF8C00 !important;
}

body.auth-page .auth-brand-foot,
body.auth-page p.auth-brand-foot {
  margin: 4px 0 0 !important;
  font-size: .68rem !important;
  color: rgba(255, 255, 255, .5) !important;
}

/* ── Right: form ───────────────────────────────────────────── */
body.auth-page .auth-panel--form {
  flex: 1 1 56%;
  width: 56%;
  max-width: 56%;
  background: #eef4fb !important;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vh, 36px) clamp(16px, 3vw, 40px);
  overflow: hidden;
  box-sizing: border-box;
}

body.auth-page .auth-form-card {
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff !important;
  border-radius: 16px;
  border: 1px solid rgba(11, 46, 89, .1);
  box-shadow: 0 16px 40px rgba(11, 46, 89, .12);
  overflow: hidden;
}

body.auth-page .auth-form-head {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #003A8C 0%, #0057C8 100%);
  color: #fff !important;
  font-size: .95rem;
  letter-spacing: .04em;
}

body.auth-page .auth-form-logo-sm {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .5);
}

body.auth-page .auth-form-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 24px 16px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

body.auth-page .auth-form-foot {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #f8fafc;
  border-top: 1px solid #e8eef5;
  text-align: center;
  font-size: .62rem;
  color: #6B7A99;
}

/* Form controls — scoped, constrained */
body.auth-page .auth-form-body .form-label {
  margin-bottom: 4px;
  font-size: .68rem;
  font-weight: 600;
  color: #0057C8;
  letter-spacing: .03em;
  text-transform: uppercase;
}

body.auth-page .auth-form-body .mb-3 { margin-bottom: .75rem !important; }
body.auth-page .auth-form-body .mb-4 { margin-bottom: .95rem !important; }

body.auth-page .auth-form-body .form-control {
  height: 40px;
  font-size: .875rem;
  border-radius: 10px;
  max-width: 100%;
}

body.auth-page .auth-form-body .input-group {
  max-width: 100%;
}

body.auth-page .auth-form-body .input-group .form-control {
  border-radius: 10px 0 0 10px;
}

body.auth-page .auth-form-body .input-group .btn {
  border-radius: 0 10px 10px 0;
  height: 40px;
}

body.auth-page .auth-form-body .form-control:focus {
  border-color: #FF8C00;
  box-shadow: 0 0 0 3px rgba(200, 160, 77, .28);
}

body.auth-page .auth-login-btn {
  background: #0057C8 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: .55rem !important;
  height: 42px;
  width: 100%;
  max-width: 100%;
}

body.auth-page .auth-login-btn:hover:not(:disabled) {
  background: #0A4BB0 !important;
}

body.auth-page .auth-captcha-box {
  background: #F5F7FA;
  border: 1px solid #DCE3EA;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #0057C8;
  letter-spacing: .1em;
  min-width: 120px;
  text-align: center;
  user-select: none;
}

body.auth-page .auth-captcha-refresh {
  background: #fff;
  border: 1px solid #DCE3EA;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: #64748B;
}

body.auth-page .auth-title {
  font-weight: 700;
  color: #0057C8 !important;
  font-size: 1.1rem;
  margin: 0 0 4px;
}

body.auth-page .auth-subtitle {
  font-size: .75rem;
  color: #6B7A99 !important;
  margin: 0 0 16px;
  line-height: 1.4;
}

body.auth-page .alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: .8rem;
  line-height: 1.4;
  border-radius: 10px;
}

body.auth-page .alert .alert-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

body.auth-page .alert .alert-body {
  flex: 1 1 auto;
  min-width: 0;
}

body.auth-page .alert .alert-close {
  flex-shrink: 0;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: currentColor;
  opacity: .55;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
}

body.auth-page .alert .alert-close:hover,
body.auth-page .alert .alert-close:focus-visible {
  opacity: 1;
  background: rgba(0, 0, 0, .06);
  outline: none;
}

/* Laptop pendek — pastikan 1 viewport tanpa scroll */
@media (max-height: 820px) {
  body.auth-page .auth-logo {
    width: min(168px, 22vh);
    max-width: 180px;
    max-height: min(168px, 22vh);
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  body.auth-page .auth-feature span { display: none; }
  body.auth-page .auth-feature {
    grid-template-columns: 36px 1fr;
    padding: 8px 10px;
  }
  body.auth-page .auth-feature-icon {
    width: 36px;
    height: 36px;
  }
  body.auth-page .auth-feature-icon i,
  body.auth-page .auth-feature-icon .bi {
    font-size: 1.1rem !important;
  }
  body.auth-page .auth-brand-stats { display: none; }
  body.auth-page .auth-form-body { padding: 16px 18px 12px; }
}

@media (max-height: 700px) {
  body.auth-page .auth-brand-desc { display: none; }
  body.auth-page .auth-feature-list {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  body.auth-page .auth-feature strong { font-size: .72rem; margin: 0; }
}

@media (max-height: 600px) {
  body.auth-page .auth-feature-list { display: none; }
  body.auth-page .auth-logo {
    width: min(140px, 20vh);
    max-width: 148px;
    max-height: min(140px, 20vh);
    padding: 8px 10px;
  }
}

/* Mobile / HP — ringkas: brand pendek, form login langsung terlihat */
@media (max-width: 991.98px) {
  html.auth-html,
  body.auth-page {
    height: auto !important;
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    background: #003A8C;
  }

  body.auth-page .auth-shell {
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    min-height: 100dvh;
    gap: 0;
  }

  body.auth-page .auth-panel--brand,
  body.auth-page .auth-panel--form {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Brand ringkas di atas, form login langsung di bawah */
  body.auth-page .auth-panel--brand { order: 1; }
  body.auth-page .auth-panel--form { order: 2; }

  body.auth-page .auth-panel--brand {
    min-height: auto;
    overflow: hidden;
  }

  body.auth-page .auth-brand-stage {
    opacity: .9;
  }

  body.auth-page .auth-brand-content {
    padding: 16px 16px 22px;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    max-width: none;
    gap: .5rem;
    justify-content: flex-start;
  }

  body.auth-page .auth-brand-top {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  body.auth-page .auth-logo {
    width: 128px;
    max-width: 128px;
    max-height: 128px;
    margin: 0 auto 10px;
    padding: 10px;
    border-radius: 16px;
  }

  body.auth-page .auth-brand-tagline {
    font-size: .82rem !important;
    margin: 0 0 2px !important;
    text-align: center;
  }

  body.auth-page .auth-brand-desc {
    font-size: .72rem !important;
    text-align: center;
    margin: 0 !important;
    opacity: .85;
  }

  body.auth-page .auth-brand-stats,
  body.auth-page .auth-brand-foot,
  body.auth-page .auth-feature-list {
    display: none !important;
  }

  body.auth-page .auth-panel--form {
    background: #eef4fb !important;
    padding: 16px 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    overflow: visible !important;
    align-items: stretch;
    justify-content: flex-start;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .18);
  }

  body.auth-page .auth-form-card {
    max-width: 480px;
    width: 100%;
    max-height: none !important;
    margin: 0 auto;
    position: relative;
    z-index: 3;
    overflow: hidden !important;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 87, 200, .12);
  }

  body.auth-page .auth-form-body {
    flex: none;
    min-height: auto;
    overflow: visible !important;
    padding: 18px 18px 14px;
  }

  body.auth-page .auth-form-head {
    display: flex !important;
    padding: 12px 16px;
    gap: 10px;
  }

  body.auth-page .auth-form-logo-sm {
    width: 36px;
    height: 36px;
    padding: 2px;
    border-radius: 8px;
  }

  body.auth-page .auth-form-foot {
    padding: 8px 16px 12px;
    font-size: .68rem;
  }
}

/* HP sempit: brand hero lebih pendek lagi */
@media (max-width: 575.98px) {
  body.auth-page .auth-brand-content {
    padding: 14px 14px 16px;
  }

  body.auth-page .auth-logo {
    width: 112px;
    max-width: 112px;
    max-height: 112px;
    padding: 8px;
  }

  body.auth-page .auth-brand-desc {
    display: none !important;
  }

  body.auth-page .auth-panel--form {
    padding: 12px 12px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
  }

  body.auth-page .auth-form-body {
    padding: 16px 14px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-page .auth-stage-scan { display: none; }
}
