/* FXC Internal Portal — Custom CSS
   Bootstrap 5.3 handles all standard components via theme.json.
   Custom CSS below is ONLY for elements Bootstrap doesn't provide. */

/* ── Avatar — Bootstrap has no avatar component ─────────────── */
.avatar {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.avatar.avatar-sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.625rem;
}

.avatar.avatar-lg {
  width: 3rem;
  height: 3rem;
  font-size: 1rem;
}

/* ── Icon box — square icon container for KPIs / features ──── */
.icon-box {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--bs-border-radius);
  font-size: 1.125rem;
}

.icon-box.icon-box-sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
}

.icon-box.icon-box-lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.25rem;
}

.icon-box.icon-box-xl {
  width: 5rem;
  height: 5rem;
  font-size: 2rem;
}

/* ── Sidebar — sticky desktop, offcanvas handles mobile ────── */
@media (min-width: 992px) {
  #sidebar.offcanvas-lg {
    position: fixed !important;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    scrollbar-width: thin;
  }

  #main {
    margin-left: 250px;
  }
}

#sidebar .nav-link {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.625rem;
  border-radius: var(--bs-border-radius-sm);
  font-size: 0.75rem;
  margin: 1px 0.5rem;
  padding: 0.5rem 0.875rem;
  color: var(--bs-primary);
}

#sidebar .nav-link:hover:not(.active) {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}

#sidebar .nav-link.active {
  background-color: var(--bs-secondary-bg-subtle);
  color: var(--bs-primary);
}

#sidebar .nav-link i {
  width: 1.25rem;
  text-align: center;
  opacity: 0.55;
}

#sidebar .nav-link.active i {
  opacity: 1;
}

#sidebar-section-main {
  margin-top: 20px;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  padding: 1.5rem 0 1rem;
}

.page-header .page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  line-height: 1.2;
}

.page-header .page-subtitle {
  font-size: 0.8125rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
}

/* ── Section heading within page ─────────────────────────── */
.section-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--bs-body-color);
  margin-bottom: 0;
}

.section-heading-sub {
  font-size: 0.6875rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
}

.section-heading-secondary {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
}

/* ── Priority indicator ─────────────────────────────────────── */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}

/* ── Mouse pointer on clickable items not buttons ─────────────────────────────────────── */
.clickable {
  cursor: pointer !important;
}

/* ── Tagify — override default large dropdown font size ──────── */
.tagify__dropdown {
  font-size: 0.8125rem !important;
}
.tagify__dropdown__item {
  font-size: 0.8125rem !important;
  padding: 0.3rem 0.6rem !important;
}
.tagify__dropdown__item__addBtn {
  font-size: 0.75rem !important;
}

/* ── Form Modals — compact data-entry modal standard ─────────── */
.modal-content > .modal-header {
  border-bottom-color: #dce7f0;
  background-color: #f5f8fb;
}

.modal-form .modal-header {
  padding-bottom: 0.5rem;
}
.modal-form .modal-footer {
  padding-top: 0.5rem;
}
.form-label,
.modal-form .form-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  margin-bottom: 0.2rem;
}

.form-text {
  font-size: 0.6875rem;
}

.settlement-preview-card {
  min-height: 8rem;
  border-left: 3px solid transparent;
}

.settlement-preview-card-out {
  border-left-color: var(--bs-danger);
  background-color: var(--bs-danger-bg-subtle);
}

.settlement-preview-card-in {
  border-left-color: var(--bs-success);
  background-color: var(--bs-success-bg-subtle);
}

.settlement-preview-direction {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.modal-form .form-control,
.modal-form .form-select,
.modal-form .input-group-text {
  font-size: 0.8125rem;
}
.modal-form .form-group {
  margin-bottom: 0.625rem !important;
}
/* Optional field indicator — used inside .modal-form labels */
.form-label-optional {
  font-weight: 400;
  font-size: 0.625rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--bs-tertiary-color);
  margin-left: 0.2rem;
  font-style: italic;
}
/* Review / confirm summary panel */
.review-summary {
  font-size: 0.8125rem;
}
.review-summary .summary-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: baseline;
  -ms-flex-align: baseline;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}
