
:root {
  --portal-accent: #2563eb;
  --portal-accent-dark: #1d4ed8;
  --portal-accent-rgb: 37, 99, 235;
  --portal-accent-soft: #eaf1ff;
  --portal-text: #172033;
  --portal-muted: #667085;
  --portal-border: #d7e0eb;
  --portal-border-soft: #e8edf3;
  --portal-page: #f4f7fb;
  --portal-surface: #ffffff;
  --portal-surface-soft: #f8fafc;
  --portal-sidebar: #f8fafc;
  --portal-sidebar-text: #4b5565;
  --portal-sidebar-muted: #8591a3;
  --portal-sidebar-icon: #8090a5;
  --portal-sidebar-hover: #eef2f7;
  --portal-sidebar-active: #e6efff;
  --portal-sidebar-active-text: #1e4fa9;
  --portal-navbar-bg: rgba(255, 255, 255, .97);
  --portal-navbar-text: #172033;
  --portal-navbar-control-bg: #ffffff;
  --portal-navbar-control-border: #d7e0eb;
  --portal-search-bg: #f9fbfd;
  --portal-search-text: #172033;
  --portal-search-placeholder: #7a8698;
  --portal-brand-bg: #172033;
  --portal-brand-text: #ffffff;
  --portal-page-header-bg: rgba(255, 255, 255, .95);
  --portal-table-head: #f8fafc;
  --portal-credit-panel: #172033;
  --portal-credit-panel-border: #172033;
  --portal-card-shadow: 0 4px 18px rgba(15, 23, 42, .045);
  --portal-card-shadow-hover: 0 12px 30px rgba(15, 23, 42, .09);
  --portal-dropdown-shadow: 0 18px 45px rgba(15, 23, 42, .16);
  --portal-sidebar-width: 18rem;
  --portal-navbar-height: 4rem;
}

html[data-portal-theme="teal-professional"] {
  --portal-accent: #0f766e;
  --portal-accent-dark: #0b5f59;
  --portal-accent-rgb: 15, 118, 110;
  --portal-accent-soft: #e3f5f2;
  --portal-text: #18302f;
  --portal-muted: #617574;
  --portal-border: #d2e3e1;
  --portal-border-soft: #e4efed;
  --portal-page: #f2f7f6;
  --portal-surface-soft: #f6fbfa;
  --portal-sidebar: #f6fbfa;
  --portal-sidebar-text: #405d5a;
  --portal-sidebar-muted: #78918e;
  --portal-sidebar-icon: #78918e;
  --portal-sidebar-hover: #e8f3f1;
  --portal-sidebar-active: #dff1ee;
  --portal-sidebar-active-text: #0b625c;
  --portal-navbar-bg: rgba(255, 255, 255, .97);
  --portal-navbar-text: #18302f;
  --portal-navbar-control-border: #d2e3e1;
  --portal-search-bg: #f6fbfa;
  --portal-search-text: #18302f;
  --portal-search-placeholder: #738b88;
  --portal-brand-bg: #143e3b;
  --portal-page-header-bg: rgba(255, 255, 255, .95);
  --portal-table-head: #f5faf9;
  --portal-credit-panel: #123c3a;
  --portal-credit-panel-border: #123c3a;
}

