.catalog-database-panel {
  margin: 24px 0;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.13), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 247, 255, 0.96));
  box-shadow: 0 22px 55px rgba(67, 56, 202, 0.09);
}

.catalog-database-heading,
.catalog-product-finder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.catalog-database-heading h3 {
  margin: 5px 0 7px;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.catalog-database-heading .pill {
  max-width: 430px;
  text-align: right;
  white-space: normal;
}

.catalog-database-import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.catalog-database-import {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 19px;
  border: 1px dashed rgba(99, 102, 241, 0.38);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.catalog-database-import:hover,
.catalog-database-import.drag-active {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.8);
  box-shadow: 0 15px 32px rgba(79, 70, 229, 0.12);
}

.catalog-database-import input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.catalog-database-import-icon {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7558ff, #4c7cff);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 13px 26px rgba(93, 70, 255, 0.25);
}

.catalog-database-import strong,
.catalog-database-import small {
  display: block;
}

.catalog-database-import small {
  margin-top: 5px;
  color: #6b6878;
  line-height: 1.45;
}

.catalog-database-file-statuses {
  margin-top: 12px;
}

.catalog-product-finder {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(99, 102, 241, 0.16);
}

.catalog-product-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  align-items: end;
  gap: 14px;
  margin-top: 16px;
}

.catalog-product-search-field input,
.catalog-product-count-field input {
  min-height: 52px;
}

.catalog-exclude-history {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(99, 102, 241, 0.13);
  font-weight: 700;
}

.catalog-exclude-history input {
  width: 18px;
  height: 18px;
}

.catalog-product-search-actions {
  margin-top: 12px;
}

.catalog-keyword-match-row {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.catalog-keyword-matches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.catalog-keyword-matches span:not(.muted) {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.11);
  color: #39308d;
  font-size: 0.82rem;
  font-weight: 800;
}

.catalog-search-results {
  display: grid;
  gap: 9px;
  max-height: 540px;
  overflow: auto;
  margin-top: 14px;
  padding-right: 4px;
}

.catalog-search-empty {
  padding: 24px;
  border: 1px dashed rgba(99, 102, 241, 0.28);
  border-radius: 18px;
  color: #777386;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.catalog-search-result {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 17px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.catalog-search-result.selected {
  border-color: rgba(79, 70, 229, 0.55);
  box-shadow: 0 9px 24px rgba(79, 70, 229, 0.11);
}

.catalog-search-result input {
  width: 18px;
  height: 18px;
}

.catalog-search-result-rank {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #111116;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.catalog-search-result-copy {
  min-width: 0;
}

.catalog-search-result-copy strong,
.catalog-search-result-copy small {
  display: block;
}

.catalog-search-result-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-search-result-copy small {
  margin-top: 4px;
  color: #747180;
}

.catalog-search-result a {
  font-weight: 800;
}

html[data-theme="dark"] .catalog-database-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(19, 20, 31, 0.98), rgba(14, 16, 25, 0.98));
  border-color: rgba(167, 139, 250, 0.22);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .catalog-database-import,
html[data-theme="dark"] .catalog-exclude-history,
html[data-theme="dark"] .catalog-keyword-match-row,
html[data-theme="dark"] .catalog-search-result,
html[data-theme="dark"] .catalog-search-empty {
  background: rgba(255, 255, 255, 0.92);
  color: #111116;
}

html[data-theme="dark"] .catalog-database-import small,
html[data-theme="dark"] .catalog-search-result-copy small,
html[data-theme="dark"] .catalog-search-empty {
  color: #5f5c68;
}

html[data-theme="dark"] .catalog-keyword-matches span:not(.muted) {
  color: #2f2778;
}

