.records-shell .workspace-card {
  display: grid !important;
  min-width: 0 !important;
  max-width: 100% !important;
  gap: 12px !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.records-shell .metric-row,
.records-shell .table-wrap,
.records-shell .records-footer {
  max-width: 100% !important;
  min-width: 0 !important;
  border: 1px solid var(--rc-border) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 10px 28px rgba(31, 41, 55, .045) !important;
}

.records-shell .workspace-head {
  min-width: 0;
  max-width: 100%;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.records-shell .metric-row { overflow: hidden; border-bottom: 1px solid var(--rc-border) !important; }
.records-shell .metric { border-bottom: 0 !important; }
.records-shell .table-wrap { min-height: 340px; overflow: auto !important; overscroll-behavior: contain; }
.records-shell .records-footer { border-top: 1px solid var(--rc-border) !important; }
.records-shell .category-tabs { padding-bottom: 8px; margin-bottom: 2px; }

.records-section-finder {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 14px;
}

.records-section-finder-field {
  position: relative;
  width: min(520px, 100%);
}

.records-section-finder-field > i {
  position: absolute;
  top: 50%;
  left: 15px;
  z-index: 2;
  color: #718096;
  transform: translateY(-50%);
}

.records-section-finder-field .form-control {
  min-height: 44px;
  padding-right: 46px;
  padding-left: 42px;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.records-section-clear {
  position: absolute;
  top: 50%;
  right: 7px;
  display: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #526174;
  transform: translateY(-50%);
}

.records-section-clear.is-visible { display: grid; }

.records-section-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, 100%);
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #dce4ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(25, 36, 54, .14);
}

.records-section-result {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  background: #fff;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.records-section-result:last-child { border-bottom: 0; }
.records-section-result:hover,
.records-section-result:focus { background: #f7f9ff; }
.records-section-result strong,
.records-section-result small { display: block; }
.records-section-result strong { font-size: .84rem; }
.records-section-result small { margin-top: 3px; color: #718096; font-size: .72rem; }
.records-section-result > i { color: #5d87ff; }
.records-section-no-result { padding: 18px; color: #718096; text-align: center; }

.records-section-finder-field .form-control:focus {
  border-color: #8eabff !important;
  box-shadow: 0 0 0 3px rgba(93, 135, 255, .11) !important;
}

.records-section-result:hover strong,
.records-section-result:focus strong {
  color: #315ec5;
}

.records-shell,
.records-shell .records-hero,
.records-shell .category-tabs,
.records-shell .workspace-card,
.records-shell .workspace-head,
.records-shell .search-panel,
.records-shell .metric-row,
.records-shell .table-wrap,
.records-shell .records-footer {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.records-shell .category-tabs,
.records-shell .resource-strip {
  display: flex !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none !important;
  touch-action: pan-x pan-y;
}

.records-shell .category-tabs::-webkit-scrollbar,
.records-shell .resource-strip::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.records-shell .category-tab,
.records-shell .resource-chip {
  flex: 0 0 auto !important;
  max-width: none !important;
  white-space: nowrap !important;
  text-align: center !important;
  scroll-snap-align: start;
}

.records-shell .resource-strip {
  padding: 3px 1px 9px !important;
}

.records-shell .workspace-head > .d-flex,
.records-shell .workspace-head > .d-flex > *,
.records-shell .search-panel .row,
.records-shell .search-panel [class*="col-"] {
  min-width: 0 !important;
  max-width: 100% !important;
}

.records-shell .records-table {
  width: max-content !important;
  min-width: 100% !important;
  max-width: none !important;
}

.records-shell .records-table th,
.records-shell .records-table td {
  max-width: 420px;
}

.records-shell .records-table td:not(.action-cell) {
  overflow: hidden;
  text-overflow: ellipsis;
}

#editModal,
#deleteModal,
#harambeeMergeModal {
  z-index: 2200 !important;
}

body:has(#editModal.show) .modal-backdrop,
body:has(#deleteModal.show) .modal-backdrop,
body:has(#harambeeMergeModal.show) .modal-backdrop {
  z-index: 2190 !important;
}

#editModal .select2-container,
#editModal .select2-dropdown {
  z-index: 2230 !important;
}

/* The Records Centre changes content frequently. Reserve scrollbar space and
   turn off Bootstrap transform animations so opening a modal never shifts the
   page, table, sidebar or action column. */
html {
  scrollbar-gutter: stable;
}

body[data-kanisa-page="records-centre"] {
  overflow-anchor: none;
}

body[data-kanisa-page="records-centre"].modal-open {
  padding-right: 0 !important;
}

body[data-kanisa-page="records-centre"] .body-wrapper,
body[data-kanisa-page="records-centre"] .records-shell,
body[data-kanisa-page="records-centre"] .table-wrap,
body[data-kanisa-page="records-centre"] .modal-body {
  overflow-anchor: none;
}

body[data-kanisa-page="records-centre"] #editModal .modal-dialog,
body[data-kanisa-page="records-centre"] #deleteModal .modal-dialog,
body[data-kanisa-page="records-centre"] #harambeeMergeModal .modal-dialog,
body[data-kanisa-page="records-centre"] .modal.fade .modal-dialog,
body[data-kanisa-page="records-centre"] .modal.show .modal-dialog,
body[data-kanisa-page="records-centre"] .modal-backdrop.fade {
  transition: none !important;
  transform: none !important;
}

body[data-kanisa-page="records-centre"] #editModal .modal-content {
  overflow: hidden;
}

body[data-kanisa-page="records-centre"] #editModal .modal-body {
  min-height: 180px;
  overscroll-behavior: contain;
}

body[data-kanisa-page="records-centre"] #editFields {
  min-height: 112px;
  contain: layout style;
}

body[data-kanisa-page="records-centre"] #editFields:has(.records-modal-loading) {
  display: block;
}

@media (max-width: 575.98px) {
  .records-shell .workspace-card { gap: 10px !important; }
  .records-shell .metric-row,
  .records-shell .table-wrap,
  .records-shell .records-footer { border-radius: 13px !important; }
  .records-section-results { max-height: 65dvh; }
  .records-section-finder,
  .records-section-finder-field,
  .records-section-results {
    width: 100%;
    max-width: 100%;
  }

  body[data-kanisa-page="records-centre"] #editModal .modal-dialog,
  body[data-kanisa-page="records-centre"] #deleteModal .modal-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    margin: 10px auto;
  }
}
