/* BMHA E-Office | Auth Portal V2
   Shared presentation layer for login.php, 2fa_verify.php, 2fa_setup.php.
   No server-side authentication or 2FA behavior is changed by this stylesheet. */
:root {
  --portal-ink: #122d4e;
  --portal-ink-muted: #667c91;
  --portal-blue: #126aa4;
  --portal-blue-dark: #0a4c82;
  --portal-teal: #119f9c;
  --portal-teal-light: #d5f4f0;
  --portal-bg-color: #f5f9fd;
  --portal-card-bg: #ffffff;
  --portal-border: #dbe7f0;
  --portal-surface: #f4f9fc;
  --portal-input: #fdfefe;
  --portal-shadow: 0 22px 64px rgba(27,75,115,.12), 0 4px 16px rgba(27,75,115,.05);
  --text-color: var(--portal-ink);
  --auth-muted: var(--portal-ink-muted);
  --primary-color: var(--portal-blue);
  --secondary-color: var(--portal-blue-dark);
}
[data-bs-theme="dark"] {
  --portal-ink: #eef7ff;
  --portal-ink-muted: #aec5d6;
  --portal-blue: #4ca9e8;
  --portal-blue-dark: #1377ae;
  --portal-teal: #44c8bf;
  --portal-teal-light: #123e48;
  --portal-bg-color: #0c1929;
  --portal-card-bg: #14273b;
  --portal-border: #2b4660;
  --portal-surface: #193248;
  --portal-input: #12283b;
  --portal-shadow: 0 22px 72px rgba(0,0,0,.25);
  --text-color: var(--portal-ink);
  --auth-muted: var(--portal-ink-muted);
  --primary-color: var(--portal-blue);
  --secondary-color: var(--portal-blue-dark);
}
html { min-height: 100%; }
body.portal-page, body.auth2fa-page.portal-page {
  display: block;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Kanit', sans-serif;
  font-weight: 400;
  line-height: 1.55;
  color: var(--portal-ink);
  background: var(--portal-bg-color);
  isolation: isolate;
}
.portal-page *, .portal-page *::before, .portal-page *::after { box-sizing: border-box; }
.portal-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 7% 30%, rgba(62,153,209,.14), transparent 43%),
    radial-gradient(circle at 77% 90%, rgba(38,191,176,.11), transparent 42%),
    linear-gradient(135deg, #fbfdff 0%, #eef6fc 68%, #edf8f8 100%);
}
[data-bs-theme="dark"] .portal-bg {
  background:
    radial-gradient(circle at 7% 30%, rgba(42,126,192,.20), transparent 43%),
    radial-gradient(circle at 77% 90%, rgba(18,153,146,.13), transparent 42%),
    linear-gradient(135deg, #0c1929 0%, #10253c 100%);
}
.portal-bg::after {
  content: '';
  position: absolute;
  right: -14%;
  bottom: -44%;
  width: 76vw;
  height: 58vw;
  border-radius: 50%;
  border: 9vw solid rgba(49,173,186,.045);
  transform: rotate(-24deg);
}
.portal-bg-grid {
  position: absolute;
  inset: 0;
  opacity: .32;
  background-image: radial-gradient(circle, rgba(44,126,175,.11) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(100deg, #000 3%, transparent 48%);
}
.portal-topbar {
  height: 88px;
  width: 100%;
  background: linear-gradient(105deg, #113968 0%, #0e557e 68%, #117e90 100%);
  color: #fff;
  box-shadow: 0 5px 16px rgba(17,67,111,.09);
}
.portal-topbar-inner {
  width: min(1240px, calc(100% - 80px));
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.portal-brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.portal-brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 51px;
  width: 51px;
  height: 51px;
  border-radius: 15px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 4px 14px rgba(2,30,62,.1);
}
.portal-brand-logo img { width: 37px; height: 37px; object-fit: contain; }
.portal-brand-copy { display: grid; line-height: 1.37; }
.portal-brand-copy strong { color: #fff; font-size: 1.13rem; font-weight: 500; }
.portal-brand-copy small { color: #d2e8f0; font-size: .8rem; font-weight: 300; }
.portal-header-right { display: inline-flex; align-items: center; gap: 22px; }
.portal-header-tag { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: #e5fbfd; letter-spacing: .15px; white-space: nowrap; }
.portal-header-tag .bi { font-size: 1.14rem; }
.portal-theme, .theme-switch-wrapper.portal-theme {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  z-index: 1;
  color: #e2faff;
  font-size: 1rem;
}
.portal-theme .theme-switch { width: 42px; height: 24px; margin: 0; display: inline-block; position: relative; }
.portal-theme .theme-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.portal-theme .slider { position: absolute; inset: 0; background: rgba(255,255,255,.24); border: 1px solid rgba(255,255,255,.23); border-radius: 99px; cursor: pointer; transition: background .2s; }
.portal-theme .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.12); transition: transform .2s; }
.portal-theme input:checked + .slider { background: rgba(41,213,195,.60); }
.portal-theme input:checked + .slider::before { transform: translateX(18px); }
.portal-theme input:focus-visible + .slider { outline: 3px solid #bcefff; outline-offset: 3px; }
.portal-shell {
  width: min(1210px, calc(100% - 80px));
  min-height: calc(100vh - 142px);
  margin: 0 auto;
  padding: 58px 0 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  align-items: center;
  gap: clamp(36px, 5.3vw, 92px);
}
.portal-hero { align-self: center; min-width: 0; }
.portal-hero-copy { position: relative; z-index: 1; }
.portal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border: 1px solid rgba(22,136,149,.19);
  border-radius: 50px;
  background: rgba(229,248,247,.74);
  color: #137f85;
  font-size: .77rem;
  letter-spacing: .09em;
  font-weight: 600;
}
[data-bs-theme="dark"] .portal-kicker { background: rgba(34,179,173,.13); color: #78e4df; }
.portal-kicker-dot { width: 7px; height: 7px; background: #1ca69b; border-radius: 50%; box-shadow: 0 0 0 3px rgba(27,166,155,.1); }
.portal-hero h1 { margin: 23px 0 9px; font-family: 'Kanit', sans-serif; font-size: clamp(2.9rem, 4.2vw, 4.5rem); line-height: 1.08; font-weight: 600; letter-spacing: -.04em; white-space: nowrap; }
.portal-hero h1 span { color: var(--portal-ink); }
.portal-hero h1 em { font-style: normal; color: var(--portal-teal); }
.portal-hero-title { margin: 0; font-size: clamp(1.45rem, 2vw, 2rem); font-weight: 500; color: var(--portal-ink); }
.portal-hero-desc { max-width: 470px; margin: 19px 0 0; font-size: 1.03rem; font-weight: 300; line-height: 1.95; color: var(--portal-ink-muted); }
.portal-illustration { position: relative; width: min(510px, 100%); height: 265px; margin-top: 30px; user-select: none; }
.portal-illustration-halo { position: absolute; inset: 15px 58px -4px 39px; border-radius: 50%; background: radial-gradient(ellipse, rgba(91,194,214,.14) 0%, rgba(91,194,214,.07) 45%, transparent 73%); border: 1px solid rgba(89,183,203,.1); }
.portal-ill-main {
  position: absolute; left: 20%; top: 14px; width: 260px; height: 204px;
  border: 1px solid rgba(126,177,205,.27); border-radius: 23px;
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(239,249,252,.97));
  box-shadow: 0 24px 40px rgba(18,81,120,.11), 0 5px 15px rgba(18,81,120,.06);
  transform: rotate(-4deg);
}
[data-bs-theme="dark"] .portal-ill-main { background: linear-gradient(160deg, #1b3a51, #163044); border-color: #42647b; }
.portal-ill-head { display: flex; align-items: center; gap: 11px; height: 47px; padding: 0 20px; border-bottom: 1px solid rgba(107,166,194,.16); }
.portal-ill-dots { display: flex; gap: 5px; }
.portal-ill-dots b { width: 6px; height: 6px; border-radius: 50%; background: #9fcbdc; }
.portal-ill-topline { width: 85px; height: 7px; border-radius: 99px; background: #d3e5ee; }
.portal-ill-chip { margin-left: auto; width: 29px; height: 12px; border-radius: 40px; background: #c2eee4; }
.portal-ill-content { display: flex; align-items: center; gap: 13px; padding: 23px 19px 18px; }
.portal-ill-icon { display: grid; place-items: center; width: 62px; height: 70px; flex: 0 0 62px; border-radius: 14px; background: linear-gradient(160deg,#d4f4f5,#b8e2f7); color: #137c9c; font-size: 2.2rem; }
.portal-ill-lines { display: grid; flex: 1; gap: 11px; }
.portal-ill-lines span { width: 90%; height: 9px; border-radius: 10px; background: #bddde8; }
.portal-ill-lines span:nth-child(2) { width: 100%; background: #daeaf2; }
.portal-ill-lines span:nth-child(3) { width: 62%; background: #daeaf2; }
.portal-ill-check { display: grid; place-items: center; position: absolute; right: 16px; bottom: 17px; width: 32px; height: 32px; border-radius: 50%; background: #1aae9b; color: #fff; font-size: 1.25rem; }
.portal-ill-footer { display: flex; gap: 8px; padding: 0 20px; }
.portal-ill-footer span { height: 9px; border-radius: 12px; background: #d7e9ef; }
.portal-ill-footer span:nth-child(1) { width: 31%; }.portal-ill-footer span:nth-child(2) { width: 22%; }.portal-ill-footer span:nth-child(3) { width: 14%; }
.portal-ill-float { position: absolute; z-index: 2; width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid rgba(99,163,188,.26); border-radius: 21px; background: linear-gradient(145deg,#fff,#deeff6); color: #1880a4; box-shadow: 0 14px 28px rgba(22,96,130,.12); font-size: 1.75rem; }
[data-bs-theme="dark"] .portal-ill-float { background: linear-gradient(145deg,#264961,#19374d); border-color: #42647b; color: #8fe0ee; }
.portal-ill-float-one { top: 10px; right: 5%; transform: rotate(9deg); }.portal-ill-float-two { bottom: 23px; right: 8%; transform: rotate(-8deg); }.portal-ill-float-three { top: 105px; left: 4%; transform: rotate(8deg); }
.portal-ill-mini { position: absolute; left: 18%; bottom: 0; z-index: 3; display: inline-flex; align-items: center; gap: 9px; padding: 11px 15px; border: 1px solid rgba(106,179,170,.16); border-radius: 13px; background: var(--portal-card-bg); box-shadow: 0 10px 24px rgba(26,94,118,.1); color: var(--portal-ink); font-size: .84rem; }
.portal-ill-mini i { color: #15aa96; font-size: 1.13rem; }
.portal-hero-foot { display: flex; align-items: center; gap: 12px; margin-top: 25px; color: #8499a8; font-size: .78rem; font-weight: 300; letter-spacing: .04em; }
.portal-hero-rule { display: inline-block; height: 2px; width: 38px; background: linear-gradient(90deg, var(--portal-teal), transparent); }
.portal-card {
  position: relative;
  min-width: 0;
  padding: clamp(28px, 3.15vw, 46px);
  border: 1px solid var(--portal-border);
  border-radius: 26px;
  background: var(--portal-card-bg);
  box-shadow: var(--portal-shadow);
  color: var(--portal-ink);
}
.portal-card-topline { position: absolute; left: 33px; right: 33px; top: 0; height: 3px; background: linear-gradient(90deg, transparent, #1b9bac 44%, #85d7d2 70%, transparent); border-radius: 0 0 9px 9px; }
.portal-card-head { display: flex; align-items: center; gap: 17px; padding-bottom: 25px; }
.portal-card-icon { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 58px; border-radius: 18px; background: linear-gradient(135deg, #e0f4f7, #d5ebfb); color: #146d9a; font-size: 1.65rem; }
[data-bs-theme="dark"] .portal-card-icon { background: linear-gradient(135deg,#1e5262,#204a66); color: #96e6f5; }
.portal-card-eyebrow { color: var(--portal-teal); font-size: .72rem; font-weight: 500; letter-spacing: .09em; }
.portal-card-head h2 { margin: 1px 0 3px; font-size: 1.9rem; font-weight: 600; line-height: 1.4; }
.portal-card-head p { margin: 0; color: var(--portal-ink-muted); font-weight: 300; font-size: .91rem; line-height: 1.6; }
.portal-step-list { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 16px; border-radius: 12px; background: var(--portal-surface); margin-bottom: 28px; }
.portal-step { display: inline-flex; align-items: center; gap: 8px; font-size: .83rem; color: var(--portal-ink-muted); white-space: nowrap; }
.portal-step > span { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 23px; border-radius: 50%; background: var(--portal-border); color: var(--portal-ink-muted); font-size: .78rem; }
.portal-step.active { color: var(--portal-blue); font-weight: 500; }.portal-step.active > span { background: var(--portal-blue); color: white; }
.portal-step.done { color: #138b82; }.portal-step.done > span { background: #d5f5ed; color: #0a9f88; }
.portal-step-divider { color: #a5bccb; font-size: .8rem; }
.portal-field { margin-bottom: 20px; }.portal-field label { display: block; margin-bottom: 8px; font-size: .94rem; font-weight: 500; color: var(--portal-ink); }
.portal-input-wrap { position: relative; }.portal-input-wrap > .bi { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); z-index: 1; color: #829cb1; font-size: 1.13rem; pointer-events: none; }
.portal-input-wrap .form-control { width: 100%; height: 54px; padding: 12px 46px; border: 1px solid #cfdeea; border-radius: 12px; background: var(--portal-input); color: var(--portal-ink); font-weight: 400; font-size: .99rem; box-shadow: none; transition: border-color .18s,box-shadow .18s,background .18s; }
[data-bs-theme="dark"] .portal-input-wrap .form-control { border-color: var(--portal-border); }
.portal-input-wrap .form-control::placeholder { color: #9aabb9; opacity: 1; }
.portal-input-wrap .form-control:focus { border-color: #149ea8; background: var(--portal-card-bg); box-shadow: 0 0 0 4px rgba(20,158,168,.1); outline: none; transform: none; }
.portal-password-wrap .form-control { padding-right: 56px; }
.portal-password-toggle { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); border: 0; border-radius: 9px; width: 36px; height: 36px; background: transparent; color: #839aae; display: grid; place-items: center; font-size: 1.1rem; cursor: pointer; }
.portal-password-toggle:hover, .portal-password-toggle:focus-visible { background: var(--portal-surface); color: var(--portal-blue); outline: none; }
.portal-primary-button, .portal-card .btn.portal-primary-button {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 54px; width: 100%; margin-top: 28px; border: 0; border-radius: 12px;
  background: linear-gradient(110deg, #126ca4 0%, #0c5a88 65%, #0c8d91 100%);
  color: #fff; font-size: 1.06rem; font-weight: 500; box-shadow: 0 12px 23px rgba(12,99,153,.18); cursor: pointer;
  transition: transform .16s,box-shadow .16s,filter .16s;
}
.portal-primary-button:hover, .portal-card .btn.portal-primary-button:hover { color: white; filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 15px 27px rgba(12,99,153,.23); }
.portal-primary-button:focus-visible, .portal-card .btn.portal-primary-button:focus-visible { outline: 3px solid #a9e8e5; outline-offset: 3px; }
.portal-primary-button:disabled, .portal-card .btn.portal-primary-button:disabled { filter: grayscale(.7); box-shadow: none; transform: none; cursor: not-allowed; }
.portal-security-note { display: flex; align-items: center; gap: 12px; margin-top: 23px; padding: 13px 15px; border-radius: 12px; background: linear-gradient(100deg, rgba(25,157,177,.095), rgba(25,157,177,.045)); color: #326b82; font-size: .83rem; font-weight: 400; line-height: 1.6; }
.portal-security-note .bi { font-size: 1.3rem; color: #1882a1; flex: 0 0 auto; }
[data-bs-theme="dark"] .portal-security-note { color: #a6d7e5; }
.portal-card-bottom { display: flex; align-items: flex-start; gap: 8px; border-top: 1px solid var(--portal-border); margin-top: 25px; padding-top: 20px; color: var(--portal-ink-muted); font-size: .8rem; line-height: 1.7; }
.portal-card-bottom .bi { flex: 0 0 auto; margin-top: 1px; }
.portal-footer { width: min(1240px, calc(100% - 80px)); margin: 0 auto; padding: 0 0 23px; display: flex; justify-content: space-between; gap: 10px; color: #8196a8; font-size: .74rem; font-weight: 300; }
/* 2FA pages share the same layout but preserve original OTP/QR form controls and scripts. */
.portal-verify .portal-shell { grid-template-columns: minmax(0,1fr) minmax(450px,.91fr); }
.portal-setup .portal-shell { width: min(1320px, calc(100% - 72px)); grid-template-columns: minmax(0,.63fr) minmax(0,1fr); gap: 50px; align-items: start; padding-top: 48px; }
.portal-setup .portal-hero { margin-top: 95px; }
.portal-setup .portal-hero h1 { font-size: clamp(2.7rem,3.4vw,3.6rem); }
.portal-setup .portal-illustration { transform: scale(.92); transform-origin: left top; margin-bottom: -20px; }
.portal-ill-shield-card { display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 20px; width: 235px; height: 215px; }
.portal-ill-shield { width: 90px; height: 98px; border-radius: 25px; display: grid; place-items: center; background: #d9f6ef; color: #149a92; font-size: 3.5rem; }
[data-bs-theme="dark"] .portal-ill-shield { background: #1b5660; color: #7fe7d8; }
.portal-ill-shield-lines { display: grid; gap: 6px; justify-items: center; width: 100%; }
.portal-ill-shield-lines span { height: 7px; border-radius: 12px; width: 58%; background: #cadfe8; }
.portal-ill-shield-lines span:nth-child(2) { width: 42%; }.portal-ill-shield-lines span:nth-child(3) { display: none; }
.portal-ill-secure-chip { position: absolute; right: -19px; bottom: 22px; background: var(--portal-card-bg); color: #1d9a8b; border-radius: 10px; padding: 9px 11px; font-size: .74rem; box-shadow: 0 8px 17px rgba(10,90,110,.12); }
.portal-ill-secure-chip i { margin-right: 3px; }
.portal-card .portal-alert { margin-top: 4px; border-radius: 12px; font-size: .88rem; }
.portal-user-greeting { display: flex; gap: 12px; align-items: center; margin: 4px 0 22px; padding: 13px 14px; background: var(--portal-surface); border-radius: 13px; font-size: .94rem; }
.portal-greeting-avatar { display: grid; place-items: center; width: 41px; height: 41px; flex: 0 0 41px; background: #d7eeed; color: #158d92; font-size: 1.16rem; border-radius: 12px; }
.portal-user-greeting > span:last-child { display: grid; line-height: 1.45; }
.portal-user-greeting small { color: var(--portal-ink-muted); font-weight: 300; font-size: .79rem; }
.portal-otp-form { margin: 0; }
.portal-otp-label { margin-bottom: 13px; font-weight: 500; font-size: .95rem; text-align: center; color: var(--portal-ink); }
.portal-page .otp-row { --otp-size: 54px; --otp-gap: 8px; margin-top: 0; margin-bottom: 18px; }
.portal-page .otp-digit { border: 1px solid #cfdeea; background: var(--portal-input); color: var(--portal-ink); box-shadow: none; font-size: 1.25rem; }
.portal-page .otp-digit:focus { border-color: #16a5a4; outline: none; box-shadow: 0 0 0 4px rgba(22,165,164,.11); }
.portal-page .otp-digit.filled { border-color: var(--portal-teal); }
.portal-otp-form .portal-primary-button { margin-top: 6px; }
.portal-back-link { display: flex; justify-content: center; gap: 9px; margin-top: 20px; font-size: .86rem; text-decoration: none; color: var(--portal-blue); }
.portal-back-link:hover { text-decoration: underline; color: var(--portal-teal); }
.portal-setup .portal-card { padding: 36px 38px 30px; }
.portal-setup .portal-card-head { padding-bottom: 18px; }
.portal-setup .portal-step-list { margin-bottom: 22px; }
.portal-page .auth-setup-grid { grid-template-columns: minmax(0,.95fr) minmax(0,1fr); gap: 15px; align-items: center; }
.portal-page .auth-qr-box { border-radius: 16px; box-shadow: none; border-color: #dfeaf0; padding: 13px; }
.portal-page .qr-helper { color: var(--portal-ink-muted); font-size: .79rem; }
.portal-page .auth-step { border-radius: 11px; background: var(--portal-surface); border: 1px solid var(--portal-border); padding: 11px 10px; }
.portal-page .auth-step span { background: linear-gradient(125deg,#117eb4,#129b97); }
.portal-page .auth-step strong { font-weight: 500; font-size: .86rem; color: var(--portal-ink); }
.portal-page .auth-step small { font-size: .76rem; color: var(--portal-ink-muted); }
.portal-page .manual-key { border-radius: 12px; background: var(--portal-surface); border: 1px dashed var(--portal-border); padding: 12px; }
.portal-page .manual-key summary { color: var(--portal-blue); font-size: .84rem; }
.portal-page .manual-key code { color: var(--portal-ink); }
.portal-setup-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--portal-border); }
.portal-setup .portal-security-note { margin-top: 18px; }
.portal-page .portal-new-secret .btn-link { color: var(--portal-blue); font-size: .88rem; }
@media(max-width:1150px) {
  .portal-shell { grid-template-columns: minmax(0,1fr) minmax(380px,.95fr); gap: 36px; }
  .portal-setup .portal-shell { grid-template-columns: minmax(0,.5fr) minmax(0,1fr); gap: 25px; }
  .portal-hero h1 { font-size: clamp(2.55rem, 4.4vw, 3.6rem); }
  .portal-hero-title { font-size: 1.5rem; }
  .portal-illustration { transform: scale(.87); transform-origin: left top; margin-bottom: -22px; }
  .portal-setup .portal-illustration { transform: scale(.72); margin-bottom: -52px; }
  .portal-setup .portal-card { padding: 27px; }
}
@media(max-width:880px) {
  .portal-topbar { height: 76px; }
  .portal-topbar-inner,.portal-footer { width: min(690px, calc(100% - 40px)); }
  .portal-shell,.portal-verify .portal-shell,.portal-setup .portal-shell { width: min(620px, calc(100% - 40px)); min-height: calc(100vh - 132px); display: flex; flex-direction: column; gap: 25px; padding: 28px 0; align-items: stretch; }
  .portal-hero, .portal-setup .portal-hero { margin: 0; }
  .portal-hero h1,.portal-setup .portal-hero h1 { font-size: clamp(2.3rem, 7vw, 3.2rem); margin: 11px 0 1px; }
  .portal-hero-title { font-size: 1.3rem; }
  .portal-hero-desc { margin-top: 9px; font-size: .93rem; line-height: 1.65; }
  .portal-illustration,.portal-hero-foot { display: none; }
  .portal-kicker { font-size: .69rem; }
  .portal-card { width: 100%; }
  .portal-footer { padding-bottom: 18px; }
}
@media(max-width:520px) {
  .portal-topbar { height: 71px; }
  .portal-topbar-inner,.portal-footer { width: calc(100% - 26px); }
  .portal-brand { gap: 9px; }
  .portal-brand-logo { flex-basis: 42px; width: 42px; height: 42px; border-radius: 12px; }
  .portal-brand-logo img { width: 32px; height: 32px; }
  .portal-brand-copy strong { font-size: .89rem; }
  .portal-brand-copy small { font-size: .65rem; }
  .portal-header-tag { display: none; }
  .portal-header-right { gap: 0; }
  .portal-theme,.theme-switch-wrapper.portal-theme { gap: 5px; font-size: .88rem; }
  .portal-shell,.portal-verify .portal-shell,.portal-setup .portal-shell { width: calc(100% - 24px); padding: 22px 0; gap: 20px; }
  .portal-hero { padding: 0 7px; }
  .portal-hero h1,.portal-setup .portal-hero h1 { font-size: clamp(2rem, 9.1vw, 2.85rem); }
  .portal-hero-title { font-size: 1.12rem; }
  .portal-hero-desc { font-size: .83rem; }
  .portal-card,.portal-setup .portal-card { padding: 24px 20px; border-radius: 20px; }
  .portal-card-head { gap: 11px; padding-bottom: 18px; }
  .portal-card-icon { width: 48px; height: 48px; flex-basis: 48px; border-radius: 13px; font-size: 1.45rem; }
  .portal-card-head h2 { font-size: 1.47rem; }
  .portal-card-head p { font-size: .79rem; }
  .portal-card-eyebrow { font-size: .65rem; }
  .portal-step-list { margin-bottom: 22px; padding: 10px 11px; }
  .portal-step { font-size: .74rem; gap: 5px; }
  .portal-input-wrap .form-control { height: 51px; }
  .portal-page .auth-setup-grid { grid-template-columns: 1fr; gap: 16px; }
  .portal-page .auth-step-panel { gap: 8px; }
  .portal-page .otp-row { --otp-size: min(13vw,48px); --otp-gap: 5px; }
  .portal-footer { flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; }
}
@media(prefers-reduced-motion:reduce) { .portal-page *, .portal-page *::before, .portal-page *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ================================================================
   BMHA E-Office | Portal V2 - Motion Enhancement (CSS-only)
   Purpose: gentle moving light traces, depth, and responsive feedback.
   Shared by Login, Verify 2FA, and Setup 2FA. No JS or auth changes.
   ================================================================ */

/* A faint moving layer of digital light paths stays behind all content. */
.portal-bg::before {
  content: '';
  position: absolute;
  inset: -6%;
  pointer-events: none;
  opacity: .48;
  background: repeating-linear-gradient(
    116deg,
    transparent 0,
    transparent 155px,
    rgba(28, 147, 181, .065) 157px,
    transparent 159px,
    transparent 230px
  );
  mask-image: radial-gradient(ellipse at 56% 42%, #000 10%, transparent 75%);
  animation: portalDigitalPaths 24s linear infinite;
}
[data-bs-theme="dark"] .portal-bg::before { opacity: .38; }
.portal-bg-grid { animation: portalGridDrift 34s ease-in-out infinite alternate; }

/* Small moving light beam along the bottom of the header. */
.portal-topbar { position: relative; }
.portal-topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -23%;
  width: 23%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(121, 248, 237, .9), transparent);
  box-shadow: 0 0 10px rgba(101, 225, 222, .3);
  pointer-events: none;
  animation: portalHeaderTrace 12s linear infinite;
}

/* Initial reveal: calm, short, and not tied to network activity. */
.portal-hero-copy { animation: portalHeroEnter .7s ease-out both; }
.portal-card { animation: portalCardEnter .7s cubic-bezier(.2, .7, .3, 1) both; }
.portal-illustration { animation: portalIllustrationEnter .9s .14s ease-out both; }

/* The welcome pill and document illustration gently show activity. */
.portal-kicker-dot { animation: portalDotPulse 3.2s ease-in-out infinite; }
.portal-illustration-halo { animation: portalHaloBreath 8s ease-in-out infinite; }
.portal-ill-main { animation: portalDocumentHover 7.5s ease-in-out infinite; }
.portal-ill-main::after {
  content: '';
  position: absolute;
  top: 23px;
  left: 16px;
  right: 16px;
  height: 2px;
  border-radius: 99px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(52, 196, 193, .65), transparent);
  box-shadow: 0 0 9px rgba(52, 196, 193, .18);
  animation: portalDocumentScan 6.5s ease-in-out infinite;
}
.portal-ill-float-one { animation: portalFloatOne 6.8s ease-in-out infinite; }
.portal-ill-float-two { animation: portalFloatTwo 7.7s ease-in-out infinite; }
.portal-ill-float-three { animation: portalFloatThree 6.3s ease-in-out infinite; }
.portal-ill-mini { animation: portalMiniHover 6.6s ease-in-out infinite; }

/* An illuminated line travels along the existing card accent. */
.portal-card-topline {
  background: linear-gradient(90deg,
    transparent 0%, #1b9bac 23%, #94f3ea 49%, #1b9bac 76%, transparent 100%);
  background-size: 210% 100%;
  animation: portalCardLightFlow 6.5s linear infinite;
}

/* Focusing either input draws a short turquoise underline. */
.portal-input-wrap::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 0;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: linear-gradient(90deg, #1799ba, #23b8aa);
  pointer-events: none;
  transition: width .28s ease;
}
.portal-input-wrap:focus-within::after { width: calc(100% - 30px); }

/* Light streak only when hovering/focusing the actual sign-in button. */
.portal-primary-button, .portal-card .btn.portal-primary-button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.portal-primary-button > *, .portal-card .btn.portal-primary-button > * {
  position: relative;
  z-index: 1;
}
.portal-primary-button::before, .portal-card .btn.portal-primary-button::before {
  content: '';
  position: absolute;
  inset: -25% auto -25% -45%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.29), transparent);
  transform: skewX(-22deg);
  pointer-events: none;
  transition: left .65s ease;
}
.portal-primary-button:not(:disabled):hover::before,
.portal-primary-button:not(:disabled):focus-visible::before {
  left: 120%;
}

/* Keep hover feedback unobtrusive on the OTP controls too. */
.portal-page .otp-digit { transition: border-color .18s ease, box-shadow .18s ease; }

@keyframes portalDigitalPaths {
  from { transform: translate3d(-90px, 0, 0); }
  to   { transform: translate3d(140px, 0, 0); }
}
@keyframes portalGridDrift {
  from { transform: translate3d(-5px, -4px, 0); }
  to   { transform: translate3d(11px, 9px, 0); }
}
@keyframes portalHeaderTrace {
  from { left: -23%; }
  to   { left: 100%; }
}
@keyframes portalHeroEnter {
  from { opacity: 0; transform: translate3d(-12px, 10px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes portalCardEnter {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes portalIllustrationEnter {
  from { opacity: 0; translate: 0 9px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes portalDotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(27,166,155,.10); }
  50%      { box-shadow: 0 0 0 7px rgba(27,166,155,.025); }
}
@keyframes portalHaloBreath {
  0%, 100% { opacity: .8; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.035); }
}
@keyframes portalDocumentHover {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(-4deg) translateY(-5px); }
}
@keyframes portalDocumentScan {
  0%, 11% { top: 23px; opacity: 0; }
  19%     { opacity: .75; }
  70%     { top: 176px; opacity: .75; }
  80%, 100% { top: 176px; opacity: 0; }
}
@keyframes portalFloatOne {
  0%, 100% { transform: translateY(0) rotate(9deg); }
  50%      { transform: translateY(-9px) rotate(12deg); }
}
@keyframes portalFloatTwo {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%      { transform: translateY(8px) rotate(-5deg); }
}
@keyframes portalFloatThree {
  0%, 100% { transform: translateY(0) rotate(8deg); }
  50%      { transform: translateY(-7px) rotate(5deg); }
}
@keyframes portalMiniHover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes portalCardLightFlow {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

/* Shorter motion on small displays; hide the illustration when V2 hides it. */
@media (max-width: 880px) {
  .portal-bg::before { opacity: .25; }
  .portal-topbar::after { opacity: .65; }
}

/* Respect accessibility settings: no perpetual movement or entrance fade. */
@media (prefers-reduced-motion: reduce) {
  .portal-page *, .portal-page *::before, .portal-page *::after {
    animation: none !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