@media (max-width: 860px) {
  .catalog-database-import-grid,
  .catalog-product-search-row {
    grid-template-columns: 1fr;
  }
  .catalog-database-heading,
  .catalog-product-finder-heading {
    display: block;
  }
  .catalog-database-heading .pill {
    display: inline-flex;
    margin-top: 12px;
    text-align: left;
  }
  .catalog-keyword-match-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .catalog-search-result {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
  .catalog-search-result a {
    grid-column: 3;
  }
}

/* R125: inspect the exact product/keyword rows stored in the permanent catalog vault. */
.catalog-database-browser {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.catalog-database-browser-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.catalog-database-browser-heading > div:first-child {
  max-width: 760px;
}

.catalog-database-view-tabs {
  flex: 0 0 auto;
  margin: 0;
  gap: 8px;
}

.catalog-database-view-tabs button.active {
  outline: 3px solid rgba(117, 88, 255, 0.22);
  outline-offset: 2px;
}

.catalog-database-browser-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px);
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.catalog-database-view-limit-field select,
.catalog-database-browser-tools input {
  min-height: 48px;
}

.catalog-database-view-summary {
  margin-top: 12px;
  color: #666273;
  font-size: 0.9rem;
  font-weight: 800;
}

.catalog-database-viewer {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
  margin-top: 10px;
  padding-right: 4px;
}

.catalog-database-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.88);
}

.catalog-database-row-main {
  min-width: 0;
}

.catalog-database-row-main strong,
.catalog-database-row-main small {
  display: block;
}

.catalog-database-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-database-row-main small {
  margin-top: 4px;
  color: #747180;
  line-height: 1.45;
}

.catalog-database-row-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.catalog-database-row-metrics span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #39308d;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

html[data-theme="dark"] .catalog-database-browser,
html[data-theme="dark"] .catalog-database-row {
  background: rgba(255, 255, 255, 0.92);
  color: #111116;
}

html[data-theme="dark"] .catalog-database-view-summary,
html[data-theme="dark"] .catalog-database-row-main small {
  color: #5f5c68;
}

html[data-theme="dark"] .catalog-database-row-metrics span {
  color: #2f2778;
}

@media (max-width: 860px) {
  .catalog-database-browser-heading {
    display: block;
  }
  .catalog-database-view-tabs {
    margin-top: 12px;
  }
  .catalog-database-browser-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .catalog-database-row {
    grid-template-columns: 1fr;
  }
  .catalog-database-row-metrics {
    justify-content: flex-start;
  }
}


