.cfa-filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  padding: 16px 0;
  --cfa-control-width: 200px;
}

/* Two-row layout modifier: add class to the root container */
.cfa-two-rows .cfa-filters-bar {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: var(--cfa-control-width);
  overflow-x: auto;
}

@media (max-width: 640px) {
  .cfa-two-rows .cfa-filters-bar {
    grid-template-rows: none;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
  }
}

.cfa-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cfa-date-container {
  position: relative;
  display: inline-block;
}

.cfa-date {
  width: var(--cfa-control-width);
  padding: 4px 25px 4px 30px;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  font-size: 12px;
  background-color: #F8FAFC;
  cursor: pointer;
  height: 28px;
  box-sizing: border-box;
}

.cfa-select2 + .select2-container {
  width: var(--cfa-control-width) !important;
  font-size: 12px;
}

.cfa-select2 + .select2-container .select2-selection--single,
.cfa-select2 + .select2-container .select2-selection--multiple {
  min-height: 28px;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  background-color: #F8FAFC;
  box-sizing: border-box;
}

.cfa-select2 + .select2-container .select2-selection--single {
  height: 28px;
  padding: 0 25px 0 8px;
}

.cfa-select2 + .select2-container .select2-selection--single .select2-selection__rendered {
  color: #121212;
  line-height: 26px;
  padding-left: 0;
  padding-right: 0;
}

.cfa-select2 + .select2-container .select2-selection--single .select2-selection__placeholder {
  color: #64748b;
}

.cfa-select2 + .select2-container .select2-selection--single .select2-selection__arrow {
  height: 26px;
  right: 6px;
}

.cfa-select2 + .select2-container .select2-selection--single .select2-selection__arrow b {
  border-color: #64748b transparent transparent transparent;
}

.cfa-select2 + .select2-container .select2-selection--multiple {
  min-height: 28px;
  height: 28px;
  overflow: hidden;
  padding: 2px 25px 2px 6px;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-selection__rendered {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  margin: 0;
  align-items: center;
  min-height: 24px;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-selection__rendered:empty::before {
  content: attr(data-placeholder);
  color: #64748b;
  font-size: 12px;
  line-height: 18px;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-selection__choice {
  margin-top: 0;
  margin-left: 0;
  border: 1px solid #94A3B8;
  border-radius: 4px;
  background: #fff;
  color: #121212;
  font-size: 12px;
  line-height: 18px;
  padding: 0 16px 0 6px;
  position: relative;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove {
  position: absolute;
  right: 4px;
  left: auto;
  margin: 0;
  top: 0;
  line-height: 18px;
  background: transparent !important;
  border: 0 !important;
  border-left: 0 !important;
  box-shadow: none !important;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #2563eb;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-search--inline {
  margin: 0;
  height: 18px;
  line-height: 18px;
  flex: 0 0 auto;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-search--inline .select2-search__field {
  padding: 0;
  margin: 0;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  line-height: 18px;
  border: 0;
  background: transparent;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  color: #121212;
  font-size: 12px;
  width: 100%;
  min-width: 0;
}

.cfa-select2 + .select2-container.cfa-multi-has-values .select2-selection--multiple {
  height: auto;
  overflow: visible;
}

.cfa-select2 + .select2-container .select2-selection--multiple .select2-search--inline .select2-search__field::placeholder {
  color: #64748b;
}

.cfa-select2 + .select2-container:hover .select2-selection--single,
.cfa-select2 + .select2-container:hover .select2-selection--multiple,
.cfa-select2 + .select2-container.select2-container--open .select2-selection--single,
.cfa-select2 + .select2-container.select2-container--open .select2-selection--multiple {
  border: 2px solid #121212;
}

.cfa-select2 + .select2-container.select2-container--open .select2-selection--single,
.cfa-select2 + .select2-container.select2-container--open .select2-selection--multiple {
  background-color: #F8FAFC;
}

.cfa-select2 + .select2-container.select2-container--focus .select2-selection--multiple,
.cfa-select2 + .select2-container.select2-container--focus .select2-selection--single {
  border: 1px solid #2563eb;
}

.select2-dropdown.cfa-select2-dropdown {
  border: 1px solid #94A3B8;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cfa-select2-dropdown .select2-search--dropdown .select2-search__field {
  border: 1px solid #94A3B8;
  border-radius: 4px;
  background-color: #F8FAFC;
  color: #121212;
  font-size: 12px;
}

.cfa-select2-dropdown .select2-results__option {
  font-size: 12px;
  color: #121212;
}

.cfa-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: #2563eb;
}

.cfa-date:hover {
  border: 2px solid #121212;
  font-weight: bold;
}

.cfa-date.date-selected {
  border: 1px solid #2563eb !important;
  color: #2563eb !important;
}

.cfa-date-clear {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: #2563eb;
  user-select: none;
  z-index: 1;
  display: none;
}

.cfa-date-clear:hover {
  color: rgb(35, 89, 206);
}

.cfa-date-chevron {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #64748b;
  user-select: none;
  pointer-events: none;
}

.cfa-date-container:hover .cfa-date-chevron {
  color: #121212;
}

.cfa-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  height: 28px;
  border: 1px solid transparent;
}

.cfa-btn-primary {
  background-color: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.cfa-btn-secondary {
  background-color: #f8fafc;
  color: #121212;
  border-color: #94A3B8;
}

/* DateRangePicker tweaks */
.daterangepicker {
  border: 1px solid #94A3B8 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.daterangepicker .drp-buttons {
  border-top: 1px solid #e5e7eb !important;
  padding: 12px !important;
  background-color: #f8fafc !important;
}

.daterangepicker .drp-buttons .btn {
  font-size: 12px !important;
  padding: 6px 16px !important;
  border-radius: 4px !important;
  font-weight: 500 !important;
  border: 1px solid !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
  font-size: 12px !important;
}

.daterangepicker .drp-calendar {
  max-width: unset !important;
}

.daterangepicker select.monthselect,
.daterangepicker select.yearselect {
  font-size: 12px !important;
  padding: 2px !important;
  height: auto !important;
  border-radius: 3px;
}