.review-summary .summary-row:last-child {
  border-bottom: none;
}
.review-summary .summary-label {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  white-space: nowrap;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.review-summary .summary-value {
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* ── Dense Data Table — compact standard for high-density grids ── */
.table-dense {
  font-size: 0.775rem;
}
.table-dense thead th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #385a7c;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.6rem 0.65rem;
  vertical-align: middle;
  border-bottom: 1px solid #d4e1ed;
  background-color: #eaf1f7;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.table-dense thead th.sortable {
  cursor: pointer;
}
.table-dense thead th.sortable:hover {
  color: #23496e;
  background-color: #dde9f3;
}
.table-dense thead th .sort-icon {
  opacity: 0.3;
  margin-left: 0.3rem;
  font-size: 0.625rem;
}
.table-dense thead th.sort-asc .sort-icon,
.table-dense thead th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--bs-primary);
}
.table-dense thead th.sort-asc .sort-icon::before {
  content: "\f0de";
}
.table-dense thead th.sort-desc .sort-icon::before {
  content: "\f0dd";
}
.table-dense tbody td {
  padding: 0.4rem 0.65rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  font-size: 0.775rem;
  line-height: 1.35;
}
.table-dense tbody tr:last-child td {
  border-bottom: none;
}
.table-dense tbody tr:hover td {
  background-color: var(--bs-tertiary-bg);
}
.table-dense .cell-secondary {
  font-size: 0.6875rem;
  color: var(--bs-secondary-color);
  line-height: 1.2;
  margin-top: 1px;
}
.table-dense .flag-img {
  border-radius: 2px;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}
.table-dense .action-btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

/* Compact secondary references and identifiers in data tables */
.table-dense .cell-reference {
  color: var(--bs-secondary-color);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Reusable constrained cells for long names and references */
.table-dense .cell-truncate {
  max-width: 10rem;
}

.table-dense .cell-truncate > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tabs-sm .nav-link {
  font-size: 0.75rem;
  padding: 0.4rem 0.65rem;
}

.nav-tabs-sm .badge {
  font-size: 0.6rem;
}

.btn-xs {
  padding: 0.18rem 0.45rem;
  border-radius: var(--bs-border-radius-sm);
  font-size: 0.6875rem;
  line-height: 1.2;
}

/* Quiet icon-only action for row-level secondary actions */
.btn-icon-subtle {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--bs-secondary-color);
  background-color: transparent;
  font-size: 0.6875rem;
}

.btn-icon-subtle:hover,
.btn-icon-subtle:focus-visible {
  color: var(--bs-primary);
  border-color: var(--bs-border-color-translucent);
  background-color: var(--bs-primary-bg-subtle);
}

/* Dense table footer / pagination bar */
.table-dense-footer {
  padding: 0.4rem 0.75rem;
  border-top: 1px solid var(--bs-border-color-translucent);
  color: var(--bs-secondary-color);
  background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity));
  font-size: 0.6875rem;
}

/* Compact footer and pagination standard for data-table surfaces */
.table-pagination-bar {
  padding: 0.4rem 0.75rem;
  border-top: 1px solid var(--bs-border-color-translucent);
  color: var(--bs-secondary-color);
  background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity));
  font-size: 0.6875rem;
}

.pagination-compact {
  gap: 0.125rem;
  margin-bottom: 0;
}

.pagination-compact .page-link {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0.1rem 0.3rem;
  border: 0;
  border-radius: var(--bs-border-radius-sm) !important;
  color: var(--bs-secondary-color);
  background-color: transparent;
  font-size: 0.6875rem;
  line-height: 1;
}

.pagination-compact .page-link:hover,
.pagination-compact .page-link:focus {
  color: var(--bs-primary);
  background-color: var(--bs-primary-bg-subtle);
  -webkit-box-shadow: none;
  box-shadow: none;
}

.pagination-compact .page-item.active .page-link {
  color: var(--bs-primary);
  background-color: var(--bs-primary-bg-subtle);
  font-weight: 700;
}

/* ── Treasury action dropdowns inside dense tables ───────── */

/*
  Bootstrap dropdowns inside .table-responsive can be clipped by the
  responsive container. Use this class only on tables where row action
  menus must escape the table body.
*/
/* Borderless data panel for compact grouped tables and summaries */
.data-panel {
  overflow: hidden;
  border: 0;
  border-top: 2px solid #6f99bd;
  border-radius: 0.25rem;
  background-color: var(--bs-body-bg);
}

.data-panel-header {
  padding: 0.4rem 0.65rem 0.5rem;
}

