:root {
  --yard-primary: #5395ec;
  --yard-secondary: #858796;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.05);
  --shadow-strong: 0 15px 50px rgba(0, 0, 0, 0.1);
  --transition-main: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(0, 0, 0, 0.05);

  --bs-blue: #5395ec;
  --bs-primary: #5395ec;
  --bs-primary-rgb: 83, 149, 236;
  --bs-success: #1cc88a;
}

[data-bs-theme="dark"] {
  --glass-bg: rgba(30, 34, 45, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.3);
  --bs-body-bg: #151921;
}

body {
  font-family: 'Outfit', sans-serif !important;
  background-color: var(--bs-body-bg);
  scroll-behavior: smooth;
}

a.disabled {
  pointer-events: none;
  cursor: default;
}

.bg-yard {
  background-color: var(--bs-blue) !important;
}

.rotate-90 {
  rotate: 90deg;
}

.bg-gradient-primary-inverse {
  background-color: #5395ec;
  background-image: linear-gradient(0deg, #5395ec 10%, #2f7de2 100%);
  background-size: cover;
}

#w.rotate-90 {
  rotate: 90deg;
}

#content {
  overflow-x: hidden;
  max-width: 100%;
  /* Anchor to viewport */
  max-height: 100vh;
  animation: fadeIn 0.5s ease-out;
}

#page-content {
  max-width: 100%;
  overflow-x: hidden;
}

.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar,
footer.sticky-footer {
  z-index: 1000;
  margin-top: -1rem;
}

.topbar~.container-fluid {
  padding-top: 2rem;
  /* Account for sticky topbar */
}

nav.function-bar {
  height: auto;
  padding: 0.3rem 0;
  margin-top: -1px;
  z-index: 1030;
  top: 4.375rem !important;
  /* Offset by topbar height */
}

/* Topbar Polish */
.topbar {
  transition: var(--transition-main);
  backdrop-filter: blur(15px);
}

[data-bs-theme="dark"] .topbar {
  background-color: rgba(26, 30, 38, 0.85) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .topbar .nav-link,
[data-bs-theme="dark"] .topbar .text-gray-600 {
  color: #d1d1d1 !important;
}

@media (min-width: 768px) {
  .sidebar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border) !important;
    transition: var(--transition-main);
    margin: 1rem;
    border-radius: var(--radius-lg);
    height: calc(100vh - 2rem) !important;
    min-height: calc(100vh - 2rem) !important;
    padding: 1rem 0.5rem;
    overflow: hidden auto;
    z-index: 1050;
    box-shadow: var(--shadow-soft) !important;
    width: 16rem !important;
  }

  .sidebar-brand {
    padding: 1.5rem 1rem !important;
    height: auto !important;
    margin-bottom: 1rem;
  }

  .sidebar-brand-text {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
  }

  .sidebar.toggled .nav-item:has(.navbar-search),
  .sidebar.toggled .nav-item:has(.navbar-search)+hr {
    display: none !important;
  }

  .sidebar.toggled .nav-link {
    width: 4rem !important;
  }

  .sidebar.toggled .nav-link span {
    display: none !important;
  }

  [data-bs-theme="dark"] .sidebar {
    border-color: rgba(255, 255, 255, 0.08) !important;
  }
}

@media (max-width: 767.98px) {
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 9999 !important;
    /* Above EVERYTHING */
    margin: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #4e73df !important;
    /* Solid blue base color */
    background: var(--yard-primary) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2) !important;
    padding-bottom: 100px !important; /* Added to prevent content from being hidden by the sticky footer on iOS devices */
  }

  .sidebar.toggled {
    width: 100% !important;
    transform: translateX(0) !important;
    display: flex !important;
    visibility: visible !important;
    overflow-y: auto;
  }

  .sidebar.toggled .nav-link {
    width: calc(100% - 2rem) !important;
    margin: 0.5rem 1rem !important;
    padding: 1.25rem 1.5rem !important;
  }

  .sidebar.toggled .nav-link,
  .sidebar.toggled .nav-link i,
  .sidebar.toggled .nav-link span {
    font-size: 1.1rem;
  }

  .sidebar.toggled .nav-item.active .nav-link {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
  }

  .sidebar-brand {
    padding: 2.5rem 1.5rem !important;
  }

  .sidebar-brand-text {
    font-size: 1.5rem !important;
    display: block !important;
  }

  #content-wrapper {
    padding-bottom: 100px !important; /* Added to prevent content from being hidden by the sticky footer on iOS devices */
  }

  .navbar.topbar {
    padding: 0 1rem !important;
  }

  .topbar .dropdown .dropdown-menu {
    width: calc(100% - 2.2rem);
  }

  .table-mobile-cards tr {
    max-width: 88vw !important;
  }
}

#wrapper {
  background-color: var(--bs-body-bg);
}

#content-wrapper {
  background-color: transparent !important;
}