html[data-portal-theme="navy-premium"] {
  --portal-accent: #4f8cff;
  --portal-accent-dark: #3274e6;
  --portal-accent-rgb: 79, 140, 255;
  --portal-accent-soft: #e8f1ff;
  --portal-text: #172033;
  --portal-muted: #68758a;
  --portal-border: #d5deea;
  --portal-border-soft: #e6ebf2;
  --portal-page: #f1f4f9;
  --portal-surface-soft: #f7f9fc;
  --portal-sidebar: #151f36;
  --portal-sidebar-text: #dbe5f4;
  --portal-sidebar-muted: #8fa1bd;
  --portal-sidebar-icon: #91a4c2;
  --portal-sidebar-hover: rgba(255, 255, 255, .07);
  --portal-sidebar-active: rgba(79, 140, 255, .2);
  --portal-sidebar-active-text: #ffffff;
  --portal-navbar-bg: #101a30;
  --portal-navbar-text: #f7f9fd;
  --portal-navbar-control-bg: rgba(255, 255, 255, .08);
  --portal-navbar-control-border: rgba(255, 255, 255, .16);
  --portal-search-bg: rgba(255, 255, 255, .08);
  --portal-search-text: #ffffff;
  --portal-search-placeholder: #aab8ce;
  --portal-brand-bg: #4f8cff;
  --portal-brand-text: #ffffff;
  --portal-page-header-bg: rgba(255, 255, 255, .96);
  --portal-table-head: #f6f8fb;
  --portal-credit-panel: #111b31;
  --portal-credit-panel-border: #111b31;
  --portal-card-shadow: 0 5px 20px rgba(15, 23, 42, .055);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--portal-page);
  color: var(--portal-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
a { text-decoration: none; }
[x-cloak] { display: none !important; }
.min-w-0 { min-width: 0; }
.fs-sm { font-size: .79rem !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.15em;
}
.portal-loading { opacity: .62; pointer-events: none; }
.portal-id { max-width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; overflow-wrap: anywhere; word-break: break-word; }

/* Header */
.portal-navbar {
  min-height: var(--portal-navbar-height);
  background: #fff;
  color: var(--portal-text);
  padding: .45rem 1.7rem;
  position: sticky;
  top: 0;
  z-index: 1035;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .025);
}
.portal-navbar .container-fluid { padding: 0; }
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--portal-text);
  font-size: 1rem;
  font-weight: 750;
  white-space: nowrap;
}
.portal-brand:hover { color: var(--portal-text); }
.portal-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .65rem;
  background: #172033;
  color: #fff;
  font-weight: 800;
}
.portal-global-search { width: min(43rem, 100%); position: relative; }
.portal-global-search .icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8698;
}
.portal-global-search input {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  padding: .6rem 1rem .6rem 2.8rem;
  background: #f9fbfd;
  color: var(--portal-text);
  outline: 0;
}
.portal-global-search input:focus {
  background: #fff;
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .1);
}
.portal-wallet-pill {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  color: var(--portal-text);
  border: 1px solid var(--portal-border);
  border-radius: .7rem;
  padding: .55rem .85rem;
  background: #fff;
  font-size: .83rem;
  white-space: nowrap;
}
.portal-wallet-pill:hover { color: var(--portal-accent); border-color: #a9bce9; }
.portal-user-button {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: 0;
  color: var(--portal-text);
  padding: .25rem;
  white-space: nowrap;
}
.portal-user-button > span:first-child {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e9eef8;
  color: #294b8f;
  font-weight: 700;
}
.portal-sidebar-toggle { color: var(--portal-text); border: 0; padding: .45rem; }

/* Shell */
.page-content { width: 100%; max-width: 100%; min-height: calc(100vh - var(--portal-navbar-height)); display: flex; overflow-x: clip; }
.portal-sidebar {
  width: var(--portal-sidebar-width);
  min-width: var(--portal-sidebar-width);
  background: var(--portal-sidebar);
  border-right: 1px solid var(--portal-border);
  color: var(--portal-text);
}
.portal-sidebar .sidebar-content { width: 100%; padding: .65rem 0 1rem; }
.portal-sidebar .sidebar-section { width: 100%; }
.portal-sidebar .sidebar-section-body { padding: 1rem 1.25rem; }
.portal-provider-summary { border-bottom: 1px solid var(--portal-border-soft); margin-bottom: .25rem; }
.portal-sidebar .nav-sidebar {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100%;
  margin: 0;
  padding: 0;
}
.portal-sidebar .nav-sidebar > .nav-item,
.portal-sidebar .nav-sidebar > .nav-item-header { width: 100%; flex: 0 0 auto; }
.portal-sidebar .nav-item-header {
  display: block;
  padding: 1.2rem 1.25rem .45rem;
  color: #8591a3;
  font-weight: 700;
  letter-spacing: .08em;
}
.portal-sidebar .nav-link {
  width: auto;
  margin: .14rem .7rem;
  padding: .72rem .85rem;
  border-radius: .62rem;
  color: #4b5565;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .78rem;
  font-weight: 570;
  line-height: 1.2;
}
.portal-sidebar .nav-link .icon { color: #8090a5; flex: 0 0 auto; }
.portal-sidebar .nav-link:hover { background: #eef2f7; color: var(--portal-text); }
.portal-sidebar .nav-link:hover .icon { color: var(--portal-accent); }
.portal-sidebar .nav-link.active { background: #e6efff; color: #1e4fa9; font-weight: 650; }
.portal-sidebar .nav-link.active .icon { color: var(--portal-accent); }
.portal-sidebar .nav-link .badge { font-weight: 600; font-size: .72rem; }
.content-wrapper { min-width: 0; max-width: 100%; flex: 1 1 auto; overflow-x: clip; }
.content-inner { min-width: 0; max-width: 100%; min-height: 100%; display: flex; flex-direction: column; }
.portal-page-header { background: #fff; padding: 1.22rem 1.6rem; }
.portal-page-header .page-header-content { padding: 0; }
.portal-page-header .page-title { font-size: 1.38rem; line-height: 1.25; font-weight: 750; color: var(--portal-text); }
.page-subtitle { color: var(--portal-muted); font-size: .88rem; }
.content { min-width: 0; max-width: 100%; flex: 1; padding: 1.45rem; }
.portal-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.6rem;
  background: #fff;
  color: var(--portal-muted);
  font-size: .78rem;
}
.portal-sidebar-overlay { display: none; }
.portal-flash { margin-bottom: 1rem; }

/* Cards and stats */
.card { box-shadow: none; }
.portal-card {
  border: 1px solid var(--portal-border);
  border-radius: .8rem;
  box-shadow: none;
  overflow: hidden;
  background: #fff;
}
.portal-card .card-header { padding: 1rem 1.2rem; background: #fff; }
.portal-card .card-body { padding: 1.2rem; }
.portal-card .card-footer { background: #fff; }
.portal-stat-card {
  min-height: 9rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem;
  background: #fff;
  border: 1px solid var(--portal-border);
  border-radius: .8rem;
  color: var(--portal-text);
  transition: border-color .15s ease, transform .15s ease;
}
.portal-stat-card:hover { color: var(--portal-text); border-color: #aab9d0; transform: translateY(-1px); }
.portal-stat-card span { display: block; color: var(--portal-muted); font-size: .82rem; }
.portal-stat-card strong { display: block; color: var(--portal-text); font-size: 1.7rem; line-height: 1.1; margin: .4rem 0 .8rem; }
.portal-stat-card small { color: var(--portal-muted); font-size: .76rem; }
.portal-stat-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 3rem;
  min-width: 3rem;
  height: 3rem;
  border-radius: .85rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent) !important;
}
.portal-stat-icon .icon { width: 1.25rem; height: 1.25rem; }
.portal-steps { margin: .25rem 0 0; padding-left: 1.25rem; }
.portal-steps li { padding: .45rem 0 .45rem .4rem; color: #465166; line-height: 1.55; }

/* Tables */
.portal-table { color: var(--portal-text); }
.portal-table thead th {
  background: #f8fafc;
  color: #5d697b;
  text-transform: uppercase;
  letter-spacing: .055em;
  font-size: .69rem;
  font-weight: 750;
  white-space: nowrap;
  border-bottom: 1px solid var(--portal-border);
  padding: .85rem 1.15rem;
}
.portal-table td {
  vertical-align: middle;
  border-color: #edf0f4;
  padding: .95rem 1.15rem;
}
.portal-table tbody tr:hover { background: #fbfcff; }
.portal-table .btn { white-space: nowrap; }
.portal-lead-id-cell { width: 20%; min-width: 15rem; }
.portal-lead-id { color: #ec4899; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; overflow-wrap: anywhere; }
.portal-lead-id:hover { color: #be185d; }
.portal-detail-table th { width: 32%; color: #697586; font-weight: 550; background: #fbfcfd; }
.portal-detail-table th, .portal-detail-table td { padding: .95rem 1.2rem; border-color: #edf0f4; vertical-align: middle; }
.portal-pagination { min-height: 3.25rem; display: flex; align-items: center; gap: .75rem; border-top: 1px solid var(--portal-border-soft); }
.portal-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: .8rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
}

/* Filters and controls */
.portal-filter-card { overflow: visible; }
.portal-filter-desktop { padding: .7rem; }
.portal-filter-mobile { display: none; padding: .7rem; }
.portal-filter-primary-row {
  display: grid;
  grid-template-columns: minmax(13.75rem, 1.7fr) minmax(6.8rem, .62fr) minmax(8.2rem, .82fr) minmax(6.5rem, .58fr) auto auto auto;
  align-items: center;
  gap: .5rem;
}
.portal-filter-primary-row > * { min-width: 0; }
.portal-filter-search { position: relative; min-width: 0; }
.portal-filter-search .icon {
  position: absolute;
  left: .78rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--portal-muted);
  pointer-events: none;
}
.portal-filter-search .form-control { width: 100%; padding-left: 2.35rem; }
.portal-page-size { min-width: 7.75rem; }
.portal-more-filters-button,
.portal-mobile-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  white-space: nowrap;
}
.portal-more-filters-button.is-active,
.portal-mobile-filter-button.is-active {
  border-color: rgba(var(--portal-accent-rgb), .55);
  background: var(--portal-accent-soft);
  color: var(--portal-accent-dark);
}
.portal-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .32rem;
  border-radius: 999px;
  background: var(--portal-accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
}
.portal-filter-chevron {
  display: inline-block;
  margin-top: -.12rem;
  color: var(--portal-muted);
  font-size: 1rem;
  line-height: 1;
  transition: transform .16s ease;
}
.portal-filter-chevron.is-open { transform: rotate(180deg); }
.portal-clear-filter {
  min-height: 2.35rem;
  padding: .35rem .25rem;
  color: var(--portal-muted);
  font-size: .78rem;
  white-space: nowrap;
  text-decoration: none;
}
.portal-clear-filter:hover,
.portal-clear-filter:focus { color: var(--portal-accent-dark); text-decoration: none; }
.portal-filter-more-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(10rem, 1fr)) minmax(9rem, .75fr);
  gap: .65rem;
  width: min(38rem, 100%);
  margin: .7rem 0 0 auto;
  padding: .75rem;
  border: 1px solid var(--portal-border-soft);
  border-radius: .75rem;
  background: var(--portal-surface-soft);
}
.portal-filter-field { min-width: 0; }
.portal-filter-field label {
  display: block;
  margin: 0 0 .3rem;
  color: var(--portal-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .015em;
}
.portal-filter-field .form-control,
.portal-filter-field .form-select { width: 100%; }
.portal-filter-mobile-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: center;
}
.portal-filter-mobile-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: .7rem;
  padding-top: .75rem;
  border-top: 1px solid var(--portal-border-soft);
}
.portal-filter-mobile-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  grid-column: 1 / -1;
}
.portal-filter-mobile-panel > .portal-filter-field:last-of-type { grid-column: 1 / -1; }
.portal-filter-mobile-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  grid-column: 1 / -1;
  padding-top: .1rem;
}
.portal-filter-mobile-actions .btn-primary { min-width: 8.5rem; }
.form-control, .form-select, .input-group-text {
  min-height: 2.65rem;
  border-color: #cdd6e2;
  border-radius: .58rem;
}
.form-control:focus, .form-select:focus { border-color: var(--portal-accent); box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .1); }
.input-group > .form-control:not(:first-child), .input-group > .form-select:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group-text { background: #f8fafc; }
.btn { border-radius: .58rem; min-height: 2.35rem; }
.btn-primary { background: var(--portal-accent); border-color: var(--portal-accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--portal-accent-dark); border-color: var(--portal-accent-dark); }
.btn-light { border-color: var(--portal-border); background: #fff; color: var(--portal-text); }
.btn-light:hover { background: #f4f6f9; border-color: #bdc8d6; color: var(--portal-text); }
.btn-outline-primary { color: #0d6efd; border-color: #0d6efd; }
.btn-outline-primary:hover { color: #fff; }
.badge { border-radius: .28rem; padding: .38em .6em; font-weight: 650; }
.bg-primary-subtle { background: #e8f0ff !important; }
.bg-success-subtle { background: #e7f7ef !important; }
.bg-danger-subtle { background: #fdecec !important; }

/* Lead details */
.portal-lead-header { display: flex; align-items: flex-start; gap: 1.5rem; }
.portal-lead-header h3 { font-size: 1.24rem; font-weight: 750; }
.portal-price-box { text-align: right; white-space: nowrap; }
.portal-price-box span { display: block; color: var(--portal-muted); font-size: .75rem; }
.portal-price-box strong { display: block; font-size: 1.4rem; margin-top: .2rem; }
.portal-facts > div { padding: .85rem; border: 1px solid #e8edf3; }
.portal-facts > div:first-child { border-radius: .65rem 0 0 .65rem; }
.portal-facts > div:last-child { border-radius: 0 .65rem .65rem 0; }
.portal-facts > div + div { border-left: 0; }
.portal-facts span,
.portal-contact-grid span,
.portal-profile-status span { display: block; color: var(--portal-muted); font-size: .75rem; margin-bottom: .25rem; }
.portal-facts strong,
.portal-contact-grid strong,
.portal-profile-status strong { display: block; min-width: 0; max-width: 65%; color: var(--portal-text); text-align: right; overflow-wrap: anywhere; }
.portal-contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.portal-contact-grid > div { padding: 1rem; border: 1px solid #e4e9f0; border-radius: .65rem; }
.portal-wallet-summary { text-align: center; padding: 1.15rem; background: #f7f9fc; border-radius: .7rem; }
.portal-wallet-summary span { display: block; color: var(--portal-muted); }
.portal-wallet-summary strong { display: block; font-size: 1.8rem; margin-top: .25rem; }
.portal-sticky-card { position: sticky; top: 5.25rem; }

/* Wallet and profile */
.portal-wallet-card { background: #172033; color: #fff; border-color: #172033; }
.portal-wallet-card .card-body { padding: 1.7rem; }
.portal-wallet-card span, .portal-wallet-card small { display: block; color: rgba(255, 255, 255, .68); }
.portal-wallet-card strong { display: block; color: #fff; font-size: 2.1rem; margin: .4rem 0 .8rem; }
.portal-profile-hero { display: flex; align-items: center; gap: 1.1rem; }
.portal-profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  min-width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
  font-size: 1.5rem;
  font-weight: 800;
}
.portal-profile-status { display: grid; gap: .9rem; }
.portal-profile-status > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #edf0f4; padding-bottom: .8rem; }
.portal-profile-status > div:last-child { border-bottom: 0; padding-bottom: 0; }

/* Login */
.portal-login-body { min-height: 100vh; background: #eef2f6; display: grid; place-items: center; padding: 1rem; }
.portal-login-shell { width: min(29rem, 100%); }
.portal-login-brand { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-bottom: 1.2rem; }
.portal-login-brand strong, .portal-login-brand span { display: block; }
.portal-login-brand > div > span { color: var(--portal-muted); font-size: .78rem; }
.portal-login-card { border: 1px solid var(--portal-border); border-radius: .95rem; box-shadow: 0 14px 35px rgba(15, 23, 42, .06); }
.portal-login-card .card-body { padding: 1.6rem; }
.portal-otp-input { letter-spacing: .55rem; font-weight: 700; text-align: center; }

@media (max-width: 1199.98px) {
  .portal-filter-desktop { display: none; }
  .portal-filter-mobile { display: block; }
  :root { --portal-sidebar-width: 16.5rem; }
  .portal-stat-card { min-height: 8.5rem; }
  .portal-sticky-card { position: static; }
}

@media (max-width: 991.98px) {
  .portal-navbar { padding-left: .8rem; padding-right: .8rem; }
  .portal-sidebar {
    position: fixed;
    z-index: 1040;
    top: var(--portal-navbar-height);
    bottom: 0;
    left: calc(-1 * var(--portal-sidebar-width));
    transition: left .2s ease;
    box-shadow: 6px 0 20px rgba(15, 23, 42, .12);
    overflow-y: auto;
  }
  body.portal-sidebar-open { overflow: hidden; }
  body.portal-sidebar-open .portal-sidebar { left: 0; }
  body.portal-sidebar-open .portal-sidebar-overlay {
    display: block;
    position: fixed;
    inset: var(--portal-navbar-height) 0 0;
    z-index: 1039;
    background: rgba(15, 23, 42, .32);
  }
  .portal-facts > div:nth-child(3) { border-left: 1px solid #e8edf3; }
  .portal-facts > div:first-child { border-radius: .65rem 0 0 0; }
  .portal-facts > div:nth-child(2) { border-radius: 0 .65rem 0 0; }
  .portal-facts > div:nth-child(3) { border-radius: 0 0 0 .65rem; border-top: 0; }
  .portal-facts > div:last-child { border-radius: 0 0 .65rem 0; border-top: 0; }
}

@media (max-width: 767.98px) {
  .portal-navbar { min-height: 3.75rem; }
  .portal-page-header { padding: 1rem 1.1rem; }
  .content { padding: 1rem; }
  .portal-footer { padding: .85rem 1rem; }
  .portal-lead-header { flex-direction: column; }
  .portal-price-box { text-align: left; }
  .portal-contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
  .portal-brand > span:last-child { display: none; }
  .portal-wallet-pill > span { display: none; }
  .portal-wallet-pill { padding: .48rem .58rem; }
  .portal-user-button > span:last-child { display: none !important; }
  .content { padding: .75rem; }
  .portal-filter-card { border-radius: .85rem; }
  .portal-filter-mobile { padding: .6rem; }
  .portal-filter-mobile-top { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .portal-mobile-filter-button { padding-left: .7rem; padding-right: .7rem; }
  .portal-filter-mobile-panel { grid-template-columns: 1fr; gap: .62rem; }
  .portal-filter-mobile-dates { grid-template-columns: 1fr; gap: .62rem; grid-column: auto; }
  .portal-filter-mobile-panel > .portal-filter-field:last-of-type,
  .portal-filter-mobile-actions { grid-column: auto; }
  .portal-filter-mobile-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .portal-filter-mobile-actions .btn-primary { min-width: 0; }
  .portal-page-header .page-title { font-size: 1.18rem; }
  .portal-footer { flex-direction: column; }
  .portal-stat-card { min-height: 7.75rem; padding: .9rem; }
  .portal-stat-card strong { font-size: 1.4rem; }
  .portal-stat-icon { width: 2.55rem; min-width: 2.55rem; height: 2.55rem; }
  .portal-facts > div { border-left: 1px solid #e8edf3 !important; border-top: 0; border-radius: 0 !important; }
  .portal-facts > div:first-child { border-top: 1px solid #e8edf3; border-radius: .65rem .65rem 0 0 !important; }
  .portal-facts > div:last-child { border-radius: 0 0 .65rem .65rem !important; }
  .portal-profile-hero { align-items: flex-start; }
  .portal-profile-avatar { width: 3.75rem; min-width: 3.75rem; height: 3.75rem; }
}

/* Production interaction states */
.portal-toast {
  position: fixed;
  top: 4.75rem;
  right: 1rem;
  z-index: 1100;
  width: min(25rem, calc(100vw - 2rem));
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .14);
  color: var(--portal-text);
}
.portal-toast-dot { width: .58rem; height: .58rem; border-radius: 50%; background: #16a34a; flex: 0 0 auto; }
.portal-toast-error .portal-toast-dot { background: #dc2626; }
.portal-toast-warning .portal-toast-dot { background: #d97706; }
.portal-toast button { margin-left: auto; border: 0; background: transparent; font-size: 1.1rem; color: var(--portal-muted); }
.portal-login-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: .9rem;
  border-radius: .9rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
}
.portal-login-help {
  display: grid;
  gap: .2rem;
  margin-top: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  background: rgba(255, 255, 255, .62);
  color: var(--portal-muted);
  font-size: .78rem;
  text-align: center;
}
.portal-login-help strong { color: var(--portal-text); }
.portal-amount-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.portal-amount-options .btn.active { border-color: var(--portal-accent); background: var(--portal-accent-soft); color: var(--portal-accent-dark); }
.portal-payment-state { width: .65rem; height: .65rem; border-radius: 50%; background: #f59e0b; flex: 0 0 auto; }
.portal-payment-state.is-paid { background: #16a34a; }
.bg-warning-subtle { background: #fff7df !important; }
.text-warning { color: #a15c00 !important; }

@media (max-width: 575.98px) {
  .portal-toast { top: 4.25rem; right: .75rem; width: calc(100vw - 1.5rem); }
}

.portal-error-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--portal-page); }
.portal-error-card { width: min(31rem, 100%); padding: 2.2rem; border: 1px solid var(--portal-border); border-radius: 1rem; background: #fff; text-align: center; box-shadow: 0 18px 45px rgba(15, 23, 42, .08); }
.portal-error-card h1 { margin: 1rem 0 .5rem; font-size: 1.55rem; }
.portal-error-card p, .portal-error-card small { color: var(--portal-muted); }
.portal-error-mark { display: inline-flex; align-items: center; justify-content: center; min-width: 3.4rem; height: 3.4rem; padding: 0 .8rem; border-radius: .9rem; background: var(--portal-accent-soft); color: var(--portal-accent); font-weight: 800; }

/* Plans, credits and direct payment */
.portal-credit-balance-card {
  overflow: hidden;
  border-color: #172033;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, .13), transparent 42%),
    #172033;
  color: #fff;
}
.portal-credit-balance-card .card-body { padding: 1.65rem; }
.portal-summary-label { color: rgba(255, 255, 255, .68); font-size: .8rem; font-weight: 650; }
.portal-credit-balance-card strong { display: block; margin: .35rem 0 .9rem; color: #fff; font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.1; }
.portal-summary-meta { display: flex; flex-wrap: wrap; gap: .45rem 1rem; color: rgba(255, 255, 255, .7); font-size: .76rem; }
.portal-current-plan { padding: 1.45rem; }
.portal-current-plan-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  min-width: 3rem;
  height: 3rem;
  border-radius: .8rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
}
.portal-current-plan-icon .icon { width: 1.35rem; height: 1.35rem; }
.portal-plan-dates { display: flex; flex-wrap: wrap; gap: .85rem 2rem; }
.portal-plan-dates span { display: block; color: var(--portal-muted); font-size: .72rem; }
.portal-plan-dates strong { display: block; margin-top: .18rem; font-size: .84rem; }
.portal-billing-toggle {
  display: inline-flex;
  align-items: stretch;
  gap: .25rem;
  padding: .28rem;
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.portal-billing-toggle button {
  min-width: 7.2rem;
  border: 0;
  border-radius: .52rem;
  padding: .55rem .85rem;
  background: transparent;
  color: var(--portal-muted);
  font-weight: 700;
  line-height: 1.15;
}
.portal-billing-toggle button span { display: block; margin-top: .2rem; font-size: .62rem; font-weight: 550; opacity: .82; }
.portal-billing-toggle button.active { background: var(--portal-accent); color: #fff; box-shadow: 0 5px 12px rgba(37, 99, 235, .18); }
.portal-plan-card { position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.portal-plan-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 23, 42, .08); }
.portal-plan-card.is-recommended { border-color: rgba(37, 99, 235, .62); box-shadow: 0 9px 24px rgba(37, 99, 235, .09); }
.portal-plan-card .card-body { padding: 1.45rem; }
.portal-plan-ribbon {
  position: absolute;
  top: 0;
  right: 1.15rem;
  padding: .38rem .7rem;
  border-radius: 0 0 .52rem .52rem;
  background: var(--portal-accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.portal-plan-price { display: flex; align-items: baseline; gap: .4rem; }
.portal-plan-price strong { color: var(--portal-text); font-size: 1.85rem; line-height: 1; letter-spacing: -.03em; }
.portal-plan-price span { color: var(--portal-muted); font-size: .78rem; }
.portal-tax-label { min-height: 2.25rem; display: flex; flex-direction: column; margin-top: .45rem; color: #a15c00; font-size: .72rem; }
.portal-tax-label.is-included { color: #15803d; }
.portal-tax-label strong { margin-top: .15rem; color: var(--portal-text); font-size: .72rem; }
.portal-credit-total { padding: 1rem; border: 1px solid #dce5f0; border-radius: .75rem; background: #f8fafc; }
.portal-credit-total > span { display: block; color: var(--portal-muted); font-size: .72rem; }
.portal-credit-total > strong { display: block; margin: .25rem 0; color: var(--portal-accent-dark); font-size: 1.35rem; }
.portal-credit-total small { display: block; color: #3d4a5f; }
.portal-plan-features { display: grid; gap: .72rem; margin: 0; padding: 0; list-style: none; }
.portal-plan-features li { display: flex; align-items: flex-start; gap: .55rem; color: #445066; font-size: .82rem; line-height: 1.4; }
.portal-plan-features .icon { width: 1rem; min-width: 1rem; height: 1rem; margin-top: .08rem; color: #16a34a; stroke-width: 2.2; }
.portal-plan-value { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; color: var(--portal-muted); font-size: .7rem; border-top: 1px solid var(--portal-border-soft); }
.portal-payment-row { display: flex; align-items: flex-start; gap: .75rem; padding: .95rem 1.1rem; }
.portal-payment-state.is-review { background: #dc2626; }
.portal-direct-payment-breakdown { display: grid; gap: .55rem; padding: .9rem 1rem; border: 1px solid var(--portal-border); border-radius: .68rem; background: #f8fafc; }
.portal-direct-payment-breakdown > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--portal-muted); font-size: .79rem; }
.portal-direct-payment-breakdown strong { color: var(--portal-text); }
.portal-direct-payment-breakdown .is-total { margin-top: .15rem; padding-top: .65rem; border-top: 1px solid var(--portal-border); color: var(--portal-text); font-weight: 700; }
.portal-direct-payment-breakdown .is-total strong { color: var(--portal-accent-dark); font-size: 1rem; }

@media (max-width: 991.98px) {
  .portal-plan-card:hover { transform: none; }
}

@media (max-width: 575.98px) {
  .portal-billing-toggle { width: 100%; }
  .portal-billing-toggle button { flex: 1 1 0; min-width: 0; }
  .portal-current-plan { padding: 1.15rem; }
  .portal-plan-ribbon { right: .85rem; }
}

/* Premium shell, safe account menu and selectable themes */
html { background: var(--portal-page); }
body,
.portal-navbar,
.portal-sidebar,
.portal-page-header,
.portal-card,
.portal-stat-card,
.portal-global-search input,
.portal-wallet-pill,
.portal-user-button > span:first-child,
.portal-sidebar .nav-link,
.btn,
.form-control,
.form-select {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.portal-navbar {
  overflow: visible !important;
  background: var(--portal-navbar-bg);
  color: var(--portal-navbar-text);
  border-color: var(--portal-navbar-control-border) !important;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .055);
}
.portal-navbar .container-fluid,
.portal-navbar .nav,
.portal-profile-dropdown { overflow: visible !important; }
.portal-brand,
.portal-brand:hover,
.portal-user-button,
.portal-sidebar-toggle { color: var(--portal-navbar-text); }
.portal-brand-mark { background: var(--portal-brand-bg); color: var(--portal-brand-text); box-shadow: 0 8px 18px rgba(var(--portal-accent-rgb), .2); }
.portal-global-search input {
  background: var(--portal-search-bg);
  color: var(--portal-search-text);
  border-color: var(--portal-navbar-control-border);
}
.portal-global-search input::placeholder { color: var(--portal-search-placeholder); opacity: 1; }
.portal-global-search .icon { color: var(--portal-search-placeholder); }
.portal-global-search input:focus {
  background: var(--portal-navbar-control-bg);
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 .2rem rgba(var(--portal-accent-rgb), .15);
}
.portal-wallet-pill {
  background: var(--portal-navbar-control-bg);
  border-color: var(--portal-navbar-control-border);
  color: var(--portal-navbar-text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
}
.portal-wallet-pill:hover { color: var(--portal-accent); border-color: var(--portal-accent); }
.portal-user-button { border-radius: .75rem; padding: .28rem .42rem; }
.portal-user-button:hover,
.portal-user-button[aria-expanded="true"] { background: var(--portal-navbar-control-bg); color: var(--portal-navbar-text); }
.portal-user-button > span:first-child {
  background: var(--portal-accent-soft);
  color: var(--portal-accent-dark);
  box-shadow: inset 0 0 0 1px rgba(var(--portal-accent-rgb), .08);
}
html[data-portal-theme="navy-premium"] .portal-user-button > span:first-child {
  background: rgba(255, 255, 255, .12);
  color: #ffffff;
}

.portal-profile-dropdown { position: relative; flex: 0 0 auto; }
.portal-profile-menu {
  position: fixed !important;
  top: calc(var(--portal-navbar-height) + .45rem) !important;
  right: max(.75rem, env(safe-area-inset-right)) !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  width: min(19rem, calc(100vw - 1.5rem));
  min-width: 0;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - var(--portal-navbar-height) - 1rem);
  padding: .55rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--portal-border);
  border-radius: .9rem;
  background: var(--portal-surface);
  color: var(--portal-text);
  box-shadow: var(--portal-dropdown-shadow);
  z-index: 1085;
}
.portal-profile-menu::before {
  content: "";
  position: absolute;
  top: -.35rem;
  right: 1.05rem;
  width: .7rem;
  height: .7rem;
  transform: rotate(45deg);
  border-top: 1px solid var(--portal-border);
  border-left: 1px solid var(--portal-border);
  background: var(--portal-surface);
}
.portal-profile-menu-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .65rem .75rem;
  border-bottom: 1px solid var(--portal-border-soft);
}
.portal-profile-menu-header > div { display: grid; min-width: 0; }
.portal-profile-menu-header strong,
.portal-profile-menu-header small { display: block; }
.portal-profile-menu-header small { color: var(--portal-muted); font-size: .72rem; margin-top: .12rem; }
.portal-profile-menu-avatar {
  display: inline-flex;
  width: 2.35rem;
  min-width: 2.35rem;
  height: 2.35rem;
  align-items: center;
  justify-content: center;
  border-radius: .72rem;
  background: var(--portal-accent-soft);
  color: var(--portal-accent-dark);
  font-weight: 800;
}
.portal-profile-menu-links { padding-top: .35rem; }
.portal-profile-menu .dropdown-item {
  border-radius: .58rem;
  padding: .68rem .72rem;
  color: var(--portal-text);
  font-size: .86rem;
}
.portal-profile-menu .dropdown-item:hover,
.portal-profile-menu .dropdown-item:focus { background: var(--portal-accent-soft); color: var(--portal-accent-dark); }
.portal-profile-menu .dropdown-item small { color: var(--portal-muted); font-size: .68rem; }
.portal-profile-menu .dropdown-divider { margin: .4rem 0; border-color: var(--portal-border-soft); }
.portal-profile-menu .dropdown-item.text-danger { color: #dc2626 !important; }
.portal-profile-menu .dropdown-item.text-danger:hover { background: #fff0f0; color: #b91c1c !important; }

.portal-sidebar {
  background: var(--portal-sidebar);
  border-color: var(--portal-border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .25);
}
.portal-provider-summary { border-color: var(--portal-border-soft); }
.portal-sidebar .sidebar-section-body { color: var(--portal-sidebar-text); }
.portal-sidebar .nav-item-header { color: var(--portal-sidebar-muted); }
.portal-sidebar .nav-link { color: var(--portal-sidebar-text); }
.portal-sidebar .nav-link .icon { color: var(--portal-sidebar-icon); }
.portal-sidebar .nav-link:hover { background: var(--portal-sidebar-hover); color: var(--portal-sidebar-active-text); }
.portal-sidebar .nav-link:hover .icon { color: var(--portal-accent); }
.portal-sidebar .nav-link.active {
  background: var(--portal-sidebar-active);
  color: var(--portal-sidebar-active-text);
  box-shadow: inset 3px 0 0 var(--portal-accent);
}
.portal-sidebar .nav-link.active .icon { color: var(--portal-accent); }
html[data-portal-theme="navy-premium"] .portal-sidebar .text-muted,
html[data-portal-theme="navy-premium"] .portal-sidebar .badge { color: var(--portal-sidebar-muted) !important; }
html[data-portal-theme="navy-premium"] .portal-sidebar .nav-link .badge {
  border-color: rgba(255, 255, 255, .14) !important;
  background: rgba(255, 255, 255, .08) !important;
  color: #dce7f7 !important;
}

.portal-page-header {
  background: var(--portal-page-header-bg);
  border-color: var(--portal-border) !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
  backdrop-filter: blur(8px);
}
.portal-card {
  border-color: var(--portal-border);
  border-radius: 1rem;
  background: var(--portal-surface);
  box-shadow: var(--portal-card-shadow);
}
.portal-card .card-header,
.portal-card .card-footer { background: var(--portal-surface); border-color: var(--portal-border-soft) !important; }
.portal-card .card-header h5 { letter-spacing: -.012em; }
.portal-stat-card {
  border-color: var(--portal-border);
  border-radius: 1rem;
  background: var(--portal-surface);
  box-shadow: var(--portal-card-shadow);
}
.portal-stat-card:hover {
  border-color: rgba(var(--portal-accent-rgb), .42);
  box-shadow: var(--portal-card-shadow-hover);
  transform: translateY(-2px);
}
.portal-stat-icon { box-shadow: inset 0 0 0 1px rgba(var(--portal-accent-rgb), .08); }
.portal-table thead th { background: var(--portal-table-head); border-color: var(--portal-border); }
.portal-table td,
.portal-detail-table th,
.portal-detail-table td,
.portal-profile-status > div { border-color: var(--portal-border-soft); }
.portal-table tbody tr:hover { background: var(--portal-surface-soft); }
.portal-detail-table th { background: var(--portal-surface-soft); }
.portal-footer { background: var(--portal-surface); border-color: var(--portal-border); }

.form-control,
.form-select,
.input-group-text {
  background-color: var(--portal-surface);
  color: var(--portal-text);
  border-color: var(--portal-border);
}
.form-control:focus,
.form-select:focus { border-color: var(--portal-accent); box-shadow: 0 0 0 .2rem rgba(var(--portal-accent-rgb), .14); }
.input-group-text { background: var(--portal-surface-soft); }
.btn { font-weight: 650; }
.btn-primary {
  box-shadow: 0 7px 16px rgba(var(--portal-accent-rgb), .18);
}
.btn-primary:hover,
.btn-primary:focus { box-shadow: 0 9px 20px rgba(var(--portal-accent-rgb), .24); }
.btn-light { background: var(--portal-surface); border-color: var(--portal-border); color: var(--portal-text); }
.btn-light:hover { background: var(--portal-surface-soft); border-color: rgba(var(--portal-accent-rgb), .32); color: var(--portal-text); }
.btn-outline-primary { color: var(--portal-accent); border-color: var(--portal-accent); }
.btn-outline-primary:hover { background: var(--portal-accent); border-color: var(--portal-accent); color: #fff; }
.portal-profile-avatar,
.portal-empty-icon,
.portal-current-plan-icon,
.portal-login-lock,
.portal-error-mark { box-shadow: inset 0 0 0 1px rgba(var(--portal-accent-rgb), .08); }
.portal-credit-balance-card,
.portal-wallet-card {
  border-color: var(--portal-credit-panel);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, .14), transparent 42%),
    var(--portal-credit-panel);
}
.portal-plan-card:hover { box-shadow: var(--portal-card-shadow-hover); }
.portal-plan-card.is-recommended {
  border-color: rgba(var(--portal-accent-rgb), .6);
  box-shadow: 0 10px 28px rgba(var(--portal-accent-rgb), .11);
}
.portal-billing-toggle,
.portal-credit-total,
.portal-direct-payment-breakdown { background: var(--portal-surface); border-color: var(--portal-border); }
.portal-credit-total { background: var(--portal-surface-soft); }
.portal-billing-toggle button.active { box-shadow: 0 6px 15px rgba(var(--portal-accent-rgb), .2); }

.portal-appearance-current {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  min-width: 0;
  margin-left: auto;
}
.portal-appearance-current small {
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-appearance-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--portal-muted);
  font-size: .9rem;
  line-height: 1;
  transition: transform .15s ease;
}
.portal-appearance-chevron.is-open { transform: rotate(180deg); }
.portal-inline-themes {
  display: grid;
  gap: .42rem;
  margin: .2rem .2rem .45rem;
  padding: .55rem;
  border: 1px solid var(--portal-border-soft);
  border-radius: .72rem;
  background: var(--portal-surface-soft);
}
.portal-inline-theme {
  width: 100%;
  display: grid;
  grid-template-columns: 2.65rem minmax(0, 1fr) 1rem;
  align-items: center;
  gap: .65rem;
  padding: .58rem;
  border: 1px solid transparent;
  border-radius: .62rem;
  background: transparent;
  color: var(--portal-text);
  text-align: left;
}
.portal-inline-theme:hover,
.portal-inline-theme:focus-visible {
  border-color: rgba(var(--portal-accent-rgb), .28);
  background: var(--portal-surface);
  outline: 0;
}
.portal-inline-theme.active {
  border-color: var(--portal-accent);
  background: var(--portal-surface);
  box-shadow: 0 0 0 .1rem rgba(var(--portal-accent-rgb), .08);
}
.portal-inline-theme > span:nth-child(2) { display: grid; min-width: 0; }
.portal-inline-theme strong {
  overflow: hidden;
  color: var(--portal-text);
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-inline-theme small {
  margin-top: .08rem;
  overflow: hidden;
  color: var(--portal-muted);
  font-size: .64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-inline-theme-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 2.65rem;
  height: 1.8rem;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: .45rem;
  background: #fff;
}
.portal-inline-theme-preview i { display: block; }
.portal-theme-preview-blue i:nth-child(1) { background: #2563eb; }
.portal-theme-preview-blue i:nth-child(2) { background: #eaf1ff; }
.portal-theme-preview-blue i:nth-child(3) { background: #ffffff; }
.portal-theme-preview-blue i:nth-child(4) { background: #172033; }
.portal-theme-preview-teal i:nth-child(1) { background: #0f766e; }
.portal-theme-preview-teal i:nth-child(2) { background: #e3f5f2; }
.portal-theme-preview-teal i:nth-child(3) { background: #ffffff; }
.portal-theme-preview-teal i:nth-child(4) { background: #143e3b; }
.portal-theme-preview-navy i:nth-child(1) { background: #101a30; }
.portal-theme-preview-navy i:nth-child(2) { background: #4f8cff; }
.portal-theme-preview-navy i:nth-child(3) { background: #f1f4f9; }
.portal-theme-preview-navy i:nth-child(4) { background: #ffffff; }
.portal-inline-theme-check {
  visibility: hidden;
  width: 1rem;
  height: 1rem;
  color: var(--portal-accent);
  stroke-width: 2.5;
}
.portal-inline-theme.active .portal-inline-theme-check { visibility: visible; }

@media (max-width: 575.98px) {
  .portal-profile-menu {
    top: calc(var(--portal-navbar-height) + .3rem) !important;
    right: .55rem !important;
    width: calc(100vw - 1.1rem);
    max-width: calc(100vw - 1.1rem);
  }
  .portal-profile-menu::before { display: none; }
  .portal-inline-theme { grid-template-columns: 2.45rem minmax(0, 1fr) 1rem; }
  .portal-inline-theme-preview { width: 2.45rem; }
}
.portal-profile-menu .dropdown-item { display: flex; align-items: center; gap: .65rem; }
.portal-profile-menu .dropdown-item > .icon,
.portal-menu-item-main .icon { width: 1rem; height: 1rem; color: var(--portal-muted); }
.portal-profile-menu .dropdown-item:hover > .icon,
.portal-profile-menu .dropdown-item:focus > .icon,
.portal-profile-menu .dropdown-item:hover .portal-menu-item-main .icon,
.portal-profile-menu .dropdown-item:focus .portal-menu-item-main .icon { color: var(--portal-accent); }
.portal-menu-item-main { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; }
.portal-profile-menu { scrollbar-width: thin; }
.text-primary { color: var(--portal-accent) !important; }
.bg-primary-subtle { background: var(--portal-accent-soft) !important; }

/* Layout containment: prevent menus, long values and responsive content from widening the document. */
.portal-navbar .container-fluid,
.portal-navbar .nav,
.portal-page-header,
.page-header-content,
.table-responsive { min-width: 0; max-width: 100%; }
.portal-navbar .nav { flex-wrap: nowrap; }
.table-responsive { overflow-x: auto; }
img, svg { max-width: 100%; }
@supports not (overflow: clip) {
  html, body, .page-content, .content-wrapper { overflow-x: hidden; }
}

/* Agent portal additions */
.agent-referral-pill {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.4rem;
  border: 1px solid var(--portal-border);
  border-radius: .7rem;
  padding: .45rem .75rem;
  background: var(--portal-surface);
  color: var(--portal-text);
  white-space: nowrap;
}
.agent-referral-pill small { color: var(--portal-muted); font-size: .72rem; }
.agent-referral-pill strong { letter-spacing: .08em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.agent-stat-category { font-size: clamp(1rem, 1.45vw, 1.35rem) !important; line-height: 1.2; }
.agent-status { display: inline-flex; align-items: center; border: 1px solid transparent; border-radius: 999px; padding: .35rem .65rem; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.agent-status-primary { background: #2563eb; border-color: #1d4ed8; }
.agent-status-info { background: #0f766e; border-color: #0b5f59; }
.agent-status-purple { background: #6d28d9; border-color: #5b21b6; }
.agent-status-success { background: #15803d; border-color: #166534; }
.agent-status-danger { background: #dc2626; border-color: #b91c1c; }
.agent-verified-line { display: flex; align-items: center; gap: .25rem; margin-top: .4rem; color: #15803d; font-size: .72rem; font-weight: 650; }
.agent-verified-line .icon { width: .8rem; height: .8rem; }
.agent-filter-bar { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(10rem, 13rem) auto auto; gap: .75rem; align-items: end; padding: 1rem; }
.agent-filter-bar > label > span { display: block; margin-bottom: .35rem; color: var(--portal-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.agent-filter-search { position: relative; }
.agent-filter-search .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--portal-muted); }
.agent-filter-search input { width: 100%; min-height: 2.7rem; border: 1px solid var(--portal-border); border-radius: .65rem; padding: .55rem .8rem .55rem 2.7rem; background: var(--portal-surface); color: var(--portal-text); outline: none; }
.agent-filter-search input:focus { border-color: var(--portal-accent); box-shadow: 0 0 0 .18rem rgba(var(--portal-accent-rgb), .12); }
.agent-table-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border-top: 1px solid var(--portal-border-soft); color: var(--portal-muted); font-size: .8rem; }
.agent-table-footer > div { display: flex; gap: .5rem; }
.agent-empty { min-height: 18rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; color: var(--portal-muted); text-align: center; }
.agent-empty strong { color: var(--portal-text); font-size: 1rem; }
.agent-stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; max-width: 58rem; margin: 0 auto 1rem; }
.agent-step { display: flex; align-items: center; gap: .7rem; min-width: 0; padding: .75rem; border: 1px solid var(--portal-border); border-radius: .8rem; background: var(--portal-surface); color: var(--portal-muted); }
.agent-step > span { display: inline-flex; flex: 0 0 auto; width: 2rem; height: 2rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--portal-surface-soft); border: 1px solid var(--portal-border); font-weight: 750; }
.agent-step div { min-width: 0; }
.agent-step strong, .agent-step small { display: block; }
.agent-step strong { color: var(--portal-text); font-size: .82rem; }
.agent-step small { margin-top: .1rem; font-size: .68rem; }
.agent-step.active { border-color: rgba(var(--portal-accent-rgb), .5); box-shadow: 0 0 0 .15rem rgba(var(--portal-accent-rgb), .08); }
.agent-step.active > span, .agent-step.complete > span { background: var(--portal-accent); border-color: var(--portal-accent); color: #fff; }
.agent-form-card { max-width: 68rem; margin: 0 auto; overflow: hidden; }
.agent-form-heading { display: flex; align-items: flex-start; gap: .85rem; margin-bottom: 1.5rem; }
.agent-form-heading h4 { margin: 0 0 .25rem; }
.agent-form-heading p { margin: 0; color: var(--portal-muted); }
.agent-form-icon { display: inline-flex; width: 2.65rem; height: 2.65rem; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: .75rem; background: var(--portal-accent-soft); color: var(--portal-accent); }
.agent-otp-panel { padding: 1rem; border: 1px dashed var(--portal-border); border-radius: .8rem; background: var(--portal-surface-soft); }
.agent-otp-panel.is-verified { border-style: solid; border-color: #86d2a0; background: #f0fdf4; }
.agent-otp-entry { display: flex; gap: .5rem; flex: 1 1 18rem; max-width: 25rem; }
.agent-otp-entry input { max-width: 12rem; }
.agent-verified-badge { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; color: #166534; font-size: .78rem; font-weight: 750; }
.agent-verified-badge .icon { width: .9rem; height: .9rem; }
.agent-category-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; padding: .85rem 1rem; border: 1px solid rgba(var(--portal-accent-rgb), .25); border-radius: .8rem; background: var(--portal-accent-soft); }
.agent-category-banner small, .agent-category-banner strong { display: block; }
.agent-category-banner small { color: var(--portal-muted); }
.agent-category-banner > span { border-radius: 999px; padding: .35rem .6rem; background: var(--portal-surface); color: var(--portal-accent-dark); font-family: ui-monospace, monospace; font-weight: 750; letter-spacing: .08em; }
.agent-dynamic-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--portal-border-soft); }
.agent-dynamic-section h5 { margin-bottom: 1rem; }
.agent-review-grid, .agent-detail-grid, .agent-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.agent-review-grid article, .agent-detail-grid > div, .agent-profile-grid > div { display: flex; flex-direction: column; gap: .3rem; min-width: 0; padding: 1rem; border: 1px solid var(--portal-border-soft); border-radius: .8rem; background: var(--portal-surface-soft); }
.agent-review-grid small, .agent-detail-grid small, .agent-profile-grid small, .agent-notes small { color: var(--portal-muted); font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.agent-review-grid strong, .agent-detail-grid strong, .agent-profile-grid strong { color: var(--portal-text); overflow-wrap: anywhere; }
.agent-review-grid span, .agent-detail-grid span { color: var(--portal-muted); font-size: .82rem; }
.agent-form-actions { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; }
.agent-success-state { padding: 2rem 0; text-align: center; }
.agent-success-state > span { display: inline-flex; width: 4.5rem; height: 4.5rem; align-items: center; justify-content: center; border-radius: 50%; background: #dcfce7; color: #15803d; }
.agent-success-state > span .icon { width: 2rem; height: 2rem; }
.agent-success-state h3 { margin: 1.2rem 0 .4rem; }
.agent-success-state p { color: var(--portal-muted); }
.agent-success-id { display: inline-flex; flex-direction: column; gap: .2rem; margin: .75rem auto 1.25rem; padding: .8rem 1.1rem; border-radius: .75rem; background: var(--portal-surface-soft); border: 1px solid var(--portal-border); }
.agent-success-id small { color: var(--portal-muted); }
.agent-success-id strong { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.agent-notes { margin-top: 1rem; padding: 1rem; border-radius: .8rem; background: var(--portal-surface-soft); }
.agent-notes p { margin: .45rem 0 0; white-space: pre-wrap; }
.agent-details-table { margin-top: 1.25rem; }
.agent-details-table h5 { margin-bottom: .75rem; }
.agent-details-table > div { display: grid; grid-template-columns: minmax(9rem, .8fr) 1.2fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--portal-border-soft); }
.agent-details-table span { color: var(--portal-muted); }
.agent-details-table strong { overflow-wrap: anywhere; }
.agent-verified-summary { display: flex; gap: .75rem; align-items: center; padding: .85rem; border-radius: .75rem; background: #f0fdf4; color: #166534; }
.agent-verified-summary > span { display: inline-flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; border-radius: 50%; background: #dcfce7; }
.agent-verified-summary strong, .agent-verified-summary small { display: block; }
.agent-meta-list { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .6rem .8rem; margin: 1rem 0 0; }
.agent-meta-list dt { color: var(--portal-muted); font-weight: 600; }
.agent-meta-list dd { margin: 0; overflow-wrap: anywhere; }
.agent-profile-avatar { display: inline-flex; width: 5rem; height: 5rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--portal-accent-soft); color: var(--portal-accent-dark); font-size: 1.65rem; font-weight: 800; }

@media (max-width: 991.98px) {
  .agent-filter-bar { grid-template-columns: 1fr 1fr auto auto; }
  .agent-filter-search { grid-column: 1 / -1; }
}
@media (max-width: 767.98px) {
  .agent-stepper { grid-template-columns: 1fr; }
  .agent-step:not(.active):not(.complete) { display: none; }
  .agent-filter-bar { grid-template-columns: 1fr 1fr; }
  .agent-filter-search, .agent-filter-bar > label { grid-column: 1 / -1; }
  .agent-filter-bar .btn { width: 100%; }
  .agent-review-grid, .agent-detail-grid, .agent-profile-grid { grid-template-columns: 1fr; }
  .agent-form-actions { flex-wrap: wrap; }
  .agent-form-actions .text-muted { order: 3; flex-basis: 100%; }
  .agent-otp-entry { flex-basis: 100%; max-width: none; }
  .agent-otp-entry input { max-width: none; }
}
@media (max-width: 575.98px) {
  .agent-filter-bar { grid-template-columns: 1fr; }
  .agent-filter-bar > * { grid-column: 1; }
  .agent-table-footer { align-items: flex-start; flex-direction: column; }
  .agent-table-footer > div { width: 100%; }
  .agent-table-footer .btn { flex: 1; }
  .agent-category-banner { align-items: flex-start; flex-direction: column; }
  .agent-details-table > div { grid-template-columns: 1fr; gap: .2rem; }
}
