/* THE-IMIS login — split mockup (50/50, navy + gold portals, full login card) */

:root {
  --navy: #001a33;
  --navy-form: #0c2342;
  --navy-form-border: rgba(56, 132, 196, 0.45);
  --gold: #ffc107;
  --gold-border: #ffcc00;
  --gold-hover: #ffd633;
  --blue: #1d4ed8;
  --blue-light: #2563eb;
  --ink: #0f172a;
  --ink-muted: #64748b;
  --input-bg: #e8eef4;
  --white: #ffffff;
  --mfa-btn: #5a6d82;
  --mfa-btn-active: #6b7f96;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

html {
  height: 100%;
}

body.login-page {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--navy);
}

.main-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* ═══════════════ LEFT PANEL ═══════════════ */
.left-panel {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
  background: var(--white);
  overflow: hidden;
}

.left-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
  padding: 10px 18px 8px;
  gap: 0;
  overflow: hidden;
}

.left-copy {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 8px;
  gap: 0;
  line-height: 1;
}

.left-copy > * {
  margin: 0;
  line-height: 1;
}

.left-copy > * + * {
  margin-top: 1em;
}

.brand-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1;
}

.brand-cap {
  font-size: clamp(36px, 4.5vw, 52px);
  color: var(--blue);
  line-height: 1;
}

.brand-wordmark {
  font-size: clamp(36px, 4.5vw, 52px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--blue);
  line-height: 1;
}

.brand-lines {
  line-height: 1;
}

.brand-line {
  display: block;
  font-size: clamp(9px, 1vw, 12px);
  font-weight: 700;
  color: var(--blue-light);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-line + .brand-line {
  margin-top: 1em;
}

.brand-tagline {
  font-size: clamp(15px, 1.65vw, 21px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.brand-tagline__imis {
  color: var(--blue);
}

.brand-lead {
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 400;
  color: var(--ink-muted);
  line-height: 1;
}

.login-scene {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
}

.login-scene__img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center center;
}

.value-pillars {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 8px;
  padding-top: 6px;
}

.value-pillar {
  text-align: center;
  min-width: 0;
  line-height: 1;
}

.value-pillar__icon {
  display: block;
  font-size: clamp(18px, 2vh, 24px);
  color: var(--blue);
  margin-bottom: 1em;
  line-height: 1;
}

.value-pillar__title {
  font-size: clamp(8px, 0.75vw, 10px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin: 0 0 1em;
}

.value-pillar__icon + .value-pillar__title {
  margin-top: 0;
}

.value-pillar__text {
  font-size: clamp(7px, 0.65vw, 8px);
  color: var(--ink-muted);
  line-height: 1;
  margin: 0;
}

.left-footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 9px;
  color: var(--ink-muted);
  line-height: 1;
  margin: 0;
  padding-top: 4px;
}

/* ═══════════════ RIGHT PANEL ═══════════════ */
.right-panel {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
  background: var(--navy);
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  max-height: 100dvh;
}

.right-inner {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: 12px 18px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.right-fit {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(8px, 1.2vh, 14px);
}

.portal-tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 1vh, 10px) clamp(8px, 1.2vw, 12px);
  width: 100%;
  line-height: 1.1;
  padding-bottom: 2px;
}

.portal-tab {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 0.6vh, 8px) 2px;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

.portal-tab__icon {
  display: none;
}

.portal-tab__label {
  font-size: clamp(10px, 1.35vmin, 13px);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  white-space: normal;
}

.portal-tab:hover .portal-tab__label {
  color: var(--gold-border);
}

.portal-tab.is-active {
  background: none;
  box-shadow: none;
}

.portal-tab.is-active .portal-tab__label {
  color: var(--gold-border);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-form-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 1.8vh, 20px) clamp(14px, 2vw, 18px);
  border-radius: 10px;
  border: 1px solid var(--navy-form-border);
  background: var(--navy-form);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-box {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#loginFormSection {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: clamp(6px, 1.1vh, 14px);
}

#loginFormSection[hidden],
#portalRedirectSection[hidden],
#portalEmbedSection[hidden] {
  display: none !important;
}