.sidebar .nav-item .nav-link {
  border-radius: var(--radius-md) !important;
  margin: 0.2rem 0.6rem;
  padding: 0.85rem 1.1rem !important;
  transition: var(--transition-main);
  color: #eee;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.sidebar .nav-item .nav-link i {
  margin-right: 0.85rem;
  font-size: 1.1rem;
  transition: var(--transition-main);
  color: inherit;
}

.sidebar .nav-item .nav-link:hover {
  background: linear-gradient(135deg, #6ba5f0 0%, #2f7de2 100%) !important;
  color: #fff !important;
  transform: translateX(4px);
}

.sidebar .nav-item .nav-link:hover i {
  color: inherit !important;
}

.sidebar .nav-item.active .nav-link {
  background: linear-gradient(135deg, #6ba5f0 0%, #2f7de2 100%) !important;
  color: #fff !important;
  box-shadow: 0 8px 16px rgba(83, 149, 236, 0.25);
}

.sidebar .nav-item.active .nav-link i {
  color: #fff !important;
  opacity: 1;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--bs-primary);
  border-radius: 4px;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 1);
}

footer.sticky-footer {
  padding: 1rem 0;
}

/* Cards Modernization */
.card {
  border: none !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-soft) !important;
  transition: var(--transition-main) !important;
  background-color: var(--bs-card-bg);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-strong) !important;
}

.card-header {
  background-color: transparent !important;
  border-bottom: 1px solid var(--glass-border) !important;
  padding: 1.25rem 1.5rem !important;
}

.card-body {
  padding: 1.5rem !important;
}

/* Table Modernization */
.table {
  border-collapse: separate !important;
  border-spacing: 0 0.4rem !important;
  width: 100% !important;
}

.table thead th {
  border: none !important;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--yard-secondary);
  padding: 1rem 1.5rem !important;
}

.table tbody tr {
  transition: var(--transition-main);
  border-radius: var(--radius-md);
}

.table tbody tr:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.08) !important;
}


.table td {
  padding: 1.1rem 1.5rem !important;
  border: none !important;
  vertical-align: middle;
}

/*
 * Dense tables: the 1.5rem cell padding that suits a five column table leaves
 * a fourteen column report wider than the page, so those opt into tighter cells
 * rather than the whole dashboard losing its breathing room. These must stay
 * after the .table rules above, which also use !important.
 */
.table-compact thead th {
  padding: 0.6rem 0.5rem !important;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.table-compact td {
  padding: 0.5rem 0.5rem !important;
  font-size: 0.82rem;
}

.table-compact tfoot th {
  padding: 0.6rem 0.5rem !important;
  font-size: 0.8rem;
}

[data-bs-theme="dark"] .table {
  color: #e0e0e0;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #fff;
}

/* Bootstrap Table Card View Modernization */
.bootstrap-table .card-view-container {
  padding: 1rem !important;
}

/* Style each record as a distinct glass card */
.bootstrap-table .card-view-container>div {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-lg) !important;
  margin-bottom: 1.5rem !important;
  box-shadow: var(--shadow-soft) !important;
  overflow: hidden;
  padding: 0.5rem !important;
}

/* Row-level layout within cards */
.bootstrap-table .card-view {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  padding: 0.85rem 0.75rem !important;
  border-bottom: 1px solid var(--glass-border) !important;
}

.bootstrap-table .card-view:last-child {
  border-bottom: none !important;
}

.bootstrap-table .card-view .card-view-title {
  font-size: 0.7rem !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  color: var(--yard-secondary) !important;
  letter-spacing: 0.05em !important;
  min-width: 100px;
  margin-right: 1rem;
}

.bootstrap-table .card-view .card-view-value {
  font-weight: 500 !important;
  color: var(--bs-emphasis-color) !important;
  text-align: right;
  flex: 1;
}

/* Special styling for the first row as a header */
.bootstrap-table .card-view:first-child .card-view-value {
  font-weight: 700 !important;
  color: var(--yard-primary) !important;
  font-size: 1.1rem;
}

/* Override Datatables */
/* Align the search and length */
.dataTables_length,
.dataTables_filter {
  display: flex;
  margin-top: 1rem;
  height: 4rem;
  align-items: flex-end;
}

.dataTables_length label {
  margin-bottom: 1.3rem;
  display: grid;
  grid-template-columns: repeat(3, auto);
  grid-template-rows: auto;
  grid-column-gap: 0.5rem;
  height: 1rem;
}

.dataTables_filter {
  justify-content: flex-end;
}

