/* This file is reserved for overriding and extending the template styles. */

/* ePortal：登入／OTP 全幅版面
 * - html/body 鎖高度並 hidden，避免 flex 子項微幅撐高文件而出現「幽靈」垂直捲軸
 * - 實際可捲區域只在 #root（表單過長時仍可捲動）
 * - 中間層 min-height:0 讓 flex 子項可正確收縮（Bootstrap row 預設 align-items-stretch）
 */
html.eportal-auth-full {
  height: 100%;
  overflow: hidden;
}

html.eportal-auth-full body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html.eportal-auth-full #root {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

html.eportal-auth-full #root > .container-fluid.h-100,
html.eportal-auth-full #root .row.h-100 {
  min-height: 0;
}

/* 左欄標語：原始做法（直接疊字 + 輕量陰影） */
html.eportal-auth-full .eportal-auth-marketing-text {
  color: var(--auth-left-text-color, rgba(255, 255, 255, 0.97));
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

html.eportal-auth-full[data-color^="light"] .eportal-auth-marketing-text {
  color: var(--auth-left-text-color, #0f172a);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* 左欄：大標題加粗（公司名 / ePortal），說明文字不特別加粗 */
html.eportal-auth-full h1.eportal-auth-marketing-text {
  font-weight: 800;
  letter-spacing: -0.01em;
}

html.eportal-auth-full p.eportal-auth-marketing-text {
  font-weight: 600;
}

/* OTP：仅显示校验码 XXXX（不显示「校驗碼」文字与 icon） */
html.eportal-auth-full .eportal-otp-code-addon {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html.eportal-auth-full[data-color^="light"] .eportal-otp-code-addon {
  letter-spacing: 0.10em;
}

/* 左欄說明：在可用寬度內自然換行，必要時才在適合處断行（避免過窄容器逼出單字一行的情況） */
html.eportal-auth-full .eportal-auth-lead {
  word-break: normal;
  overflow-wrap: anywhere;
}

/* 登入歡迎語：單行顯示，字級與原先 cta-1 接近；窄屏自動換行縮放 */
html.eportal-auth-full .eportal-auth-welcome {
  line-height: 1.35;
}
html.eportal-auth-full .eportal-auth-welcome-line {
  font-size: clamp(1rem, 2.8vw + 0.55rem, 1.5rem);
  line-height: 1.35;
  font-weight: 400;
  word-break: normal;
  overflow-wrap: anywhere;
}
html.eportal-auth-full .eportal-auth-form .filled.form-group {
  margin-bottom: 0.5rem;
}

/* 登入／OTP 工具列：語系分段與明暗按鈕同高（主題鈕為同邊長正方形） */
html.eportal-auth-full .eportal-auth-toolbar {
  --eportal-auth-control-size: 2.375rem;
}

html.eportal-auth-full .eportal-auth-toolbar .eportal-lang-segment .btn {
  min-width: 2.65rem;
  min-height: var(--eportal-auth-control-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

html.eportal-auth-full .eportal-auth-toolbar .eportal-lang-segment .btn:focus-visible {
  z-index: 2;
}

html.eportal-auth-full .eportal-auth-toolbar .eportal-auth-theme-btn {
  width: var(--eportal-auth-control-size);
  min-width: var(--eportal-auth-control-size);
  height: var(--eportal-auth-control-size);
  min-height: var(--eportal-auth-control-size);
  padding: 0;
  flex-shrink: 0;
}

/* 密碼欄：顯示／隱藏僅圖示 */
html.eportal-auth-full .eportal-pwd-toggle {
  /* Match .filled .form-control min-height (44px) for input-group addon look */
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

html.eportal-auth-full .eportal-pwd-toggle .acorn-icons {
  display: block;
}

html.eportal-auth-full .eportal-pwd-input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

html.eportal-auth-full .eportal-pwd-input-group .eportal-pwd-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* 驗證碼：外框僅作為與表單對齊的邊距與對齊；視覺主體在伺服端 SVG */
html.eportal-auth-full .eportal-captcha-frame {
  padding: 2px;
  border-radius: calc(var(--border-radius-md) + 2px);
  background: linear-gradient(
    125deg,
    rgba(var(--primary-rgb), 0.18) 0%,
    rgba(var(--secondary-rgb), 0.1) 100%
  );
  box-shadow: 0 2px 10px rgba(var(--foreground-rgb), 0.06);
  line-height: 0;
}

html.eportal-auth-full .eportal-captcha-img {
  display: block;
  width: 180px;
  height: 52px;
  border-radius: var(--border-radius-md);
  object-fit: fill;
}

/* 明暗切換：亮色主題顯示月亮（切到暗色），暗色主題顯示太陽（切到亮色）；與 html[data-color] 同步 */
html.eportal-auth-full .eportal-theme-icon-when-dark {
  display: none !important;
}

html.eportal-auth-full[data-color^="dark"] .eportal-theme-icon-when-light {
  display: none !important;
}

html.eportal-auth-full[data-color^="dark"] .eportal-theme-icon-when-dark {
  display: inline-flex !important;
}

/* 登入／OTP Logo：亮色用 logo_black.svg，暗色用 logo_white.svg */
html.eportal-auth-full .eportal-auth-logo-link {
  line-height: 0;
}

html.eportal-auth-full .eportal-auth-logo {
  display: block;
  width: auto;
  height: 72px;
  max-width: min(100%, 240px);
  object-fit: contain;
}

html.eportal-auth-full .eportal-auth-logo-dark {
  display: none !important;
}

html.eportal-auth-full[data-color^="dark"] .eportal-auth-logo-light {
  display: none !important;
}

html.eportal-auth-full[data-color^="dark"] .eportal-auth-logo-dark {
  display: block !important;
}

/* 表單驗證摘要使用 alert 時，列表留白與 Bootstrap alert 協調 */
html.eportal-auth-full .validation-summary-errors ul {
  margin-bottom: 0;
  margin-top: 0.25rem;
  padding-left: 1.25rem;
}

/* 登入／OTP：驗證通過時框架仍會輸出帶空 <ul><li style="display:none"> 的佔位，:empty 不成立，故不可對 validation-summary-valid 強制顯示 */
html.eportal-auth-full .eportal-auth-form .eportal-auth-validation-summary.validation-summary-valid {
  display: none !important;
}
html.eportal-auth-full .eportal-auth-form .eportal-auth-validation-summary.validation-summary-errors {
  display: block !important;
}

/* Main nav logo: light/dark variant */
.eportal-main-logo {
  height: 34px;
  width: auto;
  display: block;
}

.eportal-main-logo-dark {
  display: none !important;
}

html[data-color^="dark"] .eportal-main-logo-light {
  display: none !important;
}

html[data-color^="dark"] .eportal-main-logo-dark {
  display: block !important;
}

.user-container .profile {
  object-fit: contain;
  background-color: transparent;
}

/* Dashboard CTA cards */
.eportal-cta-card {
  border: 0;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.14) 0%, rgba(var(--secondary-rgb), 0.08) 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.eportal-cta-card .icon-wrap {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--primary-rgb), 0.16);
}

/* Image background variant for CTA cards */
.eportal-cta-card--image {
  position: relative;
  overflow: hidden;
  background: transparent;
}

.eportal-cta-card--image::before {
  content: "";
  position: absolute;
  inset: -30%;
  background-image: var(--cta-bg-image);
  background-size: cover;
  background-position: center;
  opacity: 0.38;
  filter: blur(2px);
  transform: rotate(-2deg) scale(1.08);
  z-index: 0;
}

.eportal-cta-card--image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 65%);
  opacity: 0.04;
  z-index: 0;
}

.eportal-cta-card--image .card-body,
.eportal-cta-card--image .icon-wrap,
.eportal-cta-card--image .card-footer {
  position: relative;
  z-index: 1;
}

html[data-color*="dark"] .eportal-cta-card--image::before {
  opacity: 0.5;
  filter: blur(2px) brightness(0.42) saturate(0.8);
}

html[data-color*="dark"] .eportal-cta-card--image::after {
  background: linear-gradient(135deg, rgba(6, 18, 31, 0.55) 0%, rgba(6, 18, 31, 0.28) 55%, rgba(6, 18, 31, 0.4) 100%);
  opacity: 1;
}

html[data-color*="dark"] .eportal-cta-card {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.18) 0%, rgba(8, 20, 36, 0.45) 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

/* Dashboard metric cards: make background image more transparent and clearer */
.eportal-metric-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(2px);
}

.eportal-metric-card::before {
  opacity: 0.4;
}

.eportal-metric-card::after {
  opacity: 0.02;
}

html[data-color*="dark"] .eportal-metric-card {
  background: rgba(8, 18, 32, 0.45);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-color*="dark"] .eportal-metric-card::before {
  opacity: 0.45;
  filter: blur(2px) brightness(0.4) saturate(0.8);
}

html[data-color*="dark"] .eportal-metric-card::after {
  background: linear-gradient(135deg, rgba(6, 18, 31, 0.5) 0%, rgba(6, 18, 31, 0.18) 100%);
  opacity: 1;
}

/* Home metric labels: same visual weight as CTA titles (帳戶結餘 / 股票持倉) */
.eportal-metric-card .eportal-metric-label {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* Account Balance: focus column highlight (?focus=available|ledger|accrued) */
/* Account Balance: focus column — soft accent, not a heavy fill */
#dt th.eportal-col-focus,
#dt td.eportal-col-focus {
  background-color: rgba(var(--primary-rgb), 0.06) !important;
  font-weight: inherit;
}

#dt thead th.eportal-col-focus {
  background-color: rgba(var(--primary-rgb), 0.1) !important;
  color: inherit;
  font-weight: 600;
}

#dt thead th.eportal-col-focus .btn-link {
  font-weight: 600;
  color: inherit;
}