.portal-embed {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-embed__frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: min(520px, calc(100dvh - 200px));
  border: none;
  border-radius: 8px;
  background: var(--navy);
}

.login-box:has(#portalEmbedSection:not([hidden])) .auth-notice {
  display: none;
}

.login-form-card:has(#portalEmbedSection:not([hidden])) {
  padding: 8px 10px;
  overflow: hidden;
}

.portal-embed-fallback {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  min-height: min(420px, calc(100dvh - 220px));
}

.portal-embed-fallback__text {
  font-size: clamp(11px, 1.2vmin, 13px);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  max-width: 36em;
}

.portal-embed-fallback__link {
  font-size: clamp(12px, 1.3vmin, 14px);
  font-weight: 700;
  color: var(--gold-border);
  text-decoration: underline;
}

.portal-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 1.2vw, 14px);
  margin-bottom: 0;
  flex-shrink: 0;
}

.portal-meta-row--role-only {
  grid-template-columns: 1fr;
}

.portal-meta-row__cell--solo {
  display: none;
}

.portal-meta-row[hidden] {
  display: none !important;
}

.credential-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 1.2vw, 14px);
  flex-shrink: 0;
}

.login-submit-btn,
.bottom-links {
  flex-shrink: 0;
}

.login-box label,
.login-box .mfa-label {
  display: block;
  font-size: clamp(12px, 1.45vmin, 15px);
  font-weight: 600;
  color: var(--white);
  margin-top: 0;
  margin-bottom: clamp(4px, 0.5vh, 6px);
  line-height: 1.1;
}

.login-box select,
.login-box input:not([type="checkbox"]) {
  width: 100%;
  padding: clamp(9px, 1.1vh, 12px) clamp(10px, 1.2vw, 12px);
  font-size: clamp(13px, 1.45vmin, 16px);
  line-height: 1.2;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  outline: none;
}

.login-box select:focus,
.login-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.28);
}

.login-box select:disabled,
.login-box input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.input-icon-wrap {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(14px, 1.4vmin, 17px);
  opacity: 0.5;
  pointer-events: none;
}

.input-icon-wrap input {
  padding-left: 34px;
}

.input-icon-wrap--password input {
  padding-left: 10px;
  padding-right: 36px;
}

.password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  font-size: clamp(15px, 1.5vmin, 18px);
  opacity: 0.65;
  cursor: pointer;
  padding: 2px;
  color: var(--ink);
}

.password-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.otp-section {
  flex-shrink: 0;
  margin-top: 0;
  line-height: 1.1;
}

.otp-section[hidden] {
  display: none !important;
}

.otp-section.section-muted {
  opacity: 0.55;
}

.otp-buttons {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  margin-bottom: 3px;
}

.otp-buttons .otp-btn {
  flex: 1 1 0;
  min-width: 0;
}

.otp-btn {
  padding: clamp(8px, 1vh, 11px) clamp(6px, 0.8vw, 8px);
  font-size: clamp(11px, 1.25vmin, 13px);
  font-weight: 700;
  line-height: 1.1;
  border: 1px solid rgba(100, 116, 139, 0.35);
  border-radius: 8px;
  background: var(--mfa-btn);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.otp-btn.is-active {
  background: rgba(255, 193, 7, 0.12);
  border: 1.5px solid var(--gold-border);
  color: var(--gold-border);
}

.otp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.otp-action-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.otp-generate-btn,
.otp-resend-btn {
  padding: clamp(8px, 1vh, 11px) clamp(10px, 1.2vw, 14px);
  font-size: clamp(11px, 1.2vmin, 13px);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--white);
  border-radius: 8px;
}

.otp-resend-btn {
  border-color: rgba(255, 255, 255, 0.4);
}