.data-panel-title {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.4rem;
  color: var(--bs-body-color);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.data-panel-title i {
  color: #527fa6;
  font-size: 0.6875rem;
  opacity: 0.9;
}

.data-panel-subtitle {
  margin-top: 0.15rem;
  color: var(--bs-secondary-color);
  font-size: 0.71875rem;
  line-height: 1.25;
}

/* Reusable drawer treatments aligned with compact data panels */
.drawer-header-subtle {
  border-bottom-color: #dce7f0 !important;
  background-color: #f5f8fb;
}

.drawer-section-title-accent {
  margin-bottom: 0.5rem;
  padding-top: 0.55rem;
  padding-bottom: 0;
  border-top: 2px solid #6f99bd;
  border-bottom: 0;
  color: #385a7c;
}

/* Compact numeric treatment for data-heavy drawers */
.drawer-numbers-compact .detail-stat .detail-stat-value {
  font-size: 0.875rem;
}

.drawer-numbers-compact .num-tabular {
  font-size: 0.75rem;
}

.table-surface-borderless {
  overflow: hidden;
  border: 0;
  border-radius: 0.25rem;
  background-color: var(--bs-body-bg);
}

.section-heading-accent {
  padding-top: 0.65rem;
  border-top: 2px solid #6f99bd;
}

.table-surface-actions {
  overflow: visible;
}

/* Compact collapsible filter panel and applied-filter badges */
.filter-panel {
  padding: 0.75rem;
  border-top: 2px solid #6f99bd;
  border-radius: 0.25rem;
  background-color: #f5f8fb;
}

.filter-panel-label {
  margin-bottom: 0.2rem;
  color: var(--bs-secondary-color);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-panel .form-control,
.filter-panel .form-select {
  font-size: 0.75rem;
}

.filter-badge-row {
  padding: 0.75rem;
  border-top: 2px solid #6f99bd;
  border-radius: 0.25rem;
  background-color: #f5f8fb;
}

.filter-badges .badge {
  padding: 0.35rem 0.55rem;
  color: var(--bs-secondary-color) !important;
  font-size: 0.6875rem;
  font-weight: 500;
}

.filter-badges .badge i {
  color: #527fa6;
}

.table-responsive.table-responsive-actions {
  overflow-x: visible;
  overflow-y: visible;
}

/* Match compact Tagify controls to Bootstrap's small inputs and selects. */
.tagify.form-control-sm {
  --tag-pad: 0.1rem 0.4rem;
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0 0.25rem;
}

.tagify.form-control-sm .tagify__tag,
.tagify.form-control-sm .tagify__input {
  margin-block: 0.125rem;
}

.tagify.form-control-sm .tagify__input {
  padding: 0.125rem 0.25rem;
  line-height: 1.5;
}

/*
  If the table genuinely needs horizontal scrolling on small screens,
  keep normal .table-responsive behaviour on mobile.
*/
@media (max-width: 767.98px) {
  .table-responsive.table-responsive-actions {
    overflow-x: auto;
    overflow-y: visible;
  }
}

.action-dropdown {
  display: inline-block;
}

.action-dropdown .action-btn {
  font-size: 0.7rem;
  line-height: 1.2;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

.action-dropdown .dropdown-toggle::after {
  margin-left: 0.35rem;
  vertical-align: 0.12em;
}

.action-menu {
  min-width: 10.5rem;
  padding: 0.25rem;
  font-size: 0.75rem;
  border-radius: var(--bs-border-radius);
  -webkit-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  z-index: 1080;
}

.action-menu .dropdown-item {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  border-radius: var(--bs-border-radius-sm);
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.25;
}

.action-menu .dropdown-item i {
  opacity: 0.7;
}

.action-menu .dropdown-item:hover,
.action-menu .dropdown-item:focus {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}

/* ── Allow row action dropdowns to escape dense table surfaces ── */

.page-surface.page-surface-actions,
.table-surface-borderless.table-surface-actions {
  overflow: visible;
}

.table-responsive.table-responsive-actions .dropdown-menu {
  z-index: 1080;
}

/* Keep normal responsive scrolling on small screens */
@media (max-width: 767.98px) {
  .table-responsive.table-responsive-actions {
    overflow-x: auto;
    overflow-y: visible;
  }
}

/* ── Compact popovers for dashboard helper text ─────────── */

.popover {
  max-width: 280px;
  border-color: var(--bs-border-color);
  -webkit-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  font-size: 0.75rem;
}

.popover-header {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  color: var(--bs-body-color);
  background-color: var(--bs-tertiary-bg);
  border-bottom-color: var(--bs-border-color);
}

.popover-body {
  padding: 0.55rem 0.65rem;
  color: var(--bs-secondary-color);
  line-height: 1.35;
}

.popover-body br {
  display: block;
  content: "";
  margin-bottom: 0.25rem;
}

/* Compact Bootstrap tooltip standard */
.tooltip {
  font-size: 0.75rem;
}

.tooltip-inner {
  max-width: 18rem;
  padding: 0.35rem 0.55rem;
  line-height: 1.35;
  word-break: break-word;
}