/* Center the table footers */
[id*="_wrapper"].dt-container div.justify-content-md-center~div>div {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Center sparklines */
.text-center canvas {
  margin: 0 auto;
}

/* Fix right-most column sorter in tables when zooming in and out */
.fixed-table-header {
  margin-right: 0 !important;
}

.no-pagination .fixed-table-pagination {
  display: none !important;
}

/* Hide outer scrollbar on fixed tables */
.table-responsive:has(.fixed-table-body) {
  overflow: hidden;
}

/* Override grlyphicon with Font Awesome Icons */
.glyphicon {
  font-family: "Font Awesome 6 Free";
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  display: var(--fa-display, inline-block);
  font-style: normal;
  font-variant: normal;
  line-height: 1;
  text-rendering: auto;
  font-weight: 900;
  font-size: 18px;
}

.glyphicon-ok {
  color: var(--bs-green);
}

.glyphicon-ok:before {
  content: "\f058";
}

.glyphicon-remove {
  color: var(--bs-red);
}

.glyphicon-remove:before {
  content: "\f05e";
}

/* Editable inputs in modal boxes */
.editable-container.editable-inline,
.editable-container.editable-inline .control-group.form-group,
.editable-container.editable-inline .control-group.form-group>div,
.editable-input .form-control {
  width: 100% !important;
}

.editable-input {
  display: block !important;
  /* max-width: 75%; */
}

.editable-input .form-control {
  font-size: 0.8rem;
}

.editable-buttons {
  display: flex !important;
  justify-content: flex-end;
  gap: 1.5rem;
  vertical-align: bottom !important;
}

.editable-submit,
.editable-cancel {
  background-color: transparent !important;
  border: none !important;
  margin-left: none;
}

.editable-error-block {
  max-width: unset !important;
}

.editable-error-block.help-block {
  color: var(--bs-red);
  font-weight: bold;
  font-style: italic;
  text-align: center;
  margin-top: 1rem;
}

/* Line breaks in Tooltips */
.ui-tooltip {
  /* tooltip container box */
  white-space: pre-line;
}

.ui-tooltip-content {
  /* tooltip content */
  white-space: pre-line;
}

/* Remove duplicate headers in fixed-header tables in modals */
.modal-body .fixed-table-toolbar .search.btn-group {
  width: 100% !important;
}

.modal-body .fixed-table-toolbar,
.modal-body .fixed-table-header {
  overflow-y: scroll !important;
  scrollbar-base-color: transparent;
  /* Firefox */
  scrollbar-face-color: transparent;
  /* IE */
  scrollbar-3dlight-color: transparent;
  /* old Opera */
  scrollbar-highlight-color: transparent;
  /* Modern Opera */
  scrollbar-track-color: transparent;
  /* Modern Chrome and IE */
  scrollbar-shadow-color: transparent;
  /* Modern Firefox */
  scrollbar-darkshadow-color: transparent;
  /* Modern IE */
}

.modal-body .fixed-table-toolbar::-webkit-scrollbar,
.modal-body .fixed-table-header::-webkit-scrollbar {
  /* WebKit */
  visibility: hidden;
}

.modal-body .fixed-table-header:has(> table > thead)+.fixed-table-body thead {
  display: none !important;
}

.modal-body .fixed-table-container.fixed-height {
  min-height: 380px;
  /* max-height: 380px; */
}

.shell {
  font-family: Consolas, "Courier New", monospace;
  height: 100vh;
  max-height: 65vh;
  overflow-y: auto;
}

/* Colours */
.blue {
  color: var(--bs-blue);
}

.red {
  color: var(--bs-red);
}

.green {
  color: var(--bs-green);
}

.grey {
  color: var(--bs-gray);
}

/* Animate Chevrons */
[data-bs-toggle] .fa-chevron-down {
  transition: transform 0.3s ease-in-out;
}

[data-bs-toggle]:has(~ .collapse:not(.show)) .fa-chevron-down {
  transform: rotate(0deg);
}

[data-bs-toggle]:has(~ .collapse.show) .fa-chevron-down {
  transform: rotate(180deg);
}

/* Additional title styling */
h1 small {
  font-size: 0.75em;
}

/* Override sb-admin-2.css */
.btn-sm {
  height: fit-content;
}

.btn-icon-split {
  padding: 0 !important;
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
}

.btn-icon-split .icon {
  background: rgba(0, 0, 0, 0.15);
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  padding: 0.5rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-icon-split .text {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  flex: 1;
}

.btn-icon-split.w-100 .text {
  justify-content: center;
}

.btn-icon-split:focus {
  box-shadow: none;
}

/* Theme Toggle Polish */
#themeToggle {
  background: rgba(0, 0, 0, 0.08) !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 12px !important;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-main);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#themeToggle:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toggle-icon-container {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-bs-theme="dark"] #themeToggle {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] #themeToggle:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.topbar {
  height: 4.375rem !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1040 !important;
}

.function-bar {
  top: 4.375rem !important;
  z-index: 1030 !important;
}

.topbar .nav-item .nav-link {
  height: 4.375rem;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
}

.nav-tabs-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  align-items: center;
  position: relative;
  justify-content: center;
  /* Center tabs on desktop */
}