.login-submit-btn {
  width: 100%;
  margin-top: 0;
  padding: clamp(12px, 1.5vh, 16px) clamp(14px, 2vw, 18px);
  border: none;
  border-radius: 9px;
  background: var(--gold);
  color: #0b1d3a;
  font-size: clamp(14px, 1.65vmin, 18px);
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.login-submit-btn:hover:enabled {
  filter: brightness(1.06);
}

.login-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bottom-links {
  display: flex;
  justify-content: space-between;
  margin: 0;
  line-height: 1.1;
  flex-shrink: 0;
}

.bottom-links .link-btn {
  border: none;
  background: none;
  font-size: clamp(11px, 1.25vmin, 14px);
  font-weight: 600;
  color: var(--gold-border);
  cursor: pointer;
  padding: 0;
  line-height: 1.1;
}

.bottom-links .link-btn:hover {
  color: var(--gold-hover);
  text-decoration: underline;
}

.auth-notice {
  font-size: 11px;
  margin-bottom: 8px;
  line-height: 1.35;
}

.auth-notice:empty {
  display: none;
  margin: 0;
}

.auth-notice.error { color: #fca5a5; }
.auth-notice.success { color: #86efac; }
.auth-notice.info { color: rgba(255, 255, 255, 0.75); }

.login-box[data-portal-tab="developer"] .portal-meta-row,
.login-box[data-portal-tab="developer"] #otpSection {
  display: none !important;
}

.portal-redirect {
  padding: 12px 4px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

.portal-redirect[hidden] {
  display: none !important;
}

.portal-redirect__title {
  color: var(--gold-border);
  margin-bottom: 8px;
}

.portal-redirect__text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 12px;
}

.portal-redirect__btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.auth-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-panel-heading {
  color: var(--gold-border);
  margin-bottom: 8px;
  font-size: 14px;
}

.auth-panel .description {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 8px;
}

.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }

.right-footer {
  flex-shrink: 0;
  text-align: right;
  font-size: clamp(10px, 1.15vmin, 12px);
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  padding: 0;
}

.right-footer strong {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
}

.feature-modal[hidden] {
  display: none !important;
}

.feature-modal:not([hidden]) {
  display: flex;
}

.feature-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.feature-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 15, 31, 0.65);
}

.feature-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 12px;
}

.feature-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.feature-modal__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.feature-modal__close {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
}

.feature-modal__body {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Mobile & tablet: same 50/50 left/right index as desktop (no stacked layout) */
@media (max-width: 1100px) {
  .main-container {
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.login-page {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
  }

  .left-panel,
  .right-panel {
    flex: 0 0 50%;
    width: 50%;
    max-width: 50%;
    min-width: 0;
  }

  .left-inner {
    padding: 6px 8px 6px;
  }

  .brand-wordmark {
    font-size: clamp(18px, 4.5vw, 28px);
  }

  .brand-line {
    font-size: clamp(6px, 1.6vw, 9px);
  }

  .brand-tagline {
    font-size: clamp(9px, 2.2vw, 12px);
  }

  .brand-lead {
    font-size: clamp(7px, 1.8vw, 9px);
  }

  .login-scene__img {
    max-height: 22vh;
    width: 100%;
    object-fit: cover;
  }

  .value-pillars {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .value-pillar__title {
    font-size: clamp(7px, 1.8vw, 9px);
  }

  .value-pillar__text {
    font-size: clamp(6px, 1.5vw, 8px);
  }

  .portal-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px 6px;
  }

  .portal-tab__label {
    font-size: clamp(7px, 1.7vw, 11px);
  }

  .right-inner {
    padding: 8px 10px 8px;
  }

  .login-form-card {
    padding: 8px 10px;
  }

  .login-form-card label {
    font-size: clamp(8px, 2vw, 11px);
  }

  .login-form-card input,
  .login-form-card select {
    font-size: clamp(9px, 2.2vw, 12px);
    padding: 6px 8px;
  }

  .login-submit-btn {
    font-size: clamp(10px, 2.4vw, 13px);
    padding: 8px 10px;
  }

  .otp-btn {
    font-size: clamp(7px, 1.8vw, 10px);
    padding: 5px 6px;
  }
}

@media (max-width: 640px) {
  .credential-row,
  .portal-meta-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .otp-action-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .otp-generate-btn,
  .otp-resend-btn {
    width: 100%;
  }

  .portal-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