/* R129: readable full-width database browser and CSV source management. */
.catalog-database-browser-heading {
  display: grid !important;
  grid-template-columns: minmax(320px, 1fr) auto !important;
  align-items: start !important;
}
.catalog-database-browser-heading > div:first-child {
  max-width: none !important;
  min-width: 0 !important;
}
.catalog-database-browser-heading .help {
  max-width: 900px;
  line-height: 1.55;
  margin-top: 6px;
}
.catalog-database-viewer { min-height: 120px; }
.catalog-source-manager {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(99, 102, 241, 0.16);
}
.catalog-source-manager-heading {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 18px;
  align-items: start;
}
.catalog-source-manager-heading .help { max-width: 820px; line-height: 1.5; margin-top: 5px; }
.catalog-export-actions { justify-content: flex-end; margin: 0; }
.catalog-source-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 15px;
  background: rgba(255,255,255,.72);
}
.catalog-source-toolbar label { display:flex; gap:9px; align-items:center; font-weight:800; }
.catalog-source-toolbar input[type="checkbox"], .catalog-source-row input[type="checkbox"] { width:18px; height:18px; }
.catalog-source-list { display:grid; gap:8px; max-height:340px; overflow:auto; margin-top:10px; }
.catalog-source-row {
  display:grid;
  grid-template-columns:auto auto minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border:1px solid rgba(148,163,184,.24);
  border-radius:15px;
  background:rgba(255,255,255,.88);
  cursor:pointer;
}
.catalog-source-row.selected { border-color:rgba(79,70,229,.55); box-shadow:0 8px 20px rgba(79,70,229,.1); }
.catalog-source-type { padding:6px 9px; border-radius:999px; background:#111116; color:white; font-size:.78rem; font-weight:900; white-space:nowrap; }
.catalog-source-copy { min-width:0; }
.catalog-source-copy strong, .catalog-source-copy small { display:block; }
.catalog-source-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.catalog-source-copy small { margin-top:3px; color:#747180; }
html[data-theme="dark"] .catalog-source-toolbar,
html[data-theme="dark"] .catalog-source-row { background:rgba(255,255,255,.92); color:#111116; }
html[data-theme="dark"] .catalog-source-copy small { color:#5f5c68; }
@media (max-width: 900px) {
  .catalog-database-browser-heading,
  .catalog-source-manager-heading { grid-template-columns:1fr !important; }
  .catalog-database-view-tabs, .catalog-export-actions { justify-content:flex-start; }
}
@media (max-width: 620px) {
  .catalog-source-toolbar { grid-template-columns:1fr; }
  .catalog-source-row { grid-template-columns:auto minmax(0,1fr); }
  .catalog-source-type { grid-column:2; justify-self:start; }
  .catalog-source-copy { grid-column:2; }
}


/* R130: uncapped database source filters, requested-count matching, readable links, and lazy product history. */
.catalog-search-source-filters {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.catalog-search-source-filters select { min-height: 48px; }
.catalog-product-count-field small {
  display: block;
  margin-top: 6px;
  color: #747180;
  line-height: 1.35;
}
.catalog-search-result-copy strong { white-space: normal; line-height: 1.35; }
.catalog-search-result-link,
.catalog-database-product-link {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  font-weight: 700;
  color: #6d5cff;
}
.catalog-result-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(17,17,22,.06);
  color: #5f5c68;
  font-size: .76rem;
  font-weight: 700;
}
.catalog-result-source b,
.catalog-source-label {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: #111116;
  color: #fff;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.catalog-source-label { display: inline-flex; margin-right: 7px; }
.catalog-source-label.keyword { background: #4f46e5; }
.catalog-keyword-matches { align-items: stretch; }
.catalog-keyword-matches .catalog-keyword-signal {
  display: inline-grid;
  gap: 2px;
  align-content: center;
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(99,102,241,.11);
  color: #39308d;
}
.catalog-keyword-signal b { font-size: .82rem; }
.catalog-keyword-signal small { font-size: .66rem; color: #6b648f; font-weight: 750; }
.product-history-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.product-history-body.hidden { display: none !important; }
#toggleProductHistoryButton { min-height: 42px; }
html[data-theme="dark"] .catalog-product-count-field small,
html[data-theme="dark"] .catalog-result-source { color: #5f5c68; }
html[data-theme="dark"] .catalog-keyword-signal small { color: #5d5682; }
@media (max-width: 760px) {
  .catalog-search-source-filters { grid-template-columns: 1fr; }
  .product-history-heading-actions { justify-content: flex-start; }
}

.approval-product-top-link { margin: 5px 0 8px; min-width: 0; }
.approval-product-top-link a { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.86rem; font-weight:700; color:#6d5cff; }
html[data-theme="dark"] .approval-product-top-link a { color:#745cff; }


/* R131: prominent live count of the records currently stored in the permanent database. */
.catalog-live-counts {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.catalog-live-count {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(66, 53, 120, 0.06);
}
.catalog-live-count span,
.catalog-live-count strong,
.catalog-live-count small {
  display: block;
}
.catalog-live-count span {
  color: #6b6476;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.09em;
}
.catalog-live-count strong {
  margin-top: 4px;
  color: #141119;
  font-size: clamp(1.55rem, 2.2vw, 2.25rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.catalog-live-count small {
  margin-top: 7px;
  color: #6c6873;
  line-height: 1.35;
}
.catalog-live-count-total {
  border-color: rgba(117, 88, 255, 0.34);
  background: linear-gradient(135deg, rgba(245, 241, 255, 0.98), rgba(255, 255, 255, 0.95));
}
.catalog-live-count-total strong {
  color: #5d3df2;
}
html[data-theme="dark"] .catalog-live-count {
  background: rgba(255, 255, 255, 0.94);
  color: #141119;
}
html[data-theme="dark"] .catalog-live-count span,
html[data-theme="dark"] .catalog-live-count small {
  color: #5f5968;
}
@media (max-width: 980px) {
  .catalog-live-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .catalog-live-counts { grid-template-columns: 1fr; }
}


/* R132: rename saved Product and Keyword CSV sources without losing their stored rows. */
.catalog-source-row.renaming {
  border-color: rgba(93, 61, 242, 0.52);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.12);
}
.catalog-source-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.catalog-source-action-button {
  min-height: 40px;
  padding: 9px 15px;
  white-space: nowrap;
}
.catalog-source-rename-editor label {
  display: block;
  margin-bottom: 6px;
  color: #292530;
  font-size: 0.76rem;
  font-weight: 900;
}
.catalog-source-rename-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(93, 61, 242, 0.36);
  border-radius: 11px;
  background: #fff;
  color: #141119;
  font: inherit;
  font-weight: 760;
  outline: none;
}
.catalog-source-rename-input:focus {
  border-color: #6747f5;
  box-shadow: 0 0 0 4px rgba(103, 71, 245, 0.13);
}
html[data-theme="dark"] .catalog-source-rename-editor label,
html[data-theme="dark"] .catalog-source-rename-input {
  color: #141119;
}
@media (max-width: 980px) {
  .catalog-source-toolbar { grid-template-columns: auto 1fr; }
  .catalog-source-toolbar #catalogRenameSelectedSource,
  .catalog-source-toolbar #catalogRemoveSelectedSources { justify-self: start; }
}
@media (max-width: 700px) {
  .catalog-source-toolbar { grid-template-columns: 1fr; }
  .catalog-source-row { grid-template-columns: auto minmax(0, 1fr); }
  .catalog-source-type { grid-column: 2; }
  .catalog-source-copy { grid-column: 2; }
  .catalog-source-actions { grid-column: 2; justify-content: flex-start; }
}


/* R133: make the inline CSV rename editor fully typeable and keep it lightweight. */
.catalog-source-row.renaming {
  grid-template-columns: auto auto minmax(320px, 1fr) auto;
}
.catalog-source-rename-editor {
  display: block;
  width: 100%;
  min-width: 0;
}
.catalog-source-rename-input {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 280px;
  height: auto !important;
  min-height: 48px !important;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
@media (max-width: 700px) {
  .catalog-source-row.renaming { grid-template-columns: auto minmax(0, 1fr); }
  .catalog-source-row.renaming .catalog-source-rename-input { min-width: 0; }
}

/* R134: sales and growth range filters for the permanent Product CSV database viewer. */
.catalog-product-metric-filters {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  transition: opacity 160ms ease, filter 160ms ease;
}
.catalog-product-metric-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.catalog-product-metric-filter-heading strong,
.catalog-product-metric-filter-heading small {
  display: block;
}
.catalog-product-metric-filter-heading strong {
  color: #17131d;
  font-size: 1rem;
  font-weight: 900;
}
.catalog-product-metric-filter-heading small {
  margin-top: 3px;
  color: #6d6877;
  line-height: 1.4;
}
.catalog-product-metric-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.catalog-product-metric-filter-grid .field {
  min-width: 0;
}
.catalog-product-metric-filter-grid input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
}
.catalog-metric-filter-reset {
  flex: 0 0 auto;
  white-space: nowrap;
}
.catalog-metric-filter-note {
  margin-top: 10px;
  color: #666273;
  font-size: 0.82rem;
  font-weight: 750;
}
.catalog-product-metric-filters.inactive {
  opacity: 0.58;
  filter: saturate(0.55);
}
.catalog-product-metric-filters.inactive .catalog-metric-filter-note {
  color: #77717f;
}
html[data-theme="dark"] .catalog-product-metric-filters {
  background: rgba(255, 255, 255, 0.92);
  color: #111116;
}
html[data-theme="dark"] .catalog-product-metric-filter-heading strong {
  color: #111116;
}
html[data-theme="dark"] .catalog-product-metric-filter-heading small,
html[data-theme="dark"] .catalog-metric-filter-note {
  color: #5f5a67;
}
@media (max-width: 1050px) {
  .catalog-product-metric-filter-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}
@media (max-width: 680px) {
  .catalog-product-metric-filter-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .catalog-metric-filter-reset {
    width: 100%;
  }
  .catalog-product-metric-filter-grid {
    grid-template-columns: 1fr;
  }
}


/* R135: selectable finder results plus finder-specific sales and growth filters. */
.catalog-finder-metric-filters {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}
.catalog-finder-metric-filter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.catalog-finder-metric-filter-heading strong,
.catalog-finder-metric-filter-heading small { display: block; }
.catalog-finder-metric-filter-heading strong {
  color: #17131d;
  font-size: 1rem;
  font-weight: 900;
}
.catalog-finder-metric-filter-heading small {
  margin-top: 3px;
  color: #6d6877;
  line-height: 1.4;
}
.catalog-finder-metric-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.catalog-finder-metric-filter-grid input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
}
.catalog-finder-metric-filter-note {
  margin-top: 10px;
  color: #666273;
  font-size: .82rem;
  font-weight: 750;
}
.catalog-search-selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 13px;
  padding: 12px 14px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}
.catalog-search-selection-toolbar[hidden] { display: none !important; }
.catalog-select-all-shown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
}
.catalog-select-all-shown input {
  width: 18px;
  height: 18px;
}
.catalog-search-selection-toolbar strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .catalog-finder-metric-filters,
html[data-theme="dark"] .catalog-search-selection-toolbar {
  background: rgba(255, 255, 255, 0.92);
  color: #111116;
}
html[data-theme="dark"] .catalog-finder-metric-filter-heading strong { color: #111116; }
html[data-theme="dark"] .catalog-finder-metric-filter-heading small,
html[data-theme="dark"] .catalog-finder-metric-filter-note { color: #5f5a67; }
@media (max-width: 1050px) {
  .catalog-finder-metric-filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 680px) {
  .catalog-finder-metric-filter-heading { flex-direction: column; }
  .catalog-finder-metric-filter-heading button { width: 100%; }
  .catalog-finder-metric-filter-grid { grid-template-columns: 1fr; }
  .catalog-search-selection-toolbar { align-items: stretch; flex-direction: column; }
  .catalog-search-selection-toolbar strong { margin-left: 0; }
}


/* R136: select saved database products and add selected or every filtered match to the Product Build List. */
.catalog-database-selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
}
.catalog-database-selection-toolbar[hidden] { display: none !important; }
.catalog-database-select-all-shown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
  white-space: nowrap;
}
.catalog-database-select-all-shown input,
.catalog-database-row-selector input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.catalog-database-selection-toolbar > strong {
  font-variant-numeric: tabular-nums;
}
.catalog-database-selection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}
.catalog-database-product-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.catalog-database-product-row.selected {
  border-color: rgba(103, 71, 245, 0.58);
  box-shadow: 0 0 0 3px rgba(103, 71, 245, 0.10);
  background: rgba(250, 248, 255, 0.98);
}
.catalog-database-row-selector {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 42px;
  color: #625d6c;
  font-size: 0.68rem;
  font-weight: 850;
  cursor: pointer;
}
.catalog-product-search-actions {
  flex-wrap: wrap;
}
.catalog-product-search-actions #catalogCreateAllProductListButton {
  white-space: normal;
}
html[data-theme="dark"] .catalog-database-selection-toolbar,
html[data-theme="dark"] .catalog-database-product-row.selected {
  background: rgba(255, 255, 255, 0.94);
  color: #111116;
}
html[data-theme="dark"] .catalog-database-row-selector { color: #4f4a57; }
@media (max-width: 860px) {
  .catalog-database-selection-actions {
    width: 100%;
    margin-left: 0;
  }
  .catalog-database-selection-actions button { flex: 1 1 260px; }
}
@media (max-width: 620px) {
  .catalog-database-product-row { grid-template-columns: auto minmax(0, 1fr); }
  .catalog-database-product-row .catalog-database-row-metrics { grid-column: 2; }
  .catalog-database-selection-toolbar { align-items: stretch; flex-direction: column; }
  .catalog-database-selection-actions { flex-direction: column; align-items: stretch; }
  .catalog-database-selection-actions button { width: 100%; }
}