@media (max-width: 767.98px) {

  .topbar,
  .nav-tabs-container,
  .nav-tabs-mobile {
    overflow: visible !important;
  }

  .topbar {
    height: 4.375rem !important;
    /* Standard height to ensure sticky stacking works */
    z-index: 1060;
    padding: 0 !important;
  }

  .nav-tabs-container {
    max-width: calc(100% - 100px);
    margin: 0 0.5rem;
    overflow: visible !important;
  }

  nav.function-bar {
    display: flex !important;
    /* Restore visibility */
    top: 4.375rem !important;
    /* Stick below the topbar */
    z-index: 1050;
    padding: 0.5rem 0 !important;
    min-height: 3.5rem;
  }
}

.topbar .nav-tabs {
  align-self: center;
  border-bottom: none;
  gap: 0.5rem;
  padding: 0.25rem;
  background: rgba(83, 149, 236, 0.04);
  border-radius: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
  -webkit-overflow-scrolling: touch;
  width: auto;
  max-width: 100%;
}

@media (min-width: 768px) {
  .topbar .nav-tabs {
    margin-left: 1.5rem;
    gap: 0.75rem;
    padding: 0.35rem;
  }
}

.topbar .nav-tabs::-webkit-scrollbar {
  display: none;
}

.topbar .nav-tabs .nav-link {
  color: #858796;
  border: none;
  border-radius: 10px !important;
  padding: 0.4rem 1rem !important;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.25s ease;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto !important;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .topbar .nav-tabs .nav-link {
    padding: 0.6rem 1.5rem !important;
    font-size: 0.95rem;
  }
}

.topbar .nav-tabs .nav-link:hover {
  background: rgba(83, 149, 236, 0.08);
  color: #5395ec;
  transform: translateY(-1px);
}

.topbar .nav-tabs .nav-link.active {
  background: linear-gradient(135deg, #5395ec 0%, #2f7de2 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(83, 149, 236, 0.25);
  text-shadow: none !important;
}

/* Overflow tab: holds the tabs that no longer fit on the desktop tab bar */
.topbar .nav-tabs .tab-overflow .nav-link {
  padding: 0.6rem 0.85rem !important;
  line-height: 1;
}

.topbar .nav-tabs .tab-overflow .nav-link i {
  font-size: 0.9rem;
}

/* The menu sits over the page, so nothing above it may clip it */
body.tab-overflow-open .topbar,
body.tab-overflow-open .nav-tabs-container,
body.tab-overflow-open .topbar .nav-tabs {
  overflow: visible !important;
}

.topbar .tab-overflow-menu {
  z-index: 2000;
  min-width: 12rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.35rem;
}

.topbar .tab-overflow-menu .dropdown-item {
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #858796;
}

.topbar .tab-overflow-menu .dropdown-item:hover {
  background: rgba(83, 149, 236, 0.08);
  color: #5395ec;
}

.topbar .tab-overflow-menu .dropdown-item.active {
  background: linear-gradient(135deg, #5395ec 0%, #2f7de2 100%);
  color: #ffffff;
}

.topbar .nav-tabs .nav-link span {
  font-size: inherit !important;
}

.border-right-primary {
  border-right: 0.25rem solid #5395ec !important;
}

.border-top-primary {
  border-top: 0.25rem solid #5395ec !important;
}

.border-right-secondary {
  border-right: 0.25rem solid #858796 !important;
}

.border-top-secondary {
  border-top: 0.25rem solid #858796 !important;
}

.border-right-success {
  border-right: 0.25rem solid #1cc88a !important;
}

.border-top-success {
  border-top: 0.25rem solid #1cc88a !important;
}

.border-right-info {
  border-right: 0.25rem solid #36b9cc !important;
}

.border-top-info {
  border-top: 0.25rem solid #36b9cc !important;
}

.border-right-warning {
  border-right: 0.25rem solid #f6c23e !important;
}

.border-top-warning {
  border-top: 0.25rem solid #f6c23e !important;
}

.border-right-danger {
  border-right: 0.25rem solid #e74a3b !important;
}

.border-top-danger {
  border-top: 0.25rem solid #e74a3b !important;
}

.border-right-light {
  border-right: 0.25rem solid #f8f9fc !important;
}

.border-top-light {
  border-top: 0.25rem solid #f8f9fc !important;
}

.border-right-dark {
  border-right: 0.25rem solid #5a5c69 !important;
}

.border-top-dark {
  border-top: 0.25rem solid #5a5c69 !important;
}

.accordion-button:not(.collapsed) {
  background-color: var(--bs-blue);
  color: var(--bs-white);
  font-weight: bold;
}

.accordion-button:not(.collapsed)::after {
  filter: invert(100%) saturate(100%) brightness(200%) contrast(200%);
}

.table .actions .btn i {
  width: 14px !important;
  height: 14px !important;
}

.w-0 {
  width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-left: none !important;
}

.fs-6-5 {
  font-size: 0.85rem !important;
}

.fs-7 {
  font-size: 0.75rem !important;
}

.fs-8 {
  font-size: 0.5rem !important;
}

.fs-9 {
  font-size: 0.25rem !important;
}

/* Flatpickr Premium Overrides */
.flatpickr-calendar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-strong) !important;
  font-family: 'Outfit', sans-serif !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
  background: var(--yard-primary) !important;
  border-color: var(--yard-primary) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  font-weight: 700;
}