html[data-color^="dark"] #dt th.eportal-col-focus,
html[data-color^="dark"] #dt td.eportal-col-focus {
  background-color: rgba(var(--primary-rgb), 0.12) !important;
}

html[data-color^="dark"] #dt thead th.eportal-col-focus {
  background-color: rgba(var(--primary-rgb), 0.16) !important;
}

/* Fancy page hero (image background) */
.eportal-page-hero {
  position: relative;
  overflow: visible;
  border-radius: 1.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12) 0%, rgba(var(--secondary-rgb), 0.06) 100%);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.eportal-page-hero .dropdown-menu {
  z-index: 1100;
}

.eportal-page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--hero-bg-image);
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  filter: blur(2px);
  transform: none;
  z-index: 0;
}

.eportal-page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 60%);
  opacity: 0.04;
  z-index: 0;
}

.eportal-page-hero > * {
  position: relative;
  z-index: 1;
}

.eportal-page-hero .icon-wrap {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--primary-rgb), 0.16);
}

.eportal-page-hero-title {
  font-weight: 700;
}

/* Keep hero subtitle readable on image backgrounds */
.eportal-page-hero .text-muted {
  color: inherit !important;
  opacity: 0.92;
}

/* Home: compact CTA card height */
.eportal-home-compact .eportal-cta-card .card-body {
  padding: 0.8rem 0.9rem;
}

