:root {
  --hpay-navy: #0b1f3a;
  --hpay-navy-strong: #07162c;
  --hpay-blue: #2563eb;
  --hpay-blue-soft: #e8f0ff;
  --hpay-surface: #ffffff;
  --hpay-bg: #f3f6fb;
  --hpay-border: #dbe3ef;
  --hpay-text: #172033;
  --hpay-muted: #637089;
  --hpay-success: #16865c;
  --hpay-warning: #a76308;
}

body.hpay-portal {
  min-height: 100vh;
  background: var(--hpay-bg);
  color: var(--hpay-text);
  font-family: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

.portal-context-bar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem 1.25rem;
  color: rgba(255, 255, 255, .78);
  background: var(--hpay-navy-strong);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: .82rem;
  white-space: nowrap;
}

.portal-context-bar .portal-route {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, .5);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
}

.portal-role {
  margin-left: auto;
  padding: .18rem .62rem;
  color: #fff;
  background: rgba(37, 99, 235, .55);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  font-weight: 700;
}

.portal-navbar {
  position: sticky;
  top: 42px;
  z-index: 1020;
  background: var(--hpay-navy) !important;
  box-shadow: 0 8px 24px rgba(7, 22, 44, .12);
}

.portal-navbar .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  letter-spacing: -.01em;
  min-width: 0;
}

.portal-hpay-lockup {
  display: block;
  width: 132px;
  height: auto;
  flex: 0 0 auto;
}

.portal-brand-descriptor {
  padding-left: .65rem;
  border-left: 1px solid rgba(255, 255, 255, .28);
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .portal-navbar .container-fluid { flex-wrap: nowrap; }
  .portal-hpay-lockup { width: 120px; }
  .portal-brand-descriptor { padding-left: .45rem; font-size: .82rem; }
  .portal-navbar .navbar-brand { gap: .4rem; margin-right: .5rem; }
  .portal-navbar .navbar-brand code { display: none; }
}

@media (max-width: 480px) {
  .portal-brand-descriptor { display: none; }
}

.portal-shell {
  min-height: calc(100vh - 98px);
}

.portal-sidebar {
  background: var(--hpay-surface);
  border-right: 1px solid var(--hpay-border);
}

.portal-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin: .12rem .55rem;
  padding: .68rem .85rem;
  color: #45516a;
  border-radius: .65rem;
  font-weight: 650;
  white-space: nowrap;
}

.portal-sidebar .nav-link:hover {
  color: var(--hpay-blue);
  background: #f3f7ff;
}

.portal-sidebar .nav-link.active {
  color: #174ebd;
  background: var(--hpay-blue-soft);
  box-shadow: inset 3px 0 0 var(--hpay-blue);
}

.portal-mobile-account {
  margin: .7rem .85rem .25rem;
  padding: .75rem .6rem 1rem;
  color: var(--hpay-text);
  border-bottom: 1px solid var(--hpay-border);
  overflow-wrap: anywhere;
}

.portal-option-card {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  align-items: flex-start;
  gap: .7rem;
  padding: 1rem;
  border: 1px solid var(--hpay-border);
  border-radius: .85rem;
  cursor: pointer;
}

.portal-option-card:has(input:checked) {
  border-color: var(--hpay-blue);
  background: var(--hpay-blue-soft);
}

.portal-option-card.is-disabled {
  cursor: not-allowed;
  opacity: .5;
}

.provider-mark {
  width: auto;
  max-width: 128px;
  height: 30px;
  object-fit: contain;
  object-position: left center;
}

.portal-main {
  min-width: 0;
  padding: 1.75rem !important;
}

.portal-main h1,
.portal-main h2 {
  color: var(--hpay-text);
  letter-spacing: -.025em;
}

.portal-main .card {
  border-color: var(--hpay-border);
  border-radius: .9rem;
  box-shadow: 0 8px 24px rgba(15, 31, 56, .045);
}

.portal-main .table {
  --bs-table-bg: transparent;
}

.portal-main .badge {
  white-space: nowrap;
}

/* Callback delivery 有多個稽核欄位；窄視窗保留欄寬並讓操作欄常駐右側。 */
.callback-delivery-scroll {
  overscroll-behavior-inline: contain;
}

.callback-delivery-scroll:focus-visible {
  outline: 3px solid rgba(13, 110, 253, .35);
  outline-offset: -3px;
}

.callback-delivery-table {
  min-width: 1120px;
}

.callback-delivery-table th,
.callback-delivery-table td {
  white-space: nowrap;
}

.callback-delivery-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 8.5rem;
  background-color: var(--bs-table-bg, var(--hpay-surface));
  box-shadow: -8px 0 12px rgba(15, 31, 56, .08);
}

.callback-delivery-table thead .callback-delivery-actions {
  z-index: 3;
}

.portal-footer {
  padding: 1rem;
  color: var(--hpay-muted);
  background: var(--hpay-surface);
  border-top: 1px solid var(--hpay-border);
}

@media (min-width: 768px) {
  .portal-sidebar {
    position: sticky;
    top: 98px;
    height: calc(100vh - 98px);
    overflow-y: auto;
  }
}

@media (max-width: 767.98px) {
  .portal-context-bar {
    padding-inline: .85rem;
  }

  .portal-role {
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .portal-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--hpay-border);
  }

  .portal-sidebar .nav {
    padding-block: .45rem;
  }

  .portal-main {
    padding: 1.1rem !important;
  }
}