.flatpickr-day.today {
  border-color: var(--yard-primary) !important;
}

.flatpickr-day:hover {
  background: rgba(83, 149, 236, 0.1) !important;
}

/* Input Styling */
.form-control.flatpickr-input[readonly] {
  background-color: transparent !important;
}

.form-control.flatpickr-input:focus {
  border-color: var(--yard-primary);
  box-shadow: 0 0 0 0.25rem rgba(83, 149, 236, 0.15);
}

[data-bs-theme="dark"] .flatpickr-calendar {
  background: rgba(30, 34, 45, 0.95) !important;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .flatpickr-day {
  color: #fff !important;
}

[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled {
  color: rgba(255, 255, 255, 0.2) !important;
}

[data-bs-theme="dark"] .flatpickr-month,
[data-bs-theme="dark"] .flatpickr-weekday {
  color: #a0a0a0 !important;
  fill: #a0a0a0 !important;
}

[data-bs-theme="dark"] .flatpickr-day.prevMonthDay,
[data-bs-theme="dark"] .flatpickr-day.nextMonthDay {
  color: rgba(255, 255, 255, 0.3) !important;
}

/* Sidebar Logo & Searchbar Polish */
.sidebar-brand-icon i {
  color: #fff !important;
}

.sidebar-brand-text {
  color: #fff !important;
}

.sidebar .navbar-search .input-group {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: #fff;
  border-radius: 8px !important;
  overflow: hidden;
}

[data-bs-theme="dark"] .sidebar .navbar-search .input-group {
  border-color: rgba(255, 255, 255, 0.1) !important;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar .navbar-search .form-control:focus {
  box-shadow: none;
  background: #fff;
}

/* Function Bar Modernization */
.function-bar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  margin: 0.25rem 1rem 0.5rem 1rem !important;
  padding: 0.35rem 1rem !important;
  box-shadow: var(--shadow-soft) !important;
  transition: var(--transition-main);
  z-index: 1040;
  height: auto !important;
}

.function-bar .mx-4 {
  margin-right: 0 !important;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.function-bar .btn {
  border-radius: 30px !important;
  padding: 0 !important;
  font-weight: 600;
  font-size: 0.8rem;
  display: inline-flex !important;
  align-items: stretch;
  transition: var(--transition-main);
  border: none !important;
  height: fit-content;
  overflow: hidden;
}

.function-bar .btn .icon {
  padding: 0.35rem 0.75rem !important;
  background: rgba(0, 0, 0, 0.1);
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.function-bar .btn .text {
  padding: 0.35rem 1rem !important;
  display: flex !important;
  align-items: center;
}

.function-bar .btn i {
  font-size: 0.9rem;
}

.function-bar .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.function-bar .btn-success {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%) !important;
  color: #fff !important;
}

.function-bar .btn-warning {
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%) !important;
  color: #fff !important;
}

.function-bar .btn-danger {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
  color: #fff !important;
}

.function-bar .btn-primary {
  background: linear-gradient(135deg, #5395ec 0%, #2f7de2 100%) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .function-bar {
  background: var(--glass-bg) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Sticky Pricing Table Styles */
#price-table_wrapper {
  position: relative;
  border-radius: var(--yard-radius-lg);
  overflow: auto !important;
  /* Allow internal scrolling if needed */
}

#price-table {
  border-collapse: separate !important;
  border-spacing: 0;
  font-size: 0.75rem !important;
  /* Compact view for dense data */
}

/* Sticky First Two Columns (SKU & Brand) */
#price-table thead tr:nth-child(1) th:nth-child(1),
#price-table tbody td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 20;
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  background-color: var(--bs-body-bg) !important;
  border-right: 1px solid var(--yard-border-soft);
}

#price-table thead tr:nth-child(1) th:nth-child(2),
#price-table tbody td:nth-child(2) {
  position: sticky;
  left: 120px;
  z-index: 20;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background-color: var(--bs-body-bg) !important;
  border-right: 2px solid var(--yard-border-soft);
}

/* Header Vertical Stickiness */
#price-table thead tr:nth-child(1) th {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--bs-body-bg) !important;
  border-bottom: 2px solid var(--yard-border-soft);
}

#price-table thead tr:nth-child(2) th {
  position: sticky;
  top: 41px;
  /* Height of the first header row */
  z-index: 25;
  background-color: var(--bs-body-bg) !important;
  border-bottom: 2px solid var(--yard-border-soft);
}