.eportal-home-compact .eportal-cta-card .icon-wrap {
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  margin-bottom: 0.45rem !important;
}

.eportal-home-compact .eportal-cta-card h5 {
  margin-bottom: 0.2rem !important;
}

.eportal-home-compact .eportal-cta-card p {
  margin-bottom: 0.45rem !important;
}

.eportal-home-compact .eportal-metric-card .card-body {
  padding: 0.7rem 0.85rem;
}

.eportal-home-compact .eportal-metric-card .card-footer {
  padding: 0.45rem 0.7rem;
}

/* BCAN / CMS：條款內文區（可捲動、易讀排版） */
.eportal-form-legal-card {
  border-radius: var(--bs-border-radius-xl, 0.75rem);
  overflow: hidden;
}

.eportal-form-legal-card > .card-header {
  background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.06), rgba(var(--bs-primary-rgb), 0.02));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.eportal-form-legal-scroll {
  max-height: min(28rem, 58vh);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--bs-secondary-bg, #f8f9fa);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* CRS：條款內文需要完整顯示，避免容器截斷導致看不到內容 */
.crs-legal-scroll--full.eportal-form-legal-scroll {
  max-height: none;
  overflow-y: visible;
}

html[data-color*="dark"] .eportal-form-legal-scroll,
html[data-color^="dark"] .eportal-form-legal-scroll {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.eportal-form-legal-prose {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--bs-body-color);
}

.eportal-form-legal-prose p {
  margin-bottom: 0.85rem;
}

.eportal-form-legal-prose p:last-child {
  margin-bottom: 0;
}

.eportal-form-legal-prose a {
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.eportal-form-ack-box {
  border: 1px dashed rgba(var(--bs-primary-rgb), 0.35);
  background: linear-gradient(180deg, rgba(var(--bs-primary-rgb), 0.05), transparent);
}

/* Upload：SweetAlert2 上傳中（與 Bootstrap / Acorn 一致） */
.eportal-swal-upload-popup {
  border-radius: var(--bs-border-radius-xl, 0.75rem) !important;
  padding: 1.35rem 1.25rem 1.6rem !important;
  box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.22) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.eportal-swal-upload-inner .spinner-border {
  border-width: 0.2em;
}

/* SweetAlert2 — Acorn main layout (Fund / Form / session timeout; excludes auth pages) */
html:not(.eportal-auth-full) .swal2-container {
  z-index: 2000;
}

html:not(.eportal-auth-full) .swal2-popup {
  border-radius: var(--bs-border-radius-xl, 0.75rem);
  padding: 1.35rem 1.25rem 1.15rem;
  box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-family: "Nunito Sans", sans-serif;
  color: var(--body, #15213b);
}

html:not(.eportal-auth-full) .swal2-title {
  font-family: "Montserrat", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--body, #15213b);
  line-height: 1.35;
  padding: 0 0.25rem;
}

html:not(.eportal-auth-full) .swal2-html-container,
html:not(.eportal-auth-full) .swal2-content {
  font-size: 0.95rem;
  color: var(--alternate, #334155);
  line-height: 1.5;
}

html:not(.eportal-auth-full) .swal2-input,
html:not(.eportal-auth-full) .swal2-textarea {
  border-radius: var(--bs-border-radius, 0.375rem);
  border: 1px solid var(--separator, #d4d9dc);
  font-size: 1rem;
  font-family: "Nunito Sans", sans-serif;
  color: var(--body, #15213b);
  box-shadow: none;
}

html:not(.eportal-auth-full) .swal2-input:focus,
html:not(.eportal-auth-full) .swal2-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.2);
}

html:not(.eportal-auth-full) .swal2-validation-message {
  border-radius: var(--bs-border-radius, 0.375rem);
  background: rgba(var(--quinary-rgb, 216, 37, 66), 0.08);
  color: var(--quinary, #d82542);
  font-size: 0.875rem;
}

html:not(.eportal-auth-full) .swal2-actions {
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

html:not(.eportal-auth-full) .swal2-styled {
  border-radius: var(--bs-border-radius, 0.375rem);
  font-family: "Nunito Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.5rem 1.15rem;
  margin: 0;
  box-shadow: none !important;
}

html:not(.eportal-auth-full) .swal2-confirm {
  background-color: var(--primary) !important;
  color: var(--light-text, #fff) !important;
}

html:not(.eportal-auth-full) .swal2-confirm:hover,
html:not(.eportal-auth-full) .swal2-confirm:focus {
  background-color: var(--primary-darker) !important;
}

html:not(.eportal-auth-full) .swal2-cancel {
  background-color: var(--secondary, #728cbf) !important;
  color: var(--light-text, #fff) !important;
}

html:not(.eportal-auth-full) .swal2-cancel:hover,
html:not(.eportal-auth-full) .swal2-cancel:focus {
  background-color: var(--secondary-darker, #5f78a8) !important;
}

html:not(.eportal-auth-full) .swal2-deny {
  background-color: transparent !important;
  color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
}

html:not(.eportal-auth-full) .swal2-deny:hover,
html:not(.eportal-auth-full) .swal2-deny:focus {
  background-color: var(--primary) !important;
  color: var(--light-text, #fff) !important;
}

html[data-color*="dark"]:not(.eportal-auth-full) .swal2-popup,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-popup {
  background: var(--foreground, #1a2234);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.45);
}

html[data-color*="dark"]:not(.eportal-auth-full) .swal2-title,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-title {
  color: var(--light-text, #fff);
}

html[data-color*="dark"]:not(.eportal-auth-full) .swal2-html-container,
html[data-color*="dark"]:not(.eportal-auth-full) .swal2-content,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-html-container,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-content {
  color: rgba(var(--light-text-rgb, 255, 255, 255), 0.85);
}

html[data-color*="dark"]:not(.eportal-auth-full) .swal2-input,
html[data-color*="dark"]:not(.eportal-auth-full) .swal2-textarea,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-input,
html[data-color^="dark"]:not(.eportal-auth-full) .swal2-textarea {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--light-text, #fff);
}

/* CRS：表頭與稅務列 */
.eportal-crs-section .card-header {
  background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.07), rgba(var(--bs-primary-rgb), 0.02));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.eportal-crs-tax-grid-header {
  background: rgba(var(--bs-primary-rgb), 0.07);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.eportal-crs-tax-row {
  border-radius: var(--bs-border-radius-md, 0.375rem);
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
}

.eportal-crs-tax-row:hover {
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.eportal-crs-radio-block {
  padding: 0.75rem 1rem;
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--bs-secondary-bg, #f8f9fa);
}

/* RPQ / DKQ：問卷題組（與 BCAN/CRS 卡片系統一致） */
.eportal-form-questionnaire > form > .card-body > .form-group,
.eportal-form-questionnaire > form > .card-body > fieldset > .form-group {
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem !important;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* RPQ：某些欄位整列 hidden，但外層 form-group 仍會顯示邊框（看起來像空白分隔線） */
.eportal-form-questionnaire > form > .card-body > .form-group:has(> .row[hidden]):not(:has(> .row:not([hidden]))),
.eportal-form-questionnaire > form > .card-body > fieldset > .form-group:has(> .row[hidden]):not(:has(> .row:not([hidden]))) {
  display: none;
}

html[data-color*="dark"] .eportal-form-questionnaire > form > .card-body > .form-group,
html[data-color^="dark"] .eportal-form-questionnaire > form > .card-body > .form-group,
html[data-color*="dark"] .eportal-form-questionnaire > form > .card-body > fieldset > .form-group,
html[data-color^="dark"] .eportal-form-questionnaire > form > .card-body > fieldset > .form-group {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.eportal-form-questionnaire .form-label {
  font-weight: 600;
  margin-bottom: 0.65rem;
  display: block;
}

.eportal-form-questionnaire .form-check {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.eportal-form-q-block {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html[data-color*="dark"] .eportal-form-q-block,
html[data-color^="dark"] .eportal-form-q-block {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.eportal-form-q-block .form-label:last-child {
  margin-bottom: 0;
}

/* RPQ: keep radio and label inline on both Web/App pages. */
.eportal-form-questionnaire .rpq-radio-inline-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.eportal-form-questionnaire .rpq-radio-inline-option .form-check-input {
  flex-shrink: 0;
  margin-top: 0.3rem;
}

.eportal-form-questionnaire .rpq-radio-inline-option .form-check-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.eportal-fileinput-wrap .file-input,
.eportal-fileinput-wrap .kv-fileinput {
  border: 1px dashed rgba(var(--bs-primary-rgb), 0.35);
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  padding: 1rem;
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.eportal-fileinput-wrap .btn-file {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
}

.eportal-fileinput-wrap .btn-file svg {
  flex-shrink: 0;
}

.eportal-dkq-pdf-hint .icon-wrap {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(var(--bs-primary-rgb), 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Portal：主／子帳切換（頭像下拉 + 首頁右上） */
.portal-account-switcher__eyebrow {
  letter-spacing: 0.06em;
  opacity: 0.85;
  font-size: 0.65rem;
}

.portal-account-switcher__current {
  letter-spacing: 0.02em;
}

.portal-account-switcher__dropdown-shell {
  background: linear-gradient(
    145deg,
    rgba(var(--bs-primary-rgb), 0.14) 0%,
    rgba(var(--bs-primary-rgb), 0.04) 48%,
    rgba(255, 255, 255, 0.06) 100%
  );
  border: 1px solid rgba(var(--bs-primary-rgb), 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.25) inset,
    0 10px 28px rgba(15, 23, 42, 0.12);
}

html[data-color*="dark"] .portal-account-switcher__dropdown-shell,
html[data-color^="dark"] .portal-account-switcher__dropdown-shell {
  background: linear-gradient(
    145deg,
    rgba(var(--bs-primary-rgb), 0.2) 0%,
    rgba(15, 23, 42, 0.55) 100%
  );
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 12px 32px rgba(0, 0, 0, 0.35);
}

.portal-account-switcher__badge-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: rgba(var(--bs-primary-rgb), 0.15);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.portal-account-switcher__select {
  border-radius: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.portal-account-switcher__select--menu {
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

/* Home/Index：標籤與下拉同一行 */
.portal-account-switcher--home-inline .portal-account-switcher__home-form {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.portal-account-switcher--home-inline .portal-account-switcher__home-label {
  flex: 0 0 auto;
  font-weight: 600;
  line-height: 1.5;
  padding-top: 0.125rem;
}

.portal-account-switcher__select-inline {
  flex: 0 1 auto;
  width: auto !important;
  min-width: 9rem;
  max-width: 16rem;
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 399.98px) {
  .portal-account-switcher--home-inline .portal-account-switcher__home-form {
    flex-wrap: wrap;
    white-space: normal;
  }
}

.portal-account-switcher__select:focus,
.portal-account-switcher__select-inline:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.55);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}

.portal-account-switcher__pill {
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
}

.portal-account-switcher__login-foot {
  border-top: 1px dashed rgba(var(--bs-primary-rgb), 0.2);
}

.dropdown-menu .portal-account-switcher--dropdown {
  min-width: 15.5rem;
}

/* table-grid touch — iPad / coarse pointer (Account, MarketData, Home) */
@media (pointer: coarse) {
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
  }

  .table-responsive table th button.btn-link {
    min-height: 36px;
    padding: 0.375rem 0.25rem !important;
    font-size: 0.875rem;
  }

  .table-responsive table td {
    padding: 0.5rem 0.625rem !important;
    font-size: 0.875rem;
  }

  [id$="-pagination"] .btn {
    min-height: 36px;
    min-width: 4rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* Grid selection — follow Theme Settings (--primary / --primary-rgb)
 * Covers pqGrid (if used) and DataTables selected rows. */
.pq-grid .pq-grid-row:hover,
.pq-grid .pq-grid-row:hover .pq-grid-cell {
  background-color: rgba(var(--primary-rgb, 13, 110, 253), 0.06) !important;
}

.pq-grid .pq-grid-row.pq-row-select,
.pq-grid .pq-grid-row.pq-row-select .pq-grid-cell,
.pq-grid .pq-state-select,
.pq-grid td.pq-state-select,
.pq-grid .ui-state-highlight,
.pq-grid td.ui-state-highlight,
.pq-grid .pq-grid-cell.ui-state-highlight {
  background: rgba(var(--primary-rgb, 13, 110, 253), 0.14) !important;
  background-color: rgba(var(--primary-rgb, 13, 110, 253), 0.14) !important;
  background-image: none !important;
  border-color: transparent !important;
  color: inherit !important;
}

.pq-grid .pq-grid-col-sort-up,
.pq-grid .pq-grid-col-sort-down {
  color: var(--primary, #0d6efd) !important;
}

table.dataTable tbody > tr.selected,
table.dataTable tbody > tr > .selected,
table.dataTable.stripe tbody > tr.odd.selected,
table.dataTable.stripe tbody > tr.odd > .selected,
table.dataTable.display tbody > tr.odd.selected,
table.dataTable.display tbody > tr.odd > .selected,
table.dataTable.hover tbody > tr.selected:hover,
table.dataTable.hover tbody > tr > .selected:hover,
table.dataTable.display tbody > tr.selected:hover,
table.dataTable.display tbody > tr > .selected:hover {
  background-color: rgba(var(--primary-rgb, 13, 110, 253), 0.14) !important;
  color: inherit !important;
}

/* Layout footer: fixed height overflows long support / login text on iPhone */
html[data-footer=true] #root > footer .portal-footer-copy,
html[data-footer=true] #root > footer .portal-footer-meta,
html[data-footer=true] #root > footer .portal-footer-support {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 991.98px) {
  html[data-footer=true] body {
    padding-bottom: 0 !important;
  }

  html[data-footer=true] #root > footer {
    position: relative !important;
    height: auto !important;
    min-height: 0;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    bottom: auto;
  }

  html[data-footer=true] #root > footer .footer-content {
    align-items: flex-start;
  }

  html[data-footer=true] #root > footer .portal-footer-meta,
  html[data-footer=true] #root > footer .portal-footer-support {
    font-size: 0.75rem;
    line-height: 1.35;
  }
}