/* Intersection of Sticky Header and Sticky Columns */
#price-table thead tr:nth-child(1) th:nth-child(1),
#price-table thead tr:nth-child(1) th:nth-child(2) {
  z-index: 40;
  /* Top-most z-index for the top-left corner */
}

/* Ensure body cells have background for horizontal stickiness */
#price-table tbody td:nth-child(1),
#price-table tbody td:nth-child(2) {
  z-index: 15;
}


/* Group Banding - Light backgrounds to separate sections */
/* MSRP columns (3-6) */
#price-table td:nth-child(3),
#price-table td:nth-child(4),
#price-table td:nth-child(5),
#price-table td:nth-child(6),
#price-table th:nth-child(3),
#price-table th:nth-child(4),
#price-table th:nth-child(5),
#price-table th:nth-child(6) {
  background-color: rgba(var(--yard-primary-rgb), 0.03) !important;
}

/* Cost columns (7-10) */
#price-table td:nth-child(7),
#price-table td:nth-child(8),
#price-table td:nth-child(9),
#price-table td:nth-child(10),
#price-table th:nth-child(7),
#price-table th:nth-child(8),
#price-table th:nth-child(9),
#price-table th:nth-child(10) {
  background-color: rgba(255, 193, 7, 0.03) !important;
  /* Warning tint for costs */
}

/* Margin Highlighting */
.margin-low {
  color: var(--yard-danger) !important;
  font-weight: 600;
}

.margin-mid {
  color: #f39c12 !important;
  font-weight: 500;
}

.margin-high {
  color: var(--yard-success) !important;
  font-weight: 600;
}

.change-up {
  color: var(--yard-success) !important;
  font-weight: 600;
}

.change-down {
  color: var(--yard-danger) !important;
  font-weight: 600;
}

.change-none {
  opacity: 0.3;
}

/* Flatpickr Today Button Enhancement */
.flatpickr-calendar {
  padding-bottom: 10px;
}

.flatpickr-today-button {
  background: var(--yard-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-main);
  text-align: center;
}

.flatpickr-today-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(83, 149, 236, 0.3);
  background: #2f7de2;
}

.flatpickr-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 10px;
}

.flatpickr-clear-button {
  background: transparent;
  color: var(--yard-secondary);
  border: 1px solid var(--yard-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-main);
}

.flatpickr-clear-button:hover {
  background: var(--yard-secondary);
  color: white;
}

[data-bs-theme="dark"] .flatpickr-clear-button {
  color: #d1d1d1;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .flatpickr-calendar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(15px);
  border-color: var(--glass-border) !important;
  box-shadow: var(--shadow-strong) !important;
}

[data-bs-theme="dark"] .flatpickr-day {
  color: #e0e0e0;
}

[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled {
  color: rgba(255, 255, 255, 0.15) !important;
}

[data-bs-theme="dark"] .flatpickr-months .flatpickr-month,
[data-bs-theme="dark"] .flatpickr-weekdays {
  color: #fff;
  fill: #fff;
}

/* Truncation with Tooltip */
.truncate-tooltip {
    max-width: 150px;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    cursor: help;
    display: inline-block !important;
    vertical-align: middle;
}

.truncate-tooltip:hover {
    color: #5395ec;
}

/* Frosted filter bar / panel surface, shared by the page filter forms. */
.bg-glass {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] .bg-glass {
    background: rgba(30, 34, 45, 0.7) !important;
}

/* Shared date-range filter (pill_filters partial): field labels only appear on
   mobile, where the pill is replaced by a stacked card. */
.pf-label {
  display: none;
}

/* Report tab pills (Sales Reports, Orders by Postcode). Spacing lives on the
   row as a gap so it is identical between every pill and still applies between
   pills once the row wraps; each pill sizes itself from its own content. */
.report-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.report-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid rgba(83, 149, 236, 0.16);
  border-radius: 50rem;
  background: rgba(83, 149, 236, 0.05);
  color: #5a6474;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, box-shadow 0.18s ease;
}

/* Fixed icon box keeps every label starting at the same offset. */
.report-tabs .nav-link i {
  width: 1.05em;
  font-size: 0.95em;
  text-align: center;
  opacity: 0.75;
  transition: opacity 0.18s ease;
}

.report-tabs .nav-link:hover {
  background: rgba(83, 149, 236, 0.12);
  border-color: rgba(83, 149, 236, 0.32);
  color: #2f7de2;
}

.report-tabs .nav-link:hover i,
.report-tabs .nav-link.active i {
  opacity: 1;
}

.report-tabs .nav-link.active {
  background: linear-gradient(135deg, #6ba5f0 0%, #2f7de2 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 125, 226, 0.28);
}

.report-tabs .nav-link:focus-visible {
  outline: 2px solid #2f7de2;
  outline-offset: 2px;
}

[data-bs-theme="dark"] .report-tabs .nav-link:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #c7d0dd;
}

[data-bs-theme="dark"] .report-tabs .nav-link:not(.active):hover {
  background: rgba(107, 165, 240, 0.16);
  border-color: rgba(107, 165, 240, 0.4);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .report-tabs .nav-link,
  .report-tabs .nav-link i {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   Mobile layout: rows must wrap, never be clipped.
   #content sets overflow-x: hidden, so a nowrap action row on a phone silently
   pushes its buttons past the right edge where they cannot be reached.
   --------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  /* Page headers: title on one line, actions below it. Pages wrap their
     content either in #content or in #page-content, so cover both. */
  #content .container-fluid > .d-flex.justify-content-between,
  #content .container-fluid > .d-flex.justify-content-around,
  #page-content > .d-flex.justify-content-between,
  #page-content > .d-flex.justify-content-around {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* DataTables export/search toolbar: stack, full width, nothing off-screen. */
  .datatable-toolbar > .col-auto:first-child {
    display: none;
  }

  .datatable-toolbar .col.d-flex {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start !important;
  }

  .datatable-toolbar .col.d-flex > div {
    margin-right: 0 !important;
  }

  .datatable-toolbar .dt-search-container {
    flex: 1 1 100%;
    justify-content: flex-start !important;
    margin-top: 0.25rem;
  }

  .datatable-toolbar .dt-custom-search {
    width: 100% !important;
    flex: 1 1 auto;
  }

  /* Toolbars inside cards (filter/pager rows) get the same treatment. */
  .card .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Legacy pages use non-responsive Bootstrap 4 columns (col-4, col-8, ...).
     Those keep their 33%/66% split on a phone and end up overlapping, so
     leave only the one-third and one-half pairs that still read well; the
     rest go full width. */
  #content .row > .col-1,
  #content .row > .col-2,
  #content .row > .col-3,
  #content .row > .col-4,
  #content .row > .col-5,
  #content .row > .col-7,
  #content .row > .col-8,
  #content .row > .col-9 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Function bar (page action buttons): right-aligned nowrap content spills
     past the LEFT edge on narrow screens, hiding the first button. */
  nav.function-bar {
    flex-wrap: wrap;
    /* Content scrolls inside #content, so a sticky bar sits on top of the
       DataTables toolbar and hides its first row. Let it scroll away. */
    position: static !important;
    top: auto !important;
  }

  nav.function-bar > div {
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start;
  }

  nav.function-bar .btn {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Select2 sizes itself from the column it starts in, so a collapsed column
     leaves a 40px dropdown. Once the column is full width, stretch to match. */
  #content .select2-container {
    width: 100% !important;
  }

  /* Report/filter pill groups: wrapping turns them into a tall stack of
     chunky buttons on a phone. Keep them on one scrollable strip instead. */
  #content .nav-pills:not(.flex-column) {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* Ring/glow room inside the scroller, pulled back out again so the strip
       still lines up with the content edge. */
    padding: 3px;
    margin: -3px;
  }

  #content .nav-pills:not(.flex-column)::-webkit-scrollbar {
    display: none;
  }

  #content .nav-pills .nav-link {
    white-space: nowrap;
  }

  /* Comfortable tap targets on the scrollable tab strip. */
  .report-tabs .nav-link {
    min-height: 2.75rem;
  }

  /* The shared date-range filter (pill_filters partial) is a rounded pill on
     desktop; stacked inside a pill it turns into an oval blob on a phone. */
  #content form.bg-glass.rounded-pill {
    border-radius: 0.75rem !important;
    /* It is a shrink-to-fit flex item in the page header row, so it stops
       short of the cards below; fill the row instead. */
    width: 100%;
  }

  #content form.bg-glass.rounded-pill > .row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem;
  }

  #content form.bg-glass.rounded-pill > .row > .col-auto {
    width: 100%;
  }

  #content form.bg-glass.rounded-pill > .row > .col-auto.text-muted {
    display: none;
  }

  #content form.bg-glass.rounded-pill > .row > .border-start {
    border-left: 0 !important;
    padding-left: 0 !important;
  }

  /* Inside the stacked card the borderless inputs read as loose text, so give
     them a field surface and a label. */
  #content form.bg-glass.rounded-pill .pf-date {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  #content form.bg-glass.rounded-pill .pf-label {
    display: block;
    margin-left: 0.75rem;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
  }

  #content form.bg-glass.rounded-pill input.datepicker {
    border: 1px solid var(--bs-border-color) !important;
    background-color: var(--bs-body-bg) !important;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  #content form.bg-glass.rounded-pill .pf-action .btn {
    width: 100%;
  }

  /* Page switcher in the topbar: let it use the free space so the page name
     reads in full instead of "Open Or…". */
  .topbar .nav-tabs-mobile {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar .nav-tabs-mobile > .btn {
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* The label carries an inline max-width: 80px cap, which is what turns
     "Open Orders" into "Open Or…" on a phone. */
  .topbar .nav-tabs-mobile > .btn > .text-truncate {
    max-width: none !important;
  }
}

/* ── Filter bars ─────────────────────────────────────────────────────────────
   One surface for every filter in the dashboard. Screens that apply everything
   together keep their filters on one row; the Invoice Forecast stacks the month
   above the refinements, because only the month reloads the data. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-md);
}

.filter-bar--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.8rem;
}

.filter-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.filter-bar__row--split {
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed var(--bs-border-color);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 0 1 auto;
}

.filter-field > label,
.filter-field > .filter-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.filter-field .form-control,
.filter-field .form-select {
  height: 38px;
  padding: 0 0.65rem;
  font-size: 0.9375rem;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.filter-field .form-control:focus,
.filter-field .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.18);
}

.filter-field--date { flex: 0 0 10rem; }
.filter-field--date .form-control { width: 100%; }
.filter-field--month { flex: 0 0 10rem; }
.filter-field--year { flex: 0 0 6.5rem; }
/* Selects keep a steady width instead of eating the free space: a growing
   field fills its line and pushes the action onto a line of its own. */
.filter-field--flex { flex: 0 1 9rem; }

.filter-field--check {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  height: 38px;
  white-space: nowrap;
}

.filter-field--check > label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

/* sb-admin-2 still positions .form-check-input absolutely (a Bootstrap 4
   leftover), which collapses a checkbox field to the width of its label. In a
   filter bar the box belongs in the flow. */
.filter-bar .form-check-input {
  position: static;
  margin: 0;
}

.filter-bar__arrow {
  display: inline-flex;
  align-items: center;
  height: 38px;
  color: var(--bs-secondary-color);
}

.filter-bar__action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 1rem;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

/* Aside + action travel together on the right; the wrapper takes the free
   space so the two never split across lines. */
.filter-bar__right {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

.filter-bar__aside {
  display: flex;
  align-items: flex-end;
}

.filter-bar__aside .form-check {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* Select2 draws its own box: give it the height and edges of a field. The
   selector is deliberately deeper than a page's own select2 reset. */
.filter-bar .select2-container { width: 100% !important; }

.filter-bar .select2-container .select2-selection--single {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 0.25rem 0 0.65rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color) !important;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.filter-bar .select2-container .select2-selection--single .select2-selection__rendered {
  padding: 0;
  font-size: 0.9375rem;
  line-height: 1.2;
  color: var(--bs-body-color);
}

.filter-bar .select2-container .select2-selection--single .select2-selection__arrow {
  height: 36px;
  right: 8px;
}

.filter-bar .select2-container--focus .select2-selection--single,
.filter-bar .select2-container--open .select2-selection--single {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.18);
}

/* A filter that is doing something should say so without being read. */
.filter-field.is-set .select2-container .select2-selection--single {
  border-color: rgba(var(--bs-primary-rgb), 0.6) !important;
  background: rgba(var(--bs-primary-rgb), 0.07);
}

@media (max-width: 767.98px) {
  .filter-bar { padding: 0.8rem; }

  .filter-bar--stacked .filter-bar__row--filters .filter-field {
    flex: 1 1 40%;
    max-width: calc(50% - 0.375rem);
  }

  .filter-field--month,
  .filter-field--year { flex: 1 1 40%; }

  /* The month/year row keeps its Load button beside the selects; at this width
     the three items are within a pixel of the row, so wrapping would leave a
     blank line above the controls. */
  .filter-bar--stacked .filter-bar__row--period { flex-wrap: nowrap; }

  .filter-bar--stacked .filter-bar__row--period .filter-field {
    flex: 1 1 0;
    min-width: 0;
  }

  .filter-bar__action { flex: 0 0 auto; }
}

/* Multi-selects (Sales Channels, etc.) need the same edges as a single one. */
.filter-bar .select2-container .select2-selection--multiple {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 2px 0.35rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color) !important;
  border-radius: 8px;
}

.filter-bar .select2-container .select2-selection--multiple .select2-selection__choice {
  margin: 2px 4px 2px 0;
  padding: 2px 0.55rem;
  border: 0;
  border-radius: 50rem;
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-body-color);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.filter-bar .select2-container .select2-selection--multiple .select2-selection__choice__remove {
  margin-right: 4px;
  color: var(--bs-secondary-color);
}

.filter-bar .select2-container .select2-selection--multiple .select2-search--inline .select2-search__field {
  height: 28px;
  margin: 0;
  font-size: 0.875rem;
  color: var(--bs-body-color);
}

/* The action sits at the end of the row rather than floating mid-bar when the
   filters are few. The stacked forecast bar keeps its button beside the month,
   and a bar with an aside (Compare, etc.) lets the aside take the free space so
   the aside and the button stay together on the right. */
.filter-bar:not(.filter-bar--stacked) > .filter-bar__action { margin-left: auto; }